Edit

kc3-lang/angle/src/compiler/translator/VersionGLSL.h

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2014-08-19 15:23:24
    Hash : b1a85f48
    Message : Rename compiler intermediate source files. This prevents confusion between "TIntermediate" and "TIntermNode". BUG=angle:711 Change-Id: Ib7a086382a479db3f77bf2ab06ce321aa7b35d13 Reviewed-on: https://chromium-review.googlesource.com/212936 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>

  • src/compiler/translator/VersionGLSL.h
  • //
    // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    #ifndef COMPILER_TRANSLATOR_VERSIONGLSL_H_
    #define COMPILER_TRANSLATOR_VERSIONGLSL_H_
    
    #include "compiler/translator/IntermNode.h"
    
    // Traverses the intermediate tree to return the minimum GLSL version
    // required to legally access all built-in features used in the shader.
    // GLSL 1.1 which is mandated by OpenGL 2.0 provides:
    //   - #version and #extension to declare version and extensions.
    //   - built-in functions refract, exp, and log.
    //   - updated step() to compare x < edge instead of x <= edge.
    // GLSL 1.2 which is mandated by OpenGL 2.1 provides:
    //   - many changes to reduce differences when compared to the ES specification.
    //   - invariant keyword and its support.
    //   - c++ style name hiding rules.
    //   - built-in variable gl_PointCoord for fragment shaders.
    //   - matrix constructors taking matrix as argument.
    //   - array as "out" function parameters
    //
    // TODO: ES3 equivalent versions of GLSL
    class TVersionGLSL : public TIntermTraverser
    {
      public:
        TVersionGLSL(sh::GLenum type);
    
        // Returns 120 if the following is used the shader:
        // - "invariant",
        // - "gl_PointCoord",
        // - matrix/matrix constructors
        // - array "out" parameters
        // Else 110 is returned.
        int getVersion() { return mVersion; }
    
        virtual void visitSymbol(TIntermSymbol *);
        virtual bool visitAggregate(Visit, TIntermAggregate *);
    
      protected:
        void updateVersion(int version);
    
      private:
        int mVersion;
    };
    
    #endif  // COMPILER_TRANSLATOR_VERSIONGLSL_H_