GL_EXT_vulkan_glsl_relaxed - retarget gl_VertexID to gl_VertexIndex
instead of allowing for multiple declarations of the variable in the resulting SPIR-V, instead use a retargeted mechanism to cause references to gl_VertexID and gl_InstanceID to use the gl_VertexIndex and gl_InstanceIndex symbol.
This commit is contained in:
@@ -34,8 +34,8 @@ Shader version: 460
|
||||
0:? 'Color' ( smooth out highp 4-component vector of float)
|
||||
0:? 'UV' ( smooth out highp 2-component vector of float)
|
||||
0:? 'anon@1' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, out unsized 1-element array of float CullDistance gl_CullDistance})
|
||||
0:? 'gl_VertexID' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceID' ( in int InstanceIndex)
|
||||
0:? 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceIndex' ( in int InstanceIndex)
|
||||
|
||||
vk.relaxed.changeSet.frag
|
||||
Shader version: 460
|
||||
@@ -108,8 +108,8 @@ Shader version: 460
|
||||
0:? 'Color' ( smooth out highp 4-component vector of float)
|
||||
0:? 'UV' ( smooth out highp 2-component vector of float)
|
||||
0:? 'anon@1' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, out 1-element array of float CullDistance gl_CullDistance})
|
||||
0:? 'gl_VertexID' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceID' ( in int InstanceIndex)
|
||||
0:? 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceIndex' ( in int InstanceIndex)
|
||||
Shader version: 460
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
@@ -162,8 +162,8 @@ gl_FragCoord origin is upper left
|
||||
MemberName 28(gl_DefaultUniformBlock) 0 "projectionMatrix"
|
||||
Name 30 ""
|
||||
Name 34 "aPos"
|
||||
Name 44 "gl_VertexID"
|
||||
Name 45 "gl_InstanceID"
|
||||
Name 44 "gl_VertexIndex"
|
||||
Name 45 "gl_InstanceIndex"
|
||||
Decorate 9(Color) Location 0
|
||||
Decorate 11(aColor) Location 2
|
||||
Decorate 15(UV) Location 1
|
||||
@@ -180,8 +180,8 @@ gl_FragCoord origin is upper left
|
||||
Decorate 30 DescriptorSet 0
|
||||
Decorate 30 Binding 0
|
||||
Decorate 34(aPos) Location 0
|
||||
Decorate 44(gl_VertexID) BuiltIn VertexIndex
|
||||
Decorate 45(gl_InstanceID) BuiltIn InstanceIndex
|
||||
Decorate 44(gl_VertexIndex) BuiltIn VertexIndex
|
||||
Decorate 45(gl_InstanceIndex) BuiltIn InstanceIndex
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@@ -212,8 +212,8 @@ gl_FragCoord origin is upper left
|
||||
36: 6(float) Constant 0
|
||||
37: 6(float) Constant 1065353216
|
||||
43: TypePointer Input 25(int)
|
||||
44(gl_VertexID): 43(ptr) Variable Input
|
||||
45(gl_InstanceID): 43(ptr) Variable Input
|
||||
44(gl_VertexIndex): 43(ptr) Variable Input
|
||||
45(gl_InstanceIndex): 43(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
12: 7(fvec4) Load 11(aColor)
|
||||
|
||||
@@ -28,8 +28,8 @@ Shader version: 460
|
||||
0:? Linker Objects
|
||||
0:? 'io' (layout( location=0) smooth out highp 4-component vector of float)
|
||||
0:? 'anon@0' (layout( column_major std140) uniform block{ uniform highp 2-component vector of float a})
|
||||
0:? 'gl_VertexID' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceID' ( in int InstanceIndex)
|
||||
0:? 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceIndex' ( in int InstanceIndex)
|
||||
|
||||
vk.relaxed.errorcheck.frag
|
||||
Shader version: 460
|
||||
@@ -94,8 +94,8 @@ Shader version: 460
|
||||
0:? Linker Objects
|
||||
0:? 'io' (layout( location=0) smooth out highp 4-component vector of float)
|
||||
0:? 'anon@0' (layout( column_major std140) uniform block{ uniform highp 2-component vector of float a})
|
||||
0:? 'gl_VertexID' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceID' ( in int InstanceIndex)
|
||||
0:? 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceIndex' ( in int InstanceIndex)
|
||||
Shader version: 460
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
|
||||
@@ -93,7 +93,9 @@ Shader version: 460
|
||||
0:28 'anon@0' (layout( column_major std140) uniform block{ uniform highp 4-component vector of float a, uniform highp 2-component vector of float b2, uniform highp 2-component vector of float b1, uniform highp 4-component vector of float c2, uniform highp 4-component vector of float d, uniform 4-element array of highp 4-component vector of float s})
|
||||
0:28 Constant:
|
||||
0:28 5 (const uint)
|
||||
0:28 'gl_VertexID' ( in int VertexIndex)
|
||||
0:28 subtract ( temp int)
|
||||
0:28 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:28 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:29 move second child to first child ( temp highp float)
|
||||
0:29 direct index ( temp highp float)
|
||||
0:29 'v' ( temp highp 4-component vector of float)
|
||||
@@ -105,7 +107,9 @@ Shader version: 460
|
||||
0:29 Constant:
|
||||
0:29 0 (const int)
|
||||
0:29 Convert int to float ( temp highp float)
|
||||
0:29 'gl_InstanceID' ( in highp int InstanceIndex)
|
||||
0:29 subtract ( temp highp int)
|
||||
0:29 'gl_InstanceIndex' ( in highp int InstanceIndex)
|
||||
0:29 'gl_InstanceIndex' ( in highp int InstanceIndex)
|
||||
0:30 move second child to first child ( temp highp 4-component vector of float)
|
||||
0:30 'io' (layout( location=0) smooth out highp 4-component vector of float)
|
||||
0:30 'v' ( temp highp 4-component vector of float)
|
||||
@@ -113,8 +117,8 @@ Shader version: 460
|
||||
0:? 'io' (layout( location=0) smooth out highp 4-component vector of float)
|
||||
0:? 'anon@0' (layout( column_major std140) uniform block{ uniform highp 4-component vector of float a, uniform highp 2-component vector of float b2, uniform highp 2-component vector of float b1, uniform highp 4-component vector of float c2, uniform highp 4-component vector of float d, uniform 4-element array of highp 4-component vector of float s})
|
||||
0:? 'anon@1' (layout( column_major std430) buffer block{ coherent volatile buffer highp uint counter3, coherent volatile buffer highp uint counter2})
|
||||
0:? 'gl_VertexID' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceID' ( in int InstanceIndex)
|
||||
0:? 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceIndex' ( in int InstanceIndex)
|
||||
|
||||
vk.relaxed.stagelink.frag
|
||||
Shader version: 460
|
||||
@@ -311,7 +315,9 @@ Shader version: 460
|
||||
0:28 'anon@0' (layout( column_major std140) uniform block{ uniform highp 4-component vector of float a, uniform highp 2-component vector of float b2, uniform highp 2-component vector of float b1, uniform highp 4-component vector of float c2, uniform highp 4-component vector of float d, uniform 4-element array of highp 4-component vector of float s})
|
||||
0:28 Constant:
|
||||
0:28 5 (const uint)
|
||||
0:28 'gl_VertexID' ( in int VertexIndex)
|
||||
0:28 subtract ( temp int)
|
||||
0:28 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:28 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:29 move second child to first child ( temp highp float)
|
||||
0:29 direct index ( temp highp float)
|
||||
0:29 'v' ( temp highp 4-component vector of float)
|
||||
@@ -323,7 +329,9 @@ Shader version: 460
|
||||
0:29 Constant:
|
||||
0:29 0 (const int)
|
||||
0:29 Convert int to float ( temp highp float)
|
||||
0:29 'gl_InstanceID' ( in highp int InstanceIndex)
|
||||
0:29 subtract ( temp highp int)
|
||||
0:29 'gl_InstanceIndex' ( in highp int InstanceIndex)
|
||||
0:29 'gl_InstanceIndex' ( in highp int InstanceIndex)
|
||||
0:30 move second child to first child ( temp highp 4-component vector of float)
|
||||
0:30 'io' (layout( location=0) smooth out highp 4-component vector of float)
|
||||
0:30 'v' ( temp highp 4-component vector of float)
|
||||
@@ -331,8 +339,8 @@ Shader version: 460
|
||||
0:? 'io' (layout( location=0) smooth out highp 4-component vector of float)
|
||||
0:? 'anon@0' (layout( column_major std140) uniform block{ uniform highp 4-component vector of float a, uniform highp 2-component vector of float b2, uniform highp 2-component vector of float b1, uniform highp 4-component vector of float c2, uniform highp 4-component vector of float d, uniform 4-element array of highp 4-component vector of float s})
|
||||
0:? 'anon@1' (layout( column_major std430) buffer block{ coherent volatile buffer highp uint counter3, coherent volatile buffer highp uint counter2})
|
||||
0:? 'gl_VertexID' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceID' ( in int InstanceIndex)
|
||||
0:? 'gl_VertexIndex' ( in int VertexIndex)
|
||||
0:? 'gl_InstanceIndex' ( in int InstanceIndex)
|
||||
Shader version: 460
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
@@ -428,12 +436,12 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000a
|
||||
// Id's are bound by 88
|
||||
// Id's are bound by 92
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 72 80 86
|
||||
EntryPoint Vertex 4 "main" 72 82 90
|
||||
Source GLSL 460
|
||||
Name 4 "main"
|
||||
Name 9 "foo("
|
||||
@@ -454,9 +462,9 @@ gl_FragCoord origin is upper left
|
||||
MemberName 35(gl_DefaultUniformBlock) 6 "c1"
|
||||
Name 37 ""
|
||||
Name 67 "v"
|
||||
Name 72 "gl_VertexID"
|
||||
Name 80 "gl_InstanceID"
|
||||
Name 86 "io"
|
||||
Name 72 "gl_VertexIndex"
|
||||
Name 82 "gl_InstanceIndex"
|
||||
Name 90 "io"
|
||||
MemberDecorate 14(gl_AtomicCounterBlock_0) 0 Coherent
|
||||
MemberDecorate 14(gl_AtomicCounterBlock_0) 0 Volatile
|
||||
MemberDecorate 14(gl_AtomicCounterBlock_0) 0 Coherent
|
||||
@@ -483,9 +491,9 @@ gl_FragCoord origin is upper left
|
||||
Decorate 35(gl_DefaultUniformBlock) Block
|
||||
Decorate 37 DescriptorSet 0
|
||||
Decorate 37 Binding 0
|
||||
Decorate 72(gl_VertexID) BuiltIn VertexIndex
|
||||
Decorate 80(gl_InstanceID) BuiltIn InstanceIndex
|
||||
Decorate 86(io) Location 0
|
||||
Decorate 72(gl_VertexIndex) BuiltIn VertexIndex
|
||||
Decorate 82(gl_InstanceIndex) BuiltIn InstanceIndex
|
||||
Decorate 90(io) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@@ -517,31 +525,35 @@ gl_FragCoord origin is upper left
|
||||
57: 17(int) Constant 4
|
||||
70: 17(int) Constant 5
|
||||
71: TypePointer Input 17(int)
|
||||
72(gl_VertexID): 71(ptr) Variable Input
|
||||
77: TypePointer Function 6(float)
|
||||
80(gl_InstanceID): 71(ptr) Variable Input
|
||||
85: TypePointer Output 7(fvec4)
|
||||
86(io): 85(ptr) Variable Output
|
||||
72(gl_VertexIndex): 71(ptr) Variable Input
|
||||
79: TypePointer Function 6(float)
|
||||
82(gl_InstanceIndex): 71(ptr) Variable Input
|
||||
89: TypePointer Output 7(fvec4)
|
||||
90(io): 89(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
67(v): 30(ptr) Variable Function
|
||||
68: 7(fvec4) FunctionCall 9(foo()
|
||||
Store 67(v) 68
|
||||
69: 7(fvec4) Load 67(v)
|
||||
73: 17(int) Load 72(gl_VertexID)
|
||||
74: 38(ptr) AccessChain 37 70 73
|
||||
75: 7(fvec4) Load 74
|
||||
76: 7(fvec4) FAdd 69 75
|
||||
Store 67(v) 76
|
||||
78: 77(ptr) AccessChain 67(v) 22
|
||||
79: 6(float) Load 78
|
||||
81: 17(int) Load 80(gl_InstanceID)
|
||||
82: 6(float) ConvertSToF 81
|
||||
83: 6(float) FSub 79 82
|
||||
84: 77(ptr) AccessChain 67(v) 22
|
||||
Store 84 83
|
||||
87: 7(fvec4) Load 67(v)
|
||||
Store 86(io) 87
|
||||
73: 17(int) Load 72(gl_VertexIndex)
|
||||
74: 17(int) Load 72(gl_VertexIndex)
|
||||
75: 17(int) ISub 73 74
|
||||
76: 38(ptr) AccessChain 37 70 75
|
||||
77: 7(fvec4) Load 76
|
||||
78: 7(fvec4) FAdd 69 77
|
||||
Store 67(v) 78
|
||||
80: 79(ptr) AccessChain 67(v) 22
|
||||
81: 6(float) Load 80
|
||||
83: 17(int) Load 82(gl_InstanceIndex)
|
||||
84: 17(int) Load 82(gl_InstanceIndex)
|
||||
85: 17(int) ISub 83 84
|
||||
86: 6(float) ConvertSToF 85
|
||||
87: 6(float) FSub 81 86
|
||||
88: 79(ptr) AccessChain 67(v) 22
|
||||
Store 88 87
|
||||
91: 7(fvec4) Load 67(v)
|
||||
Store 90(io) 91
|
||||
Return
|
||||
FunctionEnd
|
||||
9(foo(): 7(fvec4) Function None 8
|
||||
|
||||
@@ -25,7 +25,7 @@ vec4 foo() {
|
||||
void main() {
|
||||
|
||||
vec4 v = foo();
|
||||
v = v + s[gl_VertexID];
|
||||
v.x = v.x - float(gl_InstanceID);
|
||||
v = v + s[gl_VertexID - gl_VertexIndex];
|
||||
v.x = v.x - float(gl_InstanceID - gl_InstanceIndex);
|
||||
io = v;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user