Skip to content

Commit e205fc8

Browse files
svenvhjsji
authored andcommitted
Allow UniformDecoration capability for UniformId (#3021)
Starting from SPIR-V 1.6, the `UniformDecoration` capability also enables the `Uniform` decoration (in addition to the `Shader` capability). Original commit: KhronosGroup/SPIRV-LLVM-Translator@4eea290c449fca2
1 parent c7ea49b commit e205fc8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVDecorate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class SPIRVDecorateGeneric : public SPIRVAnnotationGeneric {
8484
return getCapability(BI);
8585
}
8686
case DecorationUniform:
87+
case DecorationUniformId:
8788
if (Module->isAllowedToUseVersion(VersionNumber::SPIRV_1_6))
8889
return getVec(CapabilityUniformDecoration);
8990
return getVec(CapabilityShader);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; REQUIRES: spirv-as
2+
3+
; RUN: spirv-as %s --target-env spv1.6 -o %t.spv
4+
; RUN: spirv-val %t.spv
5+
; RUN: llvm-spirv -to-text -o - %t.spv | FileCheck %s
6+
7+
; Check that the translator does not add the Shader/Matrix capability
8+
; requirements for SPIR-V 1.6.
9+
10+
; CHECK-NOT: Capability Matrix
11+
; CHECK-NOT: Capability Shader
12+
13+
OpCapability Addresses
14+
OpCapability Kernel
15+
OpCapability UniformDecoration
16+
OpMemoryModel Physical64 OpenCL
17+
OpEntryPoint Kernel %2 "test"
18+
OpDecorateId %uint_0 UniformId %uint_0
19+
%uint = OpTypeInt 32 0
20+
%uint_0 = OpConstant %uint 0
21+
%void = OpTypeVoid
22+
%1 = OpTypeFunction %void
23+
%2 = OpFunction %void None %1
24+
%3 = OpLabel
25+
OpReturn
26+
OpFunctionEnd

0 commit comments

Comments
 (0)