mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-12 17:30:15 +00:00
parent
48d923907b
commit
dab634da93
@ -266,6 +266,12 @@ spv_result_t ValidateTypeFunction(ValidationState_t& _,
|
||||
<< "OpTypeFunction Parameter Type <id> '" << _.getIdName(param_id)
|
||||
<< "' is not a type.";
|
||||
}
|
||||
|
||||
if (param_type->opcode() == SpvOpTypeVoid) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpTypeFunction Parameter Type <id> '" << _.getIdName(param_id)
|
||||
<< "' cannot be OpTypeVoid.";
|
||||
}
|
||||
}
|
||||
const uint32_t num_function_args_limit =
|
||||
_.options()->universal_limits_.max_function_args;
|
||||
|
@ -979,6 +979,18 @@ TEST_F(ValidateIdWithMessage, OpTypeFunctionParameterBad) {
|
||||
HasSubstr("OpTypeFunction Parameter Type <id> '3' is not a type."));
|
||||
}
|
||||
|
||||
TEST_F(ValidateIdWithMessage, OpTypeFunctionParameterTypeVoidBad) {
|
||||
std::string spirv = kGLSL450MemoryModel + R"(
|
||||
%1 = OpTypeVoid
|
||||
%2 = OpTypeInt 32 0
|
||||
%4 = OpTypeFunction %1 %2 %1)";
|
||||
CompileSuccessfully(spirv.c_str());
|
||||
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions());
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("OpTypeFunction Parameter Type <id> '1' cannot be "
|
||||
"OpTypeVoid."));
|
||||
}
|
||||
|
||||
TEST_F(ValidateIdWithMessage, OpTypePipeGood) {
|
||||
std::string spirv = kGLSL450MemoryModel + R"(
|
||||
%1 = OpTypeFloat 32
|
||||
|
Loading…
Reference in New Issue
Block a user