[spirv-reader] Start emitting expression
Bug: tint:3 Change-Id: I2e2fe41c43abbcbbc941968c0115d703f6bff501 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18822 Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
parent
ec322349e2
commit
d877e8b084
|
@ -163,6 +163,18 @@ bool FunctionEmitter::EmitFunctionVariables() {
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ast::Expression> FunctionEmitter::MakeExpression(uint32_t id) {
|
||||||
|
if (failed()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
const auto* spirv_constant = constant_mgr_->FindDeclaredConstant(id);
|
||||||
|
if (spirv_constant) {
|
||||||
|
return parser_impl_.MakeConstantExpression(id);
|
||||||
|
}
|
||||||
|
Fail() << "unhandled expression for ID " << id;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace spirv
|
} // namespace spirv
|
||||||
} // namespace reader
|
} // namespace reader
|
||||||
} // namespace tint
|
} // namespace tint
|
||||||
|
|
|
@ -66,6 +66,11 @@ class FunctionEmitter {
|
||||||
/// @returns false if emission failed.
|
/// @returns false if emission failed.
|
||||||
bool EmitFunctionVariables();
|
bool EmitFunctionVariables();
|
||||||
|
|
||||||
|
/// Makes an expression
|
||||||
|
/// @param id the SPIR-V ID of the value
|
||||||
|
/// @returns true if emission has not yet failed.
|
||||||
|
std::unique_ptr<ast::Expression> MakeExpression(uint32_t id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @returns the store type for the OpVariable instruction, or
|
/// @returns the store type for the OpVariable instruction, or
|
||||||
/// null on failure.
|
/// null on failure.
|
||||||
|
|
Loading…
Reference in New Issue