diff --git a/util/test/demos/d3d12/d3d12_buffer_truncation.cpp b/util/test/demos/d3d12/d3d12_buffer_truncation.cpp index 66696c44b..8e9511363 100644 --- a/util/test/demos/d3d12/d3d12_buffer_truncation.cpp +++ b/util/test/demos/d3d12/d3d12_buffer_truncation.cpp @@ -82,6 +82,14 @@ float4 main() : SV_Target0 ID3DBlobPtr vsblob = Compile(vertex, "main", "vs_5_0"); ID3DBlobPtr psblob = Compile(pixel, "main", "ps_5_0"); + bool supportSM60 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_0) && m_DXILSupport; + bool supportSM66 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_6) && m_DXILSupport; + + ID3DBlobPtr vs_6_0_blob = supportSM60 ? Compile(vertex, "main", "vs_6_0") : NULL; + ID3DBlobPtr ps_6_0_blob = supportSM60 ? Compile(pixel, "main", "ps_6_0") : NULL; + ID3DBlobPtr vs_6_6_blob = supportSM66 ? Compile(vertex, "main", "vs_6_6") : NULL; + ID3DBlobPtr ps_6_6_blob = supportSM66 ? Compile(pixel, "main", "ps_6_6") : NULL; + const DefaultA2V OffsetTri[] = { {Vec3f(7.7f, 0.0f, 0.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)}, {Vec3f(7.7f, 0.0f, 0.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)}, @@ -117,6 +125,24 @@ float4 main() : SV_Target0 ID3D12PipelineStatePtr pso = MakePSO().RootSig(sig).InputLayout().VS(vsblob).PS(psblob).RTVs( {DXGI_FORMAT_R32G32B32A32_FLOAT}); + ID3D12PipelineStatePtr sm_6_0_pso = NULL; + if(vs_6_0_blob && ps_6_0_blob) + sm_6_0_pso = MakePSO() + .RootSig(sig) + .InputLayout() + .VS(vs_6_0_blob) + .PS(ps_6_0_blob) + .RTVs({DXGI_FORMAT_R32G32B32A32_FLOAT}); + + ID3D12PipelineStatePtr sm_6_6_pso = NULL; + if(vs_6_6_blob && ps_6_6_blob) + sm_6_6_pso = MakePSO() + .RootSig(sig) + .InputLayout() + .VS(vs_6_6_blob) + .PS(ps_6_6_blob) + .RTVs({DXGI_FORMAT_R32G32B32A32_FLOAT}); + ResourceBarrier(vb, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); ResourceBarrier(ib, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_INDEX_BUFFER); ResourceBarrier(cb, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); @@ -172,8 +198,23 @@ float4 main() : SV_Target0 OMSetRenderTargets(cmd, {offrtv}, {}); + setMarker(cmd, "SM5"); cmd->DrawIndexedInstanced(6, 1, 0, 0, 0); + if(sm_6_0_pso) + { + cmd->SetPipelineState(sm_6_0_pso); + setMarker(cmd, "SM6.0"); + cmd->DrawIndexedInstanced(6, 1, 0, 0, 0); + } + + if(sm_6_6_pso) + { + cmd->SetPipelineState(sm_6_6_pso); + setMarker(cmd, "SM6.6"); + cmd->DrawIndexedInstanced(6, 1, 0, 0, 0); + } + ResourceBarrier(cmd, rtvtex, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); diff --git a/util/test/rdtest/shared/Buffer_Truncation.py b/util/test/rdtest/shared/Buffer_Truncation.py index e0954b67e..75cee38aa 100644 --- a/util/test/rdtest/shared/Buffer_Truncation.py +++ b/util/test/rdtest/shared/Buffer_Truncation.py @@ -151,7 +151,7 @@ class Buffer_Truncation(rdtest.TestCase): self.check(all(['consts.padding[' in c.name for c in cbuf_sourceVars[0:16]])) self.check(cbuf_sourceVars[16].name == 'consts.outcol') - self.check(cbuf_sourceVars[16].variables[0].name == 'cb0[16]') + self.check(cbuf_sourceVars[16].variables[0].name == 'cb0[16]' or cbuf_sourceVars[16].variables[0].name == 'consts[16]') if not rdtest.value_compare(debugged_cb.value.f32v[0:4], [0.0, 0.0, 0.0, 0.0]): raise rdtest.TestFailureException("expected outcol to be 0s, but got {}".format(debugged_cb.members[1].value.f32v[0:4])) diff --git a/util/test/tests/D3D12/D3D12_Buffer_Truncation.py b/util/test/tests/D3D12/D3D12_Buffer_Truncation.py index e3adf8f86..5458772d2 100644 --- a/util/test/tests/D3D12/D3D12_Buffer_Truncation.py +++ b/util/test/tests/D3D12/D3D12_Buffer_Truncation.py @@ -4,4 +4,29 @@ import renderdoc as rd class D3D12_Buffer_Truncation(rdtest.Buffer_Truncation): demos_test_name = 'D3D12_Buffer_Truncation' - internal = False \ No newline at end of file + internal = False + + def check_capture(self): + rdtest.log.begin_section("SM5") + self.draw_action = self.find_action("SM5") + self.draw_action = self.draw_action.next + super().check_capture() + rdtest.log.end_section("SM5") + + rdtest.log.begin_section("SM6.0") + self.draw_action = self.find_action("SM6.0") + if self.draw_action is None: + rdtest.log.print("No SM6.0 action to test") + return + self.draw_action = self.draw_action.next + super().check_capture() + rdtest.log.end_section("SM6.0") + + rdtest.log.begin_section("SM6.6") + self.draw_action = self.find_action("SM6.6") + if self.draw_action is None: + rdtest.log.print("No SM6.6 action to test") + return + self.draw_action = self.draw_action.next + super().check_capture() + rdtest.log.end_section("SM6.6") \ No newline at end of file