cogl: Add missing RGBfp16 opaque formats

This adds the last missing opaque format variants we support on Wayland.

Do not add testing for these as we are missing helper function to pack
half float values.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
This commit is contained in:
Robert Mader 2023-06-21 12:13:36 +02:00 committed by Marge Bot
parent ae5512bc05
commit eb19ac86ba
8 changed files with 48 additions and 0 deletions

View File

@ -357,7 +357,9 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_RGBX_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_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:

View File

@ -522,7 +522,9 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBX_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_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:
@ -1021,7 +1023,9 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
G_PASTE (_cogl_pack_abgr_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBX_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_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:

View File

@ -287,6 +287,13 @@ static const CoglPixelFormatInfo format_info_table[] = {
.aligned = 0,
.bpp = { 4 },
},
{
.cogl_format = COGL_PIXEL_FORMAT_RGBX_FP_16161616,
.format_str = "RGBX_FP_16161616",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_RGBA_FP_16161616,
.format_str = "RGBA_FP_16161616",
@ -294,6 +301,13 @@ static const CoglPixelFormatInfo format_info_table[] = {
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_BGRX_FP_16161616,
.format_str = "BGRX_FP_16161616",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_BGRA_FP_16161616,
.format_str = "BGRA_FP_16161616",

View File

@ -174,7 +174,9 @@ G_BEGIN_DECLS
* @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_RGBX_FP_16161616: RGBX half floating point, 64 bit
* @COGL_PIXEL_FORMAT_RGBA_FP_16161616: RGBA half floating point, 64 bit
* @COGL_PIXEL_FORMAT_BGRX_FP_16161616: BGRX half floating point, 64 bit
* @COGL_PIXEL_FORMAT_BGRA_FP_16161616: BGRA half floating point, 64 bit
* @COGL_PIXEL_FORMAT_ARGB_FP_16161616: ARGB half floating point, 64 bit
* @COGL_PIXEL_FORMAT_ABGR_FP_16161616: ABGR half floating point, 64 bit
@ -234,7 +236,9 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_XBGR_2101010 = (13 | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ABGR_2101010 = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_RGBX_FP_16161616 = 11,
COGL_PIXEL_FORMAT_RGBA_FP_16161616 = (11 | COGL_A_BIT),
COGL_PIXEL_FORMAT_BGRX_FP_16161616 = (11 | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_BGRA_FP_16161616 = (11 | COGL_A_BIT | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_XRGB_FP_16161616 = (11 | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ARGB_FP_16161616 = (11 | COGL_A_BIT | COGL_AFIRST_BIT),

View File

@ -315,12 +315,22 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
break;
case COGL_PIXEL_FORMAT_RGBX_FP_16161616:
glintformat = GL_RGB;
glformat = GL_RGBA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
glintformat = GL_RGBA;
glformat = GL_RGBA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_BGRX_FP_16161616:
glintformat = GL_RGB;
glformat = GL_BGRA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
glintformat = GL_RGBA;
@ -328,6 +338,10 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_XRGB_FP_16161616:
glintformat = GL_RGB;
glformat = GL_BGRA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
glintformat = GL_RGBA;
@ -335,6 +349,10 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_XBGR_FP_16161616:
glintformat = GL_RGB;
glformat = GL_RGBA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
glintformat = GL_RGBA;

View File

@ -435,6 +435,7 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx,
case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_RGBA_5551_PRE:
return TRUE;
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:
@ -443,6 +444,7 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx,
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
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_private_feature

View File

@ -223,6 +223,7 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
break;
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:
@ -234,6 +235,7 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
g_warning ("Unhandled 16 bpc pixel format used");
G_GNUC_FALLTHROUGH;
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_private_feature

View File

@ -488,6 +488,7 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx,
case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_RGBA_5551_PRE:
return TRUE;
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:
@ -497,6 +498,7 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx,
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
return FALSE;
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_private_feature