Add python helper functions to check indirect action names

This commit is contained in:
Jake Turner
2026-07-22 05:41:09 +01:00
parent a66becd518
commit 4aa00a2bfa
2 changed files with 51 additions and 2 deletions
+24 -1
View File
@@ -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
+27 -1
View File
@@ -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