xref: /aosp_15_r20/external/angle/src/compiler/translator/tree_ops/glsl/RewriteRepeatedAssignToSwizzled.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2018 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 // RewriteRepeatedAssignToSwizzled.h: Rewrite expressions that assign an assignment to a swizzled
7 // vector, like:
8 //     v.x = z = expression;
9 // to:
10 //     z = expression;
11 //     v.x = z;
12 //
13 // Note that this doesn't handle some corner cases: expressions nested inside other expressions,
14 // inside loop headers, or inside if conditions.
15 
16 #ifndef COMPILER_TRANSLATOR_TREEOPS_GLSL_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
17 #define COMPILER_TRANSLATOR_TREEOPS_GLSL_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
18 
19 #include "common/angleutils.h"
20 #include "common/debug.h"
21 
22 namespace sh
23 {
24 
25 class TCompiler;
26 class TIntermBlock;
27 
28 #ifdef ANGLE_ENABLE_GLSL
29 [[nodiscard]] bool RewriteRepeatedAssignToSwizzled(TCompiler *compiler, TIntermBlock *root);
30 #else
RewriteRepeatedAssignToSwizzled(TCompiler * compiler,TIntermBlock * root)31 [[nodiscard]] ANGLE_INLINE bool RewriteRepeatedAssignToSwizzled(TCompiler *compiler,
32                                                                 TIntermBlock *root)
33 {
34     UNREACHABLE();
35     return false;
36 }
37 #endif
38 
39 }  // namespace sh
40 
41 #endif  // COMPILER_TRANSLATOR_TREEOPS_GLSL_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
42