zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VersionGLSL.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2002-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 #ifndef COMPILER_VERSIONGLSL_H_
8 #define COMPILER_VERSIONGLSL_H_
9 
10 #include "GLSLANG/ShaderLang.h"
11 #include "compiler/intermediate.h"
12 
13 // Traverses the intermediate tree to return the minimum GLSL version
14 // required to legally access all built-in features used in the shader.
15 // GLSL 1.1 which is mandated by OpenGL 2.0 provides:
16 // - #version and #extension to declare version and extensions.
17 // - built-in functions refract, exp, and log.
18 // - updated step() to compare x < edge instead of x <= edge.
19 // GLSL 1.2 which is mandated by OpenGL 2.1 provides:
20 // - many changes to reduce differences when compared to the ES specification.
21 // - invariant keyword and its support.
22 // - c++ style name hiding rules.
23 // - built-in variable gl_PointCoord for fragment shaders.
24 // - matrix constructors taking matrix as argument.
25 // - array as "out" function parameters
26 //
28 public:
30 
31  // Returns 120 if the following is used the shader:
32  // - "invariant",
33  // - "gl_PointCoord",
34  // - matrix/matrix constructors
35  // - array "out" parameters
36  // Else 110 is returned.
37  int getVersion() { return mVersion; }
38 
39  virtual void visitSymbol(TIntermSymbol*);
41  virtual bool visitBinary(Visit, TIntermBinary*);
42  virtual bool visitUnary(Visit, TIntermUnary*);
43  virtual bool visitSelection(Visit, TIntermSelection*);
44  virtual bool visitAggregate(Visit, TIntermAggregate*);
45  virtual bool visitLoop(Visit, TIntermLoop*);
46  virtual bool visitBranch(Visit, TIntermBranch*);
47 
48 protected:
49  void updateVersion(int version);
50 
51 private:
52  ShShaderType mShaderType;
53  int mVersion;
54 };
55 
56 #endif // COMPILER_VERSIONGLSL_H_
TVersionGLSL(ShShaderType type)
Definition: VersionGLSL.cpp:38
Visit
Definition: intermediate.h:524
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
virtual bool visitBinary(Visit, TIntermBinary *)
Definition: VersionGLSL.cpp:54
virtual bool visitUnary(Visit, TIntermUnary *)
Definition: VersionGLSL.cpp:59
virtual bool visitAggregate(Visit, TIntermAggregate *)
Definition: VersionGLSL.cpp:69
int const char * version
Definition: zlib.h:813
virtual bool visitSelection(Visit, TIntermSelection *)
Definition: VersionGLSL.cpp:64
int getVersion()
Definition: VersionGLSL.h:37
virtual bool visitLoop(Visit, TIntermLoop *)
virtual void visitSymbol(TIntermSymbol *)
Definition: VersionGLSL.cpp:44
virtual void visitConstantUnion(TIntermConstantUnion *)
Definition: VersionGLSL.cpp:50
virtual bool visitBranch(Visit, TIntermBranch *)
ShShaderType
Definition: ShaderLang.h:48
void updateVersion(int version)