diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-03-07 07:11:08 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-03-07 07:11:08 +0000 |
| commit | 11a33969be01c7b572b9af613d10cc2fe9b80e13 (patch) | |
| tree | c00ca12382bc528cc132559e7311294746af01b1 /Tests/TestApp/src/TestShaderVarAccess.cpp | |
| parent | Fixed UWP build error (diff) | |
| download | DiligentEngine-11a33969be01c7b572b9af613d10cc2fe9b80e13.tar.gz DiligentEngine-11a33969be01c7b572b9af613d10cc2fe9b80e13.zip | |
Added shader resource print; updated core
Diffstat (limited to 'Tests/TestApp/src/TestShaderVarAccess.cpp')
| -rw-r--r-- | Tests/TestApp/src/TestShaderVarAccess.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/TestApp/src/TestShaderVarAccess.cpp b/Tests/TestApp/src/TestShaderVarAccess.cpp index 0205444..35af2ad 100644 --- a/Tests/TestApp/src/TestShaderVarAccess.cpp +++ b/Tests/TestApp/src/TestShaderVarAccess.cpp @@ -27,9 +27,27 @@ #include "pch.h" #include "TestShaderVarAccess.h" #include "BasicShaderSourceStreamFactory.h" +#include "GraphicsAccessories.h" using namespace Diligent; +void PrintShaderResources(IShader* pShader) +{ + std::stringstream ss; + ss << "Resources of shader '" << pShader->GetDesc().Name << "':" << std::endl; + for (Uint32 res=0; res < pShader->GetResourceCount(); ++res) + { + auto ResDec = pShader->GetResource(res); + std::stringstream name_ss; + name_ss << ResDec.Name; + if(ResDec.ArraySize > 1) + name_ss << "[" << ResDec.ArraySize << "]"; + ss << std::setw(2) << std::right << res << ": " << std::setw(24) << std::left << name_ss.str() + << " " << GetShaderResourceTypeLiteralName(ResDec.Type) << std::endl; + } + LOG_INFO_MESSAGE(ss.str()); +} + TestShaderVarAccess::TestShaderVarAccess( IRenderDevice *pDevice, IDeviceContext *pContext, Diligent::ISwapChain* pSwapChain ) : UnitTestBase("Shader variable access test"), m_pDeviceContext(pContext) @@ -180,6 +198,8 @@ TestShaderVarAccess::TestShaderVarAccess( IRenderDevice *pDevice, IDeviceContext pDevice->CreateShader(CreationAttrs, &pVS); VERIFY_EXPR(pVS); + + PrintShaderResources(pVS); } std::vector<ShaderResourceVariableDesc> VarDesc = @@ -220,6 +240,8 @@ TestShaderVarAccess::TestShaderVarAccess( IRenderDevice *pDevice, IDeviceContext CreationAttrs.FilePath = pDevice->GetDeviceCaps().IsD3DDevice() ? "Shaders\\ShaderVarAccessTestDX.psh" : "Shaders\\ShaderVarAccessTestGL.psh"; pDevice->CreateShader(CreationAttrs, &pPS); VERIFY_EXPR(pPS); + + PrintShaderResources(pPS); } |
