Front-ends: Non-functional: Rationalize vector and matrix swizzles.

This reduces code duplication in a few ways, and better encapsulates
vector swizzle representation.
This commit is contained in:
John Kessenich
2017-01-13 19:34:22 -07:00
parent 0a76a1870c
commit c142c88967
12 changed files with 269 additions and 340 deletions

View File

@@ -15,11 +15,9 @@ ERROR: 0:63: 'bitwise-or assign' : not supported for this version or the enabled
ERROR: 0:63: 'assign' : cannot convert from 'temp bool' to 'temp float'
ERROR: 0:79: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type 'temp 4-component vector of float' and a right operand of type 'temp 4X4 matrix of float' (or there is no acceptable conversion)
ERROR: 0:79: 'assign' : cannot convert from 'temp 4X4 matrix of float' to 'fragColor 4-component vector of float FragColor'
ERROR: 0:82: 'xr' : illegal - vector component fields not from the same set
ERROR: 0:83: 'xyxyx' : illegal vector field selection
ERROR: 0:83: 'scalar swizzle' : not supported for this version or the enabled extensions
ERROR: 0:83: 'xy' : vector field selection out of range
ERROR: 0:84: 'z' : vector field selection out of range
ERROR: 0:82: 'xr' : vector swizzle selectors not from the same set
ERROR: 0:83: 'xyxyx' : vector swizzle too long
ERROR: 0:84: 'z' : vector swizzle selection out of range
ERROR: 0:85: 'assign' : l-value required
ERROR: 0:91: 'int' : overloaded functions must have the same return type
ERROR: 0:91: 'main' : function already has a body
@@ -52,7 +50,7 @@ ERROR: 0:191: 'shadow2DProjGradARB' : required extension not requested: GL_ARB_s
ERROR: 0:209: 'shadow2DRectProjGradARB' : no matching overloaded function found
ERROR: 0:209: 'assign' : cannot convert from 'const float' to 'temp 4-component vector of float'
ERROR: 0:212: 'sampler2DRect' : Reserved word.
ERROR: 53 compilation errors. No code generated.
ERROR: 51 compilation errors. No code generated.
Shader version: 120
@@ -251,10 +249,23 @@ ERROR: node is still EOpNull!
0:82 'gl_FragColor' (fragColor 4-component vector of float FragColor)
0:82 Constant:
0:82 0 (const int)
0:83 direct index (temp float)
0:83 'gl_FragColor' (fragColor 4-component vector of float FragColor)
0:83 Constant:
0:83 0 (const int)
0:83 vector swizzle (temp 2-component vector of float)
0:83 vector swizzle (temp 4-component vector of float)
0:83 'gl_FragColor' (fragColor 4-component vector of float FragColor)
0:83 Sequence
0:83 Constant:
0:83 0 (const int)
0:83 Constant:
0:83 1 (const int)
0:83 Constant:
0:83 0 (const int)
0:83 Constant:
0:83 1 (const int)
0:83 Sequence
0:83 Constant:
0:83 0 (const int)
0:83 Constant:
0:83 1 (const int)
0:84 direct index (temp float)
0:84 'centTexCoord' (centroid smooth in 2-component vector of float)
0:84 Constant:

View File

