1 //
2 // Copyright 2023 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 // Multiple GPU vendors have issues with transforming explicit cubemap
7 // derivatives onto the appropriate face. The workarounds are vendor-specific.
8 
9 #ifndef COMPILER_TRANSLATOR_TREEOPS_PRETRANSFORMTEXTURECUBEGRADDERIVATIVES_H_
10 #define COMPILER_TRANSLATOR_TREEOPS_PRETRANSFORMTEXTURECUBEGRADDERIVATIVES_H_
11 
12 #include "compiler/translator/tree_util/IntermTraverse.h"
13 
14 namespace sh
15 {
16 
17 // GLSL specs say the following regarding cube
18 // map sampling with explicit derivatives:
19 //
20 //   For the cube version, the partial derivatives of
21 //   P are assumed to be in the coordinate system used
22 //   before texture coordinates are projected onto the
23 //   appropriate cube face.
24 //
25 // Apple silicon expects them partially pre-projected
26 // onto the target face and written to certain vector
27 // components depending on the major axis.
28 [[nodiscard]] bool PreTransformTextureCubeGradDerivatives(TCompiler *compiler,
29                                                           TIntermBlock *root,
30                                                           TSymbolTable *symbolTable,
31                                                           int shaderVersion);
32 
33 }  // namespace sh
34 
35 #endif  // COMPILER_TRANSLATOR_TREEOPS_PRETRANSFORMTEXTURECUBEGRADDERIVATIVES_H_
36