zenilib: zenilib/jni/external/angle/src/compiler/Compiler.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Compiler.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 #include "compiler/BuiltInFunctionEmulator.h"
8 #include "compiler/DetectCallDepth.h"
9 #include "compiler/ForLoopUnroll.h"
10 #include "compiler/Initialize.h"
11 #include "compiler/InitializeParseContext.h"
12 #include "compiler/MapLongVariableNames.h"
13 #include "compiler/ParseHelper.h"
14 #include "compiler/RenameFunction.h"
15 #include "compiler/ShHandle.h"
16 #include "compiler/ValidateLimitations.h"
17 #include "compiler/VariablePacker.h"
18 #include "compiler/depgraph/DependencyGraph.h"
19 #include "compiler/depgraph/DependencyGraphOutput.h"
20 #include "compiler/timing/RestrictFragmentShaderTiming.h"
21 #include "compiler/timing/RestrictVertexShaderTiming.h"
22 #include "third_party/compiler/ArrayBoundsClamper.h"
23
24 bool isWebGLBasedSpec(ShShaderSpec spec)
25 {
26 return spec == SH_WEBGL_SPEC || spec == SH_CSS_SHADERS_SPEC;
27 }
28
29 namespace {
30 class TScopedPoolAllocator {
31 public:
32 TScopedPoolAllocator(TPoolAllocator* allocator, bool pushPop)
33 : mAllocator(allocator), mPushPopAllocator(pushPop) {
34 if (mPushPopAllocator) mAllocator->push();
35 SetGlobalPoolAllocator(mAllocator);
36 }
37 ~TScopedPoolAllocator() {
38 SetGlobalPoolAllocator(NULL);
39 if (mPushPopAllocator) mAllocator->pop();
40 }
41
42 private:
43 TPoolAllocator* mAllocator;
44 bool mPushPopAllocator;
45 };
46 } // namespace
47
48 TShHandleBase::TShHandleBase() {
49 allocator.push();
50 SetGlobalPoolAllocator(&allocator);
51 }
52
53 TShHandleBase::~TShHandleBase() {
54 SetGlobalPoolAllocator(NULL);
55 allocator.popAll();
56 }
57
58 TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
59 : shaderType(type),
60 shaderSpec(spec),
61 maxUniformVectors(0),
62 maxExpressionComplexity(0),
63 maxCallStackDepth(0),
64 fragmentPrecisionHigh(false),
65 clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
66 builtInFunctionEmulator(type)
67 {
68 longNameMap = LongNameMap::GetInstance();
69 }
70
71 TCompiler::~TCompiler()
72 {
73 ASSERT(longNameMap);
74 longNameMap->Release();
75 }
76
77 bool TCompiler::Init(const ShBuiltInResources& resources)
78 {
79 maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
80 resources.MaxVertexUniformVectors :
81 resources.MaxFragmentUniformVectors;
82 maxExpressionComplexity = resources.MaxExpressionComplexity;
83 maxCallStackDepth = resources.MaxCallStackDepth;
84 TScopedPoolAllocator scopedAlloc(&allocator, false);
85
86 // Generate built-in symbol table.
87 if (!InitBuiltInSymbolTable(resources))
88 return false;
89 InitExtensionBehavior(resources, extensionBehavior);
90 fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
91
92 arrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy);
93 clampingStrategy = resources.ArrayIndexClampingStrategy;
94
95 hashFunction = resources.HashFunction;
96
97 return true;
98 }
99
100 bool TCompiler::compile(const char* const shaderStrings[],
101 size_t numStrings,
102 int compileOptions)
103 {
104 TScopedPoolAllocator scopedAlloc(&allocator, true);
105 clearResults();
106
107 if (numStrings == 0)
108 return true;
109
110 // If compiling for WebGL, validate loop and indexing as well.
111 if (isWebGLBasedSpec(shaderSpec))
112 compileOptions |= SH_VALIDATE_LOOP_INDEXING;
113
114 // First string is path of source file if flag is set. The actual source follows.
115 const char* sourcePath = NULL;
116 size_t firstSource = 0;
117 if (compileOptions & SH_SOURCE_PATH)
118 {
119 sourcePath = shaderStrings[0];
120 ++firstSource;
121 }
122
123 TIntermediate intermediate(infoSink);
124 TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
125 shaderType, shaderSpec, compileOptions, true,
126 sourcePath, infoSink);
127 parseContext.fragmentPrecisionHigh = fragmentPrecisionHigh;
128 SetGlobalParseContext(&parseContext);
129
130 // We preserve symbols at the built-in level from compile-to-compile.
131 // Start pushing the user-defined symbols at global level.
132 symbolTable.push();
133 if (!symbolTable.atGlobalLevel()) {
134 infoSink.info.prefix(EPrefixInternalError);
135 infoSink.info << "Wrong symbol table level";
136 }
137
138 // Parse shader.
139 bool success =
140 (PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], NULL, &parseContext) == 0) &&
141 (parseContext.treeRoot != NULL);
142 if (success) {
143 TIntermNode* root = parseContext.treeRoot;
144 success = intermediate.postProcess(root);
145
146 if (success)
147 success = detectCallDepth(root, infoSink, (compileOptions & SH_LIMIT_CALL_STACK_DEPTH) != 0);
148
149 if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
150 success = validateLimitations(root);
151
152 if (success && (compileOptions & SH_TIMING_RESTRICTIONS))
153 success = enforceTimingRestrictions(root, (compileOptions & SH_DEPENDENCY_GRAPH) != 0);
154
155 if (success && shaderSpec == SH_CSS_SHADERS_SPEC)
156 rewriteCSSShader(root);
157
158 // Unroll for-loop markup needs to happen after validateLimitations pass.
159 if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX))
160 ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(root);
161
162 // Built-in function emulation needs to happen after validateLimitations pass.
163 if (success && (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS))
164 builtInFunctionEmulator.MarkBuiltInFunctionsForEmulation(root);
165
166 // Clamping uniform array bounds needs to happen after validateLimitations pass.
167 if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
168 arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
169
170 // Disallow expressions deemed too complex.
171 if (success && (compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY))
172 success = limitExpressionComplexity(root);
173
174 // Call mapLongVariableNames() before collectAttribsUniforms() so in
175 // collectAttribsUniforms() we already have the mapped symbol names and
176 // we could composite mapped and original variable names.
177 // Also, if we hash all the names, then no need to do this for long names.
178 if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
179 mapLongVariableNames(root);
180
181 if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS)) {
182 collectAttribsUniforms(root);
183 if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
184 success = enforcePackingRestrictions();
185 if (!success) {
186 infoSink.info.prefix(EPrefixError);
187 infoSink.info << "too many uniforms";
188 }
189 }
190 }
191
192 if (success && (compileOptions & SH_INTERMEDIATE_TREE))
193 intermediate.outputTree(root);
194
195 if (success && (compileOptions & SH_OBJECT_CODE))
196 translate(root);
197 }
198
199 // Cleanup memory.
200 intermediate.remove(parseContext.treeRoot);
201 // Ensure symbol table is returned to the built-in level,
202 // throwing away all but the built-ins.
203 while (!symbolTable.atBuiltInLevel())
204 symbolTable.pop();
205
206 return success;
207 }
208
209 bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
210 {
211 compileResources = resources;
212
213 assert(symbolTable.isEmpty());
214 symbolTable.push();
215
216 TPublicType integer;
217 integer.type = EbtInt;
218 integer.size = 1;
219 integer.matrix = false;
220 integer.array = false;
221
222 TPublicType floatingPoint;
223 floatingPoint.type = EbtFloat;
224 floatingPoint.size = 1;
225 floatingPoint.matrix = false;
226 floatingPoint.array = false;
227
228 switch(shaderType)
229 {
230 case SH_FRAGMENT_SHADER:
231 symbolTable.setDefaultPrecision(integer, EbpMedium);
232 break;
233 case SH_VERTEX_SHADER:
234 symbolTable.setDefaultPrecision(integer, EbpHigh);
235 symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
236 break;
237 default: assert(false && "Language not supported");
238 }
239
240 InsertBuiltInFunctions(shaderType, shaderSpec, resources, symbolTable);
241
242 IdentifyBuiltIns(shaderType, shaderSpec, resources, symbolTable);
243
244 return true;
245 }
246
247 void TCompiler::clearResults()
248 {
249 arrayBoundsClamper.Cleanup();
250 infoSink.info.erase();
251 infoSink.obj.erase();
252 infoSink.debug.erase();
253
254 attribs.clear();
255 uniforms.clear();
256
257 builtInFunctionEmulator.Cleanup();
258
259 nameMap.clear();
260 }
261
262 bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool limitCallStackDepth)
263 {
264 DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
265 root->traverse(&detect);
266 switch (detect.detectCallDepth()) {
267 case DetectCallDepth::kErrorNone:
268 return true;
269 case DetectCallDepth::kErrorMissingMain:
270 infoSink.info.prefix(EPrefixError);
271 infoSink.info << "Missing main()";
272 return false;
273 case DetectCallDepth::kErrorRecursion:
274 infoSink.info.prefix(EPrefixError);
275 infoSink.info << "Function recursion detected";
276 return false;
277 case DetectCallDepth::kErrorMaxDepthExceeded:
278 infoSink.info.prefix(EPrefixError);
279 infoSink.info << "Function call stack too deep";
280 return false;
281 default:
282 UNREACHABLE();
283 return false;
284 }
285 }
286
287 void TCompiler::rewriteCSSShader(TIntermNode* root)
288 {
289 RenameFunction renamer("main(", "css_main(");
290 root->traverse(&renamer);
291 }
292
293 bool TCompiler::validateLimitations(TIntermNode* root) {
294 ValidateLimitations validate(shaderType, infoSink.info);
295 root->traverse(&validate);
296 return validate.numErrors() == 0;
297 }
298
299 bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph)
300 {
301 if (shaderSpec != SH_WEBGL_SPEC) {
302 infoSink.info << "Timing restrictions must be enforced under the WebGL spec.";
303 return false;
304 }
305
306 if (shaderType == SH_FRAGMENT_SHADER) {
307 TDependencyGraph graph(root);
308
309 // Output any errors first.
310 bool success = enforceFragmentShaderTimingRestrictions(graph);
311
312 // Then, output the dependency graph.
313 if (outputGraph) {
314 TDependencyGraphOutput output(infoSink.info);
315 output.outputAllSpanningTrees(graph);
316 }
317
318 return success;
319 }
320 else {
321 return enforceVertexShaderTimingRestrictions(root);
322 }
323 }
324
325 bool TCompiler::limitExpressionComplexity(TIntermNode* root)
326 {
327 TIntermTraverser traverser;
328 root->traverse(&traverser);
329 TDependencyGraph graph(root);
330
331 for (TFunctionCallVector::const_iterator iter = graph.beginUserDefinedFunctionCalls();
332 iter != graph.endUserDefinedFunctionCalls();
333 ++iter)
334 {
335 TGraphFunctionCall* samplerSymbol = *iter;
336 TDependencyGraphTraverser graphTraverser;
337 samplerSymbol->traverse(&graphTraverser);
338 }
339
340 if (traverser.getMaxDepth() > maxExpressionComplexity) {
341 infoSink.info << "Expression too complex.";
342 return false;
343 }
344 return true;
345 }
346
347 bool TCompiler::enforceFragmentShaderTimingRestrictions(const TDependencyGraph& graph)
348 {
349 RestrictFragmentShaderTiming restrictor(infoSink.info);
350 restrictor.enforceRestrictions(graph);
351 return restrictor.numErrors() == 0;
352 }
353
354 bool TCompiler::enforceVertexShaderTimingRestrictions(TIntermNode* root)
355 {
356 RestrictVertexShaderTiming restrictor(infoSink.info);
357 restrictor.enforceRestrictions(root);
358 return restrictor.numErrors() == 0;
359 }
360
361 void TCompiler::collectAttribsUniforms(TIntermNode* root)
362 {
363 CollectAttribsUniforms collect(attribs, uniforms, hashFunction);
364 root->traverse(&collect);
365 }
366
367 bool TCompiler::enforcePackingRestrictions()
368 {
369 VariablePacker packer;
370 return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
371 }
372
373 void TCompiler::mapLongVariableNames(TIntermNode* root)
374 {
375 ASSERT(longNameMap);
376 MapLongVariableNames map(longNameMap);
377 root->traverse(&map);
378 }
379
380 int TCompiler::getMappedNameMaxLength() const
381 {
382 return MAX_SHORTENED_IDENTIFIER_SIZE + 1;
383 }
384
385 const TExtensionBehavior& TCompiler::getExtensionBehavior() const
386 {
387 return extensionBehavior;
388 }
389
390 const ShBuiltInResources& TCompiler::getResources() const
391 {
392 return compileResources;
393 }
394
395 const ArrayBoundsClamper& TCompiler::getArrayBoundsClamper() const
396 {
397 return arrayBoundsClamper;
398 }
399
400 ShArrayIndexClampingStrategy TCompiler::getArrayIndexClampingStrategy() const
401 {
402 return clampingStrategy;
403 }
404
405 const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
406 {
407 return builtInFunctionEmulator;
408 }
ArrayBoundsClamper::MarkIndirectArrayBoundsForClamping
void MarkIndirectArrayBoundsForClamping(TIntermNode *root)
Definition: ArrayBoundsClamper.cpp:83
TCompiler::TCompiler
TCompiler(ShShaderType type, ShShaderSpec spec)
Definition: Compiler.cpp:58
TCompiler::Init
bool Init(const ShBuiltInResources &resources)
Definition: Compiler.cpp:77
TCompiler::translate
virtual void translate(TIntermNode *root)=0
TSymbolTable::push
void push()
Definition: SymbolTable.h:263
SH_CSS_SHADERS_SPEC
Definition: ShaderLang.h:77
TCompiler::validateLimitations
bool validateLimitations(TIntermNode *root)
Definition: Compiler.cpp:293
EPrefixError
Definition: InfoSink.h:26
SH_MAP_LONG_VARIABLE_NAMES
Definition: ShaderLang.h:134
TIntermediate::remove
void remove(TIntermNode *)
Definition: Intermediate.cpp:733
DetectCallDepth.h
TCompiler::enforceVertexShaderTimingRestrictions
bool enforceVertexShaderTimingRestrictions(TIntermNode *root)
Definition: Compiler.cpp:354
TExtensionBehavior
std::map< std::string, TBehavior > TExtensionBehavior
Definition: ExtensionBehavior.h:35
type
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
SH_ATTRIBUTES_UNIFORMS
Definition: ShaderLang.h:131
TShHandleBase::TShHandleBase
TShHandleBase()
Definition: Compiler.cpp:48
TSymbolTable::isEmpty
bool isEmpty()
Definition: SymbolTable.h:260
RestrictFragmentShaderTiming::numErrors
int numErrors() const
Definition: RestrictFragmentShaderTiming.h:21
TCompiler::enforceTimingRestrictions
bool enforceTimingRestrictions(TIntermNode *root, bool outputGraph)
Definition: Compiler.cpp:299
SH_OBJECT_CODE
Definition: ShaderLang.h:130
NULL
#define NULL
Definition: ftobjs.h:61
TPublicType
Definition: Types.h:259
TCompiler::getMappedNameMaxLength
int getMappedNameMaxLength() const
Definition: Compiler.cpp:380
SH_VALIDATE_LOOP_INDEXING
Definition: ShaderLang.h:128
ValidateLimitations::numErrors
int numErrors() const
Definition: ValidateLimitations.h:26
MAX_SHORTENED_IDENTIFIER_SIZE
#define MAX_SHORTENED_IDENTIFIER_SIZE
Definition: MapLongVariableNames.h:16
TParseContext
Definition: ParseHelper.h:27
SH_FRAGMENT_SHADER
Definition: ShaderLang.h:49
TIntermTraverser::getMaxDepth
int getMaxDepth() const
Definition: intermediate.h:561
SH_TIMING_RESTRICTIONS
Definition: ShaderLang.h:146
ShBuiltInResources::MaxVertexUniformVectors
int MaxVertexUniformVectors
Definition: ShaderLang.h:207
TIntermediate
Definition: localintermediate.h:23
ArrayBoundsClamper.h
ArrayBoundsClamper
Definition: ArrayBoundsClamper.h:34
ShBuiltInResources::MaxFragmentUniformVectors
int MaxFragmentUniformVectors
Definition: ShaderLang.h:212
TParseContext::fragmentPrecisionHigh
bool fragmentPrecisionHigh
Definition: ParseHelper.h:57
TDependencyGraph::endUserDefinedFunctionCalls
TFunctionCallVector::const_iterator endUserDefinedFunctionCalls() const
Definition: DependencyGraph.h:161
MapLongVariableNames
Definition: MapLongVariableNames.h:46
TCompiler::getBuiltInFunctionEmulator
const BuiltInFunctionEmulator & getBuiltInFunctionEmulator() const
Definition: Compiler.cpp:405
SH_CLAMP_WITH_CLAMP_INTRINSIC
Definition: ShaderLang.h:177
DependencyGraphOutput.h
TCompiler::enforcePackingRestrictions
bool enforcePackingRestrictions()
Definition: Compiler.cpp:367
TCompiler::~TCompiler
virtual ~TCompiler()
Definition: Compiler.cpp:71
assert
#define assert(x)
Definition: SDL_malloc.c:1234
EbtInt
Definition: BaseTypes.h:40
ArrayBoundsClamper::SetClampingStrategy
void SetClampingStrategy(ShArrayIndexClampingStrategy clampingStrategy)
Definition: ArrayBoundsClamper.cpp:78
TCompiler::getArrayBoundsClamper
const ArrayBoundsClamper & getArrayBoundsClamper() const
Definition: Compiler.cpp:395
EbpHigh
Definition: BaseTypes.h:19
attribs
const GLint * attribs
Definition: glew.h:13064
EbtFloat
Definition: BaseTypes.h:39
TCompiler::clearResults
void clearResults()
Definition: Compiler.cpp:247
TCompiler::collectAttribsUniforms
void collectAttribsUniforms(TIntermNode *root)
Definition: Compiler.cpp:361
SH_ENFORCE_PACKING_RESTRICTIONS
Definition: ShaderLang.h:157
ValidateLimitations
Definition: ValidateLimitations.h:22
RestrictFragmentShaderTiming.h
VariablePacker::CheckVariablesWithinPackingLimits
bool CheckVariablesWithinPackingLimits(int maxVectors, const TVariableInfoList &in_variables)
Definition: VariablePacker.cpp:192
CollectAttribsUniforms
Definition: VariableInfo.h:27
ShArrayIndexClampingStrategy
ShArrayIndexClampingStrategy
Definition: ShaderLang.h:175
PaParseStrings
int PaParseStrings(size_t count, const char *const string[], const int length[], TParseContext *context)
Definition: ParseHelper.cpp:1582
RestrictVertexShaderTiming
Definition: RestrictVertexShaderTiming.h:17
TDependencyGraphOutput::outputAllSpanningTrees
void outputAllSpanningTrees(TDependencyGraph &graph)
Definition: DependencyGraphOutput.cpp:53
ParseHelper.h
isWebGLBasedSpec
bool isWebGLBasedSpec(ShShaderSpec spec)
Definition: Compiler.cpp:24
TCompiler::getArrayIndexClampingStrategy
ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const
Definition: Compiler.cpp:400
TInfoSink::debug
TInfoSinkBase debug
Definition: InfoSink.h:111
TPublicType::array
bool array
Definition: Types.h:266
SH_VERTEX_SHADER
Definition: ShaderLang.h:50
TDependencyGraphTraverser
Definition: DependencyGraph.h:189
SH_SOURCE_PATH
Definition: ShaderLang.h:133
TDependencyGraphOutput
Definition: DependencyGraphOutput.h:13
BuiltInFunctionEmulator
Definition: BuiltInFunctionEmulator.h:20
BuiltInFunctionEmulator::Cleanup
void Cleanup()
Definition: BuiltInFunctionEmulator.cpp:394
Initialize.h
DependencyGraph.h
ASSERT
#define ASSERT(expression)
Definition: debug.h:36
TCompiler::InitBuiltInSymbolTable
bool InitBuiltInSymbolTable(const ShBuiltInResources &resources)
Definition: Compiler.cpp:209
EbpMedium
Definition: BaseTypes.h:18
TCompiler::rewriteCSSShader
void rewriteCSSShader(TIntermNode *root)
Definition: Compiler.cpp:287
ShBuiltInResources::ArrayIndexClampingStrategy
ShArrayIndexClampingStrategy ArrayIndexClampingStrategy
Definition: ShaderLang.h:234
TPublicType::size
int size
Definition: Types.h:264
TSymbolTable::setDefaultPrecision
bool setDefaultPrecision(const TPublicType &type, TPrecision prec)
Definition: SymbolTable.h:351
TSymbolTable::pop
void pop()
Definition: SymbolTable.h:269
TCompiler::limitExpressionComplexity
bool limitExpressionComplexity(TIntermNode *root)
Definition: Compiler.cpp:325
SH_CLAMP_INDIRECT_ARRAY_BOUNDS
Definition: ShaderLang.h:165
TCompiler::mapLongVariableNames
void mapLongVariableNames(TIntermNode *root)
Definition: Compiler.cpp:373
TIntermNode::traverse
virtual void traverse(TIntermTraverser *)=0
DetectCallDepth
Definition: DetectCallDepth.h:19
InsertBuiltInFunctions
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
Definition: Initialize.cpp:17
EPrefixInternalError
Definition: InfoSink.h:27
VariablePacker.h
TPublicType::matrix
bool matrix
Definition: Types.h:265
TPoolAllocator
Definition: PoolAlloc.h:116
DetectCallDepth::kErrorNone
Definition: DetectCallDepth.h:25
TDependencyGraph
Definition: DependencyGraph.h:139
UNREACHABLE
#define UNREACHABLE()
Definition: debug.h:47
MapLongVariableNames.h
ValidateLimitations.h
TIntermTraverser
Definition: intermediate.h:539
ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling
static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode *root)
Definition: ForLoopUnroll.cpp:146
ForLoopUnroll.h
ShBuiltInResources::MaxExpressionComplexity
int MaxExpressionComplexity
Definition: ShaderLang.h:237
SH_WEBGL_SPEC
Definition: ShaderLang.h:55
SH_EMULATE_BUILT_IN_FUNCTIONS
Definition: ShaderLang.h:138
SH_DEPENDENCY_GRAPH
Definition: ShaderLang.h:154
TCompiler::getExtensionBehavior
const TExtensionBehavior & getExtensionBehavior() const
Definition: Compiler.cpp:385
SH_LIMIT_EXPRESSION_COMPLEXITY
Definition: ShaderLang.h:168
IdentifyBuiltIns
void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
Definition: Initialize.cpp:421
TSymbolTable::atBuiltInLevel
bool atBuiltInLevel()
Definition: SymbolTable.h:261
TGraphFunctionCall::traverse
virtual void traverse(TDependencyGraphTraverser *graphTraverser)
Definition: DependencyGraphTraverse.cpp:41
SetGlobalPoolAllocator
void SetGlobalPoolAllocator(TPoolAllocator *poolAllocator)
Definition: PoolAlloc.cpp:42
TGraphFunctionCall
Definition: DependencyGraph.h:75
TSymbolTable::atGlobalLevel
bool atGlobalLevel()
Definition: SymbolTable.h:262
SetGlobalParseContext
void SetGlobalParseContext(TParseContext *context)
Definition: InitializeParseContext.cpp:29
ShBuiltInResources::MaxCallStackDepth
int MaxCallStackDepth
Definition: ShaderLang.h:240
TIntermediate::outputTree
void outputTree(TIntermNode *)
Definition: intermOut.cpp:416
TParseContext::treeRoot
TIntermNode * treeRoot
Definition: ParseHelper.h:51
sort_controllers.output
tuple output
Definition: sort_controllers.py:10
RenameFunction.h
DetectCallDepth::kErrorRecursion
Definition: DetectCallDepth.h:23
TInfoSinkBase::erase
void erase()
Definition: InfoSink.h:93
RenameFunction
Definition: RenameFunction.h:15
ShBuiltInResources
Definition: ShaderLang.h:203
DetectCallDepth::kErrorMissingMain
Definition: DetectCallDepth.h:22
VariablePacker
Definition: VariablePacker.h:13
DetectCallDepth::detectCallDepth
ErrorCode detectCallDepth()
Definition: DetectCallDepth.cpp:155
RestrictVertexShaderTiming::enforceRestrictions
void enforceRestrictions(TIntermNode *root)
Definition: RestrictVertexShaderTiming.h:24
SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX
Definition: ShaderLang.h:135
TPoolAllocator::push
void push()
Definition: PoolAlloc.cpp:152
LongNameMap::GetInstance
static LongNameMap * GetInstance()
Definition: MapLongVariableNames.cpp:39
ShHandle.h
ArrayBoundsClamper::Cleanup
void Cleanup()
Definition: ArrayBoundsClamper.h:49
DetectCallDepth::kErrorMaxDepthExceeded
Definition: DetectCallDepth.h:24
ShShaderType
ShShaderType
Definition: ShaderLang.h:48
TIntermNode
Definition: intermediate.h:206
TCompiler::getResources
const ShBuiltInResources & getResources() const
Definition: Compiler.cpp:390
TPoolAllocator::popAll
void popAll()
Definition: PoolAlloc.cpp:200
BuiltInFunctionEmulator::MarkBuiltInFunctionsForEmulation
void MarkBuiltInFunctionsForEmulation(TIntermNode *root)
Definition: BuiltInFunctionEmulator.cpp:385
RestrictFragmentShaderTiming
Definition: RestrictFragmentShaderTiming.h:17
SH_LIMIT_CALL_STACK_DEPTH
Definition: ShaderLang.h:171
ShShaderSpec
ShShaderSpec
Definition: ShaderLang.h:53
TInfoSink::info
TInfoSinkBase info
Definition: InfoSink.h:110
TShHandleBase::~TShHandleBase
virtual ~TShHandleBase()
Definition: Compiler.cpp:53
TInfoSink::obj
TInfoSinkBase obj
Definition: InfoSink.h:112
map
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
Definition: SDL_glfuncs.h:268
InitExtensionBehavior
void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavior &extBehavior)
Definition: Initialize.cpp:551
TCompiler::enforceFragmentShaderTimingRestrictions
bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph &graph)
Definition: Compiler.cpp:347
InitializeParseContext.h
TCompiler::compile
bool compile(const char *const shaderStrings[], size_t numStrings, int compileOptions)
Definition: Compiler.cpp:100
LongNameMap::Release
void Release()
Definition: MapLongVariableNames.cpp:47
SH_INTERMEDIATE_TREE
Definition: ShaderLang.h:129
TDependencyGraph::beginUserDefinedFunctionCalls
TFunctionCallVector::const_iterator beginUserDefinedFunctionCalls() const
Definition: DependencyGraph.h:156
RestrictVertexShaderTiming::numErrors
int numErrors()
Definition: RestrictVertexShaderTiming.h:25
TCompiler::detectCallDepth
bool detectCallDepth(TIntermNode *root, TInfoSink &infoSink, bool limitCallStackDepth)
Definition: Compiler.cpp:262
false
#define false
Definition: ftrandom.c:50
TPublicType::type
TBasicType type
Definition: Types.h:261
ShBuiltInResources::FragmentPrecisionHigh
int FragmentPrecisionHigh
Definition: ShaderLang.h:225
TIntermediate::postProcess
bool postProcess(TIntermNode *)
Definition: Intermediate.cpp:715
RestrictVertexShaderTiming.h
TInfoSinkBase::prefix
void prefix(TPrefixType p)
Definition: InfoSink.cpp:9
TInfoSink
Definition: InfoSink.h:108
RestrictFragmentShaderTiming::enforceRestrictions
void enforceRestrictions(const TDependencyGraph &graph)
Definition: RestrictFragmentShaderTiming.cpp:38
ShBuiltInResources::HashFunction
ShHashFunction64 HashFunction
Definition: ShaderLang.h:230
BuiltInFunctionEmulator.h