@@ -18,9 +18,9 @@ ERROR: 0:40: 'j' : undeclared identifier
ERROR: 0:40: '=' : cannot convert from 'temp float' to 'temp int'
ERROR: 0:44: 'jj' : undeclared identifier
ERROR: 0:44: '=' : cannot convert from 'temp float' to 'temp int'
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: 0:54: 'y' : vector swizzle selection out of range
ERROR: 0:62: 'xxxxx' : vector swizzle too long
ERROR: 0:63: 'xxy' : vector swizzle selection out of range
ERROR: 0:66: 'binding' : cannot declare a default, include a type or full declaration
ERROR: 0:69: 'location/component/index' : cannot declare a default, use a full declaration
ERROR: 0:70: 'input block' : not supported in this stage: vertex
@@ -124,8 +124,10 @@ ERROR: node is still EOpNull!
0:61 'smeared' (temp 3-component vector of float)
0:61 Construct vec3 (temp 3-component vector of float)
0:61 'f' (temp float)
0:62 'f' (temp float)
0:63 'f' (temp float)
0:62 Construct vec4 (temp 4-component vector of float)
0:62 'f' (temp float)
0:63 Construct vec2 (temp 2-component vector of float)
0:63 'f' (temp float)
0:88 Function Definition: bar23444( (global void)
0:88 Function Parameters:
0:? Sequence

View File

@@ -1,6 +1,8 @@
cppComplexExpr.vert
ERROR: 0:46: 'xyxwx' : illegal vector field selection
ERROR: 0:46: 'xyxwx' : illegal vector field selection
ERROR: 0:46: 'xyxwx' : vector swizzle too long
ERROR: 0:46: 'xyxwx' : vector swizzle too long
ERROR: 0:46: 'return' : cannot convert return value to function return type
WARNING: 0:46: 'return' : type conversion on return values was not explicitly allowed until version 420
ERROR: 0:66: '#define' : Macro redefined; different substitutions: BIG
ERROR: 0:81: 'preprocessor evaluation' : bad expression
ERROR: 0:81: '#if' : unexpected tokens following directive
@@ -47,7 +49,7 @@ ERROR: 0:0: 'preprocessor evaluation' : division by 0
ERROR: 0:3: 'preprocessor evaluation' : bad expression
ERROR: 0:3: 'preprocessor evaluation' : division by 0
ERROR: 0:10001: '' : missing #endif
ERROR: 48 compilation errors. No code generated.
ERROR: 49 compilation errors. No code generated.
Shader version: 300
@@ -80,19 +82,33 @@ ERROR: node is still EOpNull!
0:44 Function Parameters:
0:46 Sequence
0:46 Branch: Return with expression
0:46 add (temp highp float)
0:46 add (temp highp float)
0:46 direct index (temp highp float)
0:46 add (temp highp 4-component vector of float)
0:46 add (temp highp 4-component vector of float)
0:46 vector swizzle (temp highp 4-component vector of float)
0:46 'gl_Position' (gl_Position highp 4-component vector of float Position)
0:46 Constant:
0:46 0 (const int)
0:46 Sequence
0:46 Constant:
0:46 0 (const int)
0:46 Constant:
0:46 1 (const int)
0:46 Constant:
0:46 0 (const int)
0:46 Constant:
0:46 3 (const int)
0:46 Constant:
0:46 3.000000
0:46 add (temp highp float)
0:46 direct index (temp highp float)
0:46 add (temp highp 4-component vector of float)
0:46 vector swizzle (temp highp 4-component vector of float)
0:46 'gl_Position' (gl_Position highp 4-component vector of float Position)
0:46 Constant:
0:46 0 (const int)
0:46 Sequence
0:46 Constant:
0:46 0 (const int)
0:46 Constant:
0:46 1 (const int)
0:46 Constant:
0:46 0 (const int)
0:46 Constant:
0:46 3 (const int)
0:46 Constant:
0:46 3.000000
0:47 Branch: Return with expression

View File

@@ -22,14 +22,14 @@ ERROR: 0:172: '[]' : scalar integer expression required
ERROR: 0:175: 'x' : undeclared identifier
ERROR: 0:175: '[]' : scalar integer expression required
ERROR: 0:175: 'b' : left of '[' is not of type array, matrix, or vector
ERROR: 0:175: 'a' : vector field selection out of range
ERROR: 0:175: 'a' : vector swizzle selection out of range
ERROR: 0:175: 'length' : does not operate on this type: const float
ERROR: 0:175: '' : function call, method, or subroutine call expected
ERROR: 0:175: '' : no matching overloaded function found
ERROR: 0:178: '[]' : scalar integer expression required
ERROR: 0:178: 's' : undeclared identifier
ERROR: 0:178: 's' : left of '[' is not of type array, matrix, or vector
ERROR: 0:178: 'a' : vector field selection out of range
ERROR: 0:178: 'a' : vector swizzle selection out of range
ERROR: 0:178: 'length' : does not operate on this type: const float
ERROR: 0:178: '' : function call, method, or subroutine call expected
ERROR: 0:178: '' : no matching overloaded function found