reader/spirv: Don't create detatched AST nodes
EmitControlBarrier() was calling MakeOperand() to create ast::Expressions that held a ScalarConstructorExpression, which held a IntLiteral. The literal value was then taken, and the rest was discarded. Detached AST nodes will become an ICE, so do the work to find the literal value. Bug: tint:469 Change-Id: I522bfe8db84e853e189c714b18598feb0d49e58b Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48049 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
parent
169512e499
commit
f32719ff85
|
@ -4201,14 +4201,12 @@ bool FunctionEmitter::EmitControlBarrier(
|
||||||
const spvtools::opt::Instruction& inst) {
|
const spvtools::opt::Instruction& inst) {
|
||||||
uint32_t operands[3];
|
uint32_t operands[3];
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (auto* op = MakeOperand(inst, i).expr) {
|
auto id = inst.GetSingleWordInOperand(i);
|
||||||
auto* lit = As<ast::ScalarConstructorExpression>(op)->literal();
|
if (auto* constant = constant_mgr_->FindDeclaredConstant(id)) {
|
||||||
if (auto* int_lit = lit->As<ast::IntLiteral>()) {
|
operands[i] = constant->GetU32();
|
||||||
operands[i] = int_lit->value_as_u32();
|
} else {
|
||||||
continue;
|
return Fail() << "invalid or missing operands for control barrier";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Fail() << "invalid or missing operands for control barrier";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t execution = operands[0];
|
uint32_t execution = operands[0];
|
||||||
|
|
Loading…
Reference in New Issue