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.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27023>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user