int kk = jj; // ERROR, jj is undeclared
}
+const float cx = 4.20;
+const float dx = 4.20;
+
void bar(in highp volatile vec4 v)
{
-}
\ No newline at end of file
+ int s;
+ s.x; // okay
+ s.y; // ERROR
+ if (bad[0].x == cx.x)
+ ;
+ if (cx.x == dx.x)
+ badorder3 = bad[0];
+
+ float f;
+ vec3 smeared = f.xxx;
+ f.xxxxx; // ERROR
+ f.xxy; // ERROR
+}
ERROR: 0:79: 'assign' : cannot convert from '4X4 matrix of float' to 'fragColor 4-component vector of float'\r
ERROR: 0:82: 'xr' : illegal - vector component fields not from the same set \r
ERROR: 0:83: 'xyxyx' : illegal vector field selection \r
-ERROR: 0:83: 'xy' : dot operator requires structure, array, vector, or matrix on left hand side \r
+ERROR: 0:83: 'scalar swizzle' : not supported with this profile: none\r
+ERROR: 0:83: 'xy' : vector field selection out of range \r
ERROR: 0:84: 'z' : vector field selection out of range \r
ERROR: 0:85: 'assign' : l-value required \r
ERROR: 0:91: 'int' : overloaded functions must have the same return type \r
ERROR: 0:99: 'return' : function return is not matching type: \r
ERROR: 0:115: 'return' : void function cannot return a value \r
ERROR: 0:125: 'gl_TexCoord' : redeclaration of array with size \r
-ERROR: 30 compilation errors. No code generated.\r
+ERROR: 31 compilation errors. No code generated.\r
\r
ERROR: node is still EOpNull!\r
0:21 Function Definition: main( (void)\r
ERROR: 0:40: '=' : cannot convert from 'float' to 'int'\r
ERROR: 0:44: 'jj' : undeclared identifier \r
ERROR: 0:44: '=' : cannot convert from 'float' to 'int'\r
-ERROR: 17 compilation errors. No code generated.\r
+ERROR: 0:54: 'y' : vector field selection out of range \r
+ERROR: 0:62: 'xxxxx' : illegal vector field selection \r
+ERROR: 0:63: 'xxy' : vector field selection out of range \r
+ERROR: 20 compilation errors. No code generated.\r
\r
ERROR: node is still EOpNull!\r
0:20 Function Definition: foo( (const int)\r
0:42 Constant:\r
0:42 true (const bool)\r
0:42 No loop body\r
-0:47 Function Definition: bar(vf4; (void)\r
-0:47 Function Parameters: \r
-0:47 'v' (in 4-component vector of float)\r
+0:50 Function Definition: bar(vf4; (void)\r
+0:50 Function Parameters: \r
+0:50 'v' (in 4-component vector of float)\r
+0:? Sequence\r
+0:53 's' (int)\r
+0:54 's' (int)\r
+0:55 Test condition and select (void)\r
+0:55 Condition\r
+0:55 Compare Equal (bool)\r
+0:55 direct index (float)\r
+0:55 direct index (in 4-component vector of float)\r
+0:55 'bad' (in 10-element array of 4-component vector of float)\r
+0:55 Constant:\r
+0:55 0 (const int)\r
+0:55 Constant:\r
+0:55 0 (const int)\r
+0:55 Constant:\r
+0:55 4.200000\r
+0:55 true case is null\r
+0:57 Test condition and select (void)\r
+0:57 Condition\r
+0:57 Constant:\r
+0:57 true (const bool)\r
+0:57 true case\r
+0:58 move second child to first child (4-component vector of float)\r
+0:58 'badorder3' (flat out 4-component vector of float)\r
+0:58 direct index (in 4-component vector of float)\r
+0:58 'bad' (in 10-element array of 4-component vector of float)\r
+0:58 Constant:\r
+0:58 0 (const int)\r
+0:61 Sequence\r
+0:61 move second child to first child (3-component vector of float)\r
+0:61 'smeared' (3-component vector of float)\r
+0:61 Construct vec3 (3-component vector of float)\r
+0:61 'f' (float)\r
+0:62 'f' (float)\r
+0:63 'f' (float)\r
0:? Linker Objects\r
0:? 'v2' (smooth out 2-component vector of float)\r
0:? 'bad' (in 10-element array of 4-component vector of float)\r
0:? 'a' (const int)\r
0:? 5 (const int)\r
0:? 'b' (int)\r
+0:? 'cx' (const float)\r
+0:? 4.200000\r
+0:? 'dx' (const float)\r
+0:? 4.200000\r
0:? 'gl_VertexID' (gl_VertexId int)\r
0:? 'gl_InstanceID' (gl_InstanceId int)\r
\r
ERROR: 0:175: 'x' : undeclared identifier \r
ERROR: 0:175: '[]' : scalar integer expression required \r
ERROR: 0:175: 'b' : left of '[' is not of type array, matrix, or vector \r
-ERROR: 0:175: 'a' : dot operator requires structure, array, vector, or matrix on left hand side \r
-ERROR: 0:175: 'length' : dot operator requires structure, array, vector, or matrix on left hand side \r
+ERROR: 0:175: 'a' : vector field selection out of range \r
+ERROR: 0:175: 'length' : illegal vector field selection \r
ERROR: 0:175: '' : function call, method, or subroutine call expected \r
ERROR: 0:175: '' : no matching overloaded function found \r
ERROR: 0:178: '[]' : scalar integer expression required \r
ERROR: 0:178: 's' : undeclared identifier \r
ERROR: 0:178: 's' : left of '[' is not of type array, matrix, or vector \r
-ERROR: 0:178: 'a' : dot operator requires structure, array, vector, or matrix on left hand side \r
-ERROR: 0:178: 'length' : dot operator requires structure, array, vector, or matrix on left hand side \r
+ERROR: 0:178: 'a' : vector field selection out of range \r
+ERROR: 0:178: 'length' : illegal vector field selection \r
ERROR: 0:178: '' : function call, method, or subroutine call expected \r
ERROR: 0:178: '' : no matching overloaded function found \r
ERROR: 0:198: 'e' : redefinition \r
ERROR: 0:92: 'bar' : redefinition \r
ERROR: 0:94: 'binding' : not supported \r
ERROR: 0:94: 'offset' : there is no such layout identifier taking an assigned value \r
+ERROR: 0:94: 'a2' : redefinition \r
ERROR: 0:95: 'binding' : not supported \r
ERROR: 0:96: 'binding' : not supported \r
ERROR: 0:97: 'binding' : not supported \r
ERROR: 0:106: '' : vertex input cannot be further qualified \r
ERROR: 0:112: 'ColorIvn' : identifier not previously declared \r
-ERROR: 0:119: 'a' : redefinition \r
ERROR: 0:132: 'shared' : not supported in this stage: vertex\r
ERROR: 0:134: '' : function does not return a value: funcA\r
ERROR: 0:136: '' : function does not return a value: funcB\r
ERROR: 0:137: 'rgba32f' : unrecognized layout identifier \r
ERROR: 0:138: 'rgba32f' : unrecognized layout identifier \r
ERROR: 0:153: '' : function does not return a value: func3\r
-ERROR: 0:163: 'w' : dot operator requires structure, array, vector, or matrix on left hand side \r
-ERROR: 0:164: 'x' : dot operator requires structure, array, vector, or matrix on left hand side \r
-ERROR: 0:164: 'func' : no matching overloaded function found \r
-ERROR: 0:166: 'x' : dot operator requires structure, array, vector, or matrix on left hand side \r
-ERROR: 0:166: 'func2' : no matching overloaded function found \r
-ERROR: 0:167: 'x' : dot operator requires structure, array, vector, or matrix on left hand side \r
ERROR: 0:192: 'constructor' : constructing from a non-dereferenced array \r
ERROR: 0:193: 'constructor' : constructing from a non-dereferenced array \r
ERROR: 0:194: 'constructor' : constructing from a non-dereferenced array \r
-ERROR: 50 compilation errors. No code generated.\r
+ERROR: 44 compilation errors. No code generated.\r
\r
ERROR: node is still EOpNull!\r
0:134 Function Definition: funcA(I21; (4-component vector of float)\r
0:160 move second child to first child (3-component vector of float)\r
0:160 'r' (3-component vector of float)\r
0:160 Construct vec3 (3-component vector of float)\r
-0:160 vector-scale (4-component vector of float)\r
-0:160 Convert int to float (float)\r
-0:160 'a' (uniform int)\r
+0:160 component-wise multiply (4-component vector of float)\r
+0:160 'a' (in 4-component vector of float)\r
0:160 'b' (in 4-component vector of float)\r
0:161 Sequence\r
0:161 move second child to first child (3-component vector of float)\r
0:163 3 (const int)\r
0:163 add (float)\r
0:163 component-wise multiply (float)\r
-0:163 Convert int to float (float)\r
-0:163 'a' (uniform int)\r
+0:163 direct index (float)\r
+0:163 'a' (in 4-component vector of float)\r
+0:163 Constant:\r
+0:163 3 (const int)\r
0:163 direct index (float)\r
0:163 'b' (in 4-component vector of float)\r
0:163 Constant:\r
0:164 'v' (smooth out 4-component vector of float)\r
0:164 Constant:\r
0:164 0 (const int)\r
-0:164 Constant:\r
-0:164 0.000000\r
+0:164 Function Call: func(f1;f1;f1;f1; (float)\r
+0:164 direct index (float)\r
+0:164 'a' (in 4-component vector of float)\r
+0:164 Constant:\r
+0:164 0 (const int)\r
+0:164 direct index (float)\r
+0:164 'b' (in 4-component vector of float)\r
+0:164 Constant:\r
+0:164 0 (const int)\r
+0:164 direct index (float)\r
+0:164 'c' (in 4-component vector of float)\r
+0:164 Constant:\r
+0:164 0 (const int)\r
+0:164 direct index (float)\r
+0:164 'd' (in 4-component vector of float)\r
+0:164 Constant:\r
+0:164 0 (const int)\r
0:166 move second child to first child (float)\r
0:166 direct index (float)\r
0:166 'v' (smooth out 4-component vector of float)\r
0:166 Constant:\r
0:166 0 (const int)\r
-0:166 Constant:\r
-0:166 0.000000\r
+0:166 Function Call: func2(f1;f1;f1;f1; (float)\r
+0:166 direct index (float)\r
+0:166 'a' (in 4-component vector of float)\r
+0:166 Constant:\r
+0:166 0 (const int)\r
+0:166 direct index (float)\r
+0:166 'b' (in 4-component vector of float)\r
+0:166 Constant:\r
+0:166 0 (const int)\r
+0:166 direct index (float)\r
+0:166 'c' (in 4-component vector of float)\r
+0:166 Constant:\r
+0:166 0 (const int)\r
+0:166 direct index (float)\r
+0:166 'd' (in 4-component vector of float)\r
+0:166 Constant:\r
+0:166 0 (const int)\r
0:167 Function Call: func3(f1;f1;f1; (float)\r
0:167 component-wise multiply (float)\r
-0:167 Convert int to float (float)\r
-0:167 'a' (uniform int)\r
+0:167 direct index (float)\r
+0:167 'a' (in 4-component vector of float)\r
+0:167 Constant:\r
+0:167 0 (const int)\r
0:167 direct index (float)\r
0:167 'b' (in 4-component vector of float)\r
0:167 Constant:\r
0:? '__anon__3' (layout(std140 ) uniform block)\r
0:? '__anon__4' (layout(shared ) uniform block)\r
0:? 's17' (uniform sampler2D)\r
-0:? 'a' (uniform int)\r
-0:? 'bar' (uniform int)\r
0:? 'a2' (uniform int)\r
+0:? 'bar' (uniform int)\r
0:? 'b2' (uniform int)\r
0:? 'c2' (uniform int)\r
0:? 'd2' (uniform int)\r
0:? 'Color4' (invariant centroid smooth out 3-component vector of float)\r
0:? 'position' (smooth out 4-component vector of float)\r
0:? 'Color5' (smooth out 3-component vector of float)\r
+0:? 'a' (in 4-component vector of float)\r
0:? 'b' (in 4-component vector of float)\r
0:? 'c' (in 4-component vector of float)\r
0:? 'd' (in 4-component vector of float)\r
layout(location = 9) in mat4 transforms[2];\r
\r
layout(location = 3) struct S {\r
- vec3 a;\r
+ vec3 a1;\r
mat2 b;\r
vec4 c[2];\r
} s;\r
// in another compilation unit...\r
//layout(binding=4) uniform sampler2D s; // ERROR: contradictory bindings\r
\r
-layout (binding = 2, offset = 4) uniform atomic_uint a;\r
+layout (binding = 2, offset = 4) uniform atomic_uint a2;\r
\r
layout (binding = 2) uniform atomic_uint bar;\r
\r
GLSL 1.3 (Non-ES)
- Preprocessor token pasting (##), ## does macro expansion after pasting not before
- non-perspective (linear) interpolation (noperspective)
- - add gl_ClipDistance[] to both vertex and fragment shaders
+ + add gl_ClipDistance[] to both vertex and fragment shaders
- only statically used built-ins have to be redeclared as flat
- - Deprecated gl_ClipVertex
- - deprecate almost all built-in state
- - ftransform() is deprecated
- - Deprecated built-in vertex inputs (attributes) and some outputs (varyings).
+ + Deprecated gl_ClipVertex
+ + deprecate almost all built-in state
+ + ftransform() is deprecated
+ + Deprecated built-in vertex inputs (attributes) and some outputs (varyings).
GLSL 1.4 (Non-ES)
- - track as removed in this release, but present in others:
- - Use of gl_ClipVertex. Use gl_ClipDistance instead.
- - Built-in vertex shader inputs.
- - Built-in uniforms except for depth range parameters
- - Built-in interface between vertex and fragment: gl_TexCoord, gl_FogFragCoord, and all the color values.
- - Built-in two-sided coloring.
- - Fixed functionality for a programmable stage.
- - ftransform(). Use invariant outputs instead.
+ + track as removed in this release, but present in others:
+ + Use of gl_ClipVertex. Use gl_ClipDistance instead.
+ + Built-in vertex shader inputs.
+ + Built-in uniforms except for depth range parameters
+ + Built-in interface between vertex and fragment: gl_TexCoord, gl_FogFragCoord, and all the color values.
+ + Built-in two-sided coloring.
+ + Fixed functionality for a programmable stage.
+ + ftransform(). Use invariant outputs instead.
GLSL 1.5 (Non-ES)
- Deprecated gl_MaxVaryingComponents
- Add new minimum maximums for gl_MaxVertexOutputComponents, gl_MaxGeometryInputComponents, gl_MaxGeometryOutputComponents, and gl_MaxFragmentInputComponents,
rather than relying on gl_MaxVaryingComponents. Also, corrected gl_MaxVaryingComponents to be 60 instead of 64.
- - Added gl_PrimitiveID as an input to fragment shaders.
+ + Added gl_PrimitiveID as an input to fragment shaders.
- Added gl_FragCoord qualifiers origin_upper_left, and pixel_center_integer to modify the values returned by gl_FragCoord (and have no affect on any other aspect of the pipeline or language).
- including redeclaration of gl_FragCoord that adds nothing
- Added support for multi-sample textures through sampler2DMS and sampler2DMSArray support in texelFetch() and textureSize().
- - Broadened interface blocks from just uniforms to in and out interfaces as well.
- - Broaden array usage to include vertex shader inputs (vertex in).
+ + Broadened interface blocks from just uniforms to in and out interfaces as well.
+ + Broaden array usage to include vertex shader inputs (vertex in).
- Added geometry shaders. This includes targeting layers in FBO rendering.
- geometry shader layouts: they must be declared, telling the system the primitive input and output types and maximum number of vertices.
- Added geometry shader constants.
- textureGather()
- textureGatherOffset()
- textureGatherOffsets()
- - Add streams out from geometry shader. Output can be directed to streams through
- - EmitStreamVertex() and EndStreamPrimitive().
+ + Add streams out from geometry shader. Output can be directed to streams through
+ + EmitStreamVertex() and EndStreamPrimitive().
GLSL 4.1
- Support for partitioning shaders into multiple programs to provide light-weight mixing of different shader stages.
(GL_ARB_separate_shader_objects)
+ Variables declared in if and else statements are scoped only to the end of those statements, especially for non-compound statements
Note, this is not backward compatible, it may depend on #version.
- Allow implicit conversions of return values to the declared type of the function.
- - The const keyword can be used to declare variables within a function body with initializer expressions that are not constant expressions.
+ + The const keyword can be used to declare variables within a function body with initializer expressions that are not constant expressions.
+ Qualifiers on variable declarations no longer have to follow a strict order. The layout qualifier can be used multiple times, and multiple parameter qualifiers can be used.
+ Parameter qualifiers can include precision and memory qualifiers.
- Add a new atomic_uint type to support atomic counters. Also, add built-in functions for manipulating atomic counters.
- packHalf2x16 and unpackHalf2x16
- packSnorm2x16and unpackSnorm2x16
- Add gl_FragDepthlayout 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.
+ + 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.
- - Allow swizzle operations on scalars.
+ + Allow swizzle operations on scalars.
- Positive signed decimal literals, as well as octal and hexadecimal, can set all 32 bits. This includes setting the sign bit to create a negative value.
- - Make GLSL consistent with the API regarding user clipping, by no longer referring to gl_Positionwhen gl_ClipVertex is not written. Rather, user clipping becomes undefined.
+ - Make GLSL consistent with the API regarding user clipping, by no longer referring to gl_Position when gl_ClipVertex is not written. Rather, user clipping becomes undefined.
- Clarified that a comma sequence-operator expression cannot be a constant expression. E.g., \93(2,3)\94 is not allowed, semantically,
as a valid constant expression 3, even though it is an expression that will evaluate to 3.
- Use vec2 instead of vec3 for coordinate in textureGather*(sampler2DRect,...).
//
// Look at a '.' field selector string and change it into offsets
-// for a vector.
+// for a vector or scalar
//
// Returns true if there is no error.
//
result = intermediate.addMethod(base, TType(EbtInt), &field, loc);
} else
error(loc, "only the length method is supported for array", field.c_str(), "");
- } else if (base->isVector()) {
+ } else if (base->isVector() || base->isScalar()) {
+ if (base->isScalar()) {
+ const char* dotFeature = "scalar swizzle";
+ requireProfile(loc, ECoreProfile | ECompatibilityProfile, dotFeature);
+ profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, GL_ARB_shading_language_420pack, dotFeature);
+ }
+
TVectorFields fields;
if (! parseVectorFields(loc, field, base->getVectorSize(), fields)) {
fields.num = 1;
fields.offsets[0] = 0;
}
+ if (base->isScalar()) {
+ if (fields.num == 1)
+ return result;
+ else {
+ TType type(base->getBasicType(), EvqTemporary, fields.num);
+ return addConstructor(loc, base, type, mapTypeToConstructorOp(type));
+ }
+ }
+
if (base->getType().getQualifier().storage == EvqConst) { // constant folding for vector fields
result = addConstVectorNode(fields, base, loc);
if (result == 0)
error(loc, " no such field in structure", field.c_str(), "");
}
} else
- error(loc, " dot operator requires structure, array, vector, or matrix on left hand side", field.c_str(), "");
+ error(loc, " dot operator does not operater on this type:", field.c_str(), base->getType().getCompleteString().c_str());
return result;
}
//
void TParseContext::integerCheck(TIntermTyped* node, const char* token)
{
- if ((node->getBasicType() == EbtInt || node->getBasicType() == EbtUint) && node->isScalar() && ! node->isArray())
+ if ((node->getBasicType() == EbtInt || node->getBasicType() == EbtUint) && node->isScalar())
return;
error(node->getLoc(), "scalar integer expression required", token, "");