Tune the ShaderVariable consistency checks for resources

Do not check before/after equals existing value for ReadOnlyResource and ReadWriteResource
In the DXIL debugger for resources the same SSA ID might have different names
This commit is contained in:
Jake Turner
2025-11-11 10:53:15 +13:00
parent e2449b9eaf
commit c534b41eb6
2 changed files with 38 additions and 20 deletions
+24 -10
View File
@@ -2789,17 +2789,24 @@ void ShaderViewer::applyBackwardsChange()
if(v)
{
#if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
if(!ShaderVariableEqual(c.after, *v))
qCritical("ShaderVariableChange for '%s' after does not match existing entry",
c.before.name.c_str());
if(!(c.after.type == VarType::ReadOnlyResource || c.after.type == VarType::ReadWriteResource))
{
if(!ShaderVariableEqual(c.after, *v))
qCritical("ShaderVariableChange for '%s' after does not match existing entry",
c.before.name.c_str());
}
#endif // #if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
*v = c.before;
}
else
{
#if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
if(!(c.after == nullChange))
qCritical("ShaderVariableChange for '%s' does not have NULL after", c.before.name.c_str());
if(!(c.after.type == VarType::ReadOnlyResource || c.after.type == VarType::ReadWriteResource))
{
if(!(c.after == nullChange))
qCritical("ShaderVariableChange for '%s' does not have NULL after",
c.before.name.c_str());
}
#endif // #if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
m_Variables.insert(0, c.before);
}
@@ -2879,17 +2886,24 @@ void ShaderViewer::applyForwardsChange()
if(v)
{
#if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
if(!ShaderVariableEqual(c.before, *v))
qCritical("ShaderVariableChange for '%s' before does not match existing entry",
c.after.name.c_str());
if(!(c.after.type == VarType::ReadOnlyResource || c.after.type == VarType::ReadWriteResource))
{
if(!ShaderVariableEqual(c.before, *v))
qCritical("ShaderVariableChange for '%s' before does not match existing entry",
c.after.name.c_str());
}
#endif // #if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
*v = c.after;
}
else
{
#if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
if(!(c.before == nullChange))
qCritical("ShaderVariableChange for '%s' does not have NULL before", c.after.name.c_str());
if(!(c.after.type == VarType::ReadOnlyResource || c.after.type == VarType::ReadWriteResource))
{
if(!(c.before == nullChange) && c.before.type != VarType::ReadOnlyResource)
qCritical("ShaderVariableChange for '%s' does not have NULL before",
c.after.name.c_str());
}
#endif // #if SHADER_VARIABLE_CHANGE_CONSISTENCY_CHECKS
m_Variables.insert(0, c.after);
}
+14 -10
View File
@@ -1101,13 +1101,15 @@ class TestCase:
else:
if c.after.name in variables:
# Step Forwards: not-first appearance of a variable "before" must equal currently known value
(res, difference) = analyse.shadervariable_equal(c.before, variables[c.after.name])
if not res:
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.after.name}' before does not match existing entry {difference}")
if not (c.after.type == rd.VarType.ReadOnlyResource or c.after.type == rd.VarType.ReadWriteResource):
(res, difference) = analyse.shadervariable_equal(c.before, variables[c.after.name])
if not res:
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.after.name}' before does not match existing entry {difference}")
else:
# Step Forwards: first appearance of a variable must have "before" = {}
if c.before != rd.ShaderVariable():
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.after.name}' does not have NULL before")
if not (c.after.type == rd.VarType.ReadOnlyResource or c.after.type == rd.VarType.ReadWriteResource):
if c.before != rd.ShaderVariable():
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.after.name}' does not have NULL before")
variables[c.after.name] = c.after
# Validate c.after
if not self.validate_shadervariable(c.after):
@@ -1128,13 +1130,15 @@ class TestCase:
else:
if c.before.name in variables:
# Step Backwards: not-first appearance of a variable "after" must equal currently known value
(res, difference) = analyse.shadervariable_equal(c.after, variables[c.before.name])
if not res:
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.before.name}' after does not match existing entry {difference}")
if not (c.after.type == rd.VarType.ReadOnlyResource or c.after.type == rd.VarType.ReadWriteResource):
(res, difference) = analyse.shadervariable_equal(c.after, variables[c.before.name])
if not res:
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.before.name}' after does not match existing entry {difference}")
else:
# Step Backwards: first appearance of a variable must have "after" = {}
if c.after != rd.ShaderVariable():
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.before.name}' does not have NULL after")
if not (c.after.type == rd.VarType.ReadOnlyResource or c.after.type == rd.VarType.ReadWriteResource):
if c.after != rd.ShaderVariable():
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.before.name}' does not have NULL after")
variables[c.before.name] = c.before
# Validate c.before
if not self.validate_shadervariable(c.before):