1 // 2 // Copyright 2024 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 // ClampGLLayer: Set gl_Layer to 0 if framebuffer is not layered. The GL spec says: 7 // 8 // > A layer number written by a geometry shader has no effect if the framebuffer is not layered. 9 // 10 // While the Vulkan spec says: 11 // 12 // > If the Layer value is less than 0 or greater than or equal to the number of layers in the 13 // > framebuffer, then primitives may still be rasterized, fragment shaders may be executed, and the 14 // > framebuffer values for all layers are undefined. 15 // 16 // ANGLE sets gl_Layer to 0 if the framebuffer is not layered in this transformation. 17 // 18 19 #ifndef COMPILER_TRANSLATOR_TREEOPS_SPIRV_CLAMPGLLAYER_H_ 20 #define COMPILER_TRANSLATOR_TREEOPS_SPIRV_CLAMPGLLAYER_H_ 21 22 #include "common/angleutils.h" 23 #include "compiler/translator/Compiler.h" 24 25 namespace sh 26 { 27 class TCompiler; 28 class TIntermBlock; 29 class TSymbolTable; 30 class DriverUniform; 31 32 [[nodiscard]] bool ClampGLLayer(TCompiler *compiler, 33 TIntermBlock *root, 34 TSymbolTable *symbolTable, 35 const DriverUniform *driverUniforms); 36 } // namespace sh 37 38 #endif // COMPILER_TRANSLATOR_TREEOPS_SPIRV_CLAMPGLLAYER_H_ 39