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, ShCompileOptions compileOptions, GLenum shaderType); 28 virtual ~SpecConst(); 29 30 // Line rasterizaton emulation 31 TIntermSymbol *getLineRasterEmulation(); 32 33 // Flip/rotation 34 TIntermTyped *getMultiplierXForDFdx(); 35 TIntermTyped *getMultiplierYForDFdx(); 36 TIntermTyped *getMultiplierXForDFdy(); 37 TIntermTyped *getMultiplierYForDFdy(); 38 TIntermTyped *getPreRotationMatrix(); 39 TIntermTyped *getFragRotationMatrix(); 40 TIntermTyped *getFlipXY(); 41 TIntermTyped *getNegFlipXY(); 42 TIntermTyped *getFlipY(); 43 TIntermTyped *getFragRotationMultiplyFlipXY(); 44 45 // Half render area 46 TIntermBinary *getHalfRenderArea(); 47 48 void declareSpecConsts(TIntermBlock *root); getSpecConstUsageBits()49 SpecConstUsageBits getSpecConstUsageBits() const { return mUsageBits; } 50 51 private: 52 TIntermSymbol *getFlipRotation(); 53 TIntermTyped *getNegFlipY(); 54 TIntermSymbol *getDrawableWidth(); 55 TIntermSymbol *getDrawableHeight(); 56 TIntermTyped *getHalfRenderAreaRotationMatrix(); 57 58 // If unsupported, this should be set to null. 59 TSymbolTable *mSymbolTable; 60 ShCompileOptions mCompileOptions; 61 62 TVariable *mLineRasterEmulationVar; 63 TVariable *mSurfaceRotationVar; 64 TVariable *mDrawableWidthVar; 65 TVariable *mDrawableHeightVar; 66 67 // Bit is set if YFlip or Rotation has been used 68 SpecConstUsageBits mUsageBits; 69 }; 70 } // namespace sh 71 72 #endif // COMPILER_TRANSLATOR_TREEUTIL_SPECIALIZATIONCONSTANT_H_ 73