1 // 2 // Copyright 2020 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 // SpecializationConst.h: Add code to generate AST node for specialization constant. 7 // 8 9 #ifndef COMPILER_TRANSLATOR_TREEUTIL_SPECIALIZATIONCONSTANT_H_ 10 #define COMPILER_TRANSLATOR_TREEUTIL_SPECIALIZATIONCONSTANT_H_ 11 12 #include "common/angleutils.h" 13 #include "compiler/translator/Compiler.h" 14 #include "compiler/translator/SymbolTable.h" 15 16 class TIntermBlock; 17 class TIntermTyped; 18 class TIntermSymbol; 19 class TVariable; 20 21 namespace sh 22 { 23 24 class SpecConst 25 { 26 public: 27 SpecConst(TSymbolTable *symbolTable, const ShCompileOptions &compileOptions, GLenum shaderType); 28 virtual ~SpecConst(); 29 30 // Flip/rotation 31 // Returns a boolean: should X and Y be swapped? 32 TIntermTyped *getSwapXY(); 33 34 // Dither emulation 35 TIntermTyped *getDither(); 36 37 void declareSpecConsts(TIntermBlock *root); getSpecConstUsageBits()38 SpecConstUsageBits getSpecConstUsageBits() const { return mUsageBits; } 39 40 private: 41 TIntermSymbol *getRotation(); 42 43 // If unsupported, this should be set to null. 44 TSymbolTable *mSymbolTable; 45 const ShCompileOptions &mCompileOptions; 46 47 TVariable *mSurfaceRotationVar; 48 TVariable *mDitherVar; 49 50 // Bit is set if YFlip or Rotation has been used 51 SpecConstUsageBits mUsageBits; 52 }; 53 } // namespace sh 54 55 #endif // COMPILER_TRANSLATOR_TREEUTIL_SPECIALIZATIONCONSTANT_H_ 56