Skip to content

st/mesa: Fix GL_MAP_COLOR with glDrawPixels GL_COLOR_INDEX

Danylo Piliaiev requested to merge GL/mesa:fix/gallium-gl-map-color into master

Sorry for the necromancy but the test in question passes in i965 and fails on Iris/OtherGalliumDrivers so why not to fix it if I already took a look at it =)

Documentation for glDrawPixels with GL_COLOR_INDEX says:
"If the GL is in color index mode, and if GL_MAP_COLOR is true,
the index is replaced with the value that it references in
lookup table GL_PIXEL_MAP_I_TO_I"

We are always in RGBA mode and there is nothing in documentation about GL_MAP_COLOR in RGBA mode for GL_COLOR_INDEX.

Scale and bias are also only applicable for RGBA format and not mentioned for GL_COLOR_INDEX.

Thus the behaviour will be on par with i965 (https://gitlab.freedesktop.org/mesa/mesa/blob/master/src/mesa/main/pack.c#L1593).

Fixes: gl-1.0-drawpixels-color-index

Merge request reports