xref: /aosp_15_r20/external/angle/src/compiler/translator/tree_ops/RecordConstantPrecision.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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 // During parsing, all constant expressions are folded to constant union nodes. The expressions that
7 // have been folded may have had precision qualifiers, which should affect the precision of the
8 // consuming operation. If the folded constant union nodes are written to output as such they won't
9 // have any precision qualifiers, and their effect on the precision of the consuming operation is
10 // lost.
11 //
12 // RecordConstantPrecision is an AST traverser that inspects the precision qualifiers of constants
13 // and hoists the constants outside the containing expression as precision qualified named variables
14 // in case that is required for correct precision propagation.
15 //
16 
17 #ifndef COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
18 #define COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
19 
20 #include "common/angleutils.h"
21 
22 namespace sh
23 {
24 class TCompiler;
25 class TIntermNode;
26 class TSymbolTable;
27 
28 [[nodiscard]] bool RecordConstantPrecision(TCompiler *compiler,
29                                            TIntermNode *root,
30                                            TSymbolTable *symbolTable);
31 }  // namespace sh
32 
33 #endif  // COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
34