// // Copyright 2002 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. // #include "compiler/translator/glsl/VersionGLSL.h" #include "angle_gl.h" #include "compiler/translator/Symbol.h" namespace sh { namespace { constexpr const ImmutableString kGlPointCoordString("gl_PointCoord"); } // anonymous namespace int ShaderOutputTypeToGLSLVersion(ShShaderOutput output) { … } // We need to scan for the following: // 1. "invariant" keyword: This can occur in both - vertex and fragment shaders // but only at the global scope. // 2. "gl_PointCoord" built-in variable: This can only occur in fragment shader // but inside any scope. // 3. Call to a matrix constructor with another matrix as argument. // (These constructors were reserved in GLSL version 1.10.) // 4. Arrays as "out" function parameters. // GLSL spec section 6.1.1: "When calling a function, expressions that do // not evaluate to l-values cannot be passed to parameters declared as // out or inout." // GLSL 1.1 section 5.8: "Other binary or unary expressions, // non-dereferenced arrays, function names, swizzles with repeated fields, // and constants cannot be l-values." // GLSL 1.2 relaxed the restriction on arrays, section 5.8: "Variables that // are built-in types, entire structures or arrays... are all l-values." // TVersionGLSL::TVersionGLSL(sh::GLenum type, const TPragma &pragma, ShShaderOutput output) : … { … } void TVersionGLSL::visitSymbol(TIntermSymbol *node) { … } bool TVersionGLSL::visitDeclaration(Visit, TIntermDeclaration *node) { … } bool TVersionGLSL::visitGlobalQualifierDeclaration(Visit, TIntermGlobalQualifierDeclaration *node) { … } void TVersionGLSL::visitFunctionPrototype(TIntermFunctionPrototype *node) { … } bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node) { … } void TVersionGLSL::ensureVersionIsAtLeast(int version) { … } } // namespace sh