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:
John Kessenich 2017-09-13 13:22:50 -06:00
parent aab3bcffea
commit ba6a3c290e
7 changed files with 104 additions and 115 deletions

View File

@ -453,15 +453,13 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInCullDistance; return spv::BuiltInCullDistance;
case glslang::EbvViewportIndex: case glslang::EbvViewportIndex:
if (!memberDeclaration) { builder.addCapability(spv::CapabilityMultiViewport);
builder.addCapability(spv::CapabilityMultiViewport); if (glslangIntermediate->getStage() == EShLangVertex ||
if (glslangIntermediate->getStage() == EShLangVertex || glslangIntermediate->getStage() == EShLangTessControl ||
glslangIntermediate->getStage() == EShLangTessControl || glslangIntermediate->getStage() == EShLangTessEvaluation) {
glslangIntermediate->getStage() == EShLangTessEvaluation) {
builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer); builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer);
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT); builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
}
} }
return spv::BuiltInViewportIndex; return spv::BuiltInViewportIndex;
@ -478,17 +476,14 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInSampleMask; return spv::BuiltInSampleMask;
case glslang::EbvLayer: case glslang::EbvLayer:
if (!memberDeclaration) { builder.addCapability(spv::CapabilityGeometry);
builder.addCapability(spv::CapabilityGeometry); if (glslangIntermediate->getStage() == EShLangVertex ||
if (glslangIntermediate->getStage() == EShLangVertex || glslangIntermediate->getStage() == EShLangTessControl ||
glslangIntermediate->getStage() == EShLangTessControl || glslangIntermediate->getStage() == EShLangTessEvaluation) {
glslangIntermediate->getStage() == EShLangTessEvaluation) {
builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer); builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer);
builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT); builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
}
} }
return spv::BuiltInLayer; return spv::BuiltInLayer;
case glslang::EbvPosition: return spv::BuiltInPosition; case glslang::EbvPosition: return spv::BuiltInPosition;
@ -2485,10 +2480,6 @@ bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member)
if (member.getFieldName() == "gl_ViewportMaskPerViewNV" && if (member.getFieldName() == "gl_ViewportMaskPerViewNV" &&
extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end()) extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end())
return true; 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; return false;
}; };
@ -2936,8 +2927,6 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList&
case glslang::EbvCullDistance: case glslang::EbvCullDistance:
case glslang::EbvPointSize: case glslang::EbvPointSize:
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS
case glslang::EbvLayer:
case glslang::EbvViewportIndex:
case glslang::EbvViewportMaskNV: case glslang::EbvViewportMaskNV:
case glslang::EbvSecondaryPositionNV: case glslang::EbvSecondaryPositionNV:
case glslang::EbvSecondaryViewportMaskNV: case glslang::EbvSecondaryViewportMaskNV:

View File

@ -3,81 +3,84 @@ spv.stereoViewRendering.tesc
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 38 // Id's are bound by 38
Capability Geometry
Capability Tessellation Capability Tessellation
Capability ShaderViewportIndexLayerNV
Capability ShaderViewportMaskNV Capability ShaderViewportMaskNV
Capability ShaderStereoViewNV Capability ShaderStereoViewNV
Extension "SPV_EXT_shader_viewport_index_layer"
Extension "SPV_NV_stereo_view_rendering" Extension "SPV_NV_stereo_view_rendering"
Extension "SPV_NV_viewport_array2" Extension "SPV_NV_viewport_array2"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 16 18 32 EntryPoint TessellationControl 4 "main" 16 18 31 37
ExecutionMode 4 OutputVertices 4 ExecutionMode 4 OutputVertices 4
Source GLSL 450 Source GLSL 450
SourceExtension "GL_NV_stereo_view_rendering" SourceExtension "GL_NV_stereo_view_rendering"
SourceExtension "GL_NV_viewport_array2" SourceExtension "GL_NV_viewport_array2"
Name 4 "main" Name 4 "main"
Name 12 "gl_PerVertex" Name 12 "gl_PerVertex"
MemberName 12(gl_PerVertex) 0 "gl_Layer" MemberName 12(gl_PerVertex) 0 "gl_SecondaryPositionNV"
MemberName 12(gl_PerVertex) 1 "gl_SecondaryPositionNV" MemberName 12(gl_PerVertex) 1 "gl_SecondaryViewportMaskNV"
MemberName 12(gl_PerVertex) 2 "gl_SecondaryViewportMaskNV"
Name 16 "gl_out" Name 16 "gl_out"
Name 18 "gl_InvocationID" Name 18 "gl_InvocationID"
Name 28 "gl_PerVertex" Name 27 "gl_PerVertex"
MemberName 28(gl_PerVertex) 0 "gl_Position" MemberName 27(gl_PerVertex) 0 "gl_Position"
MemberName 28(gl_PerVertex) 1 "gl_PointSize" MemberName 27(gl_PerVertex) 1 "gl_PointSize"
MemberName 28(gl_PerVertex) 2 "gl_ClipDistance" MemberName 27(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 28(gl_PerVertex) 3 "gl_CullDistance" MemberName 27(gl_PerVertex) 3 "gl_CullDistance"
MemberName 28(gl_PerVertex) 4 "gl_SecondaryPositionNV" MemberName 27(gl_PerVertex) 4 "gl_SecondaryPositionNV"
Name 32 "gl_in" Name 31 "gl_in"
MemberDecorate 12(gl_PerVertex) 0 BuiltIn Layer Name 37 "gl_Layer"
MemberDecorate 12(gl_PerVertex) 0 ViewportRelativeNV MemberDecorate 12(gl_PerVertex) 0 BuiltIn SecondaryPositionNV
MemberDecorate 12(gl_PerVertex) 0 SecondaryViewportRelativeNV 1 MemberDecorate 12(gl_PerVertex) 1 BuiltIn SecondaryViewportMaskNV
MemberDecorate 12(gl_PerVertex) 1 BuiltIn SecondaryPositionNV
MemberDecorate 12(gl_PerVertex) 2 BuiltIn SecondaryViewportMaskNV
Decorate 12(gl_PerVertex) Block Decorate 12(gl_PerVertex) Block
Decorate 18(gl_InvocationID) BuiltIn InvocationId Decorate 18(gl_InvocationID) BuiltIn InvocationId
MemberDecorate 28(gl_PerVertex) 0 BuiltIn Position MemberDecorate 27(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 28(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 27(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 28(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 27(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 28(gl_PerVertex) 3 BuiltIn CullDistance MemberDecorate 27(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 28(gl_PerVertex) Block Decorate 27(gl_PerVertex) Block
Decorate 37(gl_Layer) BuiltIn Layer
Decorate 37(gl_Layer) ViewportRelativeNV
Decorate 37(gl_Layer) SecondaryViewportRelativeNV 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeFloat 32
7: TypeFloat 32 7: TypeVector 6(float) 4
8: TypeVector 7(float) 4 8: TypeInt 32 1
9: TypeInt 32 0 9: TypeInt 32 0
10: 9(int) Constant 2 10: 9(int) Constant 2
11: TypeArray 6(int) 10 11: TypeArray 8(int) 10
12(gl_PerVertex): TypeStruct 6(int) 8(fvec4) 11 12(gl_PerVertex): TypeStruct 7(fvec4) 11
13: 9(int) Constant 4 13: 9(int) Constant 4
14: TypeArray 12(gl_PerVertex) 13 14: TypeArray 12(gl_PerVertex) 13
15: TypePointer Output 14 15: TypePointer Output 14
16(gl_out): 15(ptr) Variable Output 16(gl_out): 15(ptr) Variable Output
17: TypePointer Input 6(int) 17: TypePointer Input 8(int)
18(gl_InvocationID): 17(ptr) Variable Input 18(gl_InvocationID): 17(ptr) Variable Input
20: 6(int) Constant 2 20: 8(int) Constant 1
21: 6(int) Constant 0 21: 8(int) Constant 0
22: 6(int) Constant 1 22: TypePointer Output 8(int)
23: TypePointer Output 6(int) 25: 9(int) Constant 1
26: 9(int) Constant 1 26: TypeArray 6(float) 25
27: TypeArray 7(float) 26 27(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 26 26 7(fvec4)
28(gl_PerVertex): TypeStruct 8(fvec4) 7(float) 27 27 8(fvec4) 28: 9(int) Constant 32
29: 9(int) Constant 32 29: TypeArray 27(gl_PerVertex) 28
30: TypeArray 28(gl_PerVertex) 29 30: TypePointer Input 29
31: TypePointer Input 30 31(gl_in): 30(ptr) Variable Input
32(gl_in): 31(ptr) Variable Input 32: TypePointer Input 7(fvec4)
33: TypePointer Input 8(fvec4) 35: TypePointer Output 7(fvec4)
36: TypePointer Output 8(fvec4) 37(gl_Layer): 22(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
19: 6(int) Load 18(gl_InvocationID) 19: 8(int) Load 18(gl_InvocationID)
24: 23(ptr) AccessChain 16(gl_out) 19 20 21 23: 22(ptr) AccessChain 16(gl_out) 19 20 21
Store 24 22 Store 23 20
25: 6(int) Load 18(gl_InvocationID) 24: 8(int) Load 18(gl_InvocationID)
34: 33(ptr) AccessChain 32(gl_in) 22 21 33: 32(ptr) AccessChain 31(gl_in) 20 21
35: 8(fvec4) Load 34 34: 7(fvec4) Load 33
37: 36(ptr) AccessChain 16(gl_out) 25 22 36: 35(ptr) AccessChain 16(gl_out) 24 21
Store 37 35 Store 36 34
Return Return
FunctionEnd FunctionEnd

View File

@ -3,6 +3,7 @@ spv.viewportArray2.tesc
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 25 // Id's are bound by 25
Capability Geometry
Capability Tessellation Capability Tessellation
Capability MultiViewport Capability MultiViewport
Capability ShaderViewportIndexLayerNV Capability ShaderViewportIndexLayerNV
@ -11,47 +12,47 @@ spv.viewportArray2.tesc
Extension "SPV_NV_viewport_array2" Extension "SPV_NV_viewport_array2"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 14 16 EntryPoint TessellationControl 4 "main" 14 16 22 24
ExecutionMode 4 OutputVertices 4 ExecutionMode 4 OutputVertices 4
Source GLSL 450 Source GLSL 450
SourceExtension "GL_NV_viewport_array2" SourceExtension "GL_NV_viewport_array2"
Name 4 "main" Name 4 "main"
Name 10 "gl_PerVertex" Name 10 "gl_PerVertex"
MemberName 10(gl_PerVertex) 0 "gl_ViewportIndex" MemberName 10(gl_PerVertex) 0 "gl_ViewportMask"
MemberName 10(gl_PerVertex) 1 "gl_Layer"
MemberName 10(gl_PerVertex) 2 "gl_ViewportMask"
Name 14 "gl_out" Name 14 "gl_out"
Name 16 "gl_InvocationID" Name 16 "gl_InvocationID"
MemberDecorate 10(gl_PerVertex) 0 BuiltIn ViewportIndex Name 22 "gl_ViewportIndex"
MemberDecorate 10(gl_PerVertex) 1 BuiltIn Layer Name 24 "gl_Layer"
MemberDecorate 10(gl_PerVertex) 1 ViewportRelativeNV MemberDecorate 10(gl_PerVertex) 0 BuiltIn ViewportMaskNV
MemberDecorate 10(gl_PerVertex) 2 BuiltIn ViewportMaskNV
Decorate 10(gl_PerVertex) Block Decorate 10(gl_PerVertex) Block
Decorate 16(gl_InvocationID) BuiltIn InvocationId 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 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
7: TypeInt 32 0 7: TypeInt 32 0
8: 7(int) Constant 2 8: 7(int) Constant 2
9: TypeArray 6(int) 8 9: TypeArray 6(int) 8
10(gl_PerVertex): TypeStruct 6(int) 6(int) 9 10(gl_PerVertex): TypeStruct 9
11: 7(int) Constant 4 11: 7(int) Constant 4
12: TypeArray 10(gl_PerVertex) 11 12: TypeArray 10(gl_PerVertex) 11
13: TypePointer Output 12 13: TypePointer Output 12
14(gl_out): 13(ptr) Variable Output 14(gl_out): 13(ptr) Variable Output
15: TypePointer Input 6(int) 15: TypePointer Input 6(int)
16(gl_InvocationID): 15(ptr) Variable Input 16(gl_InvocationID): 15(ptr) Variable Input
18: 6(int) Constant 2 18: 6(int) Constant 0
19: 6(int) Constant 0 19: 6(int) Constant 1
20: 6(int) Constant 1 20: TypePointer Output 6(int)
21: 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 4(main): 2 Function None 3
5: Label 5: Label
17: 6(int) Load 16(gl_InvocationID) 17: 6(int) Load 16(gl_InvocationID)
22: 21(ptr) AccessChain 14(gl_out) 17 18 19 21: 20(ptr) AccessChain 14(gl_out) 17 18 18
Store 22 20 Store 21 19
23: 6(int) Load 16(gl_InvocationID) Store 22(gl_ViewportIndex) 23
24: 21(ptr) AccessChain 14(gl_out) 23 19
Store 24 18
Return Return
FunctionEnd FunctionEnd

View File

@ -8,9 +8,10 @@ layout(vertices = 4) out;
out gl_PerVertex { out gl_PerVertex {
int gl_SecondaryViewportMaskNV[2]; int gl_SecondaryViewportMaskNV[2];
vec4 gl_SecondaryPositionNV; vec4 gl_SecondaryPositionNV;
layout (viewport_relative, secondary_view_offset = 1) out highp int gl_Layer;
} gl_out[4]; } gl_out[4];
layout (viewport_relative, secondary_view_offset = 1) out highp int gl_Layer;
void main() void main()
{ {
gl_out[gl_InvocationID].gl_SecondaryViewportMaskNV[0] = 1; gl_out[gl_InvocationID].gl_SecondaryViewportMaskNV[0] = 1;

View File

@ -5,12 +5,12 @@ layout(vertices = 4) out;
out gl_PerVertex { out gl_PerVertex {
int gl_ViewportMask[2]; int gl_ViewportMask[2];
int gl_ViewportIndex;
layout (viewport_relative) out highp int gl_Layer;
} gl_out[4]; } gl_out[4];
layout (viewport_relative) out highp int gl_Layer;
void main() void main()
{ {
gl_out[gl_InvocationID].gl_ViewportMask[0] = 1; gl_out[gl_InvocationID].gl_ViewportMask[0] = 1;
gl_out[gl_InvocationID].gl_ViewportIndex = 2; gl_ViewportIndex = 2;
} }

View File

@ -3462,7 +3462,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in int gl_DrawIDARB;" "in int gl_DrawIDARB;"
); );
} }
if (version >= 450) { if (version >= 410) {
stageBuiltins[EShLangVertex].append( stageBuiltins[EShLangVertex].append(
"out int gl_ViewportIndex;" "out int gl_ViewportIndex;"
"out int gl_Layer;" "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_PrimitiveID;"
"out int gl_Layer;"); "out int gl_Layer;");
if (version >= 150)
stageBuiltins[EShLangGeometry].append(
"out int gl_ViewportIndex;"
);
if (profile == ECompatibilityProfile && version < 400) if (profile == ECompatibilityProfile && version < 400)
stageBuiltins[EShLangGeometry].append( stageBuiltins[EShLangGeometry].append(
"out vec4 gl_ClipVertex;" "out vec4 gl_ClipVertex;"
@ -3604,11 +3609,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangGeometry].append( stageBuiltins[EShLangGeometry].append(
"in int gl_InvocationID;" "in int gl_InvocationID;"
); );
// GL_ARB_viewport_array
if (version >= 150)
stageBuiltins[EShLangGeometry].append(
"out int gl_ViewportIndex;"
);
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS
if (version >= 450) if (version >= 450)
@ -3685,8 +3685,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangTessControl].append( stageBuiltins[EShLangTessControl].append(
"float gl_CullDistance[];" "float gl_CullDistance[];"
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS
"int gl_ViewportIndex;"
"int gl_Layer;"
"int gl_ViewportMask[];" // GL_NV_viewport_array2 "int gl_ViewportMask[];" // GL_NV_viewport_array2
"vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering "vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
"int gl_SecondaryViewportMaskNV[];" // 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_TessLevelOuter[4];"
"patch out float gl_TessLevelInner[2];" "patch out float gl_TessLevelInner[2];"
"\n"); "\n");
if (version >= 410)
stageBuiltins[EShLangTessControl].append(
"out int gl_ViewportIndex;"
"out int gl_Layer;"
"\n");
} else { } else {
// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below, // Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,
// as it depends on the resource sizing of gl_MaxPatchVertices. // 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"); "\n");
if (version >= 450) if (version >= 410)
stageBuiltins[EShLangTessEvaluation].append( stageBuiltins[EShLangTessEvaluation].append(
"out int gl_ViewportIndex;" "out int gl_ViewportIndex;"
"out int gl_Layer;" "out int gl_Layer;"
); "\n");
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS
if (version >= 450) if (version >= 450)
@ -5518,7 +5523,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs); symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs);
} }
#else #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_Layer", 1, &E_GL_ARB_shader_viewport_layer_array);
symbolTable.setVariableExtensions("gl_ViewportIndex", 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_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, 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_ViewportMask", EbvViewportMaskNV, symbolTable);
BuiltInVariable("gl_out", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable); BuiltInVariable("gl_out", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable); BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);

View File

@ -3532,14 +3532,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
oldType.getQualifier().flat = newType.getQualifier().flat; oldType.getQualifier().flat = newType.getQualifier().flat;
oldType.getQualifier().nopersp = newType.getQualifier().nopersp; 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()) if (oldType.isImplicitlySizedArray() && newType.isExplicitlySizedArray())
oldType.changeOuterArraySize(newType.getOuterArraySize()); oldType.changeOuterArraySize(newType.getOuterArraySize());