mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-22 19:50:05 +00:00
Validator: Test OpReturnValue type check
The check already existed. I added a test for it. Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/876
This commit is contained in:
parent
8de8dd8c8c
commit
941a234132
@ -2945,6 +2945,22 @@ TEST_F(ValidateIdWithMessage, OpFunctionResultTypeBad) {
|
||||
HasSubstr("OpFunction Result Type <id> '2' does not match the "
|
||||
"Function Type <id> '2's return type."));
|
||||
}
|
||||
TEST_F(ValidateIdWithMessage, OpReturnValueTypeBad) {
|
||||
string spirv = kGLSL450MemoryModel + R"(
|
||||
%1 = OpTypeInt 32 0
|
||||
%2 = OpTypeFloat 32
|
||||
%3 = OpConstant %2 0
|
||||
%4 = OpTypeFunction %1
|
||||
%5 = OpFunction %1 None %4
|
||||
%6 = OpLabel
|
||||
OpReturnValue %3
|
||||
OpFunctionEnd)";
|
||||
CompileSuccessfully(spirv.c_str());
|
||||
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions());
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("OpReturnValue Value <id> '3's type does not match "
|
||||
"OpFunction's return type."));
|
||||
}
|
||||
TEST_F(ValidateIdWithMessage, OpFunctionFunctionTypeBad) {
|
||||
string spirv = kGLSL450MemoryModel + R"(
|
||||
%1 = OpTypeVoid
|
||||
|
Loading…
Reference in New Issue
Block a user