summaryrefslogtreecommitdiff
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2020-12-15 13:15:29 +0200
committerMarge Bot <eric+marge@anholt.net>2020-12-21 07:47:44 +0000
commit296d8662dc68612c41d0e488d9b8bdf51e674b06 (patch)
treee3fd478f27446dc1c23d6c9dc53987c39f7fb69f /src/mesa/main/fbobject.c
parent448e60314ae0956af92cfac1a63a783a8f94ece7 (diff)
mesa: fix layered framebuffer attachment target check
Current code was making the layer target checking for depth and stencil attachments as well while the check in spec is specified only for color. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3980 Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8102>
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 0decff3d967..66ac9fd1267 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1318,15 +1318,33 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
att_layer_count = att->Renderbuffer->Height;
else
att_layer_count = att->Renderbuffer->Depth;
+
+ /* From OpenGL ES 3.2 spec, chapter 9.4. FRAMEBUFFER COMPLETENESS:
+ *
+ * "If any framebuffer attachment is layered, all populated
+ * attachments must be layered. Additionally, all populated color
+ * attachments must be from textures of the same target
+ * (three-dimensional, one- or two-dimensional array, cube map, or
+ * cube map array textures)."
+ *
+ * Same text can be found from OpenGL 4.6 spec.
+ *
+ * Setup the checked layer target with first color attachment here
+ * so that mismatch check below will not trigger between depth,
+ * stencil, only between color attachments.
+ */
+ if (i == 0)
+ layer_tex_target = att_tex_target;
+
} else {
att_layer_count = 0;
}
if (!layer_info_valid) {
is_layered = att->Layered;
max_layer_count = att_layer_count;
- layer_tex_target = att_tex_target;
layer_info_valid = true;
- } else if (max_layer_count > 0 && layer_tex_target != att_tex_target) {
+ } else if (max_layer_count > 0 && layer_tex_target &&
+ layer_tex_target != att_tex_target) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS;
fbo_incomplete(ctx, "layered framebuffer has mismatched targets", i);
return;