mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-28 02:11:43 +00:00
Add python helper functions to check indirect action names
This commit is contained in:
@@ -425,4 +425,27 @@ def shadervariable_equal(a: rd.ShaderVariable, b : rd.ShaderVariable) -> Tuple[b
|
||||
difference = f"Member[{m}] differs {diff}"
|
||||
return (False, difference)
|
||||
|
||||
return (True, "")
|
||||
return (True, "")
|
||||
|
||||
def get_event_parameters_text(chunk: rd.SDChunk):
|
||||
parameters = ""
|
||||
if chunk.type.basetype == rd.SDBasic.SignedInteger:
|
||||
parameters += str(chunk.AsInt())
|
||||
elif chunk.type.basetype == rd.SDBasic.UnsignedInteger:
|
||||
parameters += str(chunk.AsInt())
|
||||
elif chunk.type.basetype == rd.SDBasic.Float:
|
||||
parameters += str(chunk.AsFloat())
|
||||
elif chunk.type.basetype == rd.SDBasic.String:
|
||||
parameters += chunk.AsString()
|
||||
|
||||
onlyImportant = (chunk.type.flags & rd.SDTypeFlags.ImportantChildren != 0)
|
||||
first = True
|
||||
for i in range(chunk.NumChildren()):
|
||||
child = chunk.GetChild(i)
|
||||
if not onlyImportant or child.type.flags & rd.SDTypeFlags.Important != 0:
|
||||
if not first:
|
||||
parameters += ", "
|
||||
parameters += get_event_parameters_text(child)
|
||||
first = False
|
||||
|
||||
return parameters
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import traceback
|
||||
import copy
|
||||
import re
|
||||
import datetime
|
||||
import renderdoc as rd
|
||||
@@ -1188,4 +1187,31 @@ class TestCase:
|
||||
if not eid in eventIds:
|
||||
log.error(f"ERROR: Missing EventId: {eid}")
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_indirect_action_name_consistency(self, controller: rd.ReplayController) -> str:
|
||||
actions = controller.GetRootActions().copy()
|
||||
sdfile = controller.GetStructuredFile()
|
||||
while len(actions) > 0:
|
||||
action = actions.pop(0)
|
||||
actions += action.children
|
||||
actionName = action.customName if len(action.customName) > 0 else sdfile.chunks[action.events[-1].chunkIndex].name
|
||||
event = None
|
||||
# Action: Indirect sub-command*(<3,3>) : should have event Indirect sub-command({ 3,3 }) as its event
|
||||
if actionName.startswith("Indirect sub-command"):
|
||||
event = action.events[-1]
|
||||
# Action: *Indirect(1) => <3,2> should have Indirect sub-command({ 3,2 }) as previous event
|
||||
if "Indirect(1) => <" in actionName:
|
||||
event = action.events[-2]
|
||||
|
||||
if event is not None:
|
||||
chunkIndex = event.chunkIndex
|
||||
eventChunk = sdfile.chunks[chunkIndex]
|
||||
eventParameters = analyse.get_event_parameters_text(eventChunk)
|
||||
paramStr = actionName.split("<")[1].split(">")[0]
|
||||
actionParameters = paramStr
|
||||
if actionParameters != eventParameters:
|
||||
log.error(f"EID:{action.eventId} Indirect action parameters {actionParameters} do not match event {eventParameters}")
|
||||
return False
|
||||
|
||||
return True
|
||||
Reference in New Issue
Block a user