diff options
author | alan-baker <alanbaker@google.com> | 2019-09-09 14:53:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-09 14:53:30 -0400 |
commit | a464ac1a2729cee950c18709cae83b24d8a6dca7 (patch) | |
tree | b6b3ef2313fe6c4991a756c662ebb8bf477c1276 | |
parent | 6797173cf63d85aa004a05011a5205c9ab881741 (diff) | |
download | spirv-tools-a464ac1a2729cee950c18709cae83b24d8a6dca7.tar.gz |
Add generic builtin validation of target (#2843)
* Validate the target's opcode is acceptable
* Update tests
* New tests
* move early exit for builtins a bit later in the pass
-rw-r--r-- | source/val/validate_builtins.cpp | 32 | ||||
-rw-r--r-- | test/val/val_builtins_test.cpp | 78 | ||||
-rw-r--r-- | test/val/val_capability_test.cpp | 240 |
3 files changed, 239 insertions, 111 deletions
diff --git a/source/val/validate_builtins.cpp b/source/val/validate_builtins.cpp index a9bf716e..42497cf6 100644 --- a/source/val/validate_builtins.cpp +++ b/source/val/validate_builtins.cpp @@ -2901,6 +2901,26 @@ spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( const Decoration& decoration, const Instruction& inst) { const SpvBuiltIn label = SpvBuiltIn(decoration.params()[0]); + // Builtins can only be applied to variables, structures or constants. + auto target_opcode = inst.opcode(); + if (target_opcode != SpvOpTypeStruct && target_opcode != SpvOpVariable && + !spvOpcodeIsConstant(target_opcode)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "BuiltIns can only target variables, structs or constants"; + } + + if (!spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { + // Early return. All currently implemented rules are based on Vulkan or + // WebGPU spec. + // + // TODO: If you are adding validation rules for environments other than + // Vulkan or WebGPU (or general rules which are not environment + // independent), then you need to modify or remove this condition. Consider + // also adding early returns into BuiltIn-specific rules, so that the system + // doesn't spawn new rules which don't do anything. + return SPV_SUCCESS; + } + if (spvIsWebGPUEnv(_.context()->target_env) && !IsBuiltInValidForWebGPU(label)) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) @@ -3156,18 +3176,6 @@ spv_result_t BuiltInsValidator::Run() { // Validates correctness of built-in variables. spv_result_t ValidateBuiltIns(ValidationState_t& _) { - if (!spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { - // Early return. All currently implemented rules are based on Vulkan or - // WebGPU spec. - // - // TODO: If you are adding validation rules for environments other than - // Vulkan or WebGPU (or general rules which are not environment - // independent), then you need to modify or remove this condition. Consider - // also adding early returns into BuiltIn-specific rules, so that the system - // doesn't spawn new rules which don't do anything. - return SPV_SUCCESS; - } - BuiltInsValidator validator(_); return validator.Run(); } diff --git a/test/val/val_builtins_test.cpp b/test/val/val_builtins_test.cpp index e3eca09a..58593dcf 100644 --- a/test/val/val_builtins_test.cpp +++ b/test/val/val_builtins_test.cpp @@ -2330,9 +2330,9 @@ OpDecorate %copy BuiltIn WorkgroupSize CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Vulkan spec requires BuiltIn WorkgroupSize to be a " - "constant. ID <2> (OpCopyObject) is not a constant")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("BuiltIns can only target variables, structs or constants")); } CodeGenerator GetWorkgroupSizeNotVectorGenerator(spv_target_env env) { @@ -3302,6 +3302,78 @@ OpFunctionEnd HasSubstr("BuiltIn SubgroupId cannot be used as a member decoration")); } +TEST_F(ValidateBuiltIns, TargetIsType) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %void BuiltIn Position +%void = OpTypeVoid +)"; + + CompileSuccessfully(text); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("BuiltIns can only target variables, structs or constants")); +} + +TEST_F(ValidateBuiltIns, TargetIsVariable) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %wg_var BuiltIn Position +%int = OpTypeInt 32 0 +%int_wg_ptr = OpTypePointer Workgroup %int +%wg_var = OpVariable %int_wg_ptr Workgroup +)"; + + CompileSuccessfully(text); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBuiltIns, TargetIsStruct) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %struct BuiltIn Position +%struct = OpTypeStruct +)"; + + CompileSuccessfully(text); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBuiltIns, TargetIsConstant) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %int0 BuiltIn Position +%int = OpTypeInt 32 0 +%int0 = OpConstant %int 0 +)"; + + CompileSuccessfully(text); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBuiltIns, TargetIsSpecConstant) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %int0 BuiltIn Position +%int = OpTypeInt 32 0 +%int0 = OpSpecConstant %int 0 +)"; + + CompileSuccessfully(text); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + } // namespace } // namespace val } // namespace spvtools diff --git a/test/val/val_capability_test.cpp b/test/val/val_capability_test.cpp index 5a6e7512..505edb22 100644 --- a/test/val/val_capability_test.cpp +++ b/test/val/val_capability_test.cpp @@ -1286,221 +1286,264 @@ INSTANTIATE_TEST_SUITE_P(BuiltIn, ValidateCapability, Values( std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn Position\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn Position\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), // Just mentioning PointSize, ClipDistance, or CullDistance as a BuiltIn does // not trigger the requirement for the associated capability. // See https://github.com/KhronosGroup/SPIRV-Tools/issues/365 std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn PointSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn PointSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn ClipDistance\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn ClipDistance\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn CullDistance\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn CullDistance\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn VertexId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn VertexId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn InstanceId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn InstanceId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn PrimitiveId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn PrimitiveId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), GeometryTessellationDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn InvocationId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn InvocationId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), GeometryTessellationDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn Layer\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn Layer\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), GeometryDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn ViewportIndex\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn ViewportIndex\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), std::vector<std::string>{"MultiViewport"}), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn TessLevelOuter\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn TessLevelOuter\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), TessellationDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn TessLevelInner\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn TessLevelInner\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), TessellationDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn TessCoord\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn TessCoord\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), TessellationDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn PatchVertices\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn PatchVertices\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), TessellationDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn FragCoord\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn FragCoord\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn PointCoord\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn PointCoord\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn FrontFacing\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn FrontFacing\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn SampleId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn SampleId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), std::vector<std::string>{"SampleRateShading"}), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn SamplePosition\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn SamplePosition\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), std::vector<std::string>{"SampleRateShading"}), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn SampleMask\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn SampleMask\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn FragDepth\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn FragDepth\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn HelperInvocation\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn HelperInvocation\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn VertexIndex\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn VertexIndex\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn InstanceIndex\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn InstanceIndex\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn NumWorkgroups\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn NumWorkgroups\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn WorkgroupSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn WorkgroupSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn WorkgroupId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn WorkgroupId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn LocalInvocationId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn LocalInvocationId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn GlobalInvocationId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn GlobalInvocationId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn LocalInvocationIndex\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn LocalInvocationIndex\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn WorkDim\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn WorkDim\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn GlobalSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn GlobalSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn EnqueuedWorkgroupSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn EnqueuedWorkgroupSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn GlobalOffset\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn GlobalOffset\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn GlobalLinearId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn GlobalLinearId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn SubgroupSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn SubgroupSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelAndGroupNonUniformDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn SubgroupMaxSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn SubgroupMaxSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn NumSubgroups\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn NumSubgroups\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelAndGroupNonUniformDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn NumEnqueuedSubgroups\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn NumEnqueuedSubgroups\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn SubgroupId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn SubgroupId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelAndGroupNonUniformDependencies()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn SubgroupLocalInvocationId\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn SubgroupLocalInvocationId\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), KernelAndGroupNonUniformDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn VertexIndex\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn VertexIndex\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" + - "OpDecorate %intt BuiltIn InstanceIndex\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn InstanceIndex\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), ShaderDependencies()) ))); @@ -1548,18 +1591,21 @@ INSTANTIATE_TEST_SUITE_P(BuiltIn, ValidateCapabilityOpenGL40, Values( std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn PointSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn PointSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllSpirV10Capabilities()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn ClipDistance\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn ClipDistance\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllSpirV10Capabilities()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn CullDistance\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn CullDistance\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllSpirV10Capabilities()) ))); @@ -1580,13 +1626,15 @@ INSTANTIATE_TEST_SUITE_P(Capabilities, ValidateCapabilityVulkan11, Values( std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn PointSize\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn PointSize\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllVulkan11Capabilities()), std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + - "OpDecorate %intt BuiltIn CullDistance\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %int0 BuiltIn CullDistance\n" + "%intt = OpTypeInt 32 0\n" + "%int0 = OpConstant %intt 0\n" + std::string(kVoidFVoid), AllVulkan11Capabilities()) ))); |