MCPcopy Create free account
hub / github.com/baldurk/renderdoc / sampleCode

Function sampleCode

docs/python_api/examples/renderdoc/fetch_shader.py:29–56  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

27 printVar(v, indent + ' ')
28
29def sampleCode(controller):
30 print("Available disassembly formats:")
31
32 targets = controller.GetDisassemblyTargets(True)
33
34 for disasm in targets:
35 print(" - " + disasm)
36
37 target = targets[0]
38
39 state = controller.GetPipelineState()
40
41 # For some APIs, it might be relevant to set the PSO id or entry point name
42 pipe = state.GetGraphicsPipelineObject()
43 entry = state.GetShaderEntryPoint(rd.ShaderStage.Pixel)
44
45 # Get the pixel shader's reflection object
46 ps = state.GetShaderReflection(rd.ShaderStage.Pixel)
47
48 cb = state.GetConstantBlock(rd.ShaderStage.Pixel, 0, 0)
49
50 print("Pixel shader:")
51 print(controller.DisassembleShader(pipe, ps, target))
52
53 cbufferVars = controller.GetCBufferVariableContents(pipe, ps.resourceId, rd.ShaderStage.Pixel, entry, 0, cb.descriptor.resource, 0, 0)
54
55 for v in cbufferVars:
56 printVar(v)
57
58def loadCapture(filename):
59 # Open a capture file handle

Callers 1

fetch_shader.pyFile · 0.70

Calls 5

printFunction · 0.85
printVarFunction · 0.85
GetDisassemblyTargetsMethod · 0.45
DisassembleShaderMethod · 0.45

Tested by

no test coverage detected