Hash :
47c66901
Author :
Date :
2024-10-21T12:47:22
Vulkan: Set gl_Layer to 0 if the framebuffer is not layered Bug: angleproject:372390039 Change-Id: I29067c9488e06f6dd2e90f207fecb843267fb77c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5949263 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
//
// Copyright 2024 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ClampGLLayer: Set gl_Layer to 0 if framebuffer is not layered. The GL spec says:
//
// > A layer number written by a geometry shader has no effect if the framebuffer is not layered.
//
// While the Vulkan spec says:
//
// > If the Layer value is less than 0 or greater than or equal to the number of layers in the
// > framebuffer, then primitives may still be rasterized, fragment shaders may be executed, and the
// > framebuffer values for all layers are undefined.
//
// ANGLE sets gl_Layer to 0 if the framebuffer is not layered in this transformation.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_SPIRV_CLAMPGLLAYER_H_
#define COMPILER_TRANSLATOR_TREEOPS_SPIRV_CLAMPGLLAYER_H_
#include "common/angleutils.h"
#include "compiler/translator/Compiler.h"
namespace sh
{
class TCompiler;
class TIntermBlock;
class TSymbolTable;
class DriverUniform;
[[nodiscard]] bool ClampGLLayer(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable,
const DriverUniform *driverUniforms);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_SPIRV_CLAMPGLLAYER_H_