diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-05-29 01:09:48 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-05-29 01:09:48 +0000 |
| commit | cd27f5affb46c349987902aa31014500d5fbef79 (patch) | |
| tree | 79c39c72242c9d08a250dd35412b036f4485224a /Tests/TestApp/src | |
| parent | Updated shader resource layout test (diff) | |
| download | DiligentEngine-cd27f5affb46c349987902aa31014500d5fbef79.tar.gz DiligentEngine-cd27f5affb46c349987902aa31014500d5fbef79.zip | |
Updated multiple tests
Diffstat (limited to 'Tests/TestApp/src')
| -rw-r--r-- | Tests/TestApp/src/TestBufferAccess.cpp | 8 | ||||
| -rw-r--r-- | Tests/TestApp/src/TestDrawCommands.cpp | 10 | ||||
| -rw-r--r-- | Tests/TestApp/src/TestPSOCompatibility.cpp | 4 | ||||
| -rw-r--r-- | Tests/TestApp/src/TestShaderResArrays.cpp | 2 | ||||
| -rw-r--r-- | Tests/TestApp/src/TestShaderResourceLayout.cpp | 108 | ||||
| -rw-r--r-- | Tests/TestApp/src/TestTexturing.cpp | 12 |
6 files changed, 100 insertions, 44 deletions
diff --git a/Tests/TestApp/src/TestBufferAccess.cpp b/Tests/TestApp/src/TestBufferAccess.cpp index 9a9e17b..f59891d 100644 --- a/Tests/TestApp/src/TestBufferAccess.cpp +++ b/Tests/TestApp/src/TestBufferAccess.cpp @@ -43,7 +43,7 @@ void TestBufferAccess::Init( IRenderDevice *pDevice, IDeviceContext *pContext, f m_pRenderDevice = pDevice; m_pDeviceContext = pContext; auto DevType = m_pRenderDevice->GetDeviceCaps().DevType; - bool bUseOpenGL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES; + bool bUseGLSL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES || DevType == DeviceType::Vulkan; m_fXExtent = fXExtent; m_fYExtent = fYExtent; @@ -115,18 +115,18 @@ void TestBufferAccess::Init( IRenderDevice *pDevice, IDeviceContext *pContext, f ShaderCreationAttribs CreationAttrs; BasicShaderSourceStreamFactory BasicSSSFactory; CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory; - CreationAttrs.Desc.TargetProfile = bUseOpenGL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0; + CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0; RefCntAutoPtr<Diligent::IShader> pVSInst, pPS; { - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh"; CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX; m_pRenderDevice->CreateShader( CreationAttrs, &pVSInst ); } { - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh"; CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL; m_pRenderDevice->CreateShader( CreationAttrs, &pPS ); } diff --git a/Tests/TestApp/src/TestDrawCommands.cpp b/Tests/TestApp/src/TestDrawCommands.cpp index 59e5a31..82bb2ee 100644 --- a/Tests/TestApp/src/TestDrawCommands.cpp +++ b/Tests/TestApp/src/TestDrawCommands.cpp @@ -37,7 +37,7 @@ void TestDrawCommands::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceCont m_pDeviceContext = pDeviceContext; auto DevType = m_pRenderDevice->GetDeviceCaps().DevType; - bool bUseOpenGL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES; + bool bUseGLSL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES || DevType == DeviceType::Vulkan; std::vector<float> VertexData; std::vector<float> VertexData2; @@ -155,23 +155,23 @@ void TestDrawCommands::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceCont ShaderCreationAttribs CreationAttrs; BasicShaderSourceStreamFactory BasicSSSFactory; CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory; - CreationAttrs.Desc.TargetProfile = bUseOpenGL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0; + CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0; RefCntAutoPtr<IShader> pVS, pVSInst, pPS; { - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalGL.vsh" : "Shaders\\minimalDX.vsh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalGL.vsh" : "Shaders\\minimalDX.vsh"; CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX; m_pRenderDevice->CreateShader( CreationAttrs, &pVS ); } { - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh"; CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX; m_pRenderDevice->CreateShader( CreationAttrs, &pVSInst ); } { - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh"; CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL; m_pRenderDevice->CreateShader( CreationAttrs, &pPS ); } diff --git a/Tests/TestApp/src/TestPSOCompatibility.cpp b/Tests/TestApp/src/TestPSOCompatibility.cpp index f14f22d..3abd3a6 100644 --- a/Tests/TestApp/src/TestPSOCompatibility.cpp +++ b/Tests/TestApp/src/TestPSOCompatibility.cpp @@ -268,10 +268,10 @@ TestPSOCompatibility::TestPSOCompatibility(IRenderDevice *pDevice ) : auto PSO_TexArr = CreateTestPSO(VS0, PS_TexArr); auto PSO_ArrOfTex = CreateTestPSO(VS0, PS_ArrOfTex); VERIFY_EXPR(PSO_Tex->IsCompatibleWith(PSO_Tex2)); - if(DevType!=DeviceType::D3D12) + if(DevType!=DeviceType::D3D12 && DevType != DeviceType::Vulkan) VERIFY_EXPR(!PSO_Tex->IsCompatibleWith(PSO_TexArr)); VERIFY_EXPR(!PSO_Tex->IsCompatibleWith(PSO_ArrOfTex)); - if (DevType != DeviceType::D3D12) + if (DevType != DeviceType::D3D12 && DevType != DeviceType::Vulkan) VERIFY_EXPR(!PSO_Tex2->IsCompatibleWith(PSO_TexArr)); VERIFY_EXPR(!PSO_Tex2->IsCompatibleWith(PSO_ArrOfTex)); VERIFY_EXPR(!PSO_TexArr->IsCompatibleWith(PSO_ArrOfTex)); diff --git a/Tests/TestApp/src/TestShaderResArrays.cpp b/Tests/TestApp/src/TestShaderResArrays.cpp index 190c13a..1f6238b 100644 --- a/Tests/TestApp/src/TestShaderResArrays.cpp +++ b/Tests/TestApp/src/TestShaderResArrays.cpp @@ -32,7 +32,7 @@ using namespace Diligent; -TestShaderResArrays::TestShaderResArrays(IRenderDevice *pDevice, IDeviceContext *pDeviceContext, bool bUseOpenGL, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent) : +TestShaderResArrays::TestShaderResArrays(IRenderDevice *pDevice, IDeviceContext *pDeviceContext, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent) : UnitTestBase("Shader resource array test") { m_pRenderDevice = pDevice; diff --git a/Tests/TestApp/src/TestShaderResourceLayout.cpp b/Tests/TestApp/src/TestShaderResourceLayout.cpp index bc55428..c4aa901 100644 --- a/Tests/TestApp/src/TestShaderResourceLayout.cpp +++ b/Tests/TestApp/src/TestShaderResourceLayout.cpp @@ -103,11 +103,11 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev BuffDesc.Mode = BUFFER_MODE_STRUCTURED; BuffDesc.ElementByteStride = 16; RefCntAutoPtr<IBuffer> pStorgeBuffs[4]; - IDeviceObject *pSBs[4]; + IDeviceObject *pSBUAVs[4]; for (int i = 0; i < 4; ++i) { pDevice->CreateBuffer(BuffDesc, BufferData{}, &(pStorgeBuffs[i])); - pSBs[i] = pStorgeBuffs[i]; + pSBUAVs[i] = pStorgeBuffs[i]->GetDefaultView(BUFFER_VIEW_UNORDERED_ACCESS); } RefCntAutoPtr<IBuffer> pUniformTexelBuff, pStorageTexelBuff; @@ -131,6 +131,46 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev pStorageTexelBuffUAV = pStorageTexelBuff->GetDefaultView(BUFFER_VIEW_UNORDERED_ACCESS); } + ResourceMappingDesc ResMappingDesc; + ResourceMappingEntry MappingEntries[] = + { + {"g_tex2D_Static", pSRVs[0]}, + {"g_tex2DArr_Static", pSRVs[0], 0}, + {"g_tex2DArr_Static", pSRVs[1], 1}, + {"g_sepTex2D_static", pSRVs[0]}, + {"g_sepTex2DArr_static", pSRVs[0], 0}, + {"g_sepTex2DArr_static", pSRVs[1], 1}, + {"g_tex2D_Mut", pSRVs[0]}, + {"g_tex2DArr_Mut", pSRVs[0], 0}, + {"g_tex2DArr_Mut", pSRVs[1], 1}, + {"g_tex2DArr_Mut", pSRVs[2], 2}, + {"g_tex2D_Dyn", pSRVs[0]}, + {"g_tex2DArr_Dyn", pSRVs[0], 0}, + {"g_tex2DArr_Dyn", pSRVs[1], 1}, + {"g_tex2DArr_Dyn", pSRVs[2], 2}, + {"g_tex2DArr_Dyn", pSRVs[3], 3}, + {"g_tex2DArr_Dyn", pSRVs[0], 4}, + {"g_tex2DArr_Dyn", pSRVs[1], 5}, + {"g_tex2DArr_Dyn", pSRVs[2], 6}, + {"g_tex2DArr_Dyn", pSRVs[3], 7}, + {"g_sepTex2D_mut", pSRVs[0]}, + {"g_sepTex2DArr_mut", pSRVs[0], 0}, + {"g_sepTex2DArr_mut", pSRVs[1], 1}, + {"g_sepTex2DArr_mut", pSRVs[2], 2}, + {"g_sepTex2D_dyn", pSRVs[0]}, + {"g_sepTex2DArr_dyn", pSRVs[0], 0}, + {"g_sepTex2DArr_dyn", pSRVs[1], 1}, + {"g_sepTex2DArr_dyn", pSRVs[2], 2}, + {"g_sepTex2DArr_dyn", pSRVs[3], 3}, + {"g_sepTex2DArr_dyn", pSRVs[0], 4}, + {"g_sepTex2DArr_dyn", pSRVs[1], 5}, + {"g_sepTex2DArr_dyn", pSRVs[2], 6}, + {"g_sepTex2DArr_dyn", pSRVs[3], 7}, + {} + }; + ResMappingDesc.pEntries = MappingEntries; + RefCntAutoPtr<IResourceMapping> pResMapping; + pDevice->CreateResourceMapping(ResMappingDesc, &pResMapping); RefCntAutoPtr<IShader> pVS; { @@ -187,18 +227,21 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev pDevice->CreateShader(CreationAttrs, &pVS); VERIFY_EXPR(pVS); - pVS->GetShaderVariable("g_tex2D_Static")->Set(pSRVs[0]); - pVS->GetShaderVariable("g_tex2DArr_Static")->SetArray(pSRVs, 0, 2); + //pVS->GetShaderVariable("g_tex2D_Static")->Set(pSRVs[0]); + //pVS->GetShaderVariable("g_tex2DArr_Static")->SetArray(pSRVs, 0, 2); pVS->GetShaderVariable("g_sepTex2D_static")->Set(pSRVs[0]); pVS->GetShaderVariable("g_sepTex2DArr_static")->SetArray(pSRVs, 0, 2); pVS->GetShaderVariable("g_SamArr_static")->SetArray(pSams, 0, 2); pVS->GetShaderVariable("UniformBuff_Stat")->Set(pUBs[0]); pVS->GetShaderVariable("UniformBuffArr_Stat")->SetArray(pUBs, 0, 2); - pVS->GetShaderVariable("storageBuff_Static")->Set(pSBs[0]); - pVS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBs, 0, 2); + pVS->GetShaderVariable("storageBuff_Static")->Set(pSBUAVs[0]); + pVS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBUAVs, 0, 2); pVS->GetShaderVariable("g_tex2DStorageImg_Stat")->Set(pUAVs[0]); pVS->GetShaderVariable("g_UniformTexelBuff")->Set(pUniformTexelBuffSRV); pVS->GetShaderVariable("g_StorageTexelBuff")->Set(pStorageTexelBuffUAV); + pVS->GetShaderVariable("g_tex2D_Mut"); + LOG_INFO_MESSAGE("The above 2 warnings and 1 errors about missing shader resources are part of the test"); + pVS->BindResources(pResMapping, BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED | BIND_SHADER_RESOURCES_ALL_RESOLVED); } RefCntAutoPtr<IShader> pPS; @@ -207,21 +250,25 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL; CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_GLSL; CreationAttrs.FilePath = "Shaders\\ShaderResLayoutTestGL.psh"; + pDevice->CreateShader(CreationAttrs, &pPS); VERIFY_EXPR(pPS); pPS->GetShaderVariable("g_tex2D_Static")->Set(pSRVs[0]); pPS->GetShaderVariable("g_tex2DArr_Static")->SetArray(pSRVs, 0, 2); - pPS->GetShaderVariable("g_sepTex2D_static")->Set(pSRVs[0]); - pPS->GetShaderVariable("g_sepTex2DArr_static")->SetArray(pSRVs, 0, 2); + //pPS->GetShaderVariable("g_sepTex2D_static")->Set(pSRVs[0]); + //pPS->GetShaderVariable("g_sepTex2DArr_static")->SetArray(pSRVs, 0, 2); pPS->GetShaderVariable("g_SamArr_static")->SetArray(pSams, 0, 2); pPS->GetShaderVariable("UniformBuff_Stat")->Set(pUBs[0]); pPS->GetShaderVariable("UniformBuffArr_Stat")->SetArray(pUBs, 0, 2); - pPS->GetShaderVariable("storageBuff_Static")->Set(pSBs[0]); - pPS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBs, 0, 2); + pPS->GetShaderVariable("storageBuff_Static")->Set(pSBUAVs[0]); + pPS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBUAVs, 0, 2); pPS->GetShaderVariable("g_tex2DStorageImg_Stat")->Set(pUAVs[0]); pPS->GetShaderVariable("g_UniformTexelBuff")->Set(pUniformTexelBuffSRV); pPS->GetShaderVariable("g_StorageTexelBuff")->Set(pStorageTexelBuffUAV); + pPS->GetShaderVariable("storageBuff_Dyn"); + LOG_INFO_MESSAGE("The above 2 warnings and 1 errors about missing shader resources are part of the test"); + pPS->BindResources(pResMapping, BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED | BIND_SHADER_RESOURCES_ALL_RESOLVED); } PipelineStateDesc PSODesc; @@ -232,6 +279,7 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev PSODesc.GraphicsPipeline.NumRenderTargets = 1; PSODesc.GraphicsPipeline.RTVFormats[0] = TEX_FORMAT_RGBA8_UNORM; PSODesc.GraphicsPipeline.DSVFormat = TEX_FORMAT_UNKNOWN; + PSODesc.SRBAllocationGranularity = 16; RefCntAutoPtr<IPipelineState> pTestPSO; pDevice->CreatePipelineState(PSODesc, &pTestPSO); @@ -240,10 +288,14 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev RefCntAutoPtr<IShaderResourceBinding> pSRB; pTestPSO->CreateShaderResourceBinding(&pSRB); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Mut")->Set(pSRVs[0]); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Mut")->SetArray(pSRVs, 0, 3); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Dyn")->Set(pSRVs[0]); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Dyn")->SetArray(pSRVs, 0, 4); + pSRB->GetVariable(SHADER_TYPE_VERTEX, "UniformBuff_Stat"); + pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_static"); + LOG_INFO_MESSAGE("The above 2 errors about missing shader resources are part of the test"); + + //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Mut")->Set(pSRVs[0]); + //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Mut")->SetArray(pSRVs, 0, 3); + //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Dyn")->Set(pSRVs[0]); + //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Dyn")->SetArray(pSRVs, 0, 4); pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_sepTex2D_mut")->Set(pSRVs[0]); pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_sepTex2DArr_mut")->SetArray(pSRVs, 0, 3); @@ -258,10 +310,10 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev pSRB->GetVariable(SHADER_TYPE_VERTEX, "UniformBuff_Dyn")->Set(pUBs[0]); pSRB->GetVariable(SHADER_TYPE_VERTEX, "UniformBuffArr_Dyn")->SetArray(pUBs, 0, 4); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Mut")->Set(pSBs[0]); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Mut")->SetArray(pSBs, 0, 3); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Dyn")->Set(pSBs[0]); - pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Dyn")->SetArray(pSBs, 0, 4); + pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Mut")->Set(pSBUAVs[0]); + pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Mut")->SetArray(pSBUAVs, 0, 3); + pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Dyn")->Set(pSBUAVs[0]); + pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Dyn")->SetArray(pSBUAVs, 0, 4); pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DStorageImgArr_Mut")->SetArray(pUAVs, 0, 2); pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DStorageImgArr_Dyn")->SetArray(pUAVs, 0, 2); @@ -276,10 +328,10 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2D_Dyn")->Set(pSRVs[0]); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2DArr_Dyn")->SetArray(pSRVs, 0, 4); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_mut")->Set(pSRVs[0]); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_mut")->SetArray(pSRVs, 0, 3); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_dyn")->Set(pSRVs[0]); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_dyn")->SetArray(pSRVs, 0, 4); + //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_mut")->Set(pSRVs[0]); + //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_mut")->SetArray(pSRVs, 0, 3); + //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_dyn")->Set(pSRVs[0]); + //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_dyn")->SetArray(pSRVs, 0, 4); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_Sam_mut")->Set(pSams[0]); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_SamArr_dyn")->SetArray(pSams, 0, 4); @@ -289,10 +341,10 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev pSRB->GetVariable(SHADER_TYPE_PIXEL, "UniformBuff_Dyn")->Set(pUBs[0]); pSRB->GetVariable(SHADER_TYPE_PIXEL, "UniformBuffArr_Dyn")->SetArray(pUBs, 0, 4); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Mut")->Set(pSBs[0]); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Mut")->SetArray(pSBs, 0, 3); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBs[0]); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Dyn")->SetArray(pSBs, 0, 4); + pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Mut")->Set(pSBUAVs[0]); + pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Mut")->SetArray(pSBUAVs, 0, 3); + pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBUAVs[0]); + pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Dyn")->SetArray(pSBUAVs, 0, 4); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2DStorageImgArr_Mut")->SetArray(pUAVs, 0, 2); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2DStorageImgArr_Dyn")->SetArray(pUAVs, 0, 2); @@ -300,6 +352,8 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_UniformTexelBuff_mut")->Set(pUniformTexelBuffSRV); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_StorageTexelBuff_mut")->Set(pStorageTexelBuffUAV); + pSRB->BindResources(SHADER_TYPE_PIXEL | SHADER_TYPE_VERTEX, pResMapping, BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED | BIND_SHADER_RESOURCES_ALL_RESOLVED); + pContext->SetPipelineState(pTestPSO); pContext->CommitShaderResources(pSRB, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES); @@ -307,7 +361,7 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev DrawAttrs.NumVertices = 3; pContext->Draw(DrawAttrs); - pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBs[1]); + pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBUAVs[1]); pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Dyn")->Set(pSRVs[1]); pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_sepTex2D_dyn")->Set(pSRVs[1]); pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_SamArr_dyn")->SetArray(pSams+1, 1, 3); diff --git a/Tests/TestApp/src/TestTexturing.cpp b/Tests/TestApp/src/TestTexturing.cpp index bcc6c30..9a9b356 100644 --- a/Tests/TestApp/src/TestTexturing.cpp +++ b/Tests/TestApp/src/TestTexturing.cpp @@ -132,11 +132,13 @@ void TestTexturing::GenerateTextureData(IRenderDevice *pRenderDevice, std::vecto } -void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext, TEXTURE_FORMAT TexFormat, bool bUseOpenGL, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent ) +void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext, TEXTURE_FORMAT TexFormat, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent ) { m_pRenderDevice = pDevice; m_TextureFormat = TexFormat; m_pDeviceContext = pDeviceContext; + auto DevType = m_pRenderDevice->GetDeviceCaps().DevType; + bool bUseGLSL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES || DevType == DeviceType::Vulkan; float Vertices[] = { @@ -167,11 +169,11 @@ void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext ShaderCreationAttribs CreationAttrs; BasicShaderSourceStreamFactory BasicSSSFactory; CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory; - CreationAttrs.Desc.TargetProfile = bUseOpenGL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0; + CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0; RefCntAutoPtr<Diligent::IShader> pVS, pPS; { - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\TextureTestGL.vsh" : "Shaders\\TextureTestDX.vsh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\TextureTestGL.vsh" : "Shaders\\TextureTestDX.vsh"; CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX; m_pRenderDevice->CreateShader( CreationAttrs, &pVS ); } @@ -180,9 +182,9 @@ void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext PixelFormatAttribs.ComponentType == COMPONENT_TYPE_SINT; { if( bIsIntTexture ) - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\TextureIntTestGL.psh" : "Shaders\\TextureIntTestDX.psh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\TextureIntTestGL.psh" : "Shaders\\TextureIntTestDX.psh"; else - CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\TextureTestGL.psh" : "Shaders\\TextureTestDX.psh"; + CreationAttrs.FilePath = bUseGLSL ? "Shaders\\TextureTestGL.psh" : "Shaders\\TextureTestDX.psh"; CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL; StaticSamplerDesc StaticSampler; |
