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:
		
							parent
							
								
									aab3bcffea
								
							
						
					
					
						commit
						ba6a3c290e
					
				@ -453,7 +453,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
 | 
			
		||||
        return spv::BuiltInCullDistance;
 | 
			
		||||
 | 
			
		||||
    case glslang::EbvViewportIndex:
 | 
			
		||||
        if (!memberDeclaration) {
 | 
			
		||||
        builder.addCapability(spv::CapabilityMultiViewport);
 | 
			
		||||
        if (glslangIntermediate->getStage() == EShLangVertex ||
 | 
			
		||||
            glslangIntermediate->getStage() == EShLangTessControl ||
 | 
			
		||||
@ -462,7 +461,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
 | 
			
		||||
            builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer);
 | 
			
		||||
            builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
 | 
			
		||||
        }
 | 
			
		||||
        }
 | 
			
		||||
        return spv::BuiltInViewportIndex;
 | 
			
		||||
 | 
			
		||||
    case glslang::EbvSampleId:
 | 
			
		||||
@ -478,7 +476,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
 | 
			
		||||
        return spv::BuiltInSampleMask;
 | 
			
		||||
 | 
			
		||||
    case glslang::EbvLayer:
 | 
			
		||||
        if (!memberDeclaration) {
 | 
			
		||||
        builder.addCapability(spv::CapabilityGeometry);
 | 
			
		||||
        if (glslangIntermediate->getStage() == EShLangVertex ||
 | 
			
		||||
            glslangIntermediate->getStage() == EShLangTessControl ||
 | 
			
		||||
@ -487,8 +484,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
 | 
			
		||||
            builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer);
 | 
			
		||||
            builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
 | 
			
		||||
        }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return spv::BuiltInLayer;
 | 
			
		||||
 | 
			
		||||
    case glslang::EbvPosition:             return spv::BuiltInPosition;
 | 
			
		||||
@ -2485,10 +2480,6 @@ bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member)
 | 
			
		||||
    if (member.getFieldName() == "gl_ViewportMaskPerViewNV" &&
 | 
			
		||||
        extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end())
 | 
			
		||||
        return true;
 | 
			
		||||
    if ((member.getFieldName() == "gl_ViewportIndex" || member.getFieldName() == "gl_Layer") &&
 | 
			
		||||
        extensions.find(glslang::E_GL_ARB_shader_viewport_layer_array) == extensions.end() &&
 | 
			
		||||
        extensions.find("GL_NV_viewport_array2") == extensions.end())
 | 
			
		||||
        return true;
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
};
 | 
			
		||||
@ -2936,8 +2927,6 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList&
 | 
			
		||||
    case glslang::EbvCullDistance:
 | 
			
		||||
    case glslang::EbvPointSize:
 | 
			
		||||
#ifdef NV_EXTENSIONS
 | 
			
		||||
    case glslang::EbvLayer:
 | 
			
		||||
    case glslang::EbvViewportIndex:
 | 
			
		||||
    case glslang::EbvViewportMaskNV:
 | 
			
		||||
    case glslang::EbvSecondaryPositionNV:
 | 
			
		||||
    case glslang::EbvSecondaryViewportMaskNV:
 | 
			
		||||
 | 
			
		||||
