Extend D3D12_Bufer_Truncation test to SM6.0 & SM6.6

To test the DXIL debugger
This commit is contained in:
Jake Turner
2025-03-16 17:42:51 +00:00
parent 9163aa76c2
commit ac2da339ae
3 changed files with 68 additions and 2 deletions
@@ -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);
+1 -1
View File
@@ -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]))
@@ -4,4 +4,29 @@ import renderdoc as rd
class D3D12_Buffer_Truncation(rdtest.Buffer_Truncation):
demos_test_name = 'D3D12_Buffer_Truncation'
internal = False
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")