mesa: add check that non base level attachment is mipmap complete

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>
This commit is contained in:
Tapani Pälli 2021-01-19 07:43:41 +02:00 committed by Marge Bot
parent a1e9a5d653
commit 2683e3b241

View 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;