diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-08-03 17:29:50 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-08-03 17:29:50 +0000 |
| commit | 6989df5932323881e1b20caf3e10aada689e6df9 (patch) | |
| tree | 57c08e23c4c424d0d46685c6b99678cd7b27dd73 /Tests/TestApp/src/TestShaderVarAccess.cpp | |
| parent | Updated core submodule; added shader variable access tests (diff) | |
| download | DiligentEngine-6989df5932323881e1b20caf3e10aada689e6df9.tar.gz DiligentEngine-6989df5932323881e1b20caf3e10aada689e6df9.zip | |
Updated Core submodule & shader var access test
Diffstat (limited to 'Tests/TestApp/src/TestShaderVarAccess.cpp')
| -rw-r--r-- | Tests/TestApp/src/TestShaderVarAccess.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
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<ITexture> 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<ITexture> 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<ITexture> 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); } |
