• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     TIntermTyped *getHalfRenderArea();
47 
48     // Dither emulation
49     TIntermTyped *getDither();
50 
51     void declareSpecConsts(TIntermBlock *root);
getSpecConstUsageBits()52     SpecConstUsageBits getSpecConstUsageBits() const { return mUsageBits; }
53 
54   private:
55     TIntermSymbol *getFlipRotation();
56     TIntermTyped *getNegFlipY();
57     TIntermSymbol *getDrawableWidth();
58     TIntermSymbol *getDrawableHeight();
59     TIntermTyped *getHalfRenderAreaRotationMatrix();
60 
61     // If unsupported, this should be set to null.
62     TSymbolTable *mSymbolTable;
63     ShCompileOptions mCompileOptions;
64 
65     TVariable *mLineRasterEmulationVar;
66     TVariable *mSurfaceRotationVar;
67     TVariable *mDrawableWidthVar;
68     TVariable *mDrawableHeightVar;
69     TVariable *mDitherVar;
70 
71     // Bit is set if YFlip or Rotation has been used
72     SpecConstUsageBits mUsageBits;
73 };
74 }  // namespace sh
75 
76 #endif  // COMPILER_TRANSLATOR_TREEUTIL_SPECIALIZATIONCONSTANT_H_
77