Commit d4e4c66b by Ben Clayton Committed by Ben Clayton

SpirvShader: Debug print human readable opcode names

My memory isn't good enough to remember all opcodes by number. Enum string list stripped in release builds. Change-Id: Ifa9b9585ee6294a26db5676a34f8ad9c90f527b8 Reviewed-on: https://swiftshader-review.googlesource.com/c/25551 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 0bb83b87
......@@ -247,7 +247,7 @@ namespace sw
break;
default:
printf("Warning: ignored opcode %u\n", insn.opcode());
printf("Warning: ignored opcode %s\n", OpcodeName(insn.opcode()).c_str());
break; // This is OK, these passes are intentionally partial
}
}
......@@ -600,7 +600,7 @@ namespace sw
}
default:
UNIMPLEMENTED("Unexpected type in WalkAccessChain");
UNIMPLEMENTED("Unexpected type '%s' in WalkAccessChain", OpcodeName(type.definition.opcode()).c_str());
}
}
......@@ -1079,7 +1079,7 @@ namespace sw
break;
}
default:
printf("emit: ignoring opcode %d\n", insn.opcode());
printf("emit: ignoring opcode %s\n", OpcodeName(insn.opcode()).c_str());
break;
}
}
......
......@@ -380,6 +380,10 @@ namespace sw
SIMD::Int WalkAccessChain(ObjectID id, uint32_t numIndexes, uint32_t const *indexIds, SpirvRoutine *routine) const;
uint32_t WalkLiteralAccessChain(TypeID id, uint32_t numIndexes, uint32_t const *indexes) const;
// OpcodeName returns the name of the opcode op.
// If NDEBUG is defined, then OpcodeName will only return the numerical code.
static std::string OpcodeName(spv::Op op);
};
class SpirvRoutine
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment