Assembler: Can't set an ID in instruction without result ID (#2852)

Fix tests that violated this rule.

Fixes #2257
This commit is contained in:
David Neto 2019-09-11 13:15:25 -04:00 committed by Steven Perron
parent c0e9807094
commit 9f188e3374
14 changed files with 85 additions and 59 deletions

View File

@ -546,6 +546,11 @@ spv_result_t spvTextEncodeOpcode(const spvtools::AssemblyGrammar& grammar,
<< "Expected <result-id> at the beginning of an instruction, found '"
<< firstWord << "'.";
}
if (!opcodeEntry->hasResult && !result_id.empty()) {
return context->diagnostic()
<< "Cannot set ID " << result_id << " because " << opcodeName
<< " does not produce a result ID.";
}
pInst->opcode = opcodeEntry->opcode;
context->setPosition(nextPosition);
// Reserve the first word for the instruction.

View File

@ -20,7 +20,7 @@ namespace {
using spvtest::ScopedContext;
using spvtest::TextToBinaryTest;
TEST_F(TextToBinaryTest, NotPlacingResultIDAtTheBeginning) {
TEST_F(TextToBinaryTest, InstOpcodeProducesResultIDButNoIDDefinedFails) {
SetText("OpTypeMatrix %1 %2 1000");
EXPECT_EQ(SPV_ERROR_INVALID_TEXT,
spvTextToBinary(ScopedContext().context, text.str, text.length,
@ -33,5 +33,18 @@ TEST_F(TextToBinaryTest, NotPlacingResultIDAtTheBeginning) {
EXPECT_EQ(0u, diagnostic->position.line);
}
TEST_F(TextToBinaryTest,
InstDefinesResultIDButOpcodeDoesNotProduceAResultFails) {
SetText("\n\n%foo = OpName %1 \"bar\"");
EXPECT_EQ(SPV_ERROR_INVALID_TEXT,
spvTextToBinary(ScopedContext().context, text.str, text.length,
&binary, &diagnostic));
ASSERT_NE(nullptr, diagnostic);
EXPECT_STREQ(
"Cannot set ID %foo because OpName does not produce a result ID.",
diagnostic->error);
EXPECT_EQ(2u, diagnostic->position.line);
}
} // namespace
} // namespace svptools

View File

@ -107,7 +107,7 @@ TEST(CInterface, DefaultConsumerNullDiagnosticForInvalidValidating) {
}
TEST(CInterface, SpecifyConsumerNullDiagnosticForAssembling) {
const char input_text[] = "%1 = OpName\n";
const char input_text[] = " OpName\n";
auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1);
int invocation = 0;
@ -213,7 +213,7 @@ TEST(CInterface, SpecifyConsumerNullDiagnosticForValidating) {
// When having both a consumer and an diagnostic object, the diagnostic object
// should take priority.
TEST(CInterface, SpecifyConsumerSpecifyDiagnosticForAssembling) {
const char input_text[] = "%1 = OpName";
const char input_text[] = " OpName";
auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1);
int invocation = 0;

View File

@ -570,10 +570,10 @@ TEST_F(CCPTest, SkipSpecConstantInstrucitons) {
%10 = OpSpecConstantFalse %bool
%main = OpFunction %void None %4
%11 = OpLabel
%12 = OpBranchConditional %10 %l1 %l2
%l1 = OpLabel
OpBranchConditional %10 %L1 %L2
%L1 = OpLabel
OpReturn
%l2 = OpLabel
%L2 = OpLabel
OpReturn
OpFunctionEnd
)";

View File

@ -1157,7 +1157,7 @@ OpDecorate %MyCBuffer Binding 0
OpStore %23 %35
%36 = OpAccessChain %_ptr_Function_v4float %23 %24
%37 = OpLoad %v4float %36
%39 = OpStore %36 %v4const
OpStore %36 %v4const
OpStore %out_var_SV_Target %37
OpReturn
OpFunctionEnd

View File

@ -273,7 +273,8 @@ TEST_P(VulkanToWebGPUPassTest, Ran) {
std::vector<uint32_t> optimized;
class ValidatorOptions validator_options;
ASSERT_TRUE(opt.Run(binary.data(), binary.size(), &optimized,
validator_options, true));
validator_options, true))
<< GetParam().input << "\n";
std::string disassembly;
{
SpirvTools tools(SPV_ENV_WEBGPU_0);
@ -412,7 +413,7 @@ INSTANTIATE_TEST_SUITE_P(
"%void_f = OpTypeFunction %void\n"
"%func = OpFunction %void None %void_f\n"
"%label = OpLabel\n"
"%val0 = OpAtomicStore %u32_var %cross_device "
" OpAtomicStore %u32_var %cross_device "
"%acquire_release_atomic_counter_workgroup %u32_1\n"
"%val1 = OpAtomicIIncrement %u32 %u32_var %cross_device "
"%acquire_release_atomic_counter_workgroup\n"

View File

@ -92,7 +92,7 @@ OpMemoryModel Logical GLSL450
%func = OpFunction %void None %func_ty
%1 = OpLabel
%ld = OpLoad %int %var
%st = OpStore %var %ld
OpStore %var %ld
OpReturn
OpFunctionEnd
)";
@ -116,7 +116,7 @@ OpMemoryModel Logical GLSL450
%param = OpFunctionParameter %ptr_int_Workgroup
%1 = OpLabel
%ld = OpLoad %int %param
%st = OpStore %param %ld
OpStore %param %ld
OpReturn
OpFunctionEnd
)";

View File

@ -328,7 +328,6 @@ INSTANTIATE_TEST_SUITE_P(
using OpConstantInvalidTypeTest =
spvtest::TextToBinaryTestBase<::testing::TestWithParam<std::string>>;
TEST_P(OpConstantInvalidTypeTest, InvalidTypes) {
const std::string input = "%1 = " + GetParam() +
"\n"
@ -360,8 +359,11 @@ INSTANTIATE_TEST_SUITE_P(
"OpTypeReserveId",
"OpTypeQueue",
"OpTypePipe ReadOnly",
"OpTypeForwardPointer %a UniformConstant",
// At least one thing that isn't a type at all
// Skip OpTypeForwardPointer doesn't even produce a result ID.
// The assembler errors out if we try to check it in this scenario.
// Try at least one thing that isn't a type at all
"OpNot %a %b"
},
}));
@ -470,8 +472,10 @@ INSTANTIATE_TEST_SUITE_P(
"OpTypeReserveId",
"OpTypeQueue",
"OpTypePipe ReadOnly",
"OpTypeForwardPointer %a UniformConstant",
// At least one thing that isn't a type at all
// Skip testing OpTypeForwardPointer because it doesn't even produce a result ID.
// Try at least one thing that isn't a type at all
"OpNot %a %b"
},
}));

