Put in infrastructure for tessellation, geometry, and compute stages, and partially flesh out with built-in functions.

Added the built-in functions EmitVertex(), EndPrimitive(), barrier(), memoryBarrier(), memoryBarrierAtomicCounter(), memoryBarrierBuffer(), memoryBarrierImage(), memoryBarrierShared(), and groupMemoryBarrier().

Have not added any new built-in variables.

Also changed the linear performance relateToOperator() to a high-performance version.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22659 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-08-09 17:14:49 +00:00
parent 317f1af217
commit c027579631
28 changed files with 520 additions and 299 deletions

View File

@ -18,8 +18,13 @@ To use the standalone binary form, execute glslangValidator, and it will print
a usage statement. Basic operation is to give it a file containing a shader,
and it will print out warnings/errors and optionally an AST.
The applied stage-specific rules are based on the file extension. Currently,
either .frag or .vert, but soon to also include all stages.
The applied stage-specific rules are based on the file extension:
.vert for a vertex shader
.tesc for a tessellation control shader
.tese for a tessellation evaluation shader
.geom for a geometry shader
.frag for a fragment shader
.comp for a compute shader
Source: Build and run on linux
-------------------------------

View File

@ -251,6 +251,8 @@ static EShLanguage FindLanguage(const std::string& name)
return EShLangGeometry;
else if (suffix == "frag")
return EShLangFragment;
else if (suffix == "comp")
return EShLangCompute;
usage();
return EShLangVertex;
@ -306,7 +308,13 @@ bool CompileFile(const char *fileName, ShHandle compiler, int debugOptions, cons
void usage()
{
printf("Usage: standalone [ options ] filename\n"
"Where: filename is a name ending in .frag or .vert\n\n"
"Where: filename is a name ending in\n"
" .vert for a vertex shader\n"
" .tesc for a tessellation control shader\n"
" .tese for a tessellation evaluation shader\n"
" .geom for a geometry shader\n"
" .frag for a fragment shader\n"
" .comp for a compute shader\n\n"
"Compilation warnings and errors will be printed to stdout.\n"
"To get other information, use one of the following options:\n"
"-i: intermediate tree (glslang AST) is printed out\n"

9
Test/150.geom Normal file
View File

@ -0,0 +1,9 @@
#version 150 core
void main()
{
EmitVertex();
EndPrimitive();
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
}

9
Test/400.geom Normal file
View File

@ -0,0 +1,9 @@
#version 400 core
void main()
{
EmitStreamVertex(1);
EndStreamPrimitive(0);
EmitVertex();
EndPrimitive();
}

6
Test/400.tesc Normal file
View File

@ -0,0 +1,6 @@
#version 400 core
void main()
{
barrier();
}

6
Test/400.tese Normal file
View File

@ -0,0 +1,6 @@
#version 400 core
void main()
{
barrier(); // ERROR
}

6
Test/420.tese Normal file
View File

@ -0,0 +1,6 @@
#version 420 core
void main()
{
memoryBarrier();
}

10
Test/430.comp Normal file
View File

@ -0,0 +1,10 @@
#version 430 core
void main()
{
memoryBarrierAtomicCounter();
memoryBarrierBuffer();
memoryBarrierShared();
memoryBarrierImage();
groupMemoryBarrier();
}

View File

@ -230,6 +230,28 @@ ERROR: node is still EOpNull!
0:98 3.200000
0:99 Function Call: foo(f1; (int)
0:99 'a' (out float)
0:102 Function Definition: gen(vf3; (bool)
0:102 Function Parameters:
0:102 'v' (in 3-component vector of float)
0:104 Sequence
0:104 Test condition and select (void)
0:104 Condition
0:104 logical-and (bool)
0:104 Compare Less Than (bool)
0:104 Absolute value (float)
0:104 direct index (in float)
0:104 'v' (in 3-component vector of float)
0:104 0 (const int)
0:104 0.000100
0:104 Compare Less Than (bool)
0:104 Absolute value (float)
0:104 direct index (in float)
0:104 'v' (in 3-component vector of float)
0:104 1 (const int)
0:104 0.000100
0:104 true case
0:105 Branch: Return with expression
0:105 true (const bool)
0:? Linker Objects
0:? 'i' (smooth in 4-component vector of float)
0:? 'o' (out 4-component vector of float)

View File

@ -0,0 +1,10 @@
0:3Function Definition: main( (void)
0:3 Function Parameters:
0:5 Sequence
0:5 EmitStreamVertex (void)
0:5 1 (const int)
0:6 EndStreamPrimitive (void)
0:6 0 (const int)
0:7 EmitVertex (void)
0:8 EndPrimitive (void)

View File

@ -0,0 +1,5 @@
0:3Function Definition: main( (void)
0:3 Function Parameters:
0:5 Sequence
0:5 Barrier (void)

View File

@ -0,0 +1,8 @@
ERROR: 0:5: 'barrier' : no matching overloaded function found
ERROR: 1 compilation errors. No code generated.
0:3Function Definition: main( (void)
0:3 Function Parameters:
0:5 Sequence
0:5 0.000000

View File

@ -0,0 +1,5 @@
0:3Function Definition: main( (void)
0:3 Function Parameters:
0:5 Sequence
0:5 MemoryBarrier (void)

View File

@ -0,0 +1,9 @@
0:3Function Definition: main( (void)
0:3 Function Parameters:
0:5 Sequence
0:5 MemoryBarrierAtomicCounter (void)
0:6 MemoryBarrierBuffer (void)
0:7 MemoryBarrierShared (void)
0:8 MemoryBarrierImage (void)
0:9 GroupMemoryBarrier (void)

View File

@ -160,65 +160,60 @@
0:87 'v' (4-component vector of float)
0:88 add second child into first child (4-component vector of float)
0:88 'v' (4-component vector of float)
0:88 normalize (4-component vector of float)
0:88 step (4-component vector of float)
0:88 'uf' (uniform float)
0:88 'v' (4-component vector of float)
0:89 add second child into first child (4-component vector of float)
0:89 'v' (4-component vector of float)
0:89 face-forward (4-component vector of float)
0:89 'v' (4-component vector of float)
0:89 'v' (4-component vector of float)
0:89 smoothstep (4-component vector of float)
0:89 'uf' (uniform float)
0:89 'uf' (uniform float)
0:89 'v' (4-component vector of float)
0:90 add second child into first child (4-component vector of float)
0:90 'v' (4-component vector of float)
0:90 reflect (4-component vector of float)
0:90 'v' (4-component vector of float)
0:90 normalize (4-component vector of float)
0:90 'v' (4-component vector of float)
0:91 add second child into first child (4-component vector of float)
0:91 'v' (4-component vector of float)
0:91 refract (4-component vector of float)
0:91 face-forward (4-component vector of float)
0:91 'v' (4-component vector of float)
0:91 'v' (4-component vector of float)
0:91 'v' (4-component vector of float)
0:91 'uf' (uniform float)
0:92 add second child into first child (4-component vector of float)
0:92 'v' (4-component vector of float)
0:92 dPdx (4-component vector of float)
0:92 reflect (4-component vector of float)
0:92 'v' (4-component vector of float)
0:92 'v' (4-component vector of float)
0:93 add second child into first child (4-component vector of float)
0:93 'v' (4-component vector of float)
0:93 dPdy (4-component vector of float)
0:93 refract (4-component vector of float)
0:93 'v' (4-component vector of float)
0:93 'v' (4-component vector of float)
0:93 'uf' (uniform float)
0:94 add second child into first child (4-component vector of float)
0:94 'v' (4-component vector of float)
0:94 fwidth (4-component vector of float)
0:94 dPdx (4-component vector of float)
0:94 'v' (4-component vector of float)
0:128 move second child to first child (bool)
0:128 'b' (bool)
0:128 any (bool)
0:128 Compare Less Than (4-component vector of bool)
0:128 'v' (4-component vector of float)
0:128 'uv4' (uniform 4-component vector of float)
0:129 move second child to first child (bool)
0:129 'b' (bool)
0:129 logical-and (bool)
0:129 'b' (bool)
0:129 any (bool)
0:129 Compare Less Than or Equal (4-component vector of bool)
0:129 'v' (4-component vector of float)
0:129 'uv4' (uniform 4-component vector of float)
0:95 add second child into first child (4-component vector of float)
0:95 'v' (4-component vector of float)
0:95 dPdy (4-component vector of float)
0:95 'v' (4-component vector of float)
0:96 add second child into first child (4-component vector of float)
0:96 'v' (4-component vector of float)
0:96 fwidth (4-component vector of float)
0:96 'v' (4-component vector of float)
0:130 move second child to first child (bool)
0:130 'b' (bool)
0:130 logical-and (bool)
0:130 'b' (bool)
0:130 any (bool)
0:130 Compare Greater Than (4-component vector of bool)
0:130 'v' (4-component vector of float)
0:130 'uv4' (uniform 4-component vector of float)
0:130 any (bool)
0:130 Compare Less Than (4-component vector of bool)
0:130 'v' (4-component vector of float)
0:130 'uv4' (uniform 4-component vector of float)
0:131 move second child to first child (bool)
0:131 'b' (bool)
0:131 logical-and (bool)
0:131 'b' (bool)
0:131 any (bool)
0:131 Compare Greater Than or Equal (4-component vector of bool)
0:131 Compare Less Than or Equal (4-component vector of bool)
0:131 'v' (4-component vector of float)
0:131 'uv4' (uniform 4-component vector of float)
0:132 move second child to first child (bool)
@ -226,177 +221,193 @@
0:132 logical-and (bool)
0:132 'b' (bool)
0:132 any (bool)
0:132 Equal (4-component vector of bool)
0:132 'ub41' (uniform 4-component vector of bool)
0:132 'ub42' (uniform 4-component vector of bool)
0:132 Compare Greater Than (4-component vector of bool)
0:132 'v' (4-component vector of float)
0:132 'uv4' (uniform 4-component vector of float)
0:133 move second child to first child (bool)
0:133 'b' (bool)
0:133 logical-and (bool)
0:133 'b' (bool)
0:133 any (bool)
0:133 NotEqual (4-component vector of bool)
0:133 'ub41' (uniform 4-component vector of bool)
0:133 'ub42' (uniform 4-component vector of bool)
0:133 Compare Greater Than or Equal (4-component vector of bool)
0:133 'v' (4-component vector of float)
0:133 'uv4' (uniform 4-component vector of float)
0:134 move second child to first child (bool)
0:134 'b' (bool)
0:134 logical-and (bool)
0:134 'b' (bool)
0:134 any (bool)
0:134 'ub41' (uniform 4-component vector of bool)
0:134 Equal (4-component vector of bool)
0:134 'ub41' (uniform 4-component vector of bool)
0:134 'ub42' (uniform 4-component vector of bool)
0:135 move second child to first child (bool)
0:135 'b' (bool)
0:135 logical-and (bool)
0:135 'b' (bool)
0:135 all (bool)
0:135 'ub41' (uniform 4-component vector of bool)
0:135 any (bool)
0:135 NotEqual (4-component vector of bool)
0:135 'ub41' (uniform 4-component vector of bool)
0:135 'ub42' (uniform 4-component vector of bool)
0:136 move second child to first child (bool)
0:136 'b' (bool)
0:136 logical-and (bool)
0:136 'b' (bool)
0:136 any (bool)
0:136 Negate conditional (4-component vector of bool)
0:136 'ub41' (uniform 4-component vector of bool)
0:138 move second child to first child (int)
0:138 'i' (int)
0:138 divide (int)
0:138 subtract (int)
0:138 component-wise multiply (int)
0:138 add (int)
0:138 'i' (int)
0:138 'ui' (uniform int)
0:138 'i' (int)
0:138 'ui' (uniform int)
0:138 'i' (int)
0:139 move second child to first child (int)
0:139 'i' (int)
0:139 mod (int)
0:139 'i' (int)
0:139 'ui' (uniform int)
0:140 Test condition and select (void)
0:140 Condition
0:140 logical-or (bool)
0:140 Compare Equal (bool)
0:140 'i' (int)
0:140 'ui' (uniform int)
0:140 logical-xor (bool)
0:140 logical-and (bool)
0:140 Compare Not Equal (bool)
0:136 'ub41' (uniform 4-component vector of bool)
0:137 move second child to first child (bool)
0:137 'b' (bool)
0:137 logical-and (bool)
0:137 'b' (bool)
0:137 all (bool)
0:137 'ub41' (uniform 4-component vector of bool)
0:138 move second child to first child (bool)
0:138 'b' (bool)
0:138 logical-and (bool)
0:138 'b' (bool)
0:138 any (bool)
0:138 Negate conditional (4-component vector of bool)
0:138 'ub41' (uniform 4-component vector of bool)
0:140 move second child to first child (int)
0:140 'i' (int)
0:140 divide (int)
0:140 subtract (int)
0:140 component-wise multiply (int)
0:140 add (int)
0:140 'i' (int)
0:140 'ui' (uniform int)
0:140 Compare Equal (bool)
0:140 'i' (int)
0:140 'ui' (uniform int)
0:140 Compare Not Equal (bool)
0:140 'i' (int)
0:140 2 (const int)
0:140 true case
0:141 Pre-Increment (int)
0:140 'ui' (uniform int)
0:140 'i' (int)
0:141 move second child to first child (int)
0:141 'i' (int)
0:141 mod (int)
0:141 'i' (int)
0:143 move second child to first child (float)
0:143 'f' (float)
0:143 divide (float)
0:143 subtract (float)
0:143 component-wise multiply (float)
0:143 add (float)
0:143 'uf' (uniform float)
0:143 'uf' (uniform float)
0:143 'uf' (uniform float)
0:143 'uf' (uniform float)
0:143 'uf' (uniform float)
0:145 add second child into first child (float)
0:141 'ui' (uniform int)
0:142 Test condition and select (void)
0:142 Condition
0:142 logical-or (bool)
0:142 Compare Equal (bool)
0:142 'i' (int)
0:142 'ui' (uniform int)
0:142 logical-xor (bool)
0:142 logical-and (bool)
0:142 Compare Not Equal (bool)
0:142 'i' (int)
0:142 'ui' (uniform int)
0:142 Compare Equal (bool)
0:142 'i' (int)
0:142 'ui' (uniform int)
0:142 Compare Not Equal (bool)
0:142 'i' (int)
0:142 2 (const int)
0:142 true case
0:143 Pre-Increment (int)
0:143 'i' (int)
0:145 move second child to first child (float)
0:145 'f' (float)
0:145 length (float)
0:145 'v' (4-component vector of float)
0:146 add second child into first child (float)
0:146 'f' (float)
0:146 distance (float)
0:146 'v' (4-component vector of float)
0:146 'v' (4-component vector of float)
0:145 divide (float)
0:145 subtract (float)
0:145 component-wise multiply (float)
0:145 add (float)
0:145 'uf' (uniform float)
0:145 'uf' (uniform float)
0:145 'uf' (uniform float)
0:145 'uf' (uniform float)
0:145 'uf' (uniform float)
0:147 add second child into first child (float)
0:147 'f' (float)
0:147 dot-product (float)
0:147 'v' (4-component vector of float)
0:147 length (float)
0:147 'v' (4-component vector of float)
0:148 add second child into first child (float)
0:148 'f' (float)
0:148 dot-product (float)
0:148 'f' (float)
0:148 'uf' (uniform float)
0:148 distance (float)
0:148 'v' (4-component vector of float)
0:148 'v' (4-component vector of float)
0:149 add second child into first child (float)
0:149 'f' (float)
0:149 direct index (float)
0:149 cross-product (3-component vector of float)
0:149 vector swizzle (3-component vector of float)
0:149 'v' (4-component vector of float)
0:149 Sequence
0:149 0 (const int)
0:149 1 (const int)
0:149 2 (const int)
0:149 vector swizzle (3-component vector of float)
0:149 'v' (4-component vector of float)
0:149 Sequence
0:149 0 (const int)
0:149 1 (const int)
0:149 2 (const int)
0:149 0 (const int)
0:151 Test condition and select (void)
0:151 Condition
0:151 logical-or (bool)
0:151 Compare Equal (bool)
0:151 'f' (float)
0:151 'uf' (uniform float)
0:151 logical-and (bool)
0:151 Compare Not Equal (bool)
0:151 'f' (float)
0:151 'uf' (uniform float)
0:151 Compare Not Equal (bool)
0:151 'f' (float)
0:151 2.000000
0:151 true case
0:152 Pre-Increment (float)
0:152 'f' (float)
0:154 and second child into first child (int)
0:154 'i' (int)
0:154 'ui' (uniform int)
0:155 or second child into first child (int)
0:155 'i' (int)
0:155 66 (const int)
0:156 exclusive or second child into first child (int)
0:149 dot-product (float)
0:149 'v' (4-component vector of float)
0:149 'v' (4-component vector of float)
0:150 add second child into first child (float)
0:150 'f' (float)
0:150 dot-product (float)
0:150 'f' (float)
0:150 'uf' (uniform float)
0:151 add second child into first child (float)
0:151 'f' (float)
0:151 direct index (float)
0:151 cross-product (3-component vector of float)
0:151 vector swizzle (3-component vector of float)
0:151 'v' (4-component vector of float)
0:151 Sequence
0:151 0 (const int)
0:151 1 (const int)
0:151 2 (const int)
0:151 vector swizzle (3-component vector of float)
0:151 'v' (4-component vector of float)
0:151 Sequence
0:151 0 (const int)
0:151 1 (const int)
0:151 2 (const int)
0:151 0 (const int)
0:153 Test condition and select (void)
0:153 Condition
0:153 logical-or (bool)
0:153 Compare Equal (bool)
0:153 'f' (float)
0:153 'uf' (uniform float)
0:153 logical-and (bool)
0:153 Compare Not Equal (bool)
0:153 'f' (float)
0:153 'uf' (uniform float)
0:153 Compare Not Equal (bool)
0:153 'f' (float)
0:153 2.000000
0:153 true case
0:154 Pre-Increment (float)
0:154 'f' (float)
0:156 and second child into first child (int)
0:156 'i' (int)
0:156 'ui' (uniform int)
0:157 mod second child into first child (int)
0:157 or second child into first child (int)
0:157 'i' (int)
0:157 17 (const int)
0:158 right shift second child into first child (int)
0:157 66 (const int)
0:158 exclusive or second child into first child (int)
0:158 'i' (int)
0:158 2 (const int)
0:159 left shift second child into first child (int)
0:158 'ui' (uniform int)
0:159 mod second child into first child (int)
0:159 'i' (int)
0:159 'ui' (uniform int)
0:160 move second child to first child (int)
0:159 17 (const int)
0:160 right shift second child into first child (int)
0:160 'i' (int)
0:160 Bitwise not (int)
0:160 'i' (int)
0:161 move second child to first child (bool)
0:161 'b' (bool)
0:161 Negate conditional (bool)
0:161 'b' (bool)
0:163 move second child to first child (4-component vector of float)
0:163 'gl_FragColor' (fragColor 4-component vector of float)
0:163 Test condition and select (4-component vector of float)
0:163 Condition
0:160 2 (const int)
0:161 left shift second child into first child (int)
0:161 'i' (int)
0:161 'ui' (uniform int)
0:162 move second child to first child (int)
0:162 'i' (int)
0:162 Bitwise not (int)
0:162 'i' (int)
0:163 move second child to first child (bool)
0:163 'b' (bool)
0:163 Negate conditional (bool)
0:163 'b' (bool)
0:163 true case
0:163 add (4-component vector of float)
0:163 add (4-component vector of float)
0:163 Construct vec4 (4-component vector of float)
0:163 Convert int to float (float)
0:163 'i' (int)
0:163 Construct vec4 (4-component vector of float)
0:163 'f' (float)
0:163 'v' (4-component vector of float)
0:163 false case
0:163 'v' (4-component vector of float)
0:165 move second child to first child (4-component vector of float)
0:165 'gl_FragColor' (fragColor 4-component vector of float)
0:165 Test condition and select (4-component vector of float)
0:165 Condition
0:165 'b' (bool)
0:165 true case
0:165 add (4-component vector of float)
0:165 add (4-component vector of float)
0:165 Construct vec4 (4-component vector of float)
0:165 Convert int to float (float)
0:165 'i' (int)
0:165 Construct vec4 (4-component vector of float)
0:165 'f' (float)
0:165 'v' (4-component vector of float)
0:165 false case
0:165 'v' (4-component vector of float)
0:? Linker Objects
0:? 'uiv4' (uniform 4-component vector of int)
0:? 'uv4' (uniform 4-component vector of float)

View File

@ -44,6 +44,11 @@ tokenLength.vert
430scope.vert
lineContinuation.vert
numeral.frag
400.geom
400.tesc
400.tese
420.tese
430.comp
../../LunarGLASS/test/aggOps.frag
../../LunarGLASS/test/always-discard.frag
../../LunarGLASS/test/always-discard2.frag

View File

@ -213,6 +213,19 @@ enum TOperator {
EOpMatrixInverse,
EOpTranspose,
EOpEmitVertex, // geometry only
EOpEndPrimitive, // geometry only
EOpEmitStreamVertex, // geometry only
EOpEndStreamPrimitive, // geometry only
EOpBarrier,
EOpMemoryBarrier,
EOpMemoryBarrierAtomicCounter,
EOpMemoryBarrierBuffer,
EOpMemoryBarrierImage,
EOpMemoryBarrierShared, // compute only
EOpGroupMemoryBarrier, // compute only
EOpAny,
EOpAll,

View File

@ -402,6 +402,11 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType,
newConstArray = new constUnion[1];
break;
case EOpEmitStreamVertex:
case EOpEndStreamPrimitive:
// These don't actually fold
return 0;
default:
newConstArray = new constUnion[objectSize];
}

View File

@ -75,13 +75,6 @@ void TBuiltIns::initialize(int version, EProfile profile)
//
// Initialize all the built-in strings for parsing.
//
TString BuiltInFunctions;
TString BuiltInFunctionsVertex;
TString BuiltInFunctionsFragment;
TString StandardVertexVaryings;
TString StandardFragmentVaryings;
TString StandardVertexAttributes;
TString StandardUniforms;
{
//============================================================================
@ -90,7 +83,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
//
//============================================================================
TString& s = BuiltInFunctions;
TString& s = commonBuiltins;
//
// Angle and Trigonometric Functions.
@ -655,7 +648,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
//
//============================================================================
TString& s = BuiltInFunctionsVertex;
TString& s = stageBuiltins[EShLangVertex];
//
// Geometric Functions.
@ -685,6 +678,45 @@ void TBuiltIns::initialize(int version, EProfile profile)
}
s.append(TString("\n"));
}
if (profile != EEsProfile && version >= 150) {
//============================================================================
//
// Prototypes for built-in functions seen by geometry shaders only.
//
//============================================================================
TString& s = stageBuiltins[EShLangGeometry];
if (version >= 400) {
s.append(TString("void EmitStreamVertex(int);"));
s.append(TString("void EndStreamPrimitive(int);"));
}
s.append(TString("void EmitVertex();"));
s.append(TString("void EndPrimitive();"));
s.append(TString("\n"));
}
if (profile != EEsProfile) {
//============================================================================
//
// Prototypes for all control functions.
//
//============================================================================
if (version >= 400)
stageBuiltins[EShLangTessControl].append("void barrier();");
if (version >= 430)
stageBuiltins[EShLangCompute].append("void barrier();");
if (version >= 420)
commonBuiltins.append("void memoryBarrier();");
if (version >= 430) {
commonBuiltins.append("void memoryBarrierAtomicCounter();");
commonBuiltins.append("void memoryBarrierBuffer();");
commonBuiltins.append("void memoryBarrierImage();");
stageBuiltins[EShLangCompute].append("void memoryBarrierShared();");
stageBuiltins[EShLangCompute].append("void groupMemoryBarrier();");
}
}
{
//============================================================================
//
@ -692,7 +724,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
//
//============================================================================
TString& s = BuiltInFunctionsFragment;
TString& s = stageBuiltins[EShLangFragment];
//
// Original-style texture Functions with bias.
@ -739,7 +771,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
//
//============================================================================
TString& s = StandardUniforms;
TString& s = commonBuiltins;
//
// Depth range in window coordinates, p. 33
@ -884,7 +916,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
//============================================================================
if (profile != EEsProfile) {
TString& s = StandardVertexAttributes;
TString& s = stageBuiltins[EShLangVertex];
if (version < 130) {
s.append(TString("attribute vec4 gl_Color;"));
@ -925,7 +957,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
//============================================================================
if (profile != EEsProfile) {
TString& s = StandardVertexVaryings;
TString& s = stageBuiltins[EShLangVertex];
if (version < 130) {
s.append(TString("varying vec4 gl_FrontColor;"));
@ -953,7 +985,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
//============================================================================
if (profile != EEsProfile) {
TString& s = StandardFragmentVaryings;
TString& s = stageBuiltins[EShLangFragment];
if (version < 130) {
s.append(TString("varying vec4 gl_Color;"));
s.append(TString("varying vec4 gl_SecondaryColor;"));
@ -970,29 +1002,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
}
}
builtInStrings[EShLangFragment].push_back(BuiltInFunctions);
builtInStrings[EShLangFragment].push_back(BuiltInFunctionsFragment);
builtInStrings[EShLangFragment].push_back(StandardUniforms);
builtInStrings[EShLangFragment].push_back(StandardFragmentVaryings);
builtInStrings[EShLangVertex].push_back(BuiltInFunctions);
builtInStrings[EShLangVertex].push_back(BuiltInFunctionsVertex);
builtInStrings[EShLangVertex].push_back(StandardVertexVaryings);
builtInStrings[EShLangVertex].push_back(StandardVertexAttributes);
builtInStrings[EShLangVertex].push_back(StandardUniforms);
if (version >= 130)
add2ndGenerationSamplingImaging(version, profile);
#ifdef TEST_MODE
printf("VERTEX SYMBOLS \n");
for (unsigned int i = 0; i < builtInStrings[EShLangVertex].size(); ++i)
printf("%s", builtInStrings[EShLangVertex][i].c_str());
printf("FRAGMENT SYMBOLS \n");
for (unsigned int i = 0; i < builtInStrings[EShLangFragment].size(); ++i)
printf("%s", builtInStrings[EShLangFragment][i].c_str());
#endif
}
void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
@ -1074,7 +1085,7 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, TString& typeName, int versi
if (version < 430 && sampler.image)
return;
TString s;
TString& s = commonBuiltins;
if (profile == EEsProfile)
s.append("highp ");
int dims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0);
@ -1093,8 +1104,6 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, TString& typeName, int versi
s.append(",int);\n");
else
s.append(");\n");
builtInStrings[EShLangFragment].push_back(s);
builtInStrings[EShLangVertex].push_back(s);
// TODO: 4.2 Functionality: imaging functions
}
@ -1268,9 +1277,12 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int ve
if (! bias) {
functions[EShLangVertex].append(s);
// all stages other than fragment get this here too
functions[EShLangGeometry].append(s);
functions[EShLangTessControl].append(s);
functions[EShLangTessEvaluation].append(s);
functions[EShLangCompute].append(s);
}
functions[EShLangFragment].append(s);
commonBuiltins.append(s);
}
}
}
@ -1278,9 +1290,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int ve
}
}
}
builtInStrings[EShLangVertex].push_back(functions[EShLangVertex]);
builtInStrings[EShLangFragment].push_back(functions[EShLangFragment]);
}
void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, EShLanguage language)
@ -1288,8 +1297,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
//
// Initialize the context-dependent (resource-dependent) built-in strings for parsing.
//
TString StandardUniforms;
{
//============================================================================
//
@ -1297,7 +1304,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
//
//============================================================================
TString& s = StandardUniforms;
TString& s = commonBuiltins;
const int maxSize = 80;
char builtInConstant[maxSize];
@ -1435,9 +1442,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(TString("\n"));
}
builtInStrings[EShLangFragment].push_back(StandardUniforms);
builtInStrings[EShLangVertex].push_back(StandardUniforms);
}
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymbolTable& symbolTable)
@ -1448,6 +1452,30 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
// the built-in text strings.
//
switch(language) {
case EShLangVertex:
pq = profile == EEsProfile ? EpqHigh : EpqNone;
symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EvqPosition, pq, 4)));
pq = profile == EEsProfile ? (version > 100 ? EpqHigh : EpqMedium) : EpqNone;
symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EvqPointSize, pq, 1)));
if (profile != EEsProfile)
symbolTable.insert(*new TVariable(NewPoolTString("gl_ClipVertex"), TType(EbtFloat, EvqClipVertex, 4)));
if (version >= 130) {
pq = profile == EEsProfile ? EpqHigh : EpqNone;
symbolTable.insert(*new TVariable(NewPoolTString("gl_VertexID"), TType(EbtInt, EvqVertexId, pq, 1)));
if (version >= 140)
symbolTable.insert(*new TVariable(NewPoolTString("gl_InstanceID"), TType(EbtInt, EvqInstanceId, pq, 1)));
}
break;
case EShLangTessControl:
case EShLangTessEvaluation:
case EShLangGeometry:
// TODO: desktop functionality: support new stages
break;
case EShLangFragment:
symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EvqFace, 1)));
@ -1473,28 +1501,9 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
}
break;
case EShLangVertex:
pq = profile == EEsProfile ? EpqHigh : EpqNone;
symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EvqPosition, pq, 4)));
pq = profile == EEsProfile ? (version > 100 ? EpqHigh : EpqMedium) : EpqNone;
symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EvqPointSize, pq, 1)));
if (profile != EEsProfile)
symbolTable.insert(*new TVariable(NewPoolTString("gl_ClipVertex"), TType(EbtFloat, EvqClipVertex, 4)));
if (version >= 130) {
pq = profile == EEsProfile ? EpqHigh : EpqNone;
symbolTable.insert(*new TVariable(NewPoolTString("gl_VertexID"), TType(EbtInt, EvqVertexId, pq, 1)));
if (version >= 140)
symbolTable.insert(*new TVariable(NewPoolTString("gl_InstanceID"), TType(EbtInt, EvqInstanceId, pq, 1)));
}
break;
case EShLangTessControl:
case EShLangTessEvaluation:
case EShLangGeometry:
case EShLangCompute:
// TODO: desktop functionality: support new stages
break;
default:
assert(false && "Language not supported");
@ -1593,19 +1602,40 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
symbolTable.relateToOperator("any", EOpAny);
symbolTable.relateToOperator("all", EOpAll);
switch(language) {
symbolTable.relateToOperator("barrier", EOpBarrier);
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
switch(language) {
case EShLangVertex:
break;
case EShLangTessControl:
case EShLangTessEvaluation:
break;
case EShLangGeometry:
symbolTable.relateToOperator("EmitStreamVertex", EOpEmitStreamVertex);
symbolTable.relateToOperator("EndStreamPrimitive", EOpEndStreamPrimitive);
symbolTable.relateToOperator("EmitVertex", EOpEmitVertex);
symbolTable.relateToOperator("EndPrimitive", EOpEndPrimitive);
break;
case EShLangFragment:
symbolTable.relateToOperator("dFdx", EOpDPdx);
symbolTable.relateToOperator("dFdy", EOpDPdy);
symbolTable.relateToOperator("fwidth", EOpFwidth);
break;
default: assert(false && "Language not supported");
case EShLangCompute:
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
break;
default:
assert(false && "Language not supported");
}
}
@ -1628,6 +1658,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
}
break;
default: break;
default:
break;
}
}

View File

@ -43,8 +43,6 @@
#include "SymbolTable.h"
#include "Versions.h"
typedef TVector<TString> TBuiltInStrings;
class TBuiltIns {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
@ -52,7 +50,8 @@ public:
virtual ~TBuiltIns();
void initialize(int version, EProfile);
void initialize(const TBuiltInResource& resources, int version, EProfile, EShLanguage);
TBuiltInStrings* getBuiltInStrings() { return builtInStrings; }
const TString& getCommonString() const { return commonBuiltins; }
const TString& getStageString(EShLanguage language) const { return stageBuiltins[language]; }
protected:
void add2ndGenerationSamplingImaging(int version, EProfile profile);
@ -60,7 +59,8 @@ protected:
void addImageFunctions(TSampler, TString& typeName, int version, EProfile profile);
void addSamplingFunctions(TSampler, TString& typeName, int version, EProfile profile);
TBuiltInStrings builtInStrings[EShLangCount];
TString commonBuiltins;
TString stageBuiltins[EShLangCount];
// Helpers for making text
const char* postfixes[5];

View File

@ -264,7 +264,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
return node;
}
TIntermTyped* TIntermediate::addBuiltInFunctionCall(TOperator op, bool unary, TIntermNode* childNode, const TType& returnType)
TIntermTyped* TIntermediate::addBuiltInFunctionCall(TSourceLoc loc, TOperator op, bool unary, TIntermNode* childNode, const TType& returnType)
{
if (unary) {
//
@ -279,9 +279,11 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(TOperator op, bool unary, TI
return 0;
}
if (child->getAsConstantUnion())
return child->getAsConstantUnion()->fold(op, returnType, infoSink);
if (child->getAsConstantUnion()) {
TIntermTyped* folded = child->getAsConstantUnion()->fold(op, returnType, infoSink);
if (folded)
return folded;
}
TIntermUnary* node = new TIntermUnary(op);
node->setLoc(child->getLoc());
@ -299,7 +301,7 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(TOperator op, bool unary, TI
return node;
} else {
// setAggregateOperater() calls fold() for constant folding
TIntermTyped* node = setAggregateOperator(childNode, op, returnType, childNode->getLoc());
TIntermTyped* node = setAggregateOperator(childNode, op, returnType, loc);
TPrecisionQualifier correctPrecision = returnType.getQualifier().precision;
if (correctPrecision == EpqNone && profile == EEsProfile) {

View File

@ -81,7 +81,7 @@ TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb,
defaultPrecision[EbtSampler] = EpqLow;
break;
default:
infoSink.info.message(EPrefixError, "unexpected language");
infoSink.info.message(EPrefixError, "unexpected es-profile stage");
}
}
@ -1965,13 +1965,11 @@ void TParseContext::updateTypedDefaults(TSourceLoc loc, TQualifier qualifier, co
if (qualifier.layoutPacking != ElpNone)
error(loc, "cannot specify packing on a variable declaration", id->c_str(), "");
} else if (qualifier.storage == EvqVaryingIn) {
if (qualifier.hasLayout() && language != EShLangVertex) {
if (qualifier.hasLayout() && language != EShLangVertex)
error(loc, "can only use location layout qualifier on a vertex input or fragment output", id->c_str(), "");
}
} else if (qualifier.storage == EvqVaryingOut) {
if (qualifier.hasLayout() && language != EShLangFragment) {
if (qualifier.hasLayout() && language != EShLangFragment)
error(loc, "can only use location layout qualifier on a vertex input or fragment output", id->c_str(), "");
}
} else {
if (qualifier.layoutMatrix != ElmNone ||
qualifier.layoutPacking != ElpNone)

View File

@ -89,7 +89,7 @@ TSymbolTable* SharedSymbolTables[VersionCount][EProfileCount][EShLangCount] = {}
TPoolAllocator* PerProcessGPA = 0;
bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, int version, EProfile profile, EShLanguage language, TInfoSink& infoSink,
bool InitializeSymbolTable(const TBuiltIns& builtIns, int version, EProfile profile, EShLanguage language, TInfoSink& infoSink,
const TBuiltInResource* resources, TSymbolTable* symbolTables)
{
TIntermediate intermediate(infoSink, version, profile);
@ -119,26 +119,25 @@ bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, int version, EProfil
symbolTable->push();
for (TBuiltInStrings::iterator i = BuiltInStrings[parseContext.language].begin();
i != BuiltInStrings[parseContext.language].end(); ++i) {
const char* builtInShaders[1];
int builtInLengths[1];
const char* builtInShaders[2];
int builtInLengths[2];
builtInShaders[0] = builtIns.getCommonString().c_str();
builtInLengths[0] = builtIns.getCommonString().size();
builtInShaders[1] = builtIns.getStageString(language).c_str();
builtInLengths[1] = builtIns.getStageString(language).size();
builtInShaders[0] = (*i).c_str();
builtInLengths[0] = (int) (*i).size();
if (! parseContext.parseShaderStrings(ppContext, const_cast<char**>(builtInShaders), builtInLengths, 1) != 0) {
infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
printf("Unable to parse built-ins\n");
if (! parseContext.parseShaderStrings(ppContext, const_cast<char**>(builtInShaders), builtInLengths, 2) != 0) {
infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
printf("Unable to parse built-ins\n");
return false;
}
return false;
}
if (resources) {
if (resources)
IdentifyBuiltIns(version, profile, parseContext.language, *symbolTable, *resources);
} else {
else
IdentifyBuiltIns(version, profile, parseContext.language, *symbolTable);
}
return true;
}
@ -147,8 +146,16 @@ bool GenerateBuiltInSymbolTable(TInfoSink& infoSink, TSymbolTable* symbolTables,
TBuiltIns builtIns;
builtIns.initialize(version, profile);
InitializeSymbolTable(builtIns.getBuiltInStrings(), version, profile, EShLangVertex, infoSink, 0, symbolTables);
InitializeSymbolTable(builtIns.getBuiltInStrings(), version, profile, EShLangFragment, infoSink, 0, symbolTables);
InitializeSymbolTable(builtIns, version, profile, EShLangVertex, infoSink, 0, symbolTables);
if (profile != EEsProfile && version >= 400) {
InitializeSymbolTable(builtIns, version, profile, EShLangTessControl, infoSink, 0, symbolTables);
InitializeSymbolTable(builtIns, version, profile, EShLangTessEvaluation, infoSink, 0, symbolTables);
}
if (profile != EEsProfile && version >= 150)
InitializeSymbolTable(builtIns, version, profile, EShLangGeometry, infoSink, 0, symbolTables);
InitializeSymbolTable(builtIns, version, profile, EShLangFragment, infoSink, 0, symbolTables);
if (profile != EEsProfile && version >= 430)
InitializeSymbolTable(builtIns, version, profile, EShLangCompute, infoSink, 0, symbolTables);
return true;
}
@ -158,7 +165,7 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
TBuiltIns builtIns;
builtIns.initialize(*resources, version, profile, language);
InitializeSymbolTable(builtIns.getBuiltInStrings(), version, profile, language, infoSink, resources, symbolTables);
InitializeSymbolTable(builtIns, version, profile, language, infoSink, resources, symbolTables);
return true;
}
@ -207,10 +214,12 @@ void SetupBuiltinSymbolTable(int version, EProfile profile)
SetThreadPoolAllocator(*PerProcessGPA);
// Copy the symbol table from the new pool to the process-global pool
SharedSymbolTables[versionIndex][profile][EShLangVertex] = new TSymbolTable;
SharedSymbolTables[versionIndex][profile][EShLangVertex]->copyTable(symTables[EShLangVertex]);
SharedSymbolTables[versionIndex][profile][EShLangFragment] = new TSymbolTable;
SharedSymbolTables[versionIndex][profile][EShLangFragment]->copyTable(symTables[EShLangFragment]);
for (int stage = 0; stage < EShLangCount; ++stage) {
if (! symTables[stage].isEmpty()) {
SharedSymbolTables[versionIndex][profile][stage] = new TSymbolTable;
SharedSymbolTables[versionIndex][profile][stage]->copyTable(symTables[stage]);
}
}
delete builtInPoolAllocator;
SetThreadPoolAllocator(savedGPA);
@ -416,9 +425,18 @@ int ShCompile(
TIntermediate intermediate(compiler->infoSink, version, profile);
SetupBuiltinSymbolTable(version, profile);
TSymbolTable symbolTable(*SharedSymbolTables[MapVersionToIndex(version)]
[profile]
[compiler->getLanguage()]);
TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)]
[profile]
[compiler->getLanguage()];
TSymbolTable* errorTable = 0;
if (! cachedTable) {
errorTable = new TSymbolTable;
cachedTable = errorTable;
}
TSymbolTable symbolTable(*cachedTable);
if (errorTable)
delete errorTable;
// Add built-in symbols that are potentially context dependent;
// they get popped again further down.
@ -436,13 +454,13 @@ int ShCompile(
if (! goodProfile)
parseContext.error(beginning, "incorrect", "#version", "");
parseContext.initializeExtensionBehavior();
if (versionStatementMissing)
parseContext.warn(beginning, "statement missing: use #version on first line of shader", "#version", "");
else if (profile == EEsProfile && version >= 300 && versionNotFirst)
parseContext.error(beginning, "statement must appear first in ESSL shader; before comments or newlines", "#version", "");
parseContext.initializeExtensionBehavior();
//
// Parse the application's shaders. All the following symbol table
// work will be throw-away, so push a new allocation scope that can

View File

@ -188,19 +188,20 @@ TSymbolTableLevel::~TSymbolTableLevel()
//
// Change all function entries in the table with the non-mangled name
// to be related to the provided built-in operation. This is a low
// performance operation, and only intended for symbol tables that
// live across a large number of compiles.
// to be related to the provided built-in operation.
//
void TSymbolTableLevel::relateToOperator(const char* name, TOperator op)
{
tLevel::iterator it;
for (it = level.begin(); it != level.end(); ++it) {
TFunction* function = (*it).second->getAsFunction();
if (function) {
if (function->getName() == name)
function->relateToOperator(op);
}
tLevel::const_iterator candidate = level.lower_bound(name);
while (candidate != level.end()) {
const TString& candidateName = (*candidate).first;
TString::size_type parenAt = candidateName.find_first_of('(');
if (parenAt != candidateName.npos && candidateName.substr(0, parenAt) == name) {
TFunction* function = (*candidate).second->getAsFunction();
function->relateToOperator(op);
} else
break;
++candidate;
}
}

View File

@ -373,10 +373,12 @@ public:
}
explicit TSymbolTable(TSymbolTable& symTable)
{
table.push_back(symTable.table[0]);
adoptedLevels = 1;
uniqueId = symTable.uniqueId;
noBuiltInRedeclarations = symTable.noBuiltInRedeclarations;
if (! symTable.isEmpty()) {
table.push_back(symTable.table[0]);
adoptedLevels = 1;
uniqueId = symTable.uniqueId;
noBuiltInRedeclarations = symTable.noBuiltInRedeclarations;
} // else should only be to handle error paths
}
~TSymbolTable()
{
@ -391,6 +393,9 @@ public:
// built-ins specific to a compile are at level 1 and the shader
// globals are at level 2.
//
// TODO: compile-time memory: have an even earlier level for all built-ins
// common to all stages. Currently, each stage has copy.
//
bool isEmpty() { return table.size() == 0; }
bool atBuiltInLevel() { return atSharedBuiltInLevel() || atDynamicBuiltInLevel(); }
bool atSharedBuiltInLevel() { return table.size() == 1; }

View File

@ -491,7 +491,7 @@ function_call
op = fnCandidate->getBuiltInOp();
if (builtIn && op != EOpNull) {
// A function call mapped to a built-in operation.
$$ = parseContext.intermediate.addBuiltInFunctionCall(op, fnCandidate->getParamCount() == 1, $1.intermNode, fnCandidate->getReturnType());
$$ = parseContext.intermediate.addBuiltInFunctionCall($1.loc, op, fnCandidate->getParamCount() == 1, $1.intermNode, fnCandidate->getReturnType());
if ($$ == 0) {
parseContext.error($1.intermNode->getLoc(), " wrong operand type", "Internal Error",
"built in unary operator function. Type: %s",

View File

@ -260,6 +260,9 @@ bool OutputUnary(bool /* preVisit */, TIntermUnary* node, TIntermTraverser* it)
case EOpAny: out.debug << "any"; break;
case EOpAll: out.debug << "all"; break;
case EOpEmitStreamVertex: out.debug << "EmitStreamVertex"; break;
case EOpEndStreamPrimitive: out.debug << "EndStreamPrimitive"; break;
default: out.debug.message(EPrefixError, "Bad unary op");
}
@ -355,6 +358,17 @@ bool OutputAggregate(bool /* preVisit */, TIntermAggregate* node, TIntermTravers
case EOpMul: out.debug << "component-wise multiply"; break;
case EOpOuterProduct: out.debug << "outer product"; break;
case EOpEmitVertex: out.debug << "EmitVertex"; break;
case EOpEndPrimitive: out.debug << "EndPrimitive"; break;
case EOpBarrier: out.debug << "Barrier"; break;
case EOpMemoryBarrier: out.debug << "MemoryBarrier"; break;
case EOpMemoryBarrierAtomicCounter: out.debug << "MemoryBarrierAtomicCounter"; break;
case EOpMemoryBarrierBuffer: out.debug << "MemoryBarrierBuffer"; break;
case EOpMemoryBarrierImage: out.debug << "MemoryBarrierImage"; break;
case EOpMemoryBarrierShared: out.debug << "MemoryBarrierShared"; break;
case EOpGroupMemoryBarrier: out.debug << "GroupMemoryBarrier"; break;
default: out.debug.message(EPrefixError, "Bad aggregation op");
}

View File

@ -60,7 +60,7 @@ public:
TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc);
TIntermTyped* addUnaryMath(TOperator, TIntermNode* child, TSourceLoc);
TIntermTyped* addBuiltInFunctionCall(TOperator, bool unary, TIntermNode*, const TType& returnType);
TIntermTyped* addBuiltInFunctionCall(TSourceLoc line, TOperator, bool unary, TIntermNode*, const TType& returnType);
bool canImplicitlyPromote(TBasicType from, TBasicType to);
TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right);
TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc);