From 2683e3b241b9a652de64e545cc7d17fb3968e74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 19 Jan 2021 07:43:41 +0200 Subject: [PATCH] mesa: add check that non base level attachment is mipmap complete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/fbobject.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 2bfe2e9de6a..37087519f97 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -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;