@ -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_ViewportIndex = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -3462,7 +3462,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
 | 
			
		||||
                "in int gl_DrawIDARB;"
 | 
			
		||||
                );
 | 
			
		||||
        }
 | 
			
		||||
        if (version >= 450) {
 | 
			
		||||
        if (version >= 410) {
 | 
			
		||||
            stageBuiltins[EShLangVertex].append(
 | 
			
		||||
                "out int gl_ViewportIndex;"
 | 
			
		||||
                "out int gl_Layer;"
 | 
			
		||||
@ -3595,6 +3595,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
 | 
			
		||||
            "out int gl_PrimitiveID;"
 | 
			
		||||
            "out int gl_Layer;");
 | 
			
		||||
 | 
			
		||||
        if (version >= 150)
 | 
			
		||||
            stageBuiltins[EShLangGeometry].append(
 | 
			
		||||
            "out int gl_ViewportIndex;"
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
        if (profile == ECompatibilityProfile && version < 400)
 | 
			
		||||
            stageBuiltins[EShLangGeometry].append(
 | 
			
		||||
            "out vec4 gl_ClipVertex;"
 | 
			
		||||
@ -3604,11 +3609,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
 | 
			
		||||
            stageBuiltins[EShLangGeometry].append(
 | 
			
		||||
            "in int gl_InvocationID;"
 | 
			
		||||
            );
 | 
			
		||||
        // GL_ARB_viewport_array
 | 
			
		||||
        if (version >= 150)
 | 
			
		||||
            stageBuiltins[EShLangGeometry].append(
 | 
			
		||||
            "out int gl_ViewportIndex;"
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
#ifdef NV_EXTENSIONS
 | 
			
		||||
        if (version >= 450)
 | 
			
		||||
@ -3685,8 +3685,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
 | 
			
		||||
            stageBuiltins[EShLangTessControl].append(
 | 
			
		||||
                "float gl_CullDistance[];"
 | 
			
		||||
#ifdef NV_EXTENSIONS
 | 
			
		||||
                "int  gl_ViewportIndex;"
 | 
			
		||||
                "int  gl_Layer;"
 | 
			
		||||
                "int  gl_ViewportMask[];"             // GL_NV_viewport_array2
 | 
			
		||||
                "vec4 gl_SecondaryPositionNV;"        // GL_NV_stereo_view_rendering
 | 
			
		||||
                "int  gl_SecondaryViewportMaskNV[];"  // GL_NV_stereo_view_rendering
 | 
			
		||||
@ -3700,6 +3698,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
 | 
			
		||||
            "patch out float gl_TessLevelOuter[4];"
 | 
			
		||||
            "patch out float gl_TessLevelInner[2];"
 | 
			
		||||
            "\n");
 | 
			
		||||
 | 
			
		||||
        if (version >= 410)
 | 
			
		||||
            stageBuiltins[EShLangTessControl].append(
 | 
			
		||||
                "out int gl_ViewportIndex;"
 | 
			
		||||
                "out int gl_Layer;"
 | 
			
		||||
                "\n");
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        // Note:  "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,
 | 
			
		||||
        // as it depends on the resource sizing of gl_MaxPatchVertices.
 | 
			
		||||
@ -3771,11 +3776,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
 | 
			
		||||
            "};"
 | 
			
		||||
            "\n");
 | 
			
		||||
 | 
			
		||||
        if (version >= 450)
 | 
			
		||||
        if (version >= 410)
 | 
			
		||||
            stageBuiltins[EShLangTessEvaluation].append(
 | 
			
		||||
                "out int gl_ViewportIndex;"
 | 
			
		||||
                "out int gl_Layer;"
 | 
			
		||||
                );
 | 
			
		||||
                "\n");
 | 
			
		||||
 | 
			
		||||
#ifdef NV_EXTENSIONS
 | 
			
		||||
        if (version >= 450)
 | 
			
		||||
@ -5518,7 +5523,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
 | 
			
		||||
            symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs);
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
        if (language == EShLangVertex || language == EShLangTessEvaluation) {
 | 
			
		||||
        if (language != EShLangGeometry && version >= 410) {
 | 
			
		||||
            symbolTable.setVariableExtensions("gl_Layer",         1, &E_GL_ARB_shader_viewport_layer_array);
 | 
			
		||||
            symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &E_GL_ARB_shader_viewport_layer_array);
 | 
			
		||||
        }
 | 
			
		||||
@ -5541,8 +5546,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
 | 
			
		||||
            BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
 | 
			
		||||
            BuiltInVariable("gl_in", "gl_PositionPerViewNV",   EbvPositionPerViewNV,   symbolTable);
 | 
			
		||||
        }
 | 
			
		||||
        BuiltInVariable("gl_out", "gl_Layer",                   EbvLayer,                   symbolTable);
 | 
			
		||||
        BuiltInVariable("gl_out", "gl_ViewportIndex",           EbvViewportIndex,           symbolTable);
 | 
			
		||||
        BuiltInVariable("gl_out", "gl_ViewportMask",            EbvViewportMaskNV,          symbolTable);
 | 
			
		||||
        BuiltInVariable("gl_out", "gl_SecondaryPositionNV",     EbvSecondaryPositionNV,     symbolTable);
 | 
			
		||||
        BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);
 | 
			
		||||
 | 
			
		||||
@ -3532,14 +3532,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
 | 
			
		||||
            oldType.getQualifier().flat = newType.getQualifier().flat;
 | 
			
		||||
            oldType.getQualifier().nopersp = newType.getQualifier().nopersp;
 | 
			
		||||
 | 
			
		||||
#ifdef NV_EXTENSIONS
 | 
			
		||||
            if (member->type->getFieldName() == "gl_Layer") {
 | 
			
		||||
                if (!newType.getQualifier().layoutViewportRelative && newType.getQualifier().layoutSecondaryViewportRelativeOffset == -2048)
 | 
			
		||||
                    error(loc, "redeclaration only allowed for viewport_relative or secondary_view_offset layout", "redeclaration", member->type->getFieldName().c_str());
 | 
			
		||||
                oldType.getQualifier().layoutViewportRelative = newType.getQualifier().layoutViewportRelative;
 | 
			
		||||
                oldType.getQualifier().layoutSecondaryViewportRelativeOffset = newType.getQualifier().layoutSecondaryViewportRelativeOffset;
 | 
			
		||||
            }
 | 
			
		||||
#endif
 | 
			
		||||
            if (oldType.isImplicitlySizedArray() && newType.isExplicitlySizedArray())
 | 
			
		||||
                oldType.changeOuterArraySize(newType.getOuterArraySize());
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user