spirv-reader: set failure bit when SPIR-V validation fails
The error message was already being logged, but the status flag was not being set. Change-Id: I7f6f2f45c15a64dd089e221c62218afe9e774edd Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49643 Commit-Queue: David Neto <dneto@google.com> Auto-Submit: David Neto <dneto@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
01c3ce7c03
commit
6e2461096a
|
@ -291,6 +291,7 @@ bool ParserImpl::Parse() {
|
|||
// Only consider modules valid for Vulkan 1.0. On failure, the message
|
||||
// consumer will set the error status.
|
||||
if (!spv_tools.Validate(spv_binary_)) {
|
||||
success_ = false;
|
||||
return false;
|
||||
}
|
||||
if (!BuildInternalModule()) {
|
||||
|
|
|
@ -2184,13 +2184,13 @@ TEST_F(SpvModuleScopeVarParserTest, SampleId_I32_FunctParam) {
|
|||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
// TODO(dneto): We can handle this if we make a shadow variable and mutate
|
||||
// the parameter type.
|
||||
ASSERT_FALSE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(
|
||||
p->error(),
|
||||
HasSubstr(
|
||||
"unhandled use of a pointer to the SampleId builtin, with ID: 1"));
|
||||
|
||||
// This example is invalid because you can't pass pointer-to-Input
|
||||
// as a function parameter.
|
||||
EXPECT_FALSE(p->Parse());
|
||||
EXPECT_FALSE(p->success());
|
||||
EXPECT_THAT(p->error(),
|
||||
HasSubstr("Invalid storage class for pointer operand 1"));
|
||||
}
|
||||
|
||||
TEST_F(SpvModuleScopeVarParserTest, SampleId_U32_Load_Direct) {
|
||||
|
|
|
@ -64,6 +64,7 @@ class ParserImplWrapperForTest {
|
|||
Namer& namer() { return impl_.namer(); }
|
||||
ProgramBuilder& builder() { return impl_.builder(); }
|
||||
const std::string error() { return impl_.error(); }
|
||||
bool success() { return impl_.success(); }
|
||||
FailStream& Fail() { return impl_.Fail(); }
|
||||
spvtools::opt::IRContext* ir_context() { return impl_.ir_context(); }
|
||||
|
||||
|
|
Loading…
Reference in New Issue