Mesa (staging/20.3): mesa: fix layered framebuffer attachment target check

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 21 22:11:42 UTC 2020


Module: Mesa
Branch: staging/20.3
Commit: eec213d2adce3c9ce04d3007b6c6fc80584f69f3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eec213d2adce3c9ce04d3007b6c6fc80584f69f3

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Tue Dec 15 13:15:29 2020 +0200

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 at intel.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8102>
(cherry picked from commit 296d8662dc68612c41d0e488d9b8bdf51e674b06)

---

 .pick_status.json        |  2 +-
 src/mesa/main/fbobject.c | 22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 687825c34c9..8d350d9fd78 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -166,7 +166,7 @@
         "description": "mesa: fix layered framebuffer attachment target check",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 600c941a24f..103b285e4b0 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1320,15 +1320,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;



More information about the mesa-commit mailing list