View File

@ -342,7 +342,7 @@ TEST_P(OpSwitchInvalidTypeTestCase, InvalidTypes) {
"%1 = " + GetParam() +
"\n"
"%3 = OpCopyObject %1 %2\n" // We only care the type of the expression
"%4 = OpSwitch %3 %default 32 %c\n";
" OpSwitch %3 %default 32 %c\n";
EXPECT_THAT(CompileFailure(input),
Eq("The selector operand for OpSwitch must be the result of an "
"instruction that generates an integer scalar"));
@ -371,8 +371,11 @@ INSTANTIATE_TEST_SUITE_P(
"OpTypeReserveId",
"OpTypeQueue",
"OpTypePipe ReadOnly",
"OpTypeForwardPointer %a UniformConstant",
// At least one thing that isn't a type at all
// Skip OpTypeForwardPointer becasuse it doesn't even produce a result
// ID.
// At least one thing that isn't a type at all
"OpNot %a %b"
},
}));

View File

@ -144,7 +144,7 @@ OpBranch %end_label
%false_label = OpLabel
OpBranch %end_label
%end_label = OpLabel
%line = OpLine %string 0 0
OpLine %string 0 0
%result = OpPhi %bool %true %true_label %false %false_label
)";
@ -178,7 +178,7 @@ OpBranch %end_label
%false_label = OpLabel
OpBranch %end_label
%end_label = OpLabel
%line = OpLine %string 0 0
OpLine %string 0 0
%result = OpPhi %bool %true %true_label %false %false_label
)";

View File

@ -708,7 +708,7 @@ OpAtomicStore %f32_var %device %relaxed %u32_1
TEST_F(ValidateAtomics, AtomicExchangeShaderSuccess) {
const std::string body = R"(
%val1 = OpAtomicStore %u32_var %device %relaxed %u32_1
OpAtomicStore %u32_var %device %relaxed %u32_1
%val2 = OpAtomicExchange %u32 %u32_var %device %relaxed %u32_0
)";
@ -720,7 +720,7 @@ TEST_F(ValidateAtomics, AtomicExchangeKernelSuccess) {
const std::string body = R"(
OpAtomicStore %f32_var %device %relaxed %f32_1
%val2 = OpAtomicExchange %f32 %f32_var %device %relaxed %f32_0
%val3 = OpAtomicStore %u32_var %device %relaxed %u32_1
OpAtomicStore %u32_var %device %relaxed %u32_1
%val4 = OpAtomicExchange %u32 %u32_var %device %relaxed %u32_0
)";
@ -743,7 +743,7 @@ OpAtomicStore %f32_var %device %relaxed %f32_1
TEST_F(ValidateAtomics, AtomicExchangeWrongResultType) {
const std::string body = R"(
%val1 = OpStore %f32vec4_var %f32vec4_0000
OpStore %f32vec4_var %f32vec4_0000
%val2 = OpAtomicExchange %f32vec4 %f32vec4_var %device %relaxed %f32vec4_0000
)";
@ -768,7 +768,7 @@ TEST_F(ValidateAtomics, AtomicExchangeWrongPointerType) {
TEST_F(ValidateAtomics, AtomicExchangeWrongPointerDataType) {
const std::string body = R"(
%val1 = OpStore %f32vec4_var %f32vec4_0000
OpStore %f32vec4_var %f32vec4_0000
%val2 = OpAtomicExchange %f32 %f32vec4_var %device %relaxed %f32vec4_0000
)";
@ -822,7 +822,7 @@ OpAtomicStore %f32_var %device %relaxed %f32_1
TEST_F(ValidateAtomics, AtomicCompareExchangeShaderSuccess) {
const std::string body = R"(
%val1 = OpAtomicStore %u32_var %device %relaxed %u32_1
OpAtomicStore %u32_var %device %relaxed %u32_1
%val2 = OpAtomicCompareExchange %u32 %u32_var %device %relaxed %relaxed %u32_0 %u32_0
)";
@ -834,7 +834,7 @@ TEST_F(ValidateAtomics, AtomicCompareExchangeKernelSuccess) {
const std::string body = R"(
OpAtomicStore %f32_var %device %relaxed %f32_1
%val2 = OpAtomicCompareExchange %f32 %f32_var %device %relaxed %relaxed %f32_0 %f32_1
%val3 = OpAtomicStore %u32_var %device %relaxed %u32_1
OpAtomicStore %u32_var %device %relaxed %u32_1
%val4 = OpAtomicCompareExchange %u32 %u32_var %device %relaxed %relaxed %u32_0 %u32_0
)";
@ -857,7 +857,7 @@ OpAtomicStore %f32_var %device %relaxed %f32_1
TEST_F(ValidateAtomics, AtomicCompareExchangeWrongResultType) {
const std::string body = R"(
%val1 = OpStore %f32vec4_var %f32vec4_0000
OpStore %f32vec4_var %f32vec4_0000
%val2 = OpAtomicCompareExchange %f32vec4 %f32vec4_var %device %relaxed %relaxed %f32vec4_0000 %f32vec4_0000
)";
@ -882,7 +882,7 @@ TEST_F(ValidateAtomics, AtomicCompareExchangeWrongPointerType) {
TEST_F(ValidateAtomics, AtomicCompareExchangeWrongPointerDataType) {
const std::string body = R"(
%val1 = OpStore %f32vec4_var %f32vec4_0000
OpStore %f32vec4_var %f32vec4_0000
%val2 = OpAtomicCompareExchange %f32 %f32vec4_var %device %relaxed %relaxed %f32_0 %f32_1
)";
@ -975,7 +975,7 @@ OpAtomicStore %f32_var %device %relaxed %f32_1
TEST_F(ValidateAtomics, AtomicCompareExchangeWeakSuccess) {
const std::string body = R"(
%val3 = OpAtomicStore %u32_var %device %relaxed %u32_1
OpAtomicStore %u32_var %device %relaxed %u32_1
%val4 = OpAtomicCompareExchangeWeak %u32 %u32_var %device %relaxed %relaxed %u32_0 %u32_0
)";

View File

@ -2317,8 +2317,8 @@ TEST_F(ValidateIdWithMessage, OpLoadGood) {
%6 = OpFunction %1 None %4
%7 = OpLabel
%8 = OpLoad %2 %5
%9 = OpReturn
%10 = OpFunctionEnd
OpReturn
OpFunctionEnd
)";
CompileSuccessfully(spirv.c_str());
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());

View File

@ -2938,7 +2938,7 @@ TEST_F(ValidateImage, ReadCoordinateSizeTooSmall) {
TEST_F(ValidateImage, WriteSuccess1) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123
OpImageWrite %img %u32vec2_01 %u32vec4_0123
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -2949,7 +2949,7 @@ TEST_F(ValidateImage, WriteSuccess1) {
TEST_F(ValidateImage, WriteSuccess2) {
const std::string body = R"(
%img = OpLoad %type_image_f32_1d_0002_rgba32f %uniform_image_f32_1d_0002_rgba32f
%res1 = OpImageWrite %img %u32_1 %f32vec4_0000
OpImageWrite %img %u32_1 %f32vec4_0000
)";
const std::string extra = "\nOpCapability Image1D\n";
@ -2960,7 +2960,7 @@ TEST_F(ValidateImage, WriteSuccess2) {
TEST_F(ValidateImage, WriteSuccess3) {
const std::string body = R"(
%img = OpLoad %type_image_f32_cube_0102_rgba32f %uniform_image_f32_cube_0102_rgba32f
%res1 = OpImageWrite %img %u32vec3_012 %f32vec4_0000
OpImageWrite %img %u32vec3_012 %f32vec4_0000
)";
const std::string extra = "\nOpCapability ImageCubeArray\n";
@ -2972,8 +2972,8 @@ TEST_F(ValidateImage, WriteSuccess4) {
const std::string body = R"(
%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010
;TODO(atgoo@github.com) Is it legal to write to MS image without sample index?
%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000
%res2 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %u32_1
OpImageWrite %img %u32vec2_01 %f32vec4_0000
OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %u32_1
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -2984,7 +2984,7 @@ TEST_F(ValidateImage, WriteSuccess4) {
TEST_F(ValidateImage, WriteSubpassData) {
const std::string body = R"(
%img = OpLoad %type_image_f32_spd_0002 %uniform_image_f32_spd_0002
%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000
OpImageWrite %img %u32vec2_01 %f32vec4_0000
)";
CompileSuccessfully(GenerateShaderCode(body).c_str());
@ -2996,7 +2996,7 @@ TEST_F(ValidateImage, WriteSubpassData) {
TEST_F(ValidateImage, WriteNeedCapabilityStorageImageWriteWithoutFormat) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123
OpImageWrite %img %u32vec2_01 %u32vec4_0123
)";
CompileSuccessfully(GenerateShaderCode(body).c_str());
@ -3006,7 +3006,7 @@ TEST_F(ValidateImage, WriteNeedCapabilityStorageImageWriteWithoutFormat) {
TEST_F(ValidateImage, WriteNeedCapabilityStorageImageWriteWithoutFormatVulkan) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123
OpImageWrite %img %u32vec2_01 %u32vec4_0123
)";
spv_target_env env = SPV_ENV_VULKAN_1_0;
@ -3023,7 +3023,7 @@ TEST_F(ValidateImage, WriteNeedCapabilityStorageImageWriteWithoutFormatVulkan) {
TEST_F(ValidateImage, WriteNeedCapabilityImage1D) {
const std::string body = R"(
%img = OpLoad %type_image_f32_1d_0002_rgba32f %uniform_image_f32_1d_0002_rgba32f
%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000
OpImageWrite %img %u32vec2_01 %f32vec4_0000
)";
CompileSuccessfully(GenerateShaderCode(body).c_str());
@ -3036,7 +3036,7 @@ TEST_F(ValidateImage, WriteNeedCapabilityImage1D) {
TEST_F(ValidateImage, WriteNeedCapabilityImageCubeArray) {
const std::string body = R"(
%img = OpLoad %type_image_f32_cube_0102_rgba32f %uniform_image_f32_cube_0102_rgba32f
%res1 = OpImageWrite %img %u32vec3_012 %f32vec4_0000
OpImageWrite %img %u32vec3_012 %f32vec4_0000
)";
CompileSuccessfully(GenerateShaderCode(body).c_str());
@ -3050,7 +3050,7 @@ TEST_F(ValidateImage, WriteNeedCapabilityImageCubeArray) {
TEST_F(ValidateImage, WriteNotImage) {
const std::string body = R"(
%sampler = OpLoad %type_sampler %uniform_sampler
%res1 = OpImageWrite %sampler %u32vec2_01 %f32vec4_0000
OpImageWrite %sampler %u32vec2_01 %f32vec4_0000
)";
CompileSuccessfully(GenerateShaderCode(body).c_str());
@ -3062,7 +3062,7 @@ TEST_F(ValidateImage, WriteNotImage) {
TEST_F(ValidateImage, WriteImageSampled) {
const std::string body = R"(
%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001
%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000
OpImageWrite %img %u32vec2_01 %f32vec4_0000
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -3075,7 +3075,7 @@ TEST_F(ValidateImage, WriteImageSampled) {
TEST_F(ValidateImage, WriteWrongCoordinateType) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %f32vec2_00 %u32vec4_0123
OpImageWrite %img %f32vec2_00 %u32vec4_0123
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -3088,7 +3088,7 @@ TEST_F(ValidateImage, WriteWrongCoordinateType) {
TEST_F(ValidateImage, WriteCoordinateSizeTooSmall) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32_1 %u32vec4_0123
OpImageWrite %img %u32_1 %u32vec4_0123
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -3102,7 +3102,7 @@ TEST_F(ValidateImage, WriteCoordinateSizeTooSmall) {
TEST_F(ValidateImage, WriteTexelWrongType) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %img
OpImageWrite %img %u32vec2_01 %img
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -3115,7 +3115,7 @@ TEST_F(ValidateImage, WriteTexelWrongType) {
TEST_F(ValidateImage, DISABLED_WriteTexelNotVector4) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec3_012
OpImageWrite %img %u32vec2_01 %u32vec3_012
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -3128,7 +3128,7 @@ TEST_F(ValidateImage, DISABLED_WriteTexelNotVector4) {
TEST_F(ValidateImage, WriteTexelWrongComponentType) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000
OpImageWrite %img %u32vec2_01 %f32vec4_0000
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -3143,7 +3143,7 @@ TEST_F(ValidateImage, WriteTexelWrongComponentType) {
TEST_F(ValidateImage, WriteSampleNotInteger) {
const std::string body = R"(
%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010
%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %f32_1
OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %f32_1
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -3156,7 +3156,7 @@ TEST_F(ValidateImage, WriteSampleNotInteger) {
TEST_F(ValidateImage, SampleNotMultisampled) {
const std::string body = R"(
%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002
%res2 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %u32_1
OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %u32_1
)";
const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n";
@ -4527,7 +4527,7 @@ OpExtension "SPV_KHR_vulkan_memory_model"
TEST_F(ValidateImage, MakeTexelAvailableKHRSuccessImageWrite) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR|NonPrivateTexelKHR %u32_2
OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR|NonPrivateTexelKHR %u32_2
)";
const std::string extra = R"(
@ -4567,7 +4567,7 @@ OpExtension "SPV_KHR_vulkan_memory_model"
TEST_F(ValidateImage, MakeTexelAvailableKHRFailureMissingNonPrivate) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR %u32_1
OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR %u32_1
)";
const std::string extra = R"(
@ -4588,7 +4588,7 @@ OpExtension "SPV_KHR_vulkan_memory_model"
TEST_F(ValidateImage, VulkanMemoryModelDeviceScopeImageWriteBad) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR|NonPrivateTexelKHR %u32_1
OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR|NonPrivateTexelKHR %u32_1
)";
const std::string extra = R"(
@ -4610,7 +4610,7 @@ OpExtension "SPV_KHR_vulkan_memory_model"
TEST_F(ValidateImage, VulkanMemoryModelDeviceScopeImageWriteGood) {
const std::string body = R"(
%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000
%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR|NonPrivateTexelKHR %u32_1
OpImageWrite %img %u32vec2_01 %u32vec4_0123 MakeTexelAvailableKHR|NonPrivateTexelKHR %u32_1
)";
const std::string extra = R"(

View File

@ -212,7 +212,7 @@ TEST_F(ValidateLimits, SwitchNumBranchesGood) {
%5 = OpFunction %1 None %2
%7 = OpLabel
%8 = OpIAdd %3 %4 %4
%9 = OpSwitch %4 %10)";
OpSwitch %4 %10)";
// Now add the (literal, label) pairs
for (int i = 0; i < 16383; ++i) {
@ -240,7 +240,7 @@ TEST_F(ValidateLimits, SwitchNumBranchesBad) {
%5 = OpFunction %1 None %2
%7 = OpLabel
%8 = OpIAdd %3 %4 %4
%9 = OpSwitch %4 %10)";
OpSwitch %4 %10)";
// Now add the (literal, label) pairs
for (int i = 0; i < 16384; ++i) {
@ -271,7 +271,7 @@ TEST_F(ValidateLimits, CustomizedSwitchNumBranchesGood) {
%5 = OpFunction %1 None %2
%7 = OpLabel
%8 = OpIAdd %3 %4 %4
%9 = OpSwitch %4 %10)";
OpSwitch %4 %10)";
// Now add the (literal, label) pairs
for (int i = 0; i < 10; ++i) {
@ -301,7 +301,7 @@ TEST_F(ValidateLimits, CustomizedSwitchNumBranchesBad) {
%5 = OpFunction %1 None %2
%7 = OpLabel
%8 = OpIAdd %3 %4 %4
%9 = OpSwitch %4 %10)";
OpSwitch %4 %10)";
// Now add the (literal, label) pairs
for (int i = 0; i < 11; ++i) {