Set more tests to use common check_vertex_debug() helper

This commit is contained in:
baldurk
2026-09-11 19:19:26 +01:00
parent fc27cf0deb
commit d7cbb743e4
5 changed files with 46 additions and 106 deletions
+4 -38
View File
@@ -154,49 +154,15 @@ class Subgroup_Zoo(rdtest.TestCase):
for view in range(pipe.MultiviewBroadcastCount()):
postvs = self.get_postvs(
action, rd.MeshDataStage.VSOut, first_index=0, num_indices=action.numIndices, instance=inst)
action, rd.MeshDataStage.VSOut, first_index=0, num_indices=action.numIndices, instance=inst, view = view)
for vtx in range(action.numIndices):
trace = self.controller.DebugVertex(vtx, inst, vtx, view)
if trace.debugger is None:
self.controller.FreeTrace(trace)
rdtest.log.error(
f"Test {idx} at {action.eventId} got no debug result at {vtx} inst {inst} view {view}")
success, err = self.check_vertex_debug(vtx, idx, inst, postvs, fatal=False)
if not success:
failed = True
rdtest.log.error(f"Test {idx} at {action.eventId}: {err}")
continue
_, variables = self.process_trace(trace)
for var in trace.sourceVars:
if var.name == 'vertdata':
name = var.name
if var.name not in postvs[vtx].keys():
rdtest.log.error(
f"Don't have expected output for {var.name}")
failed = True
continue
real = postvs[vtx][name]
assert rdtest.is_vector(real)
debugged = self.evaluate_source_var(
var, variables)
if debugged.columns != 4 or len(real) != 4:
rdtest.log.error(
f"Vertex output is not the right size ({len(real)} vs {debugged.columns})")
failed = True
continue
if not rdtest.value_compare(real, debugged.value.f32v[0:4], eps=5.0E-06):
rdtest.log.error(
f"Test {idx} at {action.eventId} debugged vertex value {debugged.value.f32v[0:4]} at {vtx} instance {inst} view {view} does not match output {real}")
failed = True
self.controller.FreeTrace(trace)
# check some assorted pixel outputs
target = pipe.GetOutputTargets()[0].resource
+19 -13
View File
@@ -535,22 +535,22 @@ class TestCase:
*,
view=-1,
eps=util.FLT_EPSILON,
fatal=True,
single_postvs=False,
ignore_uninit=False,
name_retry: Callable[[str], str] | None = None
):
trace = self.controller.DebugVertex(vtx, inst, idx, max(0, view))
ctx = f"vertex {vtx} (idx {idx}) instance {inst}"
if view >= 0:
ctx += f" view {view}"
if trace.debugger is None:
self.controller.FreeTrace(trace)
raise TestFailureException(f"Couldn't debug {ctx}")
) -> Tuple[bool, str]:
trace = None
try:
trace = self.controller.DebugVertex(vtx, inst, idx, max(0, view))
ctx = f"vertex {vtx} (idx {idx}) instance {inst}"
if view >= 0:
ctx += f" view {view}"
if trace.debugger is None:
raise TestFailureException(f"Couldn't debug {ctx}")
cycles, variables = self.process_trace(trace)
postvs_vtx = vtx
@@ -601,8 +601,14 @@ class TestCase:
f"Debugged value {name} at {ctx}: {debugged} doesn't exactly match postvs output {expect}. {diff_amt} difference")
log.success(f'Successfully debugged vertex {ctx} in {cycles} cycles')
except TestFailureException as ex:
if not fatal:
return False, ex.message
raise ex
finally:
self.controller.FreeTrace(trace)
if trace is not None:
self.controller.FreeTrace(trace)
return True, ""
def run(self):
self.capture_filename = self.get_capture()
+17 -47
View File
@@ -133,25 +133,20 @@ class D3D12_Shader_Debug_Zoo(rdtest.TestCase):
rdtest.log.print(f"Skipping Graphics tests for {sectionName}")
continue
action = test_marker.nextAction
assert action is not None
self.controller.SetFrameEvent(action.eventId, False)
pipe = self.controller.GetPipelineState()
if pipe.GetShaderReflection(rd.ShaderStage.Vertex).debugInfo.debuggable:
# Debug the vertex shader
trace = self.controller.DebugVertex(0, instId, 0, 0)
cycles, variables = self.process_trace(trace)
output = self.find_output_source_var(trace, rd.ShaderBuiltin.Undefined, 4)
assert output is not None
debugged = self.evaluate_source_var(output, variables)
self.controller.FreeTrace(trace)
actual = debugged.value.u32v[0]
expected = instId
if not rdtest.value_compare(actual, expected):
postvs = self.get_postvs(action, rd.MeshDataStage.VSOut, instance=instId)
success, err = self.check_vertex_debug(0, 0, instId, postvs, fatal=False)
if not success:
failed = True
rdtest.log.error(
f"Vertex shader TRIANGLE output did not match expectation {actual} != {expected}")
if not failed:
rdtest.log.error(f"Basic VS debugging didn't match: {err}")
continue
else:
rdtest.log.success("Basic VS debugging was successful")
else:
rdtest.log.print(f"Ignoring undebuggable Vertex shader at {action.eventId} for {shaderModels[sm]}.")
@@ -244,26 +239,19 @@ class D3D12_Shader_Debug_Zoo(rdtest.TestCase):
rdtest.log.print(f"Skipping Vertex Sample tests for {shaderModels[sm]}")
continue
action = test_marker.nextAction
assert action is not None
self.controller.SetFrameEvent(action.eventId, False)
pipe = self.controller.GetPipelineState()
if pipe.GetShaderReflection(rd.ShaderStage.Vertex).debugInfo.debuggable:
# Debug the vertex shader
trace = self.controller.DebugVertex(0, 0, 0, 0)
cycles, variables = self.process_trace(trace)
output = self.find_output_source_var(trace, rd.ShaderBuiltin.Undefined, 1)
assert output is not None
debugged = self.evaluate_source_var(output, variables)
self.controller.FreeTrace(trace)
actual = debugged.value.f32v[0:4]
expected = [0.3, 0.5, 0.8, 1.0]
if not rdtest.value_compare(actual, expected):
success, err = self.check_vertex_debug(0, 0, 0, self.get_postvs(action, rd.MeshDataStage.VSOut), fatal=False)
if not success:
failed = True
rdtest.log.error(
f"{shaderModels[sm]} Vertex shader color output did not match expectation {actual} != {expected}")
if not failed:
f"{shaderModels[sm]} Vertex shader failed: {err}")
continue
else:
rdtest.log.success(shaderModels[sm] + " VertexSample VS was debugged correctly")
else:
rdtest.log.print(f"Skipping undebuggable Vertex shader at {action.eventId} for {shaderModels[sm]}.")
@@ -294,30 +282,12 @@ class D3D12_Shader_Debug_Zoo(rdtest.TestCase):
test_marker = self.find_action("Banned")
action = test_marker.nextAction
assert action is not None
self.controller.SetFrameEvent(action.eventId, False)
pipe = self.controller.GetPipelineState()
# Debug the vertex shader
trace = self.controller.DebugVertex(0, 0, 0, 0)
cycles, variables = self.process_trace(trace)
output = self.find_output_source_var(trace, rd.ShaderBuiltin.Position, 0)
assert output is not None
debugged = self.evaluate_source_var(output, variables)
self.controller.FreeTrace(trace)
actual = debugged.value.f32v[0:4]
expected = [-0.5, -0.5, 0.0, 1.0]
if not rdtest.value_compare(actual, expected):
failed = True
rdtest.log.error(f"Banned signature vertex shader position did not match expectation {actual} != {expected}")
if not failed:
rdtest.log.success("Banned signature VS was debugged correctly")
# Debug the banned vertex shader
self.check_vertex_debug(0, 0, 0, self.get_postvs(action, rd.MeshDataStage.VSOut), fatal=False)
# Debug the pixel shader
inputs = rd.DebugPixelInputs()
+3 -4
View File
@@ -102,11 +102,10 @@ class GL_Shader_Debug_Zoo(rdtest.TestCase):
postvs = self.get_postvs(action, rd.MeshDataStage.VSOut, first_index=vtx, num_indices=1, instance=inst)
try:
self.check_vertex_debug(vtx, idx, inst, postvs, single_postvs=True, name_retry = lambda x: x.replace(".", "Block."))
except rdtest.TestFailureException as err:
success, err = self.check_vertex_debug(vtx, idx, inst, postvs, fatal=False, single_postvs=True, name_retry = lambda x: x.replace(".", "Block."))
if not success:
failed = True
rdtest.log.error(f"Error debugging vertex at test {test} in sub-section {child}: {err.message}")
rdtest.log.error(f"Error debugging vertex at test {test} in sub-section {child}: {err}")
continue
rdtest.log.success(f"Test {test} vertex in sub-section {child} matched as expected")
+3 -4
View File
@@ -157,10 +157,9 @@ class Iter_Test(rdtest.TestCase):
postvs = self.get_postvs(action, rd.MeshDataStage.VSOut, first_index=vtx, num_indices=1, instance=inst)
try:
self.check_vertex_debug(vtx, idx, inst, postvs, eps=5.0E-06, single_postvs=True, ignore_uninit=True)
except rdtest.TestFailureException as err:
rdtest.log.error(f"Error debugging at EID {action.eventId}: {err.message}")
success, err = self.check_vertex_debug(vtx, idx, inst, postvs, fatal=False, eps=5.0E-06, single_postvs=True, ignore_uninit=True)
if not success:
rdtest.log.error(f"Error debugging at EID {action.eventId}: {err}")
return
def pixel_debug(self, action: rd.ActionDescription):