mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-22 19:50:05 +00:00
Merge pull request #829 from atgoo/fix_val_logicals
Validator: fix logicals pass for OpSelect pointers
This commit is contained in:
commit
cf6c20ee06
@ -179,10 +179,11 @@ spv_result_t LogicalsPass(ValidationState_t& _,
|
||||
const SpvOp type_opcode = type_inst->opcode();
|
||||
switch (type_opcode) {
|
||||
case SpvOpTypePointer: {
|
||||
if (!_.features().variable_pointers)
|
||||
if (!_.features().variable_pointers &&
|
||||
!_.features().variable_pointers_storage_buffer)
|
||||
return _.diag(SPV_ERROR_INVALID_DATA)
|
||||
<< "Using pointers with OpSelect requires capability "
|
||||
<< "VariablePointers";
|
||||
<< "VariablePointers or VariablePointersStorageBuffer";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -570,10 +570,11 @@ OpStore %y %f32vec4_1234
|
||||
CompileSuccessfully(GenerateShaderCode(body).c_str());
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
|
||||
EXPECT_THAT(getDiagnosticString(), HasSubstr(
|
||||
"Using pointers with OpSelect requires capability VariablePointers"));
|
||||
"Using pointers with OpSelect requires capability VariablePointers "
|
||||
"or VariablePointersStorageBuffer"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateLogicals, OpSelectPointerWithCapability) {
|
||||
TEST_F(ValidateLogicals, OpSelectPointerWithCapability1) {
|
||||
const std::string body = R"(
|
||||
%x = OpVariable %f32vec4ptr Function
|
||||
%y = OpVariable %f32vec4ptr Function
|
||||
@ -591,6 +592,24 @@ OpExtension "SPV_KHR_variable_pointers"
|
||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_F(ValidateLogicals, OpSelectPointerWithCapability2) {
|
||||
const std::string body = R"(
|
||||
%x = OpVariable %f32vec4ptr Function
|
||||
%y = OpVariable %f32vec4ptr Function
|
||||
OpStore %x %f32vec4_0123
|
||||
OpStore %y %f32vec4_1234
|
||||
%val1 = OpSelect %f32vec4ptr %true %x %y
|
||||
)";
|
||||
|
||||
const std::string extra_cap_ext = R"(
|
||||
OpCapability VariablePointersStorageBuffer
|
||||
OpExtension "SPV_KHR_variable_pointers"
|
||||
)";
|
||||
|
||||
CompileSuccessfully(GenerateShaderCode(body, extra_cap_ext).c_str());
|
||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_F(ValidateLogicals, OpSelectWrongCondition) {
|
||||
const std::string body = R"(
|
||||
%val1 = OpSelect %u32 %u32_1 %u32_0 %u32_1
|
||||
|
Loading…
Reference in New Issue
Block a user