Add an assert that ID operands are non-zero

Zero is not a valid ID value and the SPIR-V emitter library should never
be emitting instructions with ID values of 0.
This commit is contained in:
Arcady Goldmints-Orlov 2023-06-22 16:11:29 -04:00 committed by arcady-lunarg
parent d89c0b1d13
commit 3ebb72cc74

View File

@ -97,6 +97,8 @@ public:
explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { }
virtual ~Instruction() {}
void addIdOperand(Id id) {
// ids can't be 0
assert(id);
operands.push_back(id);
idOperand.push_back(true);
}