[spirv-reader] Fix SPIR-V assembly, re-enable test

Fix typos in SPIR-V IDs that were causing the optimizer to assert
out when building up its internal data structures.

Bug: tint:3
Change-Id: I27210623b0d3d241dbd6afe6bef63e88a02b390e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18640
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto 2020-04-02 03:22:53 +00:00 committed by dan sinclair
parent 3038e6ee36
commit cc39bae42c
2 changed files with 6 additions and 6 deletions

View File

@ -122,11 +122,11 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
})")); })"));
} }
TEST_F(SpvParserTest, DISABLED_EmitFunctions_NonVoidResultType) { TEST_F(SpvParserTest, EmitFunctions_NonVoidResultType) {
auto p = parser(test::Assemble(Names({"ret_float"}) + CommonTypes() + R"( auto p = parser(test::Assemble(Names({"ret_float"}) + CommonTypes() + R"(
%fn_ret_float = OpTypeFunction %float %fn_ret_float = OpTypeFunction %float
%ret_float = OpFunction %float None %nf_ret_float %ret_float = OpFunction %float None %fn_ret_float
%ret_float_entry = OpLabel %ret_float_entry = OpLabel
OpReturnValue %float_0 OpReturnValue %float_0
OpFunctionEnd OpFunctionEnd

View File

@ -49,12 +49,12 @@ TEST_F(SpvParserTest, ModuleScopeVar_BadStorageClass) {
EXPECT_THAT(p->error(), HasSubstr("unknown SPIR-V storage class: 5")); EXPECT_THAT(p->error(), HasSubstr("unknown SPIR-V storage class: 5"));
} }
TEST_F(SpvParserTest, DISABLED_ModuleScopeVar_BadPointerType) { TEST_F(SpvParserTest, ModuleScopeVar_BadPointerType) {
auto p = parser(test::Assemble(R"( auto p = parser(test::Assemble(R"(
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%fn_ty = OpTypeFunction %float %fn_ty = OpTypeFunction %float
%fn_ptr_ty = OpTypePointer Private %fn_ty %3 = OpTypePointer Private %fn_ty
%52 = OpVariable %ptr Private %52 = OpVariable %3 Private
)")); )"));
EXPECT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->BuildInternalModule());
// Normally we should run ParserImpl::RegisterTypes before emitting // Normally we should run ParserImpl::RegisterTypes before emitting
@ -62,7 +62,7 @@ TEST_F(SpvParserTest, DISABLED_ModuleScopeVar_BadPointerType) {
// us catch this error. // us catch this error.
EXPECT_FALSE(p->EmitModuleScopeVariables()); EXPECT_FALSE(p->EmitModuleScopeVariables());
EXPECT_THAT(p->error(), HasSubstr("internal error: failed to register Tint " EXPECT_THAT(p->error(), HasSubstr("internal error: failed to register Tint "
"AST type for SPIR-V type with ID: 4")); "AST type for SPIR-V type with ID: 3"));
} }
TEST_F(SpvParserTest, ModuleScopeVar_AnonWorkgroupVar) { TEST_F(SpvParserTest, ModuleScopeVar_AnonWorkgroupVar) {