Skip to content

Commit aff64c5

Browse files
authored
[val] Tie Int64ImageEXT requirement to R64 image format (KhronosGroup#6735)
The capability is required by the R64i/R64ui Image Format operand, not by a 64-bit Sampled Type Related SPIRV-LLVM-Translator PR that fixes this issue there: KhronosGroup/SPIRV-LLVM-Translator#3773
1 parent 27a67c8 commit aff64c5

2 files changed

Lines changed: 21 additions & 15 deletions

File tree

source/val/validate_image.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -961,13 +961,6 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) {
961961
<< "Corrupt image type definition";
962962
}
963963

964-
if (_.IsIntScalarType(info.sampled_type, 64) &&
965-
!_.HasCapability(spv::Capability::Int64ImageEXT)) {
966-
return _.diag(SPV_ERROR_INVALID_DATA, inst)
967-
<< "Capability Int64ImageEXT is required when using Sampled Type of "
968-
"64-bit int";
969-
}
970-
971964
const auto target_env = _.context()->target_env;
972965
if (spvIsVulkanEnv(target_env)) {
973966
if (!_.IsFloatScalarType(info.sampled_type, 32) &&

test/val/val_image_test.cpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,8 @@ OpFunctionEnd
610610

611611
const spv_target_env env = SPV_ENV_VULKAN_1_0;
612612
CompileSuccessfully(code, env);
613-
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(env));
614-
EXPECT_THAT(getDiagnosticString(),
615-
HasSubstr("Capability Int64ImageEXT is required when using "
616-
"Sampled Type of 64-bit int"));
613+
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(env));
614+
EXPECT_THAT(getDiagnosticString(), Eq(""));
617615
}
618616

619617
TEST_F(ValidateImage, TypeImageI64SampledTypeVulkan) {
@@ -645,10 +643,8 @@ OpFunctionEnd
645643

646644
const spv_target_env env = SPV_ENV_VULKAN_1_0;
647645
CompileSuccessfully(code, env);
648-
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(env));
649-
EXPECT_THAT(getDiagnosticString(),
650-
HasSubstr("Capability Int64ImageEXT is required when using "
651-
"Sampled Type of 64-bit int"));
646+
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(env));
647+
EXPECT_THAT(getDiagnosticString(), Eq(""));
652648
}
653649

654650
TEST_F(ValidateImage, TypeImageU64SampledTypeVulkan) {
@@ -669,6 +665,23 @@ OpFunctionEnd
669665
EXPECT_THAT(getDiagnosticString(), Eq(""));
670666
}
671667

668+
TEST_F(ValidateImage, TypeImageR64FormatNoCapabilityVulkan) {
669+
const std::string code = GetShaderHeader() + R"(
670+
%img_type = OpTypeImage %s64 2D 0 0 0 2 R64i
671+
%main = OpFunction %void None %func
672+
%main_lab = OpLabel
673+
OpReturn
674+
OpFunctionEnd
675+
)";
676+
677+
const spv_target_env env = SPV_ENV_VULKAN_1_0;
678+
CompileSuccessfully(code, env);
679+
ASSERT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions(env));
680+
EXPECT_THAT(getDiagnosticString(),
681+
HasSubstr("Operand 8 of TypeImage requires one of these "
682+
"capabilities: Int64ImageEXT"));
683+
}
684+
672685
TEST_F(ValidateImage, TypeImageF32SampledTypeVulkan) {
673686
const std::string code = GetShaderHeader() + R"(
674687
%img_type = OpTypeImage %f32 2D 0 0 0 1 Unknown

0 commit comments

Comments
 (0)