mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-18 11:45:55 +00:00
* These come from long ago when using PyCharm with not as good type checking and with renderdoc module stubs that were incomplete so needed help identifying types.
95 lines
4.1 KiB
Python
95 lines
4.1 KiB
Python
import renderdoc as rd
|
|
import rdtest
|
|
|
|
class VK_Multi_View(rdtest.TestCase):
|
|
demos_test_name = 'VK_Multi_View'
|
|
|
|
def check_capture(self):
|
|
if not self.controller.GetAPIProperties().shaderDebugging:
|
|
rdtest.log.success("Shader debugging not enabled, skipping test")
|
|
return
|
|
|
|
x = 200
|
|
y = 150
|
|
|
|
for test_name in ["Vertex: viewIndex", "Geometry: viewIndex", "Fragment: viewIndex", "No viewIndex"]:
|
|
rdtest.log.print("Test {}".format(test_name))
|
|
label = self.find_action(test_name)
|
|
if label is None:
|
|
continue
|
|
action = label.nextAction
|
|
self.controller.SetFrameEvent(action.eventId, True)
|
|
|
|
pipe = self.controller.GetPipelineState()
|
|
if not pipe.GetShaderReflection(rd.ShaderStage.Pixel).debugInfo.debuggable:
|
|
raise rdtest.TestFailureException("Test {} shader can not be debugged".format(test_name))
|
|
|
|
for view in range(2):
|
|
# Debug the pixel shader
|
|
inputs = rd.DebugPixelInputs()
|
|
inputs.view = view
|
|
trace = self.controller.DebugPixel(x, y, inputs)
|
|
if trace.debugger is None:
|
|
self.controller.FreeTrace(trace)
|
|
raise rdtest.TestFailureException("Test {} view {} did not debug at all".format(test_name, view))
|
|
|
|
cycles, variables = self.process_trace(trace)
|
|
output = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, 0)
|
|
debugged = self.evaluate_source_var(output, variables)
|
|
slice = view + 1
|
|
sub = rd.Subresource(0, slice, 0)
|
|
self.check_pixel_value(pipe.GetOutputTargets()[0].resource, x, y, debugged.value.f32v[0:4], sub=sub)
|
|
self.controller.FreeTrace(trace)
|
|
|
|
inst = 0
|
|
postvs = self.get_postvs(action, rd.MeshDataStage.VSOut, instance=inst, view=view)
|
|
for vtx in range(action.numIndices):
|
|
idx = vtx
|
|
self.check_vertex_debug(vtx, idx, inst, postvs, view=view)
|
|
rdtest.log.print(f"View {view} Slice {slice} passed")
|
|
|
|
for test_name in ["viewportIndex choice"]:
|
|
rdtest.log.print("Test {}".format(test_name))
|
|
label = self.find_action(test_name)
|
|
if label is None:
|
|
continue
|
|
action = label.nextAction
|
|
self.controller.SetFrameEvent(action.eventId, True)
|
|
|
|
pipe = self.controller.GetPipelineState()
|
|
if not pipe.GetShaderReflection(rd.ShaderStage.Pixel).debugInfo.debuggable:
|
|
raise rdtest.TestFailureException("Test {} shader can not be debugged".format(test_name))
|
|
|
|
for view in range(2):
|
|
if view == 0:
|
|
x, y = 100, 140
|
|
else:
|
|
x, y = 300, 140
|
|
|
|
# Debug the pixel shader
|
|
inputs = rd.DebugPixelInputs()
|
|
inputs.view = view
|
|
trace = self.controller.DebugPixel(x, y, inputs)
|
|
if trace.debugger is None:
|
|
self.controller.FreeTrace(trace)
|
|
raise rdtest.TestFailureException("Test {} view {} did not debug at all".format(test_name, view))
|
|
|
|
cycles, variables = self.process_trace(trace)
|
|
output = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, 0)
|
|
debugged = self.evaluate_source_var(output, variables)
|
|
slice = view + 1
|
|
sub = rd.Subresource(0, slice, 0)
|
|
self.check_pixel_value(pipe.GetOutputTargets()[0].resource, x, y, debugged.value.f32v[0:4], sub=sub)
|
|
self.controller.FreeTrace(trace)
|
|
|
|
inst = 0
|
|
postvs = self.get_postvs(action, rd.MeshDataStage.VSOut, instance=inst, view=view)
|
|
for vtx in range(action.numIndices):
|
|
idx = vtx
|
|
self.check_vertex_debug(vtx, idx, inst, postvs, view=view)
|
|
rdtest.log.print(f"View {view} Slice {slice} passed")
|
|
|
|
rdtest.log.success("All tests matched")
|
|
|
|
|