diff --git a/util/test/demos/d3d12/d3d12_cbuffer_zoo.cpp b/util/test/demos/d3d12/d3d12_cbuffer_zoo.cpp index 2cc2aa4b3..2c1206aa7 100644 --- a/util/test/demos/d3d12/d3d12_cbuffer_zoo.cpp +++ b/util/test/demos/d3d12/d3d12_cbuffer_zoo.cpp @@ -330,8 +330,13 @@ float4 main() : SV_Target0 ID3DBlobPtr vs5blob = Compile(D3DDefaultVertex, "main", "vs_5_0"); ID3DBlobPtr ps5blob = Compile(pixel, "main", "ps_5_1"); - ID3DBlobPtr vs6blob = m_DXILSupport ? Compile(D3DDefaultVertex, "main", "vs_6_0") : NULL; - ID3DBlobPtr ps6blob = m_DXILSupport ? Compile(pixel, "main", "ps_6_0") : NULL; + bool supportSM60 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_0) && m_DXILSupport; + bool supportSM66 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_6) && m_DXILSupport; + + ID3DBlobPtr vs6blob = supportSM60 ? Compile(D3DDefaultVertex, "main", "vs_6_0") : NULL; + ID3DBlobPtr ps6blob = supportSM60 ? Compile(pixel, "main", "ps_6_0") : NULL; + ID3DBlobPtr vs66blob = supportSM66 ? Compile(D3DDefaultVertex, "main", "vs_6_6") : NULL; + ID3DBlobPtr ps66blob = supportSM66 ? Compile(pixel, "main", "ps_6_6") : NULL; const size_t bindOffset = 16; @@ -387,6 +392,12 @@ float4 main() : SV_Target0 dxilpso = MakePSO().RootSig(sig).InputLayout().VS(vs6blob).PS(ps6blob).RTVs( {DXGI_FORMAT_R32G32B32A32_FLOAT}); + ID3D12PipelineStatePtr sm6_6pso = NULL; + + if(vs66blob && ps66blob) + sm6_6pso = MakePSO().RootSig(sig).InputLayout().VS(vs66blob).PS(ps66blob).RTVs( + {DXGI_FORMAT_R32G32B32A32_FLOAT}); + ResourceBarrier(vb, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); ResourceBarrier(cb, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); @@ -436,7 +447,15 @@ float4 main() : SV_Target0 { cmd->SetPipelineState(dxilpso); - setMarker(cmd, "DXIL Draw"); + setMarker(cmd, "SM6.0"); + cmd->DrawInstanced(3, 1, 0, 0); + } + + if(sm6_6pso) + { + cmd->SetPipelineState(sm6_6pso); + + setMarker(cmd, "SM6.6"); cmd->DrawInstanced(3, 1, 0, 0); } diff --git a/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py b/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py index ec769c8a4..cb0c6a061 100644 --- a/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py +++ b/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py @@ -5,6 +5,7 @@ class D3D12_CBuffer_Zoo(rdtest.TestCase): demos_test_name = 'D3D12_CBuffer_Zoo' def check_capture(self): + rdtest.log.begin_section("DXBC Draw") action = self.find_action("DXBC Draw") self.check(action is not None) @@ -24,12 +25,14 @@ class D3D12_CBuffer_Zoo(rdtest.TestCase): self.check_event() rdtest.log.success("DXBC action is as expected") + rdtest.log.end_section("DXBC Draw") - # Move to the DXIL action - action = self.find_action("DXIL Draw") + rdtest.log.begin_section("SM6.0 Draw") + # Move to the SM6.0 action + action = self.find_action("SM6.0") if action is None: - rdtest.log.print("No DXIL action to test") + rdtest.log.print("No SM6.0 action to test") return self.controller.SetFrameEvent(action.next.eventId, False) @@ -40,10 +43,28 @@ class D3D12_CBuffer_Zoo(rdtest.TestCase): '') self.check('SM6.0' in disasm) - self.check_event() + rdtest.log.success("SM 6.0 action is as expected") + rdtest.log.end_section("SM6.0 Draw") - rdtest.log.success("DXIL action is as expected") + rdtest.log.begin_section("SM6.6 Draw") + # Move to the SM6.6 action + action = self.find_action("SM6.6") + + if action is None: + rdtest.log.print("No SM6.6 action to test") + return + + self.controller.SetFrameEvent(action.next.eventId, False) + + pipe: rd.PipeState = self.controller.GetPipelineState() + + disasm = self.controller.DisassembleShader(pipe.GetGraphicsPipelineObject(), pipe.GetShaderReflection(stage), + '') + self.check('SM6.6' in disasm) + self.check_event() + rdtest.log.success("SM 6.6 action is as expected") + rdtest.log.end_section("SM6.6 Draw") def check_event(self): pipe: rd.PipeState = self.controller.GetPipelineState()