1
0
Fork 0

cogl/gles: Explain GLES2 requirement of matching internalformat & format

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>

(cherry picked from commit ce5f97fde1)
This commit is contained in:
Sebastian Wick 2024-07-31 17:59:41 +02:00 committed by Robert Mader
parent 7ab98f961c
commit d9d3199127

View file

@ -150,6 +150,20 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
* RGB8, RGBA8, RGBA4, RGB5_A1, RGB565
*/
/* For GLES 2 (not GLES 3) the glintformat and glformat have to match:
*
* internalformat must match format. No conversion between formats is
* supported during texture image processing.
*
* GL_INVALID_OPERATION is generated if format does not match internalformat.
*
* This means for e.g. COGL_PIXEL_FORMAT_RGBX_8888 we cannot use
* glintformat=GL_RGB8 with glformat=GL_RGBA. Using glintformat=GL_RGBA8 with
* glformat=GL_RGBA means the alpha channel won't be ignored and using
* glintformat=GL_RGB8 with glformat=GL_RGB means the uploading is only
* expecting 3 channels and not 4.
*/
/* We try to use the exact matching GL format but if that's not possible
* because the driver doesn't support it, we fall back to the next best match
* by calling this function again. This works for all formats which are