From 66156236e2d0cdc9889cdd66f79b8d6c4ac8fde1 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Wed, 31 Jul 2024 17:49:47 +0200 Subject: [PATCH] cogl/gles: Use a premul required format for opaque fp16 Cogl formats The opaque fp16 Cogl format variants need a required format that is already premultiplied whereas the fp16 formats with an alpha channel can be either straight or premult. Part-of: (cherry picked from commit d820fe030ae83c6f7292c2cd5c7c7d0db68ac8ff) --- cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index 2931e8fc4..9e29fa0cc 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -349,7 +349,6 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context, &gltype); break; - case COGL_PIXEL_FORMAT_RGBX_FP_16161616: case COGL_PIXEL_FORMAT_RGBA_FP_16161616: case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE: if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_HALF_FLOAT)) @@ -364,14 +363,23 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context, } break; + case COGL_PIXEL_FORMAT_RGBX_FP_16161616: case COGL_PIXEL_FORMAT_BGRX_FP_16161616: - case COGL_PIXEL_FORMAT_BGRA_FP_16161616: case COGL_PIXEL_FORMAT_XRGB_FP_16161616: - case COGL_PIXEL_FORMAT_ARGB_FP_16161616: case COGL_PIXEL_FORMAT_XBGR_FP_16161616: - case COGL_PIXEL_FORMAT_ABGR_FP_16161616: + required_format = + _cogl_driver_pixel_format_to_gl (context, + COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE, + &glintformat, + &glformat, + &gltype); + break; + + case COGL_PIXEL_FORMAT_BGRA_FP_16161616: case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE: + case COGL_PIXEL_FORMAT_ARGB_FP_16161616: case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE: + case COGL_PIXEL_FORMAT_ABGR_FP_16161616: case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE: required_format = _cogl_driver_pixel_format_to_gl (context,