Implement GL_EXT_null_initializer

Adds null initializer syntax (empty braces)
Allows null initialization of shared variables
This commit is contained in:
John Kessenich
2020-06-11 08:30:03 -06:00
committed by Alan Baker
parent 6abdde3ce5
commit c739e03748
17 changed files with 2694 additions and 2355 deletions

View File

@@ -9,7 +9,7 @@ ERROR: 0:40: 'in' : global storage input qualifier cannot be used in a compute s
ERROR: 0:41: 'out' : global storage output qualifier cannot be used in a compute shader
ERROR: 0:44: 'shared' : cannot apply layout qualifiers to a shared variable
ERROR: 0:44: 'location' : can only apply to uniform, buffer, in, or out storage qualifiers
ERROR: 0:45: 'shared' : cannot initialize this type of qualifier
ERROR: 0:45: 'shared' : initializer can only be a null initializer ('{}')
ERROR: 0:47: 'local_size' : can only apply to 'in'
ERROR: 0:47: 'local_size' : can only apply to 'in'
ERROR: 0:47: 'local_size' : can only apply to 'in'
@@ -115,6 +115,11 @@ ERROR: node is still EOpNull!
0:36 Constant:
0:36 1 (const uint)
0:36 'gl_LocalInvocationIndex' ( in highp uint LocalInvocationIndex)
0:45 Sequence
0:45 move second child to first child ( temp highp float)
0:45 'fs' ( shared highp float)
0:45 Constant:
0:45 4.200000
0:59 Function Definition: foo( ( global void)
0:59 Function Parameters:
0:61 Sequence
@@ -553,6 +558,11 @@ ERROR: node is still EOpNull!
0:36 Constant:
0:36 1 (const uint)
0:36 'gl_LocalInvocationIndex' ( in highp uint LocalInvocationIndex)
0:45 Sequence
0:45 move second child to first child ( temp highp float)
0:45 'fs' ( shared highp float)
0:45 Constant:
0:45 4.200000
0:? Linker Objects
0:? 'gl_WorkGroupSize' ( const highp 3-component vector of uint WorkGroupSize)
0:? 2 (const uint)

View File

@@ -7,7 +7,7 @@ ERROR: 0:44: 'in' : global storage input qualifier cannot be used in a compute s
ERROR: 0:45: 'out' : global storage output qualifier cannot be used in a compute shader
ERROR: 0:48: 'shared' : cannot apply layout qualifiers to a shared variable
ERROR: 0:48: 'location' : can only apply to uniform, buffer, in, or out storage qualifiers
ERROR: 0:49: 'shared' : cannot initialize this type of qualifier
ERROR: 0:49: 'shared' : initializer can only be a null initializer ('{}')
ERROR: 0:52: 'local_size' : cannot change previously set size
ERROR: 0:54: 'local_size' : can only apply to 'in'
ERROR: 0:54: 'local_size' : can only apply to 'in'
@@ -52,6 +52,11 @@ ERROR: node is still EOpNull!
0:39 10 (const int)
0:39 true case
0:40 Barrier ( global void)
0:49 Sequence
0:49 move second child to first child ( temp float)
0:49 'fs' ( shared float)
0:49 Constant:
0:49 4.200000
0:66 Function Definition: foo( ( global void)
0:66 Function Parameters:
0:68 Sequence
@@ -184,6 +189,11 @@ ERROR: node is still EOpNull!
0:39 10 (const int)
0:39 true case
0:40 Barrier ( global void)
0:49 Sequence
0:49 move second child to first child ( temp float)
0:49 'fs' ( shared float)
0:49 Constant:
0:49 4.200000
0:? Linker Objects
0:? 'gl_WorkGroupSize' ( const 3-component vector of uint WorkGroupSize)
0:? 2 (const uint)

View File

@@ -0,0 +1,66 @@
spv.nullInit.comp
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 37
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 460
SourceExtension "GL_EXT_null_initializer"
Name 4 "main"
Name 12 "S"
MemberName 12(S) 0 "v"
MemberName 12(S) 1 "a"
Name 15 "local"
Name 23 "f"
Name 24 "T"
MemberName 24(T) 0 "b"
MemberName 24(T) 1 "s"
Name 27 "t1"
Name 28 "t2"
Name 30 "s"
Name 31 "g"
Name 34 "i"
Name 36 "global"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 3
8: TypeInt 32 0
9: 8(int) Constant 4
10: TypeArray 7(fvec3) 9
11: TypeInt 32 1
12(S): TypeStruct 10 11(int)
13: 12(S) ConstantNull
14: TypePointer Function 12(S)
16: 11(int) Constant 1
17: TypePointer Function 11(int)
21: 6(float) ConstantNull
22: TypePointer Workgroup 6(float)
23(f): 22(ptr) Variable Workgroup 21
24(T): TypeStruct 11(int) 12(S)
25: 24(T) ConstantNull
26: TypePointer Workgroup 24(T)
27(t1): 26(ptr) Variable Workgroup 25
28(t2): 26(ptr) Variable Workgroup 25
29: TypePointer Workgroup 12(S)
30(s): 29(ptr) Variable Workgroup 13
31(g): 22(ptr) Variable Workgroup 21
32: 11(int) ConstantNull
33: TypePointer Workgroup 11(int)
34(i): 33(ptr) Variable Workgroup 32
35: TypePointer Private 12(S)
36(global): 35(ptr) Variable Private 13
4(main): 2 Function None 3
5: Label
15(local): 14(ptr) Variable Function 13
18: 17(ptr) AccessChain 15(local) 16
19: 11(int) Load 18
20: 11(int) IAdd 19 16
Store 18 20
Return
FunctionEnd

View File

@@ -1,6 +1,17 @@
vulkan.comp
ERROR: 0:5: 'local_size' : cannot change previously set size
ERROR: 1 compilation errors. No code generated.
ERROR: 0:10: 'empty { } initializer' : not supported for this version or the enabled extensions
ERROR: 0:15: 'empty { } initializer' : not supported for this version or the enabled extensions
ERROR: 0:15: 'initialization with shared qualifier' : not supported for this version or the enabled extensions
ERROR: 0:16: 'empty { } initializer' : not supported for this version or the enabled extensions
ERROR: 0:26: '{}' : null initializers can't size unsized arrays
ERROR: 0:31: 'structure' : non-uniform struct contains a sampler or image: sampVar
ERROR: 0:31: '{}' : null initializers can't be used on opaque values
ERROR: 0:33: 'atomic counter types' : not allowed when using GLSL for Vulkan
ERROR: 0:33: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: a
ERROR: 0:33: '{}' : null initializers can't be used on opaque values
ERROR: 0:33: 'atomic_uint' : layout(binding=X) is required
ERROR: 12 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link