Skip to content

Commit 548c279

Browse files
committed
Extend D3D12_Bufer_Truncation test to SM6.0 & SM6.6
To test the DXIL debugger
1 parent 09584f7 commit 548c279

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

util/test/demos/d3d12/d3d12_buffer_truncation.cpp

+41
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ float4 main() : SV_Target0
8282
ID3DBlobPtr vsblob = Compile(vertex, "main", "vs_5_0");
8383
ID3DBlobPtr psblob = Compile(pixel, "main", "ps_5_0");
8484

85+
bool supportSM60 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_0) && m_DXILSupport;
86+
bool supportSM66 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_6) && m_DXILSupport;
87+
88+
ID3DBlobPtr vs_6_0_blob = supportSM60 ? Compile(vertex, "main", "vs_6_0") : NULL;
89+
ID3DBlobPtr ps_6_0_blob = supportSM60 ? Compile(pixel, "main", "ps_6_0") : NULL;
90+
ID3DBlobPtr vs_6_6_blob = supportSM66 ? Compile(vertex, "main", "vs_6_6") : NULL;
91+
ID3DBlobPtr ps_6_6_blob = supportSM66 ? Compile(pixel, "main", "ps_6_6") : NULL;
92+
8593
const DefaultA2V OffsetTri[] = {
8694
{Vec3f(7.7f, 0.0f, 0.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
8795
{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
117125
ID3D12PipelineStatePtr pso = MakePSO().RootSig(sig).InputLayout().VS(vsblob).PS(psblob).RTVs(
118126
{DXGI_FORMAT_R32G32B32A32_FLOAT});
119127

128+
ID3D12PipelineStatePtr sm_6_0_pso = NULL;
129+
if(vs_6_0_blob && ps_6_0_blob)
130+
sm_6_0_pso = MakePSO()
131+
.RootSig(sig)
132+
.InputLayout()
133+
.VS(vs_6_0_blob)
134+
.PS(ps_6_0_blob)
135+
.RTVs({DXGI_FORMAT_R32G32B32A32_FLOAT});
136+
137+
ID3D12PipelineStatePtr sm_6_6_pso = NULL;
138+
if(vs_6_6_blob && ps_6_6_blob)
139+
sm_6_6_pso = MakePSO()
140+
.RootSig(sig)
141+
.InputLayout()
142+
.VS(vs_6_6_blob)
143+
.PS(ps_6_6_blob)
144+
.RTVs({DXGI_FORMAT_R32G32B32A32_FLOAT});
145+
120146
ResourceBarrier(vb, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
121147
ResourceBarrier(ib, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_INDEX_BUFFER);
122148
ResourceBarrier(cb, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
@@ -172,8 +198,23 @@ float4 main() : SV_Target0
172198

173199
OMSetRenderTargets(cmd, {offrtv}, {});
174200

201+
setMarker(cmd, "SM5");
175202
cmd->DrawIndexedInstanced(6, 1, 0, 0, 0);
176203

204+
if(sm_6_0_pso)
205+
{
206+
cmd->SetPipelineState(sm_6_0_pso);
207+
setMarker(cmd, "SM6.0");
208+
cmd->DrawIndexedInstanced(6, 1, 0, 0, 0);
209+
}
210+
211+
if(sm_6_6_pso)
212+
{
213+
cmd->SetPipelineState(sm_6_6_pso);
214+
setMarker(cmd, "SM6.6");
215+
cmd->DrawIndexedInstanced(6, 1, 0, 0, 0);
216+
}
217+
177218
ResourceBarrier(cmd, rtvtex, D3D12_RESOURCE_STATE_RENDER_TARGET,
178219
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
179220

util/test/rdtest/shared/Buffer_Truncation.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ class Buffer_Truncation(rdtest.TestCase):
88

99
def check_capture(self):
1010
action = self.find_action("Draw")
11+
self.check_capture_action(action)
1112

13+
def check_capture_action(self, action: rd.ActionDescription):
1214
self.check(action is not None)
1315

1416
self.controller.SetFrameEvent(action.eventId, False)
@@ -148,7 +150,7 @@ def check_capture(self):
148150
self.check(all(['consts.padding[' in c.name for c in cbuf_sourceVars[0:16]]))
149151
self.check(cbuf_sourceVars[16].name == 'consts.outcol')
150152

151-
self.check(cbuf_sourceVars[16].variables[0].name == 'cb0[16]')
153+
self.check(cbuf_sourceVars[16].variables[0].name == 'cb0[16]' or cbuf_sourceVars[16].variables[0].name == 'consts[16]')
152154

153155
if not rdtest.value_compare(debugged_cb.value.f32v[0:4], [0.0, 0.0, 0.0, 0.0]):
154156
raise rdtest.TestFailureException("expected outcol to be 0s, but got {}".format(debugged_cb.members[1].value.f32v[0:4]))

util/test/tests/D3D12/D3D12_Buffer_Truncation.py

+23-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,26 @@
44

55
class D3D12_Buffer_Truncation(rdtest.Buffer_Truncation):
66
demos_test_name = 'D3D12_Buffer_Truncation'
7-
internal = False
7+
internal = False
8+
9+
def check_capture(self):
10+
rdtest.log.begin_section("SM5")
11+
action = self.find_action("SM5")
12+
self.check_capture_action(action.next)
13+
rdtest.log.end_section("SM5")
14+
15+
rdtest.log.begin_section("SM6.0")
16+
action = self.find_action("SM6.0")
17+
if action is None:
18+
rdtest.log.print("No SM6.0 action to test")
19+
return
20+
self.check_capture_action(action.next)
21+
rdtest.log.end_section("SM6.0")
22+
23+
rdtest.log.begin_section("SM6.6")
24+
action = self.find_action("SM6.6")
25+
if action is None:
26+
rdtest.log.print("No SM6.6 action to test")
27+
return
28+
self.check_capture_action(action.next)
29+
rdtest.log.end_section("SM6.6")

0 commit comments

Comments
 (0)