Path: blob/main_old/src/compiler/translator/ASTMetadataHLSL.h
1693 views
//1// Copyright 2002 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56// Defines analyses of the AST needed for HLSL generation78#ifndef COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_9#define COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_1011#include <set>12#include <vector>1314namespace sh15{1617class CallDAG;18class TIntermNode;19class TIntermIfElse;20class TIntermLoop;2122struct ASTMetadataHLSL23{24ASTMetadataHLSL()25: mUsesGradient(false),26mCalledInDiscontinuousLoop(false),27mHasGradientLoopInCallGraph(false),28mNeedsLod0(false)29{}3031// Here "something uses a gradient" means here that it either contains a32// gradient operation, or a call to a function that uses a gradient.33bool hasGradientInCallGraph(TIntermLoop *node);34bool hasGradientLoop(TIntermIfElse *node);3536// Does the function use a gradient.37bool mUsesGradient;3839// Even if usesGradient is true, some control flow might not use a gradient40// so we store the set of all gradient-using control flows.41std::set<TIntermNode *> mControlFlowsContainingGradient;4243// Remember information about the discontinuous loops and which functions44// are called in such loops.45bool mCalledInDiscontinuousLoop;46bool mHasGradientLoopInCallGraph;47std::set<TIntermLoop *> mDiscontinuousLoops;48std::set<TIntermIfElse *> mIfsContainingGradientLoop;4950// Will we need to generate a Lod0 version of the function.51bool mNeedsLod0;52};5354typedef std::vector<ASTMetadataHLSL> MetadataList;5556// Return the AST analysis result, in the order defined by the call DAG57MetadataList CreateASTMetadataHLSL(TIntermNode *root, const CallDAG &callDag);5859} // namespace sh6061#endif // COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_626364