Commit ef676b0a by John Kessenich

Front-end "pure" built-in TOperator: Finish adding full support, but still turned off.

This is to avoid all need to do text comparison of built-in function names when consuming the AST. All built-in functions get enumerants. Will want to turn on soon. See PureOperatorBuiltins. See issue #8.
parent e88217b7
...@@ -59,7 +59,7 @@ void main() ...@@ -59,7 +59,7 @@ void main()
v = textureLod(s2DArray, c3D, 1.2); v = textureLod(s2DArray, c3D, 1.2);
f = textureOffset(s2DShadow, c3D, ic2D, c1D); // ERROR, offset argument not constant f = textureOffset(s2DShadow, c3D, ic2D, c1D); // ERROR, offset argument not constant
v = texelFetch(s3D, ic3D, ic1D); v = texelFetch(s3D, ic3D, ic1D);
v = texelFetchOffset(arrayedSampler[2], ic2D, 4, ic2D); v = texelFetchOffset(arrayedSampler[2], ic2D, 4, ic2D); // ERROR, offset argument not constant
f = textureLodOffset(s2DShadow, c3D, c1D, ic2D); f = textureLodOffset(s2DShadow, c3D, c1D, ic2D);
v = textureProjLodOffset(s2D, c3D, c1D, ic2D); v = textureProjLodOffset(s2D, c3D, c1D, ic2D);
v = textureGrad(sCube, c3D, c3D, c3D); v = textureGrad(sCube, c3D, c3D, c3D);
......
...@@ -49,7 +49,9 @@ Shader version: 430 ...@@ -49,7 +49,9 @@ Shader version: 430
0:43 'ic2D' (flat in 2-component vector of int) 0:43 'ic2D' (flat in 2-component vector of int)
0:43 Constant: 0:43 Constant:
0:43 4 (const int) 0:43 4 (const int)
0:43 'ic2D' (flat in 2-component vector of int) 0:43 Constant:
0:43 3 (const int)
0:43 3 (const int)
0:44 add second child into first child (temp float) 0:44 add second child into first child (temp float)
0:44 direct index (temp float) 0:44 direct index (temp float)
0:44 'v' (temp 4-component vector of float) 0:44 'v' (temp 4-component vector of float)
...@@ -301,7 +303,9 @@ Shader version: 430 ...@@ -301,7 +303,9 @@ Shader version: 430
0:43 'ic2D' (flat in 2-component vector of int) 0:43 'ic2D' (flat in 2-component vector of int)
0:43 Constant: 0:43 Constant:
0:43 4 (const int) 0:43 4 (const int)
0:43 'ic2D' (flat in 2-component vector of int) 0:43 Constant:
0:43 3 (const int)
0:43 3 (const int)
0:44 add second child into first child (temp float) 0:44 add second child into first child (temp float)
0:44 direct index (temp float) 0:44 direct index (temp float)
0:44 'v' (temp 4-component vector of float) 0:44 'v' (temp 4-component vector of float)
......
...@@ -40,7 +40,7 @@ void main() ...@@ -40,7 +40,7 @@ void main()
v += textureLod(s2DArray, c3D, 1.2); v += textureLod(s2DArray, c3D, 1.2);
v.y += textureOffset(s2DShadow, c3D, ivec2(3), c1D); v.y += textureOffset(s2DShadow, c3D, ivec2(3), c1D);
v += texelFetch(s3D, ic3D, ic1D); v += texelFetch(s3D, ic3D, ic1D);
v += texelFetchOffset(s2D, ic2D, 4, ic2D); v += texelFetchOffset(s2D, ic2D, 4, ivec2(3));
v.y += textureLodOffset(s2DShadow, c3D, c1D, ivec2(3)); v.y += textureLodOffset(s2DShadow, c3D, c1D, ivec2(3));
v += textureProjLodOffset(s2D, c3D, c1D, ivec2(3)); v += textureProjLodOffset(s2D, c3D, c1D, ivec2(3));
v += textureGrad(sCube, c3D, c3D, c3D); v += textureGrad(sCube, c3D, c3D, c3D);
......
...@@ -38,7 +38,7 @@ void main() ...@@ -38,7 +38,7 @@ void main()
v += textureLod(s2DArray, c3D, 1.2); v += textureLod(s2DArray, c3D, 1.2);
v.y += textureOffset(s2DShadow, c3D, ivec2(3), c1D); v.y += textureOffset(s2DShadow, c3D, ivec2(3), c1D);
v += texelFetch(s3D, ic3D, ic1D); v += texelFetch(s3D, ic3D, ic1D);
v += texelFetchOffset(s2D, ic2D, 4, ic2D); v += texelFetchOffset(s2D, ic2D, 4, ivec2(3));
v.y += textureLodOffset(s2DShadow, c3D, c1D, ivec2(3)); v.y += textureLodOffset(s2DShadow, c3D, c1D, ivec2(3));
v += textureProjLodOffset(s2D, c3D, c1D, ivec2(3)); v += textureProjLodOffset(s2D, c3D, c1D, ivec2(3));
v += textureGrad(sCube, c3D, c3D, c3D); v += textureGrad(sCube, c3D, c3D, c3D);
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "2.3.723" #define GLSLANG_REVISION "2.3.725"
#define GLSLANG_DATE "18-Aug-2015" #define GLSLANG_DATE "18-Aug-2015"
...@@ -59,7 +59,7 @@ bool ARBCompatibility = true; ...@@ -59,7 +59,7 @@ bool ARBCompatibility = true;
const bool ForwardCompatibility = false; const bool ForwardCompatibility = false;
// change this back to false if depending on textual spellings of texturing calls when consuming the AST // change this back to false if depending on textual spellings of texturing calls when consuming the AST
const bool PureOperatorBuiltins = false; bool PureOperatorBuiltins = false;
inline bool IncludeLegacy(int version, EProfile profile) inline bool IncludeLegacy(int version, EProfile profile)
{ {
...@@ -3097,7 +3097,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb ...@@ -3097,7 +3097,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
// //
// Next, identify which built-ins have a mapping to an operator. // Next, identify which built-ins have a mapping to an operator.
// Those that are not identified as such are // If PureOperatorBuiltins is false, those that are not identified as such are
// expected to be resolved through a library of functions, versus as // expected to be resolved through a library of functions, versus as
// operations. // operations.
// //
...@@ -3267,30 +3267,59 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb ...@@ -3267,30 +3267,59 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset); symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset);
symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets); symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets);
if (IncludeLegacy(version, profile)) { if (IncludeLegacy(version, profile) || (profile == EEsProfile && version == 100)) {
// TBD: add ftransform(), any others? symbolTable.relateToOperator("ftransform", EOpFtransform);
symbolTable.relateToOperator("texture1D", EOpTexture);
symbolTable.relateToOperator("texture1DProj", EOpTextureProj); symbolTable.relateToOperator("texture1D", EOpTexture);
symbolTable.relateToOperator("texture1DLod", EOpTextureLod); symbolTable.relateToOperator("texture1DGradARB", EOpTextureGrad);
symbolTable.relateToOperator("texture1DProjLod", EOpTextureProjLod); symbolTable.relateToOperator("texture1DProj", EOpTextureProj);
symbolTable.relateToOperator("texture2D", EOpTexture); symbolTable.relateToOperator("texture1DProjGradARB", EOpTextureProjGrad);
symbolTable.relateToOperator("texture2DProj", EOpTextureProj); symbolTable.relateToOperator("texture1DLod", EOpTextureLod);
symbolTable.relateToOperator("texture2DLod", EOpTextureLod); symbolTable.relateToOperator("texture1DProjLod", EOpTextureProjLod);
symbolTable.relateToOperator("texture2DProjLod", EOpTextureProjLod);
symbolTable.relateToOperator("texture3D", EOpTexture); symbolTable.relateToOperator("texture2DRect", EOpTexture);
symbolTable.relateToOperator("texture3DProj", EOpTextureProj); symbolTable.relateToOperator("texture2DRectProj", EOpTextureProj);
symbolTable.relateToOperator("texture3DLod", EOpTextureLod); symbolTable.relateToOperator("texture2DRectGradARB", EOpTextureGrad);
symbolTable.relateToOperator("texture3DProjLod", EOpTextureProjLod); symbolTable.relateToOperator("texture2DRectProjGradARB", EOpTextureProjGrad);
symbolTable.relateToOperator("textureCube", EOpTexture); symbolTable.relateToOperator("shadow2DRect", EOpTexture);
symbolTable.relateToOperator("textureCubeLod", EOpTextureLod); symbolTable.relateToOperator("shadow2DRectProj", EOpTextureProj);
symbolTable.relateToOperator("shadow1D", EOpTexture); symbolTable.relateToOperator("shadow2DRectGradARB", EOpTextureGrad);
symbolTable.relateToOperator("shadow2D", EOpTexture); symbolTable.relateToOperator("shadow2DRectProjGradARB", EOpTextureProjGrad);
symbolTable.relateToOperator("shadow1DProj", EOpTextureProj);
symbolTable.relateToOperator("shadow2DProj", EOpTextureProj); symbolTable.relateToOperator("texture2D", EOpTexture);
symbolTable.relateToOperator("shadow1DLod", EOpTextureLod); symbolTable.relateToOperator("texture2DProj", EOpTextureProj);
symbolTable.relateToOperator("shadow2DLod", EOpTextureLod); symbolTable.relateToOperator("texture2DGradEXT", EOpTextureGrad);
symbolTable.relateToOperator("shadow1DProjLod", EOpTextureProjLod); symbolTable.relateToOperator("texture2DGradARB", EOpTextureGrad);
symbolTable.relateToOperator("shadow2DProjLod", EOpTextureProjLod); symbolTable.relateToOperator("texture2DProjGradEXT", EOpTextureProjGrad);
symbolTable.relateToOperator("texture2DProjGradARB", EOpTextureProjGrad);
symbolTable.relateToOperator("texture2DLod", EOpTextureLod);
symbolTable.relateToOperator("texture2DLodEXT", EOpTextureLod);
symbolTable.relateToOperator("texture2DProjLod", EOpTextureProjLod);
symbolTable.relateToOperator("texture2DProjLodEXT", EOpTextureProjLod);
symbolTable.relateToOperator("texture3D", EOpTexture);
symbolTable.relateToOperator("texture3DGradARB", EOpTextureGrad);
symbolTable.relateToOperator("texture3DProj", EOpTextureProj);
symbolTable.relateToOperator("texture3DProjGradARB", EOpTextureProjGrad);
symbolTable.relateToOperator("texture3DLod", EOpTextureLod);
symbolTable.relateToOperator("texture3DProjLod", EOpTextureProjLod);
symbolTable.relateToOperator("textureCube", EOpTexture);
symbolTable.relateToOperator("textureCubeGradEXT", EOpTextureGrad);
symbolTable.relateToOperator("textureCubeGradARB", EOpTextureGrad);
symbolTable.relateToOperator("textureCubeLod", EOpTextureLod);
symbolTable.relateToOperator("textureCubeLodEXT", EOpTextureLod);
symbolTable.relateToOperator("shadow1D", EOpTexture);
symbolTable.relateToOperator("shadow1DGradARB", EOpTextureGrad);
symbolTable.relateToOperator("shadow2D", EOpTexture);
symbolTable.relateToOperator("shadow2DGradARB", EOpTextureGrad);
symbolTable.relateToOperator("shadow1DProj", EOpTextureProj);
symbolTable.relateToOperator("shadow2DProj", EOpTextureProj);
symbolTable.relateToOperator("shadow1DProjGradARB", EOpTextureProjGrad);
symbolTable.relateToOperator("shadow2DProjGradARB", EOpTextureProjGrad);
symbolTable.relateToOperator("shadow1DLod", EOpTextureLod);
symbolTable.relateToOperator("shadow2DLod", EOpTextureLod);
symbolTable.relateToOperator("shadow1DProjLod", EOpTextureProjLod);
symbolTable.relateToOperator("shadow2DProjLod", EOpTextureProjLod);
} }
} }
......
...@@ -119,6 +119,7 @@ public: ...@@ -119,6 +119,7 @@ public:
TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*); TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*);
void addInputArgumentConversions(const TFunction&, TIntermNode*&) const; void addInputArgumentConversions(const TFunction&, TIntermNode*&) const;
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const; TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const;
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
void nonOpBuiltInCheck(const TSourceLoc&, const TFunction&, TIntermAggregate&); void nonOpBuiltInCheck(const TSourceLoc&, const TFunction&, TIntermAggregate&);
TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&); TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment