#version 330 compatibility
in vec4 inVar;
-out vec4 outVar;
+layout(location=0, index=0) out vec4 outVar;
varying vec4 varyingVar;
vec4 j; // gets location 43
vec4 k; // ERROR, location 44 already used
};
+
+layout(index=0) out vec4 outVar2; // ERROR: missing explicit location
+layout(location=0, index=1) out vec4 outVar3; // no error even though location is overlapping
+layout(location=0, index=1) out vec4 outVar4; // ERROR overlapping
+layout(location=27, index=0) in vec4 indexIn; // ERROR, not on in
+layout(location=0, index=0) in; // ERROR, not just on in
+layout(location=0, index=0) out; // ERROR, need a variable
+layout(location=26, index=0) out indexBlock { int a; } indexBlockI; // ERROR, not on a block
\ No newline at end of file
i1 = findMSB(i1);\r
i2 = findMSB(u2);\r
}\r
+\r
+layout(location = 7, index = 1) out vec4 indexedOut;\r
const int start2 = 5;\r
layout(location = start2 * start2 - 2 - 4) in vec4 v6;\r
\r
-layout(location = 28) in inblock2 {\r
+layout(location = 28) in inblock2 { // ERROR, input block in vertex shader, other errors are valid checks still...\r
bool b1;\r
float f1;\r
layout(location = 25) float f2;\r
} ininst2;\r
\r
-in ublock4 {\r
+in ublock4 { // ERROR, input block in vertex shader, other errors are valid checks still...\r
layout(location = 50) float f1;\r
layout(location = 51) float f2;\r
} in4;\r
ERROR: 0:24: 'location qualifier on input' : not supported for this version or the enabled extensions \r
ERROR: 0:26: 'location' : not supported for this version or the enabled extensions \r
ERROR: 0:26: 'location qualifier on output' : not supported for this version or the enabled extensions \r
-WARNING: 0:28: '#extension' : extension is only partially supported: GL_ARB_explicit_attrib_location\r
ERROR: 0:38: 'assign' : l-value required "v" (can't modify shader input)\r
ERROR: 0:38: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters. \r
ERROR: 8 compilation errors. No code generated.\r
ERROR: 0:23: 'gl_Position' : identifiers starting with "gl_" are reserved \r
ERROR: 0:25: 'location' : not supported for this version or the enabled extensions \r
ERROR: 0:25: 'location qualifier on input' : not supported for this version or the enabled extensions \r
-WARNING: 0:27: '#extension' : extension is only partially supported: GL_ARB_explicit_attrib_location\r
ERROR: 0:34: 'redeclaration' : cannot change storage, memory, or auxiliary qualification of gl_Position\r
ERROR: 0:34: 'redeclaration' : cannot change interpolation qualification of gl_Position\r
ERROR: 0:35: 'redeclaration' : cannot change the type of gl_Position\r
ERROR: 0:94: 'location' : either the block needs a location, or all members need a location, or no members have a location \r
ERROR: 0:108: 'A' : cannot use layout qualifiers on structure members \r
ERROR: 0:119: 'location' : overlapping use of location 44\r
-ERROR: 27 compilation errors. No code generated.\r
+ERROR: 0:122: 'index' : can only be used with an explicit location \r
+ERROR: 0:124: 'location' : overlapping use of location 0\r
+ERROR: 0:125: 'index' : can only be used on an output \r
+ERROR: 0:126: 'index' : can only be used on an output \r
+ERROR: 0:126: 'location/component/index' : cannot declare a default, use a full declaration \r
+ERROR: 0:127: 'location/component/index' : cannot declare a default, use a full declaration \r
+ERROR: 0:128: 'out' : cannot declare an output block in a fragment shader \r
+ERROR: 34 compilation errors. No code generated.\r
\r
\r
Shader version: 330\r
0:23 Constant:\r
0:23 2 (const uint)\r
0:24 move second child to first child (4-component vector of float)\r
-0:24 'outVar' (out 4-component vector of float)\r
+0:24 'outVar' (layout(location=0 index=0 ) out 4-component vector of float)\r
0:24 'inVar' (smooth in 4-component vector of float)\r
0:? Linker Objects\r
0:? 'inVar' (smooth in 4-component vector of float)\r
-0:? 'outVar' (out 4-component vector of float)\r
+0:? 'outVar' (layout(location=0 index=0 ) out 4-component vector of float)\r
0:? 'varyingVar' (smooth in 4-component vector of float)\r
0:? 'anon@0' (in block{in 4-component vector of float gl_Color, })\r
0:? 'gl_name' (in block{in int gl_i})\r
0:? 'in4' (in block{layout(location=50 ) in float f1, layout(location=51 ) in float f2})\r
0:? 's' (layout(location=33 ) smooth in structure{3-component vector of float a, 2X2 matrix of float b, 2-element array of 4-component vector of float c, 2-component vector of float A})\r
0:? 'anon@2' (in block{layout(location=44 component=0 ) in 4-component vector of float d, layout(location=45 component=0 ) in 4-component vector of float e, layout(location=47 ) in 4-component vector of float f, layout(location=48 component=0 ) in 4-component vector of float g, layout(location=41 ) in 4-component vector of float h, layout(location=42 component=0 ) in 4-component vector of float i, layout(location=43 component=0 ) in 4-component vector of float j, layout(location=44 component=0 ) in 4-component vector of float k})\r
+0:? 'outVar2' (layout(location=63 index=0 ) out 4-component vector of float)\r
+0:? 'outVar3' (layout(location=0 index=1 ) out 4-component vector of float)\r
+0:? 'outVar4' (layout(location=0 index=1 ) out 4-component vector of float)\r
+0:? 'indexIn' (layout(location=27 index=0 ) smooth in 4-component vector of float)\r
+0:? 'indexBlockI' (layout(location=26 index=0 ) out block{out int a})\r
\r
\r
Linked fragment stage:\r
0:23 Constant:\r
0:23 2 (const uint)\r
0:24 move second child to first child (4-component vector of float)\r
-0:24 'outVar' (out 4-component vector of float)\r
+0:24 'outVar' (layout(location=0 index=0 ) out 4-component vector of float)\r
0:24 'inVar' (smooth in 4-component vector of float)\r
0:? Linker Objects\r
0:? 'inVar' (smooth in 4-component vector of float)\r
-0:? 'outVar' (out 4-component vector of float)\r
+0:? 'outVar' (layout(location=0 index=0 ) out 4-component vector of float)\r
0:? 'varyingVar' (smooth in 4-component vector of float)\r
0:? 'anon@0' (in block{in 4-component vector of float gl_Color, })\r
0:? 'gl_name' (in block{in int gl_i})\r
0:? 'in4' (in block{layout(location=50 ) in float f1, layout(location=51 ) in float f2})\r
0:? 's' (layout(location=33 ) smooth in structure{3-component vector of float a, 2X2 matrix of float b, 2-element array of 4-component vector of float c, 2-component vector of float A})\r
0:? 'anon@2' (in block{layout(location=44 component=0 ) in 4-component vector of float d, layout(location=45 component=0 ) in 4-component vector of float e, layout(location=47 ) in 4-component vector of float f, layout(location=48 component=0 ) in 4-component vector of float g, layout(location=41 ) in 4-component vector of float h, layout(location=42 component=0 ) in 4-component vector of float i, layout(location=43 component=0 ) in 4-component vector of float j, layout(location=44 component=0 ) in 4-component vector of float k})\r
+0:? 'outVar2' (layout(location=63 index=0 ) out 4-component vector of float)\r
+0:? 'outVar3' (layout(location=0 index=1 ) out 4-component vector of float)\r
+0:? 'outVar4' (layout(location=0 index=1 ) out 4-component vector of float)\r
+0:? 'indexIn' (layout(location=27 index=0 ) smooth in 4-component vector of float)\r
+0:? 'indexBlockI' (layout(location=26 index=0 ) out block{out int a})\r
\r
ERROR: 0:65: 'invocations' : can only apply to 'in' \r
ERROR: 0:67: 'in' : type must be an array: inbls\r
ERROR: 0:71: 'triangles' : inconsistent input primitive for array size of inbla\r
-ERROR: 18 compilation errors. No code generated.\r
+ERROR: 0:103: 'index' : there is no such layout identifier for this stage taking an assigned value \r
+ERROR: 19 compilation errors. No code generated.\r
\r
\r
Shader version: 400\r
0:? 'scalar' (in float)\r
0:? 'inbls' (in block{in int a})\r
0:? 'inbla' (in 17-element array of block{in int a})\r
+0:? 'indexedOut' (layout(location=7 stream=0 ) out 4-component vector of float)\r
\r
\r
Linked geometry stage:\r
0:? 'scalar' (in float)\r
0:? 'inbls' (in block{in int a})\r
0:? 'inbla' (in 17-element array of block{in int a})\r
+0:? 'indexedOut' (layout(location=7 stream=0 ) out 4-component vector of float)\r
\r
ERROR: 0:62: 'xxxxx' : illegal vector field selection \r
ERROR: 0:63: 'xxy' : vector field selection out of range \r
ERROR: 0:66: 'binding' : cannot declare a default, include a type or full declaration \r
-ERROR: 0:69: 'location' : cannot declare a default, use a full declaration \r
+ERROR: 0:69: 'location/component/index' : cannot declare a default, use a full declaration \r
+ERROR: 0:70: 'in' : cannot declare an input block in a vertex shader \r
ERROR: 0:70: 'binding' : requires uniform or buffer storage qualifier \r
ERROR: 0:71: 'binding' : binding is too large \r
ERROR: 0:74: 'binding' : sampler binding not less than gl_MaxCombinedTextureImageUnits \r
ERROR: 0:143: 'rgba32ui' : does not apply to signed integer images \r
ERROR: 0:144: 'r8ui' : does not apply to signed integer images \r
ERROR: 0:147: 'offset on block member' : not supported for this version or the enabled extensions \r
-ERROR: 47 compilation errors. No code generated.\r
+ERROR: 48 compilation errors. No code generated.\r
\r
\r
Shader version: 420\r
430.vert\r
Warning, version 430 is not yet complete; most version-specific features are present, but some are missing.\r
ERROR: 0:3: 'location' : can only appy to uniform, buffer, in, or out storage qualifiers \r
+ERROR: 0:7: 'in' : cannot declare an input block in a vertex shader \r
ERROR: 0:7: 'location qualifier on in/out block' : not supported for this version or the enabled extensions \r
ERROR: 0:8: 'location qualifier on in/out block' : not supported for this version or the enabled extensions \r
ERROR: 0:21: 'g' : cannot use storage or interpolation qualifiers on structure members \r
ERROR: 0:51: 'start' : undeclared identifier \r
ERROR: 0:51: '' : constant expression required \r
ERROR: 0:51: 'layout-id value' : scalar integer expression required \r
+ERROR: 0:53: 'in' : cannot declare an input block in a vertex shader \r
ERROR: 0:54: 'location on block member' : not supported for this version or the enabled extensions \r
+ERROR: 0:57: 'in' : cannot declare an input block in a vertex shader \r
ERROR: 0:58: 'location on block member' : not supported for this version or the enabled extensions \r
ERROR: 0:59: 'location on block member' : not supported for this version or the enabled extensions \r
ERROR: 0:62: 'uniform buffer-member align' : not supported for this version or the enabled extensions \r
ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions \r
ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions \r
ERROR: 0:93: 'transform feedback qualifier' : not supported for this version or the enabled extensions \r
+ERROR: 0:117: 'in' : cannot declare an input block in a vertex shader \r
+ERROR: 0:123: 'in' : cannot declare an input block in a vertex shader \r
ERROR: 0:146: 'shared' : not supported in this stage: vertex\r
ERROR: 0:150: 'barrier' : no matching overloaded function found \r
ERROR: 0:154: 'memoryBarrierShared' : no matching overloaded function found \r
ERROR: 0:169: 'textureSamples and imageSamples' : not supported for this version or the enabled extensions \r
ERROR: 0:170: 'textureSamples and imageSamples' : not supported for this version or the enabled extensions \r
ERROR: 0:171: 'textureSamples and imageSamples' : not supported for this version or the enabled extensions \r
-ERROR: 53 compilation errors. No code generated.\r
+ERROR: 58 compilation errors. No code generated.\r
\r
\r
Shader version: 430\r
ERROR: 0:37: 'offset' : only applies to block members, not blocks \r
ERROR: 0:38: 'layout' : offset/align can only be used on a uniform or buffer \r
ERROR: 0:38: 'offset' : only applies to block members, not blocks \r
+ERROR: 0:39: 'out' : cannot declare an output block in a fragment shader \r
ERROR: 0:39: 'layout' : offset/align can only be used on a uniform or buffer \r
ERROR: 0:39: 'offset' : only applies to block members, not blocks \r
ERROR: 0:42: 'offset/align' : can only be used with std140 or std430 layout packing \r
ERROR: 0:43: 'offset/align' : can only be used with std140 or std430 layout packing \r
ERROR: 0:43: 'layout' : offset/align can only be used on a uniform or buffer \r
+ERROR: 0:44: 'out' : cannot declare an output block in a fragment shader \r
ERROR: 0:44: 'offset/align' : can only be used with std140 or std430 layout packing \r
ERROR: 0:44: 'layout' : offset/align can only be used on a uniform or buffer \r
ERROR: 0:46: 'offset' : cannot specify on a variable declaration \r
ERROR: 0:103: 'align' : must be a power of 2 \r
ERROR: 0:102: 'offset' : cannot lie in previous members \r
ERROR: 0:104: 'offset' : must be a multiple of the member's alignment \r
-ERROR: 45 compilation errors. No code generated.\r
+ERROR: 47 compilation errors. No code generated.\r
\r
\r
Shader version: 440\r
ERROR: 0:55: 'component' : type overflows the available 4 components \r
ERROR: 0:57: 'component' : cannot apply to a matrix, structure, or block \r
ERROR: 0:58: 'component' : cannot apply to a matrix, structure, or block \r
-ERROR: 0:61: 'location' : cannot declare a default, use a full declaration \r
+ERROR: 0:61: 'location/component/index' : cannot declare a default, use a full declaration \r
ERROR: 0:81: 'xfb layout qualifier' : can only be used on an output \r
ERROR: 0:87: 'xfb_offset' : cannot declare a default, use a full declaration \r
ERROR: 0:97: 'xfb_buffer' : member cannot contradict block (or what block inherited from global) \r
ERROR: 0:99: 'local_size_y' : there is no such layout identifier for this stage taking an assigned value \r
ERROR: 0:100: 'local_size_x' : there is no such layout identifier for this stage taking an assigned value \r
ERROR: 0:102: 'color' : redefinition \r
-ERROR: 0:103: 'index' : there is no such layout identifier for this stage taking an assigned value \r
-ERROR: 0:104: 'location' : overlapping use of location 3\r
ERROR: 0:112: 'redeclaration' : all redeclarations must use the same depth layout on gl_FragDepth\r
ERROR: 0:118: 'redeclaration' : all redeclarations must use the same depth layout on gl_FragDepth\r
ERROR: 0:121: 'redeclaration' : all redeclarations must use the same depth layout on gl_FragDepth\r
ERROR: 0:227: 'in' : not allowed in nested scope \r
ERROR: 0:228: 'in' : not allowed in nested scope \r
ERROR: 0:232: 'out' : not allowed in nested scope \r
-ERROR: 43 compilation errors. No code generated.\r
+ERROR: 41 compilation errors. No code generated.\r
\r
\r
Shader version: 430\r
0:? 'Materiala' (in block{in 4-component vector of float Color, in 2-component vector of float TexCoord})\r
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float)\r
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float)\r
-0:? 'factor' (layout(location=3 ) out 4-component vector of float)\r
+0:? 'factor' (layout(location=3 index=1 ) out 4-component vector of float)\r
0:? 'colors' (layout(location=2 ) out 3-element array of 4-component vector of float)\r
0:? 'gl_FragDepth' (gl_FragDepth float)\r
0:? 'gl_FragDepth' (gl_FragDepth float)\r
0:? 'Materiala' (in block{in 4-component vector of float Color, in 2-component vector of float TexCoord})\r
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float)\r
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float)\r
-0:? 'factor' (layout(location=3 ) out 4-component vector of float)\r
+0:? 'factor' (layout(location=3 index=1 ) out 4-component vector of float)\r
0:? 'colors' (layout(location=2 ) out 3-element array of 4-component vector of float)\r
0:? 'gl_FragDepth' (gl_FragDepth float)\r
0:? 'gl_FragDepth' (gl_FragDepth float)\r
+ Add built-in functions to pack/unpack 16 bit floating-point numbers (ARB_shading_language_pack2f).
+ packHalf2x16 and unpackHalf2x16
+ packSnorm2x16and unpackSnorm2x16
- - Add gl_FragDepth layout qualifiers to communicate what kind of changes will be made to gl_FragDepth (GL_AMD_conservative depth).
+ + Add gl_FragDepth layout qualifiers to communicate what kind of changes will be made to gl_FragDepth (GL_AMD_conservative depth).
+ Add C-style curly brace initializer lists syntax for initializers. Full initialization of aggregates is required when these are used.
+ Allow .length() to be applied to vectors and matrices, returning the number of components or columns.
+ Clarify that .length() returns an int type and can be used as a constant integer expression.
layoutLocation = layoutLocationEnd;
layoutComponent = layoutComponentEnd;
layoutBinding = layoutBindingEnd;
+ layoutIndex = layoutIndexEnd;
+
layoutStream = layoutStreamEnd;
layoutXfbBuffer = layoutXfbBufferEnd;
bool hasLayout() const
{
return hasUniformLayout() ||
- hasLocation() ||
+ hasAnyLocation() ||
hasBinding() ||
hasStream() ||
hasXfb() ||
unsigned int layoutBinding : 8;
static const unsigned int layoutBindingEnd = 0xFF;
+ unsigned int layoutIndex : 8;
+ static const unsigned int layoutIndexEnd = 0xFF;
+
unsigned int layoutStream : 8;
static const unsigned int layoutStreamEnd = 0xFF;
{
return layoutAlign != -1;
}
+ bool hasAnyLocation() const
+ {
+ return hasLocation() ||
+ hasComponent() ||
+ hasIndex();
+ }
bool hasLocation() const
{
- return layoutLocation != layoutLocationEnd ||
- layoutComponent != layoutComponentEnd;
+ return layoutLocation != layoutLocationEnd;
}
bool hasComponent() const
{
return layoutComponent != layoutComponentEnd;
}
+ bool hasIndex() const
+ {
+ return layoutIndex != layoutIndexEnd;
+ }
bool hasBinding() const
{
return layoutBinding != layoutBindingEnd;
noXfbBuffer.layoutXfbBuffer = TQualifier::layoutXfbBufferEnd;
if (noXfbBuffer.hasLayout()) {
p += snprintf(p, end - p, "layout(");
- if (qualifier.hasLocation()) {
+ if (qualifier.hasAnyLocation()) {
p += snprintf(p, end - p, "location=%d ", qualifier.layoutLocation);
- if (qualifier.layoutComponent != qualifier.layoutComponentEnd)
+ if (qualifier.hasComponent())
p += snprintf(p, end - p, "component=%d ", qualifier.layoutComponent);
+ if (qualifier.hasIndex())
+ p += snprintf(p, end - p, "index=%d ", qualifier.layoutIndex);
}
if (qualifier.hasBinding())
p += snprintf(p, end - p, "binding=%d ", qualifier.layoutBinding);
break;
case EShLangFragment:
+ if (id == "index") {
+ requireProfile(loc, ECompatibilityProfile | ECoreProfile, "index layout qualifier on fragment output");
+ const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
+ profileRequires(loc, ECompatibilityProfile | ECoreProfile, 330, 2, exts, "index layout qualifier on fragment output");
+ publicType.qualifier.layoutIndex = value;
+ return;
+ }
break;
case EShLangCompute:
dst.layoutAlign = src.layoutAlign;
if (! inheritOnly) {
- if (src.layoutLocation != TQualifier::layoutLocationEnd)
+ if (src.hasLocation())
dst.layoutLocation = src.layoutLocation;
- if (src.layoutComponent != TQualifier::layoutComponentEnd)
+ if (src.hasComponent())
dst.layoutComponent = src.layoutComponent;
-
+ if (src.hasIndex())
+ dst.layoutIndex = src.layoutIndex;
+
if (src.hasOffset())
dst.layoutOffset = src.layoutOffset;
// now, any remaining error checking based on the object itself
- if (qualifier.hasLocation()) {
+ if (qualifier.hasAnyLocation()) {
switch (qualifier.storage) {
case EvqUniform:
case EvqBuffer:
// now, error checking combining type and qualifier
- if (qualifier.hasLocation()) {
- if (qualifier.layoutComponent != TQualifier::layoutComponentEnd) {
+ if (qualifier.hasAnyLocation()) {
+ if (qualifier.hasLocation()) {
+ if (qualifier.storage == EvqVaryingOut && language == EShLangFragment) {
+ if (qualifier.layoutLocation >= (unsigned int)resources.maxDrawBuffers)
+ error(loc, "too large for fragment output", "location", "");
+ }
+ }
+ if (qualifier.hasComponent()) {
// "It is a compile-time error if this sequence of components gets larger than 3."
if (qualifier.layoutComponent + type.getVectorSize() > 4)
error(loc, "type overflows the available 4 components", "component", "");
error(loc, "cannot apply to a matrix, structure, or block", "component", "");
}
- if (qualifier.storage == EvqVaryingOut && language == EShLangFragment) {
- if (qualifier.layoutLocation >= (unsigned int)resources.maxDrawBuffers)
- error(loc, "too large for fragment output", "location", "");
- }
-
switch (qualifier.storage) {
case EvqVaryingIn:
case EvqVaryingOut:
error(loc, "cannot apply layout qualifiers to a shared variable", "shared", "");
// "It is a compile-time error to use *component* without also specifying the location qualifier (order does not matter)."
- if (qualifier.layoutComponent != TQualifier::layoutComponentEnd && qualifier.layoutLocation == TQualifier::layoutLocationEnd)
+ if (qualifier.hasComponent() && ! qualifier.hasLocation())
error(loc, "must specify 'location' to use 'component'", "component", "");
- if (qualifier.hasLocation()) {
+ if (qualifier.hasAnyLocation()) {
// "As with input layout qualifiers, all shaders except compute shaders
// allow *location* layout qualifiers on output variable declarations,
default:
break;
}
+ if (qualifier.hasIndex()) {
+ if (qualifier.storage != EvqVaryingOut)
+ error(loc, "can only be used on an output", "index", "");
+ if (! qualifier.hasLocation())
+ error(loc, "can only be used with an explicit location", "index", "");
+ }
}
if (qualifier.hasBinding()) {
case EvqVaryingIn:
requireProfile(loc, ~EEsProfile, "input block");
profileRequires(loc, ~EEsProfile, 150, GL_ARB_separate_shader_objects, "input block");
+ if (language == EShLangVertex)
+ error(loc, "cannot declare an input block in a vertex shader", "in", "");
break;
case EvqVaryingOut:
requireProfile(loc, ~EEsProfile, "output block");
profileRequires(loc, ~EEsProfile, 150, GL_ARB_separate_shader_objects, "output block");
+ if (language == EShLangFragment)
+ error(loc, "cannot declare an output block in a fragment shader", "out", "");
break;
default:
error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), "");
if (memberWithLocation) {
// remove any block-level location and make it per *every* member
int nextLocation; // by the rule above, initial value is not relevant
- if (qualifier.hasLocation()) {
+ if (qualifier.hasAnyLocation()) {
nextLocation = qualifier.layoutLocation;
qualifier.layoutLocation = TQualifier::layoutLocationEnd;
- if (qualifier.layoutComponent != TQualifier::layoutComponentEnd) {
+ if (qualifier.hasComponent()) {
// "It is a compile-time error to apply the *component* qualifier to a ... block"
error(loc, "cannot apply to a block", "component", "");
}
+ if (qualifier.hasIndex()) {
+ error(loc, "cannot apply to a block", "index", "");
+ }
}
for (unsigned int member = 0; member < typeList.size(); ++member) {
TQualifier& memberQualifier = typeList[member].type->getQualifier();
if (qualifier.hasBinding())
error(loc, "cannot declare a default, include a type or full declaration", "binding", "");
- if (qualifier.hasLocation())
- error(loc, "cannot declare a default, use a full declaration", "location", "");
+ if (qualifier.hasAnyLocation())
+ error(loc, "cannot declare a default, use a full declaration", "location/component/index", "");
if (qualifier.hasXfbOffset())
error(loc, "cannot declare a default, use a full declaration", "xfb_offset", "");
}
extensionBehavior[GL_ARB_enhanced_layouts] = EBhDisable;
extensionBehavior[GL_ARB_texture_cube_map_array] = EBhDisable;
extensionBehavior[GL_ARB_shader_texture_lod] = EBhDisable;
- extensionBehavior[GL_ARB_explicit_attrib_location] = EBhDisablePartial; // "index" for fragment outputs is missing
+ extensionBehavior[GL_ARB_explicit_attrib_location] = EBhDisable;
extensionBehavior[GL_ARB_shader_image_load_store] = EBhDisable;
extensionBehavior[GL_ARB_shader_atomic_counters] = EBhDisable;
extensionBehavior[GL_ARB_derivative_control] = EBhDisable;
}\r
\r
// Layouts... \r
- // TODO: 4.4 enhanced layouts: Generalize to include offset/align: currrent spec \r
+ // TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec \r
// requires separate user-supplied offset from actual computed offset, but \r
// current implementation only has one offset.\r
- if (symbol.getQualifier().layoutMatrix != unitSymbol.getQualifier().layoutMatrix ||\r
- symbol.getQualifier().layoutPacking != unitSymbol.getQualifier().layoutPacking ||\r
- symbol.getQualifier().layoutLocation != unitSymbol.getQualifier().layoutLocation ||\r
- symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding) {\r
+ if (symbol.getQualifier().layoutMatrix != unitSymbol.getQualifier().layoutMatrix ||\r
+ symbol.getQualifier().layoutPacking != unitSymbol.getQualifier().layoutPacking ||\r
+ symbol.getQualifier().layoutLocation != unitSymbol.getQualifier().layoutLocation ||\r
+ symbol.getQualifier().layoutComponent != unitSymbol.getQualifier().layoutComponent ||\r
+ symbol.getQualifier().layoutIndex != unitSymbol.getQualifier().layoutIndex ||\r
+ symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding) {\r
error(infoSink, "Layout qualification must match:");\r
writeTypeComparison = true;\r
}\r
if (language == EShLangFragment) {\r
if (qualifier.storage == EvqVaryingOut) {\r
++numFragOut;\r
- if (qualifier.hasLocation())\r
+ if (qualifier.hasAnyLocation())\r
fragOutHasLocation = true;\r
else\r
fragOutWithNoLocation = true;\r
\r
TRange locationRange(qualifier.layoutLocation, qualifier.layoutLocation + size - 1);\r
TRange componentRange(0, 3);\r
- if (qualifier.layoutComponent != TQualifier::layoutComponentEnd) {\r
+ if (qualifier.hasComponent()) {\r
componentRange.start = qualifier.layoutComponent;\r
componentRange.last = componentRange.start + type.getVectorSize() - 1;\r
}\r
- TIoRange range(locationRange, componentRange, type.getBasicType());\r
+ TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0);\r
\r
// check for collisions, except for vertex inputs on desktop\r
if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput())) {\r
int last;
};
-// A *location* range is a 2-D rectangle; the set of (location, component) pairs all lying
-// both within the location range and the component range. Locations don't alias unless
-// both dimensions of their range overlap.
+// An IO range is a 3-D rectangle; the set of (location, component, index) triples all lying
+// within the same location range, component range, and index value. Locations don't alias unless
+// all other dimensions of their range overlap.
struct TIoRange {
- TIoRange(TRange location, TRange component, TBasicType basicType) : location(location), component(component), basicType(basicType) { }
+ TIoRange(TRange location, TRange component, TBasicType basicType, int index)
+ : location(location), component(component), basicType(basicType), index(index) { }
bool overlap(const TIoRange& rhs) const
{
- return location.overlap(rhs.location) && component.overlap(rhs.component);
+ return location.overlap(rhs.location) && component.overlap(rhs.component) && index == rhs.index;
}
TRange location;
TRange component;
TBasicType basicType;
+ int index;
};
// Things that need to be tracked per xfb buffer.