xref: /aosp_15_r20/external/angle/src/compiler/translator/tree_ops/spirv/RewriteInterpolateAtOffset.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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 // This mutating tree traversal flips the 2nd argument of interpolateAtOffset() to account for
7 // Y-coordinate flipping
8 //
9 // From: interpolateAtOffset(float interpolant, vec2 offset);
10 // To: interpolateAtOffset(float interpolant, vec2(offset * (pre-rotation * viewportYScale)));
11 //
12 // See http://anglebug.com/42262252
13 
14 #ifndef COMPILER_TRANSLATOR_TREEOPS_SPIRV_REWRITEINTERPOLATEATOFFSET_H_
15 #define COMPILER_TRANSLATOR_TREEOPS_SPIRV_REWRITEINTERPOLATEATOFFSET_H_
16 
17 #include "common/angleutils.h"
18 #include "compiler/translator/Compiler.h"
19 
20 namespace sh
21 {
22 
23 class TCompiler;
24 class TIntermBlock;
25 class TSymbolTable;
26 class SpecConst;
27 class DriverUniform;
28 
29 // If fragRotation = nullptr, no rotation will be applied.
30 [[nodiscard]] bool RewriteInterpolateAtOffset(TCompiler *compiler,
31                                               TIntermBlock *root,
32                                               TSymbolTable *symbolTable,
33                                               int shaderVersion,
34                                               SpecConst *specConst,
35                                               const DriverUniform *driverUniforms);
36 
37 }  // namespace sh
38 
39 #endif  // COMPILER_TRANSLATOR_TREEOPS_SPIRV_REWRITEINTERPOLATEATOFFSET_H_
40