Add swizzles to scalars.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23580 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-10-18 03:56:23 +00:00
parent 8d8f4cc408
commit 8f13e1322d
8 changed files with 159 additions and 60 deletions

View File

@ -44,6 +44,21 @@ void main()
int kk = jj; // ERROR, jj is undeclared int kk = jj; // ERROR, jj is undeclared
} }
const float cx = 4.20;
const float dx = 4.20;
void bar(in highp volatile vec4 v) void bar(in highp volatile vec4 v)
{ {
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
} }

View File

@ -17,7 +17,8 @@ ERROR: 0:79: ':' : wrong operand types: no operation ':' exists that takes a le
ERROR: 0:79: 'assign' : cannot convert from '4X4 matrix of float' to 'fragColor 4-component vector of float' ERROR: 0:79: 'assign' : cannot convert from '4X4 matrix of float' to 'fragColor 4-component vector of float'
ERROR: 0:82: 'xr' : illegal - vector component fields not from the same set ERROR: 0:82: 'xr' : illegal - vector component fields not from the same set
ERROR: 0:83: 'xyxyx' : illegal vector field selection ERROR: 0:83: 'xyxyx' : illegal vector field selection
ERROR: 0:83: 'xy' : dot operator requires structure, array, vector, or matrix on left hand side ERROR: 0:83: 'scalar swizzle' : not supported with this profile: none
ERROR: 0:83: 'xy' : vector field selection out of range
ERROR: 0:84: 'z' : vector field selection out of range ERROR: 0:84: 'z' : vector field selection out of range
ERROR: 0:85: 'assign' : l-value required ERROR: 0:85: 'assign' : l-value required
ERROR: 0:91: 'int' : overloaded functions must have the same return type ERROR: 0:91: 'int' : overloaded functions must have the same return type
@ -29,7 +30,7 @@ ERROR: 0:97: 'out' : overloaded functions must have the same parameter qualifier
ERROR: 0:99: 'return' : function return is not matching type: ERROR: 0:99: 'return' : function return is not matching type:
ERROR: 0:115: 'return' : void function cannot return a value ERROR: 0:115: 'return' : void function cannot return a value
ERROR: 0:125: 'gl_TexCoord' : redeclaration of array with size ERROR: 0:125: 'gl_TexCoord' : redeclaration of array with size
ERROR: 30 compilation errors. No code generated. ERROR: 31 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:21 Function Definition: main( (void) 0:21 Function Definition: main( (void)

View File

@ -17,7 +17,10 @@ ERROR: 0:40: 'j' : undeclared identifier
ERROR: 0:40: '=' : cannot convert from 'float' to 'int' ERROR: 0:40: '=' : cannot convert from 'float' to 'int'
ERROR: 0:44: 'jj' : undeclared identifier ERROR: 0:44: 'jj' : undeclared identifier
ERROR: 0:44: '=' : cannot convert from 'float' to 'int' ERROR: 0:44: '=' : cannot convert from 'float' to 'int'
ERROR: 17 compilation errors. No code generated. ERROR: 0:54: 'y' : vector field selection out of range
ERROR: 0:62: 'xxxxx' : illegal vector field selection
ERROR: 0:63: 'xxy' : vector field selection out of range
ERROR: 20 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:20 Function Definition: foo( (const int) 0:20 Function Definition: foo( (const int)
@ -52,9 +55,43 @@ ERROR: node is still EOpNull!
0:42 Constant: 0:42 Constant:
0:42 true (const bool) 0:42 true (const bool)
0:42 No loop body 0:42 No loop body
0:47 Function Definition: bar(vf4; (void) 0:50 Function Definition: bar(vf4; (void)
0:47 Function Parameters: 0:50 Function Parameters:
0:47 'v' (in 4-component vector of float) 0:50 'v' (in 4-component vector of float)
0:? Sequence
0:53 's' (int)
0:54 's' (int)
0:55 Test condition and select (void)
0:55 Condition
0:55 Compare Equal (bool)
0:55 direct index (float)
0:55 direct index (in 4-component vector of float)
0:55 'bad' (in 10-element array of 4-component vector of float)
0:55 Constant:
0:55 0 (const int)
0:55 Constant:
0:55 0 (const int)
0:55 Constant:
0:55 4.200000
0:55 true case is null
0:57 Test condition and select (void)
0:57 Condition
0:57 Constant:
0:57 true (const bool)
0:57 true case
0:58 move second child to first child (4-component vector of float)
0:58 'badorder3' (flat out 4-component vector of float)
0:58 direct index (in 4-component vector of float)
0:58 'bad' (in 10-element array of 4-component vector of float)
0:58 Constant:
0:58 0 (const int)
0:61 Sequence
0:61 move second child to first child (3-component vector of float)
0:61 'smeared' (3-component vector of float)
0:61 Construct vec3 (3-component vector of float)
0:61 'f' (float)
0:62 'f' (float)
0:63 'f' (float)
0:? Linker Objects 0:? Linker Objects
0:? 'v2' (smooth out 2-component vector of float) 0:? 'v2' (smooth out 2-component vector of float)
0:? 'bad' (in 10-element array of 4-component vector of float) 0:? 'bad' (in 10-element array of 4-component vector of float)
@ -71,6 +108,10 @@ ERROR: node is still EOpNull!
0:? 'a' (const int) 0:? 'a' (const int)
0:? 5 (const int) 0:? 5 (const int)
0:? 'b' (int) 0:? 'b' (int)
0:? 'cx' (const float)
0:? 4.200000
0:? 'dx' (const float)
0:? 4.200000
0:? 'gl_VertexID' (gl_VertexId int) 0:? 'gl_VertexID' (gl_VertexId int)
0:? 'gl_InstanceID' (gl_InstanceId int) 0:? 'gl_InstanceID' (gl_InstanceId int)

View File

@ -32,15 +32,15 @@ ERROR: 0:172: '' : no matching overloaded function found
ERROR: 0:175: 'x' : undeclared identifier ERROR: 0:175: 'x' : undeclared identifier
ERROR: 0:175: '[]' : scalar integer expression required ERROR: 0:175: '[]' : scalar integer expression required
ERROR: 0:175: 'b' : left of '[' is not of type array, matrix, or vector ERROR: 0:175: 'b' : left of '[' is not of type array, matrix, or vector
ERROR: 0:175: 'a' : dot operator requires structure, array, vector, or matrix on left hand side ERROR: 0:175: 'a' : vector field selection out of range
ERROR: 0:175: 'length' : dot operator requires structure, array, vector, or matrix on left hand side ERROR: 0:175: 'length' : illegal vector field selection
ERROR: 0:175: '' : function call, method, or subroutine call expected ERROR: 0:175: '' : function call, method, or subroutine call expected
ERROR: 0:175: '' : no matching overloaded function found ERROR: 0:175: '' : no matching overloaded function found
ERROR: 0:178: '[]' : scalar integer expression required ERROR: 0:178: '[]' : scalar integer expression required
ERROR: 0:178: 's' : undeclared identifier ERROR: 0:178: 's' : undeclared identifier
ERROR: 0:178: 's' : left of '[' is not of type array, matrix, or vector ERROR: 0:178: 's' : left of '[' is not of type array, matrix, or vector
ERROR: 0:178: 'a' : dot operator requires structure, array, vector, or matrix on left hand side ERROR: 0:178: 'a' : vector field selection out of range
ERROR: 0:178: 'length' : dot operator requires structure, array, vector, or matrix on left hand side ERROR: 0:178: 'length' : illegal vector field selection
ERROR: 0:178: '' : function call, method, or subroutine call expected ERROR: 0:178: '' : function call, method, or subroutine call expected
ERROR: 0:178: '' : no matching overloaded function found ERROR: 0:178: '' : no matching overloaded function found
ERROR: 0:198: 'e' : redefinition ERROR: 0:198: 'e' : redefinition

View File

@ -28,28 +28,22 @@ ERROR: 0:92: 'offset' : there is no such layout identifier taking an assigned va
ERROR: 0:92: 'bar' : redefinition ERROR: 0:92: 'bar' : redefinition
ERROR: 0:94: 'binding' : not supported ERROR: 0:94: 'binding' : not supported
ERROR: 0:94: 'offset' : there is no such layout identifier taking an assigned value ERROR: 0:94: 'offset' : there is no such layout identifier taking an assigned value
ERROR: 0:94: 'a2' : redefinition
ERROR: 0:95: 'binding' : not supported ERROR: 0:95: 'binding' : not supported
ERROR: 0:96: 'binding' : not supported ERROR: 0:96: 'binding' : not supported
ERROR: 0:97: 'binding' : not supported ERROR: 0:97: 'binding' : not supported
ERROR: 0:106: '' : vertex input cannot be further qualified ERROR: 0:106: '' : vertex input cannot be further qualified
ERROR: 0:112: 'ColorIvn' : identifier not previously declared ERROR: 0:112: 'ColorIvn' : identifier not previously declared
ERROR: 0:119: 'a' : redefinition
ERROR: 0:132: 'shared' : not supported in this stage: vertex ERROR: 0:132: 'shared' : not supported in this stage: vertex
ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:134: '' : function does not return a value: funcA
ERROR: 0:136: '' : function does not return a value: funcB ERROR: 0:136: '' : function does not return a value: funcB
ERROR: 0:137: 'rgba32f' : unrecognized layout identifier ERROR: 0:137: 'rgba32f' : unrecognized layout identifier
ERROR: 0:138: 'rgba32f' : unrecognized layout identifier ERROR: 0:138: 'rgba32f' : unrecognized layout identifier
ERROR: 0:153: '' : function does not return a value: func3 ERROR: 0:153: '' : function does not return a value: func3
ERROR: 0:163: 'w' : dot operator requires structure, array, vector, or matrix on left hand side
ERROR: 0:164: 'x' : dot operator requires structure, array, vector, or matrix on left hand side
ERROR: 0:164: 'func' : no matching overloaded function found
ERROR: 0:166: 'x' : dot operator requires structure, array, vector, or matrix on left hand side
ERROR: 0:166: 'func2' : no matching overloaded function found
ERROR: 0:167: 'x' : dot operator requires structure, array, vector, or matrix on left hand side
ERROR: 0:192: 'constructor' : constructing from a non-dereferenced array ERROR: 0:192: 'constructor' : constructing from a non-dereferenced array
ERROR: 0:193: 'constructor' : constructing from a non-dereferenced array ERROR: 0:193: 'constructor' : constructing from a non-dereferenced array
ERROR: 0:194: 'constructor' : constructing from a non-dereferenced array ERROR: 0:194: 'constructor' : constructing from a non-dereferenced array
ERROR: 50 compilation errors. No code generated. ERROR: 44 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:134 Function Definition: funcA(I21; (4-component vector of float) 0:134 Function Definition: funcA(I21; (4-component vector of float)
@ -112,9 +106,8 @@ ERROR: node is still EOpNull!
0:160 move second child to first child (3-component vector of float) 0:160 move second child to first child (3-component vector of float)
0:160 'r' (3-component vector of float) 0:160 'r' (3-component vector of float)
0:160 Construct vec3 (3-component vector of float) 0:160 Construct vec3 (3-component vector of float)
0:160 vector-scale (4-component vector of float) 0:160 component-wise multiply (4-component vector of float)
0:160 Convert int to float (float) 0:160 'a' (in 4-component vector of float)
0:160 'a' (uniform int)
0:160 'b' (in 4-component vector of float) 0:160 'b' (in 4-component vector of float)
0:161 Sequence 0:161 Sequence
0:161 move second child to first child (3-component vector of float) 0:161 move second child to first child (3-component vector of float)
@ -143,8 +136,10 @@ ERROR: node is still EOpNull!
0:163 3 (const int) 0:163 3 (const int)
0:163 add (float) 0:163 add (float)
0:163 component-wise multiply (float) 0:163 component-wise multiply (float)
0:163 Convert int to float (float) 0:163 direct index (float)
0:163 'a' (uniform int) 0:163 'a' (in 4-component vector of float)
0:163 Constant:
0:163 3 (const int)
0:163 direct index (float) 0:163 direct index (float)
0:163 'b' (in 4-component vector of float) 0:163 'b' (in 4-component vector of float)
0:163 Constant: 0:163 Constant:
@ -163,19 +158,51 @@ ERROR: node is still EOpNull!
0:164 'v' (smooth out 4-component vector of float) 0:164 'v' (smooth out 4-component vector of float)
0:164 Constant: 0:164 Constant:
0:164 0 (const int) 0:164 0 (const int)
0:164 Constant: 0:164 Function Call: func(f1;f1;f1;f1; (float)
0:164 0.000000 0:164 direct index (float)
0:164 'a' (in 4-component vector of float)
0:164 Constant:
0:164 0 (const int)
0:164 direct index (float)
0:164 'b' (in 4-component vector of float)
0:164 Constant:
0:164 0 (const int)
0:164 direct index (float)
0:164 'c' (in 4-component vector of float)
0:164 Constant:
0:164 0 (const int)
0:164 direct index (float)
0:164 'd' (in 4-component vector of float)
0:164 Constant:
0:164 0 (const int)
0:166 move second child to first child (float) 0:166 move second child to first child (float)
0:166 direct index (float) 0:166 direct index (float)
0:166 'v' (smooth out 4-component vector of float) 0:166 'v' (smooth out 4-component vector of float)
0:166 Constant: 0:166 Constant:
0:166 0 (const int) 0:166 0 (const int)
0:166 Constant: 0:166 Function Call: func2(f1;f1;f1;f1; (float)
0:166 0.000000 0:166 direct index (float)
0:166 'a' (in 4-component vector of float)
0:166 Constant:
0:166 0 (const int)
0:166 direct index (float)
0:166 'b' (in 4-component vector of float)
0:166 Constant:
0:166 0 (const int)
0:166 direct index (float)
0:166 'c' (in 4-component vector of float)
0:166 Constant:
0:166 0 (const int)
0:166 direct index (float)
0:166 'd' (in 4-component vector of float)
0:166 Constant:
0:166 0 (const int)
0:167 Function Call: func3(f1;f1;f1; (float) 0:167 Function Call: func3(f1;f1;f1; (float)
0:167 component-wise multiply (float) 0:167 component-wise multiply (float)
0:167 Convert int to float (float) 0:167 direct index (float)
0:167 'a' (uniform int) 0:167 'a' (in 4-component vector of float)
0:167 Constant:
0:167 0 (const int)
0:167 direct index (float) 0:167 direct index (float)
0:167 'b' (in 4-component vector of float) 0:167 'b' (in 4-component vector of float)
0:167 Constant: 0:167 Constant:
@ -264,9 +291,8 @@ ERROR: node is still EOpNull!
0:? '__anon__3' (layout(std140 ) uniform block) 0:? '__anon__3' (layout(std140 ) uniform block)
0:? '__anon__4' (layout(shared ) uniform block) 0:? '__anon__4' (layout(shared ) uniform block)
0:? 's17' (uniform sampler2D) 0:? 's17' (uniform sampler2D)
0:? 'a' (uniform int)
0:? 'bar' (uniform int)
0:? 'a2' (uniform int) 0:? 'a2' (uniform int)
0:? 'bar' (uniform int)
0:? 'b2' (uniform int) 0:? 'b2' (uniform int)
0:? 'c2' (uniform int) 0:? 'c2' (uniform int)
0:? 'd2' (uniform int) 0:? 'd2' (uniform int)
@ -275,6 +301,7 @@ ERROR: node is still EOpNull!
0:? 'Color4' (invariant centroid smooth out 3-component vector of float) 0:? 'Color4' (invariant centroid smooth out 3-component vector of float)
0:? 'position' (smooth out 4-component vector of float) 0:? 'position' (smooth out 4-component vector of float)
0:? 'Color5' (smooth out 3-component vector of float) 0:? 'Color5' (smooth out 3-component vector of float)
0:? 'a' (in 4-component vector of float)
0:? 'b' (in 4-component vector of float) 0:? 'b' (in 4-component vector of float)
0:? 'c' (in 4-component vector of float) 0:? 'c' (in 4-component vector of float)
0:? 'd' (in 4-component vector of float) 0:? 'd' (in 4-component vector of float)

View File

@ -23,7 +23,7 @@ layout(location = 6) in vec4 colors[3];
layout(location = 9) in mat4 transforms[2]; layout(location = 9) in mat4 transforms[2];
layout(location = 3) struct S { layout(location = 3) struct S {
vec3 a; vec3 a1;
mat2 b; mat2 b;
vec4 c[2]; vec4 c[2];
} s; } s;
@ -82,7 +82,7 @@ uniform sampler2D s17; // okay, s still bound at 3
// in another compilation unit... // in another compilation unit...
//layout(binding=4) uniform sampler2D s; // ERROR: contradictory bindings //layout(binding=4) uniform sampler2D s; // ERROR: contradictory bindings
layout (binding = 2, offset = 4) uniform atomic_uint a; layout (binding = 2, offset = 4) uniform atomic_uint a2;
layout (binding = 2) uniform atomic_uint bar; layout (binding = 2) uniform atomic_uint bar;

View File

@ -60,31 +60,31 @@ Shader Functionality to Implement/Finish
GLSL 1.3 (Non-ES) GLSL 1.3 (Non-ES)
- Preprocessor token pasting (##), ## does macro expansion after pasting not before - Preprocessor token pasting (##), ## does macro expansion after pasting not before
- non-perspective (linear) interpolation (noperspective) - 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 - only statically used built-ins have to be redeclared as flat
- Deprecated gl_ClipVertex + Deprecated gl_ClipVertex
- deprecate almost all built-in state + deprecate almost all built-in state
- ftransform() is deprecated + ftransform() is deprecated
- Deprecated built-in vertex inputs (attributes) and some outputs (varyings). + Deprecated built-in vertex inputs (attributes) and some outputs (varyings).
GLSL 1.4 (Non-ES) GLSL 1.4 (Non-ES)
- track as removed in this release, but present in others: + track as removed in this release, but present in others:
- Use of gl_ClipVertex. Use gl_ClipDistance instead. + Use of gl_ClipVertex. Use gl_ClipDistance instead.
- Built-in vertex shader inputs. + Built-in vertex shader inputs.
- Built-in uniforms except for depth range parameters + 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 interface between vertex and fragment: gl_TexCoord, gl_FogFragCoord, and all the color values.
- Built-in two-sided coloring. + Built-in two-sided coloring.
- Fixed functionality for a programmable stage. + Fixed functionality for a programmable stage.
- ftransform(). Use invariant outputs instead. + ftransform(). Use invariant outputs instead.
GLSL 1.5 (Non-ES) GLSL 1.5 (Non-ES)
- Deprecated gl_MaxVaryingComponents - Deprecated gl_MaxVaryingComponents
- Add new minimum maximums for gl_MaxVertexOutputComponents, gl_MaxGeometryInputComponents, gl_MaxGeometryOutputComponents, and gl_MaxFragmentInputComponents, - 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. 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). - 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 - including redeclaration of gl_FragCoord that adds nothing
- Added support for multi-sample textures through sampler2DMS and sampler2DMSArray support in texelFetch() and textureSize(). - 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. + Broadened interface blocks from just uniforms to in and out interfaces as well.
- Broaden array usage to include vertex shader inputs (vertex in). + Broaden array usage to include vertex shader inputs (vertex in).
- Added geometry shaders. This includes targeting layers in FBO rendering. - 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. - 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. - Added geometry shader constants.
@ -119,8 +119,8 @@ Shader Functionality to Implement/Finish
- textureGather() - textureGather()
- textureGatherOffset() - textureGatherOffset()
- textureGatherOffsets() - textureGatherOffsets()
- Add streams out from geometry shader. Output can be directed to streams through + Add streams out from geometry shader. Output can be directed to streams through
- EmitStreamVertex() and EndStreamPrimitive(). + EmitStreamVertex() and EndStreamPrimitive().
GLSL 4.1 GLSL 4.1
- Support for partitioning shaders into multiple programs to provide light-weight mixing of different shader stages. - Support for partitioning shaders into multiple programs to provide light-weight mixing of different shader stages.
(GL_ARB_separate_shader_objects) (GL_ARB_separate_shader_objects)
@ -150,7 +150,7 @@ Shader Functionality to Implement/Finish
+ Variables declared in if and else statements are scoped only to the end of those statements, especially for non-compound statements + 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. Note, this is not backward compatible, it may depend on #version.
- Allow implicit conversions of return values to the declared type of the function. - 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. + 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. + 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. - Add a new atomic_uint type to support atomic counters. Also, add built-in functions for manipulating atomic counters.
@ -160,12 +160,12 @@ Shader Functionality to Implement/Finish
- packHalf2x16 and unpackHalf2x16 - packHalf2x16 and unpackHalf2x16
- packSnorm2x16and unpackSnorm2x16 - packSnorm2x16and unpackSnorm2x16
- Add gl_FragDepthlayout qualifiers to communicate what kind of changes will be made to gl_FragDepth(GL_AMD_conservative depth). - 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. - 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. + 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. - 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., “(2,3)” is not allowed, semantically, - Clarified that a comma sequence-operator expression cannot be a constant expression. E.g., “(2,3)” is not allowed, semantically,
as a valid constant expression 3, even though it is an expression that will evaluate to 3. 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,...). - Use vec2 instead of vec3 for coordinate in textureGather*(sampler2DRect,...).

View File

@ -270,7 +270,7 @@ void TParseContext::handlePragma(const char **tokens, int numTokens)
// //
// Look at a '.' field selector string and change it into offsets // 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. // Returns true if there is no error.
// //
@ -561,13 +561,28 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
result = intermediate.addMethod(base, TType(EbtInt), &field, loc); result = intermediate.addMethod(base, TType(EbtInt), &field, loc);
} else } else
error(loc, "only the length method is supported for array", field.c_str(), ""); 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; TVectorFields fields;
if (! parseVectorFields(loc, field, base->getVectorSize(), fields)) { if (! parseVectorFields(loc, field, base->getVectorSize(), fields)) {
fields.num = 1; fields.num = 1;
fields.offsets[0] = 0; 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 if (base->getType().getQualifier().storage == EvqConst) { // constant folding for vector fields
result = addConstVectorNode(fields, base, loc); result = addConstVectorNode(fields, base, loc);
if (result == 0) if (result == 0)
@ -625,7 +640,7 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
error(loc, " no such field in structure", field.c_str(), ""); error(loc, " no such field in structure", field.c_str(), "");
} }
} else } 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; return result;
} }
@ -1211,7 +1226,7 @@ void TParseContext::constantValueCheck(TIntermTyped* node, const char* token)
// //
void TParseContext::integerCheck(TIntermTyped* node, const char* token) 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; return;
error(node->getLoc(), "scalar integer expression required", token, ""); error(node->getLoc(), "scalar integer expression required", token, "");