30 class TScopedPoolAllocator {
33 : mAllocator(allocator), mPushPopAllocator(pushPop) {
34 if (mPushPopAllocator) mAllocator->push();
37 ~TScopedPoolAllocator() {
39 if (mPushPopAllocator) mAllocator->pop();
44 bool mPushPopAllocator;
62 maxExpressionComplexity(0),
64 fragmentPrecisionHigh(
false),
66 builtInFunctionEmulator(type)
84 TScopedPoolAllocator scopedAlloc(&allocator,
false);
104 TScopedPoolAllocator scopedAlloc(&allocator,
true);
115 const char* sourcePath =
NULL;
116 size_t firstSource = 0;
119 sourcePath = shaderStrings[0];
124 TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
125 shaderType, shaderSpec, compileOptions,
true,
126 sourcePath, infoSink);
135 infoSink.
info <<
"Wrong symbol table level";
140 (
PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource],
NULL, &parseContext) == 0) &&
187 infoSink.
info <<
"too many uniforms";
211 compileResources = resources;
220 integer.
array =
false;
224 floatingPoint.
size = 1;
225 floatingPoint.
matrix =
false;
226 floatingPoint.
array =
false;
237 default:
assert(
false &&
"Language not supported");
257 builtInFunctionEmulator.
Cleanup();
264 DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
271 infoSink.
info <<
"Missing main()";
275 infoSink.
info <<
"Function recursion detected";
279 infoSink.
info <<
"Function call stack too deep";
302 infoSink.
info <<
"Timing restrictions must be enforced under the WebGL spec.";
337 samplerSymbol->
traverse(&graphTraverser);
340 if (traverser.
getMaxDepth() > maxExpressionComplexity) {
341 infoSink.
info <<
"Expression too complex.";
387 return extensionBehavior;
392 return compileResources;
397 return arrayBoundsClamper;
402 return clampingStrategy;
407 return builtInFunctionEmulator;
void MarkIndirectArrayBoundsForClamping(TIntermNode *root)
TCompiler(ShShaderType type, ShShaderSpec spec)
bool Init(const ShBuiltInResources &resources)
virtual void translate(TIntermNode *root)=0
bool validateLimitations(TIntermNode *root)
bool enforceVertexShaderTimingRestrictions(TIntermNode *root)
std::map< std::string, TBehavior > TExtensionBehavior
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
bool enforceTimingRestrictions(TIntermNode *root, bool outputGraph)
int getMappedNameMaxLength() const
#define MAX_SHORTENED_IDENTIFIER_SIZE
int MaxVertexUniformVectors
int MaxFragmentUniformVectors
bool fragmentPrecisionHigh
TFunctionCallVector::const_iterator endUserDefinedFunctionCalls() const
const BuiltInFunctionEmulator & getBuiltInFunctionEmulator() const
bool enforcePackingRestrictions()
void SetClampingStrategy(ShArrayIndexClampingStrategy clampingStrategy)
const ArrayBoundsClamper & getArrayBoundsClamper() const
void collectAttribsUniforms(TIntermNode *root)
bool CheckVariablesWithinPackingLimits(int maxVectors, const TVariableInfoList &in_variables)
ShArrayIndexClampingStrategy
int PaParseStrings(size_t count, const char *const string[], const int length[], TParseContext *context)
void outputAllSpanningTrees(TDependencyGraph &graph)
bool isWebGLBasedSpec(ShShaderSpec spec)
ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const
#define ASSERT(expression)
bool InitBuiltInSymbolTable(const ShBuiltInResources &resources)
void rewriteCSSShader(TIntermNode *root)
ShArrayIndexClampingStrategy ArrayIndexClampingStrategy
bool setDefaultPrecision(const TPublicType &type, TPrecision prec)
bool limitExpressionComplexity(TIntermNode *root)
void mapLongVariableNames(TIntermNode *root)
virtual void traverse(TIntermTraverser *)=0
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode *root)
int MaxExpressionComplexity
const TExtensionBehavior & getExtensionBehavior() const
void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
virtual void traverse(TDependencyGraphTraverser *graphTraverser)
void SetGlobalPoolAllocator(TPoolAllocator *poolAllocator)
void SetGlobalParseContext(TParseContext *context)
ErrorCode detectCallDepth()
void enforceRestrictions(TIntermNode *root)
static LongNameMap * GetInstance()
const ShBuiltInResources & getResources() const
void MarkBuiltInFunctionsForEmulation(TIntermNode *root)
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavior &extBehavior)
bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph &graph)
bool compile(const char *const shaderStrings[], size_t numStrings, int compileOptions)
TFunctionCallVector::const_iterator beginUserDefinedFunctionCalls() const
bool detectCallDepth(TIntermNode *root, TInfoSink &infoSink, bool limitCallStackDepth)
int FragmentPrecisionHigh
void prefix(TPrefixType p)
void enforceRestrictions(const TDependencyGraph &graph)
ShHashFunction64 HashFunction