KhronosGroup / KhronosGroup/SPIRV-Tools
spirv-val: Check that variable only has one builtin decoration
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
Currently spirv-val doesn't print an error if a variable has multiple builtin decorations. Example repro:
```
$ cat test.spvasm
OpCapability SampleRateShading
OpCapability Geometry
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %5 "main" %Color %broken
OpExecutionMode %5 OriginUpperLeft
OpDecorate %Color Index 0
OpDecorate %Color Location 0
OpDecorate %broken BuiltIn PrimitiveId
OpDecorate %broken BuiltIn SampleId
%void = OpTypeVoid
%4 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%optr = OpTypePointer Output %v4float
%Color = OpVariable %optr Output
%uint = OpTypeInt 32 0
%ptr = OpTypePointer Input %uint
%broken = OpVariable %ptr Input
%5 = OpFunction %void None %4
%44 = OpLabel
OpReturn
OpFunctionEnd
$ spirv-as --target-env vulkan1.0 test.spvasm -o test.spv
$ spirv-val --target-env vulkan1.0 test.spv
$ spirv-val --version
SPIRV-Tools v2020.3-dev v2020.2-1-gfd773eb5
Targets:
SPIR-V 1.0
SPIR-V 1.1
SPIR-V 1.2
SPIR-V 1.3
SPIR-V 1.4
SPIR-V 1.5
SPIR-V 1.2 (under OpenCL 2.2 Full Profile semantics)
SPIR-V 1.0 (under Vulkan 1.0 semantics)
SPIR-V 1.3 (under Vulkan 1.1 semantics)
SPIR-V 1.4 (under Vulkan 1.1 semantics)
SPIR-V 1.3 (under WIP WebGPU semantics)
```
Contributor guide
Assessment
This issue has not been assessed yet.