spirv-reader: check conversion of a result type

Bug: chromium:1230976
Change-Id: I793e437f298be3f34a80da7b43ee779fc122e6a8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/62921
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: David Neto <dneto@google.com>
This commit is contained in:
David Neto 2021-08-27 15:26:06 +00:00 committed by Tint LUCI CQ
parent 231648c6a9
commit d30c07e4df
1 changed files with 11 additions and 2 deletions

View File

@ -3523,6 +3523,9 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) {
TypedExpression combinatorial_expr;
if (def_info->skip == SkipReason::kDontSkip) {
combinatorial_expr = MaybeEmitCombinatorialValue(inst);
if (!success()) {
return false;
}
}
// An access chain or OpCopyObject can generate a skip.
if (def_info->skip != SkipReason::kDontSkip) {
@ -3813,8 +3816,14 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue(
const auto opcode = inst.opcode();
const Type* ast_type =
inst.type_id() != 0 ? parser_impl_.ConvertType(inst.type_id()) : nullptr;
const Type* ast_type = nullptr;
if (inst.type_id()) {
ast_type = parser_impl_.ConvertType(inst.type_id());
if (!ast_type) {
Fail() << "couldn't convert result type for: " << inst.PrettyPrint();
return {};
}
}
auto binary_op = ConvertBinaryOp(opcode);
if (binary_op != ast::BinaryOp::kNone) {