gfx/angle/src/compiler/VersionGLSL.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/compiler/VersionGLSL.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +#ifndef COMPILER_VERSIONGLSL_H_
    1.11 +#define COMPILER_VERSIONGLSL_H_
    1.12 +
    1.13 +#include "GLSLANG/ShaderLang.h"
    1.14 +#include "compiler/intermediate.h"
    1.15 +
    1.16 +// Traverses the intermediate tree to return the minimum GLSL version
    1.17 +// required to legally access all built-in features used in the shader.
    1.18 +// GLSL 1.1 which is mandated by OpenGL 2.0 provides:
    1.19 +//   - #version and #extension to declare version and extensions.
    1.20 +//   - built-in functions refract, exp, and log.
    1.21 +//   - updated step() to compare x < edge instead of x <= edge.
    1.22 +// GLSL 1.2 which is mandated by OpenGL 2.1 provides:
    1.23 +//   - many changes to reduce differences when compared to the ES specification.
    1.24 +//   - invariant keyword and its support.
    1.25 +//   - c++ style name hiding rules.
    1.26 +//   - built-in variable gl_PointCoord for fragment shaders.
    1.27 +//   - matrix constructors taking matrix as argument.
    1.28 +//   - array as "out" function parameters
    1.29 +//
    1.30 +class TVersionGLSL : public TIntermTraverser {
    1.31 +public:
    1.32 +    TVersionGLSL(ShShaderType type);
    1.33 +
    1.34 +    // Returns 120 if the following is used the shader:
    1.35 +    // - "invariant",
    1.36 +    // - "gl_PointCoord",
    1.37 +    // - matrix/matrix constructors
    1.38 +    // - array "out" parameters
    1.39 +    // Else 110 is returned.
    1.40 +    int getVersion() { return mVersion; }
    1.41 +
    1.42 +    virtual void visitSymbol(TIntermSymbol*);
    1.43 +    virtual void visitConstantUnion(TIntermConstantUnion*);
    1.44 +    virtual bool visitBinary(Visit, TIntermBinary*);
    1.45 +    virtual bool visitUnary(Visit, TIntermUnary*);
    1.46 +    virtual bool visitSelection(Visit, TIntermSelection*);
    1.47 +    virtual bool visitAggregate(Visit, TIntermAggregate*);
    1.48 +    virtual bool visitLoop(Visit, TIntermLoop*);
    1.49 +    virtual bool visitBranch(Visit, TIntermBranch*);
    1.50 +
    1.51 +protected:
    1.52 +    void updateVersion(int version);
    1.53 +
    1.54 +private:
    1.55 +    ShShaderType mShaderType;
    1.56 +    int mVersion;
    1.57 +};
    1.58 +
    1.59 +#endif  // COMPILER_VERSIONGLSL_H_

mercurial