zenilib: zenilib/jni/external/angle/src/compiler/ValidateLimitations.h 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
ValidateLimitations.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2010 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 "GLSLANG/ShaderLang.h"
8 #include "compiler/intermediate.h"
9
10 class TInfoSinkBase;
11
12 struct TLoopInfo {
13 struct TIndex {
14 int id; // symbol id.
15 } index;
16 TIntermLoop* loop;
17 };
18 typedef TVector<TLoopInfo> TLoopStack;
19
20 // Traverses intermediate tree to ensure that the shader does not exceed the
21 // minimum functionality mandated in GLSL 1.0 spec, Appendix A.
22 class ValidateLimitations : public TIntermTraverser {
23 public:
24 ValidateLimitations(ShShaderType shaderType, TInfoSinkBase& sink);
25
26 int numErrors() const { return mNumErrors; }
27
28 virtual bool visitBinary(Visit, TIntermBinary*);
29 virtual bool visitUnary(Visit, TIntermUnary*);
30 virtual bool visitAggregate(Visit, TIntermAggregate*);
31 virtual bool visitLoop(Visit, TIntermLoop*);
32
33 private:
34 void error(TSourceLoc loc, const char *reason, const char* token);
35
36 bool withinLoopBody() const;
37 bool isLoopIndex(const TIntermSymbol* symbol) const;
38 bool validateLoopType(TIntermLoop* node);
39 bool validateForLoopHeader(TIntermLoop* node, TLoopInfo* info);
40 bool validateForLoopInit(TIntermLoop* node, TLoopInfo* info);
41 bool validateForLoopCond(TIntermLoop* node, TLoopInfo* info);
42 bool validateForLoopExpr(TIntermLoop* node, TLoopInfo* info);
43 // Returns true if none of the loop indices is used as the argument to
44 // the given function out or inout parameter.
45 bool validateFunctionCall(TIntermAggregate* node);
46 bool validateOperation(TIntermOperator* node, TIntermNode* operand);
47
48 // Returns true if indexing does not exceed the minimum functionality
49 // mandated in GLSL 1.0 spec, Appendix A, Section 5.
50 bool isConstExpr(TIntermNode* node);
51 bool isConstIndexExpr(TIntermNode* node);
52 bool validateIndexing(TIntermBinary* node);
53
54 ShShaderType mShaderType;
55 TInfoSinkBase& mSink;
56 int mNumErrors;
57 TLoopStack mLoopStack;
58 };
59
sink
GLsizei GLenum GLboolean sink
Definition: glew.h:4448
Visit
Visit
Definition: intermediate.h:524
TLoopInfo::loop
TIntermLoop * loop
Definition: ValidateLimitations.h:16
ValidateLimitations::visitUnary
virtual bool visitUnary(Visit, TIntermUnary *)
Definition: ValidateLimitations.cpp:144
ValidateLimitations::visitLoop
virtual bool visitLoop(Visit, TIntermLoop *)
Definition: ValidateLimitations.cpp:164
ValidateLimitations::numErrors
int numErrors() const
Definition: ValidateLimitations.h:26
ShaderLang.h
intermediate.h
TLoopStack
TVector< TLoopInfo > TLoopStack
Definition: ValidateLimitations.h:18
TLoopInfo
Definition: ValidateLimitations.h:12
TLoopInfo::TIndex
Definition: ValidateLimitations.h:13
ValidateLimitations
Definition: ValidateLimitations.h:22
TIntermAggregate
Definition: intermediate.h:460
TIntermBinary
Definition: intermediate.h:404
TInfoSinkBase
Definition: InfoSink.h:38
TLoopInfo::index
struct TLoopInfo::TIndex index
ValidateLimitations::visitBinary
virtual bool visitBinary(Visit, TIntermBinary *)
Definition: ValidateLimitations.cpp:107
TIntermOperator
Definition: intermediate.h:387
ValidateLimitations::ValidateLimitations
ValidateLimitations(ShShaderType shaderType, TInfoSinkBase &sink)
Definition: ValidateLimitations.cpp:99
TIntermTraverser
Definition: intermediate.h:539
TIntermSymbol
Definition: intermediate.h:340
TIntermLoop
Definition: intermediate.h:284
TLoopInfo::TIndex::id
int id
Definition: ValidateLimitations.h:14
TIntermUnary
Definition: intermediate.h:431
TSourceLoc
Definition: Common.h:17
TVector< TLoopInfo >
ShShaderType
ShShaderType
Definition: ShaderLang.h:48
TIntermNode
Definition: intermediate.h:206
ValidateLimitations::visitAggregate
virtual bool visitAggregate(Visit, TIntermAggregate *)
Definition: ValidateLimitations.cpp:152