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/3589 13 14 #ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEINTERPOLATEATOFFSET_H_ 15 #define COMPILER_TRANSLATOR_TREEOPS_VULKAN_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 TIntermNode; 25 class TIntermBinary; 26 class TIntermTyped; 27 class TSymbolTable; 28 class SpecConst; 29 class DriverUniform; 30 31 // If fragRotation = nullptr, no rotation will be applied. 32 ANGLE_NO_DISCARD bool RewriteInterpolateAtOffset(TCompiler *compiler, 33 ShCompileOptions compileOptions, 34 TIntermNode *root, 35 const TSymbolTable &symbolTable, 36 int shaderVersion, 37 SpecConst *specConst, 38 const DriverUniform *driverUniforms); 39 40 } // namespace sh 41 42 #endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEINTERPOLATEATOFFSET_H_ 43