Files
renderdoc/util/test/tests/D3D12/D3D12_Parameter_Zoo.py
T
baldurk 2a0989ba9a Use local helper function for setting current EID
* This lets the testcase track the current EID and print it when a failure
  happens
2026-09-11 19:19:27 +01:00

128 lines
3.7 KiB
Python

import renderdoc as rd
import rdtest
class D3D12_Parameter_Zoo(rdtest.TestCase):
demos_test_name = 'D3D12_Parameter_Zoo'
def check_capture(self):
action = self.find_action("Color Draw")
assert action is not None
action = action.nextAction
assert action is not None
self.set_event(action.eventId, False)
pipe = self.controller.GetPipelineState()
self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0])
rdtest.log.success("Captured loaded with color as expected")
postvs_data = self.get_postvs(action, rd.MeshDataStage.VSOut, 0, action.numIndices)
postvs_ref: rdtest.MeshReference = {
0: {
'vtx': 0,
'idx': 0,
'SV_POSITION': [-0.5, -0.5, 0.0, 1.0],
'COLOR': [0.0, 1.0, 0.0, 1.0],
'TEXCOORD': [0.0, 0.0],
},
1: {
'vtx': 1,
'idx': 1,
'SV_POSITION': [0.0, 0.5, 0.0, 1.0],
'COLOR': [0.0, 1.0, 0.0, 1.0],
'TEXCOORD': [0.0, 1.0],
},
2: {
'vtx': 2,
'idx': 2,
'SV_POSITION': [0.5, -0.5, 0.0, 1.0],
'COLOR': [0.0, 1.0, 0.0, 1.0],
'TEXCOORD': [1.0, 0.0],
},
}
self.check_mesh_data(postvs_ref, postvs_data)
rdtest.log.success("Mesh data is correct")
tex = rd.TextureDisplay()
tex.overlay = rd.DebugOverlay.Drawcall
tex.resourceId = pipe.GetOutputTargets()[0].resource
out = self.controller.CreateOutput(
rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture
)
out.SetTextureDisplay(tex)
out.Display()
overlay_id = out.GetDebugOverlayTexID()
v = pipe.GetViewport(0)
self.check_pixel_value(overlay_id, int(0.5 * v.width), int(0.5 * v.height), [0.8, 0.1, 0.8, 1.0],
eps=1.0 / 256.0)
out.Shutdown()
res = self.get_resource_by_name("Sampler Heap")
sdfile = self.controller.GetStructuredFile()
chunk = sdfile.chunks[res.initialisationChunks[-1]]
desc1234 = chunk.GetChild(2).GetChild(1234).GetChild(3)
rdtest.log.comment('desc1234: ' + desc1234.name)
# filter
assert desc1234.GetChild(0).AsString() == 'D3D12_FILTER_ANISOTROPIC'
assert desc1234.GetChild(0).AsInt() == 0x55
# wrapping
assert desc1234.GetChild(1).AsString() == 'D3D12_TEXTURE_ADDRESS_MODE_BORDER'
assert desc1234.GetChild(1).AsInt() == 4
# MaxAnisotropy
assert desc1234.GetChild(1).AsInt() == 4
# MinLod
assert desc1234.GetChild(8).AsFloat() == 1.5
rdtest.log.success("Overlay color is as expected")
action = self.find_action("No Sig Draw")
action = action.nextAction
self.set_event(action.eventId, False)
pipe = self.controller.GetPipelineState()
self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0])
rdtest.log.success("No sig draw worked as expected")
action = self.find_action("No Sig Dispatch")
action = action.nextAction
self.set_event(action.eventId, False)
# nothing to actually check here
action = self.find_action("Temp heap Draw")
action = action.nextAction
self.set_event(action.eventId, False)
pipe = self.controller.GetPipelineState()
self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0])
rdtest.log.success("Temp heap worked as expected")