From 64f4415f28b4bbfc39b00bbc3789c598471cf11f Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Mon, 4 Dec 2023 17:44:48 +0100 Subject: [PATCH] cogl/gl: Use CPU packing/unpacking for opaque fp16 formats There is no internal fp16 format which has no alpha which means we would get garbage alpha when reading the framebuffer directly. We have to use the packing/unpacking to always get the alpha of 1. Part-of: --- cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index c807f03e2..c20bd3671 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -280,10 +280,8 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context, glformat = GL_BGRA; gltype = GL_HALF_FLOAT; break; - case COGL_PIXEL_FORMAT_XRGB_FP_16161616: case COGL_PIXEL_FORMAT_ARGB_FP_16161616: case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE: - case COGL_PIXEL_FORMAT_XBGR_FP_16161616: case COGL_PIXEL_FORMAT_ABGR_FP_16161616: case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE: required_format = @@ -294,6 +292,15 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context, &glformat, &gltype); break; + case COGL_PIXEL_FORMAT_XRGB_FP_16161616: + case COGL_PIXEL_FORMAT_XBGR_FP_16161616: + required_format = + _cogl_driver_pixel_format_to_gl (context, + COGL_PIXEL_FORMAT_RGBX_FP_16161616, + &glintformat, + &glformat, + &gltype); + break; case COGL_PIXEL_FORMAT_DEPTH_16: glintformat = GL_DEPTH_COMPONENT16;