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 // ReplaceForShaderFramebufferFetch.h: Find any references to gl_LastFragData, and replace it with
7 // ANGLELastFragData.
8 //
9 
10 #ifndef COMPILER_TRANSLATOR_TREEUTIL_REPLACEFORSHADERFRAMEBUFFERFETCH_H_
11 #define COMPILER_TRANSLATOR_TREEUTIL_REPLACEFORSHADERFRAMEBUFFERFETCH_H_
12 
13 #include "common/angleutils.h"
14 
15 namespace sh
16 {
17 
18 class TCompiler;
19 class TIntermBlock;
20 class TSymbolTable;
21 struct ShaderVariable;
22 
23 // Declare the global variable, "ANGLELastFragData", and at the begining of the main function,
24 // assign a subpassLoad value to it. Then replace every gl_LastFragData to "ANGLELastFragData". This
25 // is to solve the problem GLSL for Vulkan can't process gl_LastFragData variable.
26 ANGLE_NO_DISCARD bool ReplaceLastFragData(TCompiler *compiler,
27                                           TIntermBlock *root,
28                                           TSymbolTable *symbolTable,
29                                           std::vector<ShaderVariable> *uniforms);
30 
31 // Similar to "ANGLELastFragData", but the difference is the variable for loading a framebuffer
32 // data. The variable decorated with a inout qualifier will be replaced to the variable decorated
33 // with a out qualifier. And this variable will be used to load the framebuffer data.
34 ANGLE_NO_DISCARD bool ReplaceInOutVariables(TCompiler *compiler,
35                                             TIntermBlock *root,
36                                             TSymbolTable *symbolTable,
37                                             std::vector<ShaderVariable> *uniforms);
38 
39 }  // namespace sh
40 
41 #endif  // COMPILER_TRANSLATOR_TREEUTIL_REPLACEFORSHADERFRAMEBUFFERFETCH_H_
42