mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 17:58:26 +02:00
mesa: fix CopyTexImage format compatibility checks for ES
the ES spec imposes additional requirements for copy commands,
specifically that the formats have matching component sizes
the existing check used the driver's internal formats to check
for a match, which is broken since the spec requires the match be
between the passed internalFormat and the buffer's effective internal
format (i.e., this has no relation to what the driver supports)
fixes KHR-GLES3.copy_tex_image_conversions.forbidden* on a bunch of drivers
cc: mesa-stable
Reviewed-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/28030>
(cherry picked from commit 2cd192f879)
This commit is contained in:
parent
5e8ca5d067
commit
c54a222442
2 changed files with 24 additions and 13 deletions
|
|
@ -24,7 +24,7 @@
|
|||
"description": "mesa: fix CopyTexImage format compatibility checks for ES",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -4561,22 +4561,33 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO
|
|||
return;
|
||||
}
|
||||
}
|
||||
/* From Page 139 of OpenGL ES 3.0 spec:
|
||||
* "If internalformat is sized, the internal format of the new texel
|
||||
* array is internalformat, and this is also the new texel array’s
|
||||
* effective internal format. If the component sizes of internalformat
|
||||
* do not exactly match the corresponding component sizes of the source
|
||||
* buffer’s effective internal format, described below, an
|
||||
* INVALID_OPERATION error is generated. If internalformat is unsized,
|
||||
* the internal format of the new texel array is the effective internal
|
||||
* format of the source buffer, and this is also the new texel array’s
|
||||
* effective internal format.
|
||||
*/
|
||||
else if (formats_differ_in_component_sizes (texFormat, rb->Format)) {
|
||||
else {
|
||||
/* From Page 139 of OpenGL ES 3.0 spec:
|
||||
* "If internalformat is sized, the internal format of the new texel
|
||||
* array is internalformat, and this is also the new texel array’s
|
||||
* effective internal format. If the component sizes of internalformat
|
||||
* do not exactly match the corresponding component sizes of the source
|
||||
* buffer’s effective internal format, described below, an
|
||||
* INVALID_OPERATION error is generated. If internalformat is unsized,
|
||||
* the internal format of the new texel array is the effective internal
|
||||
* format of the source buffer, and this is also the new texel array’s
|
||||
* effective internal format.
|
||||
*/
|
||||
enum pipe_format rb_format = st_choose_format(ctx->st, rb->InternalFormat,
|
||||
GL_NONE, GL_NONE,
|
||||
PIPE_TEXTURE_2D, 0, 0, 0,
|
||||
false, false);
|
||||
enum pipe_format new_format = st_choose_format(ctx->st, internalFormat,
|
||||
GL_NONE, GL_NONE,
|
||||
PIPE_TEXTURE_2D, 0, 0, 0,
|
||||
false, false);
|
||||
/* this comparison must be done on the API format, not the driver format */
|
||||
if (formats_differ_in_component_sizes (new_format, rb_format)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%uD(component size changed in"
|
||||
" internal format)", dims);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue