GLSL: Make gl_Layer and gl_ViewportIndex always be outside blocks.
There was some ambiguity/contradiction in this behavior, and Khronos decided glslang should always have these outside blocks, rather than have stage/vendor/target variations.
This commit is contained in:
@@ -3,81 +3,84 @@ spv.stereoViewRendering.tesc
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 38
|
||||
|
||||
Capability Geometry
|
||||
Capability Tessellation
|
||||
Capability ShaderViewportIndexLayerNV
|
||||
Capability ShaderViewportMaskNV
|
||||
Capability ShaderStereoViewNV
|
||||
Extension "SPV_EXT_shader_viewport_index_layer"
|
||||
Extension "SPV_NV_stereo_view_rendering"
|
||||
Extension "SPV_NV_viewport_array2"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationControl 4 "main" 16 18 32
|
||||
EntryPoint TessellationControl 4 "main" 16 18 31 37
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_NV_stereo_view_rendering"
|
||||
SourceExtension "GL_NV_viewport_array2"
|
||||
Name 4 "main"
|
||||
Name 12 "gl_PerVertex"
|
||||
MemberName 12(gl_PerVertex) 0 "gl_Layer"
|
||||
MemberName 12(gl_PerVertex) 1 "gl_SecondaryPositionNV"
|
||||
MemberName 12(gl_PerVertex) 2 "gl_SecondaryViewportMaskNV"
|
||||
MemberName 12(gl_PerVertex) 0 "gl_SecondaryPositionNV"
|
||||
MemberName 12(gl_PerVertex) 1 "gl_SecondaryViewportMaskNV"
|
||||
Name 16 "gl_out"
|
||||
Name 18 "gl_InvocationID"
|
||||
Name 28 "gl_PerVertex"
|
||||
MemberName 28(gl_PerVertex) 0 "gl_Position"
|
||||
MemberName 28(gl_PerVertex) 1 "gl_PointSize"
|
||||
MemberName 28(gl_PerVertex) 2 "gl_ClipDistance"
|
||||
MemberName 28(gl_PerVertex) 3 "gl_CullDistance"
|
||||
MemberName 28(gl_PerVertex) 4 "gl_SecondaryPositionNV"
|
||||
Name 32 "gl_in"
|
||||
MemberDecorate 12(gl_PerVertex) 0 BuiltIn Layer
|
||||
MemberDecorate 12(gl_PerVertex) 0 ViewportRelativeNV
|
||||
MemberDecorate 12(gl_PerVertex) 0 SecondaryViewportRelativeNV 1
|
||||
MemberDecorate 12(gl_PerVertex) 1 BuiltIn SecondaryPositionNV
|
||||
MemberDecorate 12(gl_PerVertex) 2 BuiltIn SecondaryViewportMaskNV
|
||||
Name 27 "gl_PerVertex"
|
||||
MemberName 27(gl_PerVertex) 0 "gl_Position"
|
||||
MemberName 27(gl_PerVertex) 1 "gl_PointSize"
|
||||
MemberName 27(gl_PerVertex) 2 "gl_ClipDistance"
|
||||
MemberName 27(gl_PerVertex) 3 "gl_CullDistance"
|
||||
MemberName 27(gl_PerVertex) 4 "gl_SecondaryPositionNV"
|
||||
Name 31 "gl_in"
|
||||
Name 37 "gl_Layer"
|
||||
MemberDecorate 12(gl_PerVertex) 0 BuiltIn SecondaryPositionNV
|
||||
MemberDecorate 12(gl_PerVertex) 1 BuiltIn SecondaryViewportMaskNV
|
||||
Decorate 12(gl_PerVertex) Block
|
||||
Decorate 18(gl_InvocationID) BuiltIn InvocationId
|
||||
MemberDecorate 28(gl_PerVertex) 0 BuiltIn Position
|
||||
MemberDecorate 28(gl_PerVertex) 1 BuiltIn PointSize
|
||||
MemberDecorate 28(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||
MemberDecorate 28(gl_PerVertex) 3 BuiltIn CullDistance
|
||||
Decorate 28(gl_PerVertex) Block
|
||||
MemberDecorate 27(gl_PerVertex) 0 BuiltIn Position
|
||||
MemberDecorate 27(gl_PerVertex) 1 BuiltIn PointSize
|
||||
MemberDecorate 27(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||
MemberDecorate 27(gl_PerVertex) 3 BuiltIn CullDistance
|
||||
Decorate 27(gl_PerVertex) Block
|
||||
Decorate 37(gl_Layer) BuiltIn Layer
|
||||
Decorate 37(gl_Layer) ViewportRelativeNV
|
||||
Decorate 37(gl_Layer) SecondaryViewportRelativeNV 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 1
|
||||
7: TypeFloat 32
|
||||
8: TypeVector 7(float) 4
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeInt 32 1
|
||||
9: TypeInt 32 0
|
||||
10: 9(int) Constant 2
|
||||
11: TypeArray 6(int) 10
|
||||
12(gl_PerVertex): TypeStruct 6(int) 8(fvec4) 11
|
||||
11: TypeArray 8(int) 10
|
||||
12(gl_PerVertex): TypeStruct 7(fvec4) 11
|
||||
13: 9(int) Constant 4
|
||||
14: TypeArray 12(gl_PerVertex) 13
|
||||
15: TypePointer Output 14
|
||||
16(gl_out): 15(ptr) Variable Output
|
||||
17: TypePointer Input 6(int)
|
||||
17: TypePointer Input 8(int)
|
||||
18(gl_InvocationID): 17(ptr) Variable Input
|
||||
20: 6(int) Constant 2
|
||||
21: 6(int) Constant 0
|
||||
22: 6(int) Constant 1
|
||||
23: TypePointer Output 6(int)
|
||||
26: 9(int) Constant 1
|
||||
27: TypeArray 7(float) 26
|
||||
28(gl_PerVertex): TypeStruct 8(fvec4) 7(float) 27 27 8(fvec4)
|
||||
29: 9(int) Constant 32
|
||||
30: TypeArray 28(gl_PerVertex) 29
|
||||
31: TypePointer Input 30
|
||||
32(gl_in): 31(ptr) Variable Input
|
||||
33: TypePointer Input 8(fvec4)
|
||||
36: TypePointer Output 8(fvec4)
|
||||
20: 8(int) Constant 1
|
||||
21: 8(int) Constant 0
|
||||
22: TypePointer Output 8(int)
|
||||
25: 9(int) Constant 1
|
||||
26: TypeArray 6(float) 25
|
||||
27(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 26 26 7(fvec4)
|
||||
28: 9(int) Constant 32
|
||||
29: TypeArray 27(gl_PerVertex) 28
|
||||
30: TypePointer Input 29
|
||||
31(gl_in): 30(ptr) Variable Input
|
||||
32: TypePointer Input 7(fvec4)
|
||||
35: TypePointer Output 7(fvec4)
|
||||
37(gl_Layer): 22(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
19: 6(int) Load 18(gl_InvocationID)
|
||||
24: 23(ptr) AccessChain 16(gl_out) 19 20 21
|
||||
Store 24 22
|
||||
25: 6(int) Load 18(gl_InvocationID)
|
||||
34: 33(ptr) AccessChain 32(gl_in) 22 21
|
||||
35: 8(fvec4) Load 34
|
||||
37: 36(ptr) AccessChain 16(gl_out) 25 22
|
||||
Store 37 35
|
||||
19: 8(int) Load 18(gl_InvocationID)
|
||||
23: 22(ptr) AccessChain 16(gl_out) 19 20 21
|
||||
Store 23 20
|
||||
24: 8(int) Load 18(gl_InvocationID)
|
||||
33: 32(ptr) AccessChain 31(gl_in) 20 21
|
||||
34: 7(fvec4) Load 33
|
||||
36: 35(ptr) AccessChain 16(gl_out) 24 21
|
||||
Store 36 34
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
@@ -3,6 +3,7 @@ spv.viewportArray2.tesc
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 25
|
||||
|
||||
Capability Geometry
|
||||
Capability Tessellation
|
||||
Capability MultiViewport
|
||||
Capability ShaderViewportIndexLayerNV
|
||||
@@ -11,47 +12,47 @@ spv.viewportArray2.tesc
|
||||
Extension "SPV_NV_viewport_array2"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationControl 4 "main" 14 16
|
||||
EntryPoint TessellationControl 4 "main" 14 16 22 24
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_NV_viewport_array2"
|
||||
Name 4 "main"
|
||||
Name 10 "gl_PerVertex"
|
||||
MemberName 10(gl_PerVertex) 0 "gl_ViewportIndex"
|
||||
MemberName 10(gl_PerVertex) 1 "gl_Layer"
|
||||
MemberName 10(gl_PerVertex) 2 "gl_ViewportMask"
|
||||
MemberName 10(gl_PerVertex) 0 "gl_ViewportMask"
|
||||
Name 14 "gl_out"
|
||||
Name 16 "gl_InvocationID"
|
||||
MemberDecorate 10(gl_PerVertex) 0 BuiltIn ViewportIndex
|
||||
MemberDecorate 10(gl_PerVertex) 1 BuiltIn Layer
|
||||
MemberDecorate 10(gl_PerVertex) 1 ViewportRelativeNV
|
||||
MemberDecorate 10(gl_PerVertex) 2 BuiltIn ViewportMaskNV
|
||||
Name 22 "gl_ViewportIndex"
|
||||
Name 24 "gl_Layer"
|
||||
MemberDecorate 10(gl_PerVertex) 0 BuiltIn ViewportMaskNV
|
||||
Decorate 10(gl_PerVertex) Block
|
||||
Decorate 16(gl_InvocationID) BuiltIn InvocationId
|
||||
Decorate 22(gl_ViewportIndex) BuiltIn ViewportIndex
|
||||
Decorate 24(gl_Layer) BuiltIn Layer
|
||||
Decorate 24(gl_Layer) ViewportRelativeNV
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 1
|
||||
7: TypeInt 32 0
|
||||
8: 7(int) Constant 2
|
||||
9: TypeArray 6(int) 8
|
||||
10(gl_PerVertex): TypeStruct 6(int) 6(int) 9
|
||||
10(gl_PerVertex): TypeStruct 9
|
||||
11: 7(int) Constant 4
|
||||
12: TypeArray 10(gl_PerVertex) 11
|
||||
13: TypePointer Output 12
|
||||
14(gl_out): 13(ptr) Variable Output
|
||||
15: TypePointer Input 6(int)
|
||||
16(gl_InvocationID): 15(ptr) Variable Input
|
||||
18: 6(int) Constant 2
|
||||
19: 6(int) Constant 0
|
||||
20: 6(int) Constant 1
|
||||
21: TypePointer Output 6(int)
|
||||
18: 6(int) Constant 0
|
||||
19: 6(int) Constant 1
|
||||
20: TypePointer Output 6(int)
|
||||
22(gl_ViewportIndex): 20(ptr) Variable Output
|
||||
23: 6(int) Constant 2
|
||||
24(gl_Layer): 20(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
17: 6(int) Load 16(gl_InvocationID)
|
||||
22: 21(ptr) AccessChain 14(gl_out) 17 18 19
|
||||
Store 22 20
|
||||
23: 6(int) Load 16(gl_InvocationID)
|
||||
24: 21(ptr) AccessChain 14(gl_out) 23 19
|
||||
Store 24 18
|
||||
21: 20(ptr) AccessChain 14(gl_out) 17 18 18
|
||||
Store 21 19
|
||||
Store 22(gl_ViewportIndex) 23
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
@@ -8,9 +8,10 @@ layout(vertices = 4) out;
|
||||
out gl_PerVertex {
|
||||
int gl_SecondaryViewportMaskNV[2];
|
||||
vec4 gl_SecondaryPositionNV;
|
||||
layout (viewport_relative, secondary_view_offset = 1) out highp int gl_Layer;
|
||||
} gl_out[4];
|
||||
|
||||
layout (viewport_relative, secondary_view_offset = 1) out highp int gl_Layer;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_out[gl_InvocationID].gl_SecondaryViewportMaskNV[0] = 1;
|
||||
|
||||
@@ -5,12 +5,12 @@ layout(vertices = 4) out;
|
||||
|
||||
out gl_PerVertex {
|
||||
int gl_ViewportMask[2];
|
||||
int gl_ViewportIndex;
|
||||
layout (viewport_relative) out highp int gl_Layer;
|
||||
} gl_out[4];
|
||||
|
||||
layout (viewport_relative) out highp int gl_Layer;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_out[gl_InvocationID].gl_ViewportMask[0] = 1;
|
||||
gl_out[gl_InvocationID].gl_ViewportIndex = 2;
|
||||
gl_out[gl_InvocationID].gl_ViewportMask[0] = 1;
|
||||
gl_ViewportIndex = 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user