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 // ReplaceClipDistanceVariable.h: Find any references to gl_ClipDistance and 7 // replace it with ANGLEClipDistance. 8 // 9 10 #ifndef COMPILER_TRANSLATOR_TREEUTIL_REPLACECLIPDISTANCEVARIABLE_H_ 11 #define COMPILER_TRANSLATOR_TREEUTIL_REPLACECLIPDISTANCEVARIABLE_H_ 12 13 #include "common/angleutils.h" 14 15 namespace sh 16 { 17 18 class TCompiler; 19 class TIntermBlock; 20 class TSymbolTable; 21 class TIntermTyped; 22 23 // Replace every gl_ClipDistance assignment with assignment to "ANGLEClipDistance", 24 // then at the end of shader re-assign the values of this global variable to gl_ClipDistance. 25 // This to solve some complex usages such as user passing gl_ClipDistance as output reference 26 // to a function. 27 // Furthermore, at the end shader, some disabled gl_ClipDistance[i] can be skipped from the 28 // assignment. 29 ANGLE_NO_DISCARD bool ReplaceClipDistanceAssignments(TCompiler *compiler, 30 TIntermBlock *root, 31 TSymbolTable *symbolTable, 32 const TIntermTyped *clipDistanceEnableFlags); 33 } // namespace sh 34 35 #endif