Skip to content

fix GLES CopyTexImage for drivers not fully supporting RGBA4

Karol Herbst requested to merge karolherbst/mesa:cts_v3 into main

Nvidia hardware doesn't support RGB(A)4 for rendering, but only for texturing. Simply removing support for those formats doesn't make the GLES CTS happy either and also negatively impacts Gallium Nine, where this isn't a problem.

Anyway, for checking if a copy is allowed we actually have to compare the internal format passed into the call, not what the driver ends up choosing internally (Nouveau upgrades RGB(A)4 to RGB(A)8, so a copy from RGBA4 to RGBA8 doesn't fail although GLES requires it to generate an INVALID_OPERATION.

In order to fix it, let's require RGB(A)4 to be renderable in st/mesa and compare the actually passed in internal format.

What I currently have only a dirty solution for is if the passed in internal format is sized and the source buffer only unsized, as there is no trivial way to get the "effective internal format" at that point.

EDIT:

affected tests:

KHR-GLES3.packed_pixels.*rectangle.rgba
KHR-GLES3.packed_pixels.*rectangle.rgba4
KHR-GLES3.packed_pixels.*rectangle.rgba8
KHR-GLES3.copy_tex_image_conversions.forbidden.*
Edited by Jordan Justen

Merge request reports