From 6989df5932323881e1b20caf3e10aada689e6df9 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 3 Aug 2018 10:29:50 -0700 Subject: Updated Core submodule & shader var access test --- Tests/TestApp/src/TestShaderVarAccess.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'Tests/TestApp/src/TestShaderVarAccess.cpp') diff --git a/Tests/TestApp/src/TestShaderVarAccess.cpp b/Tests/TestApp/src/TestShaderVarAccess.cpp index e7e8234..0bf9329 100644 --- a/Tests/TestApp/src/TestShaderVarAccess.cpp +++ b/Tests/TestApp/src/TestShaderVarAccess.cpp @@ -88,13 +88,17 @@ TestShaderVarAccess::TestShaderVarAccess( IRenderDevice *pDevice, IDeviceContext // pUAVs[i] = pStorageTex[i]->GetDefaultView(TEXTURE_VIEW_UNORDERED_ACCESS); //} - //TexDesc.BindFlags = BIND_RENDER_TARGET; - //RefCntAutoPtr pRenderTarget; - //pDevice->CreateTexture(TexDesc, TextureData{}, &pRenderTarget); - //auto *pRTV = pRenderTarget->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET); - //m_pDeviceContext->SetRenderTargets(1, &pRTV, nullptr); - //float Zero[4] = {}; - //m_pDeviceContext->ClearRenderTarget(pRTV, Zero); + TexDesc.Format = pSwapChain->GetDesc().ColorBufferFormat; + TexDesc.BindFlags = BIND_RENDER_TARGET | BIND_SHADER_RESOURCE; + RefCntAutoPtr pRenderTarget; + pDevice->CreateTexture(TexDesc, TextureData{}, &pRenderTarget); + auto *pRTV = pRenderTarget->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET); + + TexDesc.Format = pSwapChain->GetDesc().DepthBufferFormat; + TexDesc.BindFlags = BIND_DEPTH_STENCIL; + RefCntAutoPtr pDepthTex; + pDevice->CreateTexture(TexDesc, TextureData{}, &pDepthTex); + auto *pDSV = pDepthTex->GetDefaultView(TEXTURE_VIEW_DEPTH_STENCIL); BufferDesc BuffDesc; BuffDesc.uiSizeInBytes = 1024; @@ -520,8 +524,15 @@ TestShaderVarAccess::TestShaderVarAccess( IRenderDevice *pDevice, IDeviceContext pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_rwBuff_Dyn")->Set(pFormattedBuffUAV[3]); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_Buffer_Dyn")->Set(pFormattedBuffSRVs[2]); + m_pDeviceContext->SetRenderTargets(1, &pRTV, pDSV); + float Zero[4] = {}; + m_pDeviceContext->ClearRenderTarget(pRTV, Zero); + m_pDeviceContext->ClearDepthStencil(pDSV, CLEAR_DEPTH_FLAG); + pContext->CommitShaderResources(pSRB, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES); pContext->Draw(DrawAttrs); + m_pDeviceContext->SetRenderTargets(0, nullptr, nullptr); + SetStatus(TestResult::Succeeded); } -- cgit v1.2.3