Module: Mesa Branch: staging/23.3 Commit: 4c37d02fe238a3b1ff1257417315dbb963696616 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c37d02fe238a3b1ff1257417315dbb963696616
Author: Jesse Natalie <jenat...@microsoft.com> Date: Thu Jan 11 15:46:07 2024 -0800 mesa: Consider mesa format in addition to internal format for mip/cube completeness Prior to 06b526de, the mesa format was used for these completeness checks. That was to address the case where a *different* internal format selected the *same* mesa format, and the texture shouldn't be considered compatible. But this didn't address the case where the *same* internal format selected a *different* mesa format, e.g. because the type passed to the TexImage API was different. An old WGL demo app called TexFilter.exe tries to redefine a mipped RGBA16 texture as RGBA8. This incorrect logic caused Mesa to try to copy the RGBA16 data from the smaller mips into the newly created RGBA8 data, because it thought that the texture was still mip-complete, despite the format changing. Cc: mesa-stable Reviewed-By: Mike Blumenkrantz <michael.blumenkra...@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27023> (cherry picked from commit 4cb9c77e8e08507b5c181a480259e42b43dd647e) --- .pick_status.json | 2 +- src/mesa/main/texobj.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 49e74ac2ae7..0a4a9542e2d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -284,7 +284,7 @@ "description": "mesa: Consider mesa format in addition to internal format for mip/cube completeness", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 20e14ee21ee..5c960c730bf 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -817,7 +817,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, return; } if (t->Image[face][baseLevel]->InternalFormat != - baseImage->InternalFormat) { + baseImage->InternalFormat || + t->Image[face][baseLevel]->TexFormat != baseImage->TexFormat) { incomplete(t, BASE, "Cube face format mismatch"); return; } @@ -876,7 +877,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, incomplete(t, MIPMAP, "TexImage[%d] is missing", i); return; } - if (img->InternalFormat != baseImage->InternalFormat) { + if (img->InternalFormat != baseImage->InternalFormat || + img->TexFormat != baseImage->TexFormat) { incomplete(t, MIPMAP, "Format[i] != Format[baseLevel]"); return; }