Skip to content

lima: implement GL_EXT_texture_swizzle

Erico Nunes requested to merge enunes/mesa:lima-ext_texture_swizzle into master

Enabling rg textures in lima (!8549 (merged)) caused glamor to switch to R8 textures [1] and that caused breakage in glyph rendering in some applications (#4225 (closed)).

After some investigation in #4225 (closed) it seems that glamor also requires GL_EXT_texture_swizzle in some paths for that to work. In some cases the extension is checked [2] and in other it is not [3]. That could also be observed by a ton of errors like

Mesa: User error: GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_SWIZZLE_R)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_SWIZZLE_R)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_SWIZZLE_A)
Mesa: User error: GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_SWIZZLE_R)
...

from attempting to use unsupported texture swizzles.

It seems to be straightforward to implement GL_EXT_texture_swizzle following the vc4 implementation so we can just do that to resolve the issue and support this additional feature.

  1. https://gitlab.freedesktop.org/xorg/xserver/-/blob/c7730cfe5577ebde006d408f502766d8c3a73670/glamor/glamor.c#L552
  2. https://gitlab.freedesktop.org/xorg/xserver/-/blob/c7730cfe5577ebde006d408f502766d8c3a73670/glamor/glamor_picture.c#L320
  3. https://gitlab.freedesktop.org/xorg/xserver/-/blob/c7730cfe5577ebde006d408f502766d8c3a73670/glamor/glamor.c#L190

Fixes #4225 (closed)

WIP: Submitting now so the user can check the issue. I want to do some more testing with this and check remaining piglit tests before going forward with merging it.

Edited by Erico Nunes

Merge request reports