tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ASTMetadataHLSL.h (1841B)


      1 //
      2 // Copyright 2002 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 
      7 // Defines analyses of the AST needed for HLSL generation
      8 
      9 #ifndef COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
     10 #define COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
     11 
     12 #include <set>
     13 #include <vector>
     14 
     15 namespace sh
     16 {
     17 
     18 class CallDAG;
     19 class TIntermNode;
     20 class TIntermIfElse;
     21 class TIntermLoop;
     22 
     23 struct ASTMetadataHLSL
     24 {
     25    ASTMetadataHLSL()
     26        : mUsesGradient(false),
     27          mCalledInDiscontinuousLoop(false),
     28          mHasGradientLoopInCallGraph(false),
     29          mNeedsLod0(false)
     30    {}
     31 
     32    // Here "something uses a gradient" means here that it either contains a
     33    // gradient operation, or a call to a function that uses a gradient.
     34    bool hasGradientInCallGraph(TIntermLoop *node);
     35    bool hasGradientLoop(TIntermIfElse *node);
     36 
     37    // Does the function use a gradient.
     38    bool mUsesGradient;
     39 
     40    // Even if usesGradient is true, some control flow might not use a gradient
     41    // so we store the set of all gradient-using control flows.
     42    std::set<TIntermNode *> mControlFlowsContainingGradient;
     43 
     44    // Remember information about the discontinuous loops and which functions
     45    // are called in such loops.
     46    bool mCalledInDiscontinuousLoop;
     47    bool mHasGradientLoopInCallGraph;
     48    std::set<TIntermLoop *> mDiscontinuousLoops;
     49    std::set<TIntermIfElse *> mIfsContainingGradientLoop;
     50 
     51    // Will we need to generate a Lod0 version of the function.
     52    bool mNeedsLod0;
     53 };
     54 
     55 typedef std::vector<ASTMetadataHLSL> MetadataList;
     56 
     57 // Return the AST analysis result, in the order defined by the call DAG
     58 MetadataList CreateASTMetadataHLSL(TIntermNode *root, const CallDAG &callDag);
     59 
     60 }  // namespace sh
     61 
     62 #endif  // COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_