mesa: add check that non base level attachment is mipmap complete
authorTapani Pälli <tapani.palli@intel.com>
Tue, 19 Jan 2021 05:43:41 +0000 (07:43 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 1 Mar 2021 08:23:58 +0000 (08:23 +0000)
Patch adds a check for mipmap completeness of framebuffer object texture
attachments. Since a glTexImage call might have updated miplevels
meanwhile, we test the completeness before setting framebuffer object
incomplete.

Fixes some upcoming framebuffer completeness CTS tests that explicitly
test case where we have mipmap incomplete non base level texture which
should make also framebuffer object incomplete. After update to the
texture it should make framebuffer object complete again.

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/8520>

src/mesa/main/fbobject.c

index 2bfe2e9..3708751 100644 (file)
@@ -920,6 +920,21 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
          att->Complete = GL_FALSE;
          return;
       }
+
+      /* Mutable non base level texture as framebuffer attachment
+       * must be mipmap complete.
+       */
+      if (texImage->Level > texObj->Attrib.BaseLevel &&
+          !texObj->_MipmapComplete) {
+         /* Test if texture has become mipmap complete meanwhile. */
+         _mesa_test_texobj_completeness(ctx, att->Texture);
+         if (!texObj->_MipmapComplete) {
+            att_incomplete("texture attachment not mipmap complete");
+            att->Complete = GL_FALSE;
+            return;
+         }
+      }
+
       if (texImage->Width < 1 || texImage->Height < 1) {
          att_incomplete("teximage width/height=0");
          att->Complete = GL_FALSE;