cogl: Add XRGB_2101010 and XBGR_2101010 formats

These match their alpha counterparts, apart from not setting the
alpha bit. This allows our internal mashinery to more easily
distinguish whether we need a slow alpha-pass during rendering or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1810>
This commit is contained in:
Robert Mader 2021-04-02 11:05:40 +02:00 committed by Marge Bot
parent 3059d3ffc8
commit dc442e7a75
8 changed files with 30 additions and 0 deletions

View File

@ -345,7 +345,9 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
case COGL_PIXEL_FORMAT_RGBA_1010102: case COGL_PIXEL_FORMAT_RGBA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102: case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_XRGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010: case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_XBGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010: case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:

View File

@ -396,10 +396,12 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
G_PASTE (_cogl_unpack_bgra_1010102_, component_size) (src, dst, width); G_PASTE (_cogl_unpack_bgra_1010102_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_XRGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010: case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
G_PASTE (_cogl_unpack_argb_2101010_, component_size) (src, dst, width); G_PASTE (_cogl_unpack_argb_2101010_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_XBGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010: case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (src, dst, width); G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (src, dst, width);
@ -775,10 +777,12 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
G_PASTE (_cogl_pack_bgra_1010102_, component_size) (src, dst, width); G_PASTE (_cogl_pack_bgra_1010102_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_XRGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010: case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
G_PASTE (_cogl_pack_argb_2101010_, component_size) (src, dst, width); G_PASTE (_cogl_pack_argb_2101010_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_XBGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010: case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
G_PASTE (_cogl_pack_abgr_2101010_, component_size) (src, dst, width); G_PASTE (_cogl_pack_abgr_2101010_, component_size) (src, dst, width);

View File

@ -161,6 +161,13 @@ static const CoglPixelFormatInfo format_info_table[] = {
.aligned = 0, .aligned = 0,
.bpp = { 4 }, .bpp = { 4 },
}, },
{
.cogl_format = COGL_PIXEL_FORMAT_XRGB_2101010,
.format_str = "XRGB_2101010",
.n_planes = 1,
.aligned = 0,
.bpp = { 4 },
},
{ {
.cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010, .cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010,
.format_str = "ARGB_2101010", .format_str = "ARGB_2101010",
@ -168,6 +175,13 @@ static const CoglPixelFormatInfo format_info_table[] = {
.aligned = 0, .aligned = 0,
.bpp = { 4 }, .bpp = { 4 },
}, },
{
.cogl_format = COGL_PIXEL_FORMAT_XBGR_2101010,
.format_str = "XBGR_2101010",
.n_planes = 1,
.aligned = 0,
.bpp = { 4 },
},
{ {
.cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010, .cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010,
.format_str = "ABGR_2101010", .format_str = "ABGR_2101010",

View File

@ -221,7 +221,9 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_RGBA_1010102 = (13 | COGL_A_BIT), COGL_PIXEL_FORMAT_RGBA_1010102 = (13 | COGL_A_BIT),
COGL_PIXEL_FORMAT_BGRA_1010102 = (13 | COGL_A_BIT | COGL_BGR_BIT), COGL_PIXEL_FORMAT_BGRA_1010102 = (13 | COGL_A_BIT | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_XRGB_2101010 = (13 | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ARGB_2101010 = (13 | COGL_A_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_ARGB_2101010 = (13 | COGL_A_BIT | COGL_AFIRST_BIT),
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_ABGR_2101010 = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_RGBA_FP_16161616 = (11 | COGL_A_BIT), COGL_PIXEL_FORMAT_RGBA_FP_16161616 = (11 | COGL_A_BIT),

View File

@ -253,6 +253,7 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_INT_10_10_10_2; gltype = GL_UNSIGNED_INT_10_10_10_2;
break; break;
case COGL_PIXEL_FORMAT_XBGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010: case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
glintformat = GL_RGBA; glintformat = GL_RGBA;
@ -260,6 +261,7 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_INT_2_10_10_10_REV; gltype = GL_UNSIGNED_INT_2_10_10_10_REV;
break; break;
case COGL_PIXEL_FORMAT_XRGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010: case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
glintformat = GL_RGBA; glintformat = GL_RGBA;

View File

@ -413,8 +413,10 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx,
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
case COGL_PIXEL_FORMAT_BGRA_1010102: case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_XBGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010: case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_XRGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010: case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
case COGL_PIXEL_FORMAT_RGBA_8888: case COGL_PIXEL_FORMAT_RGBA_8888:

View File

@ -158,8 +158,10 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
#endif #endif
case COGL_PIXEL_FORMAT_BGRA_1010102: case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_XBGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010: case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_XRGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010: case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN #if G_BYTE_ORDER == G_LITTLE_ENDIAN

View File

@ -457,8 +457,10 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx,
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
case COGL_PIXEL_FORMAT_BGRA_1010102: case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_XBGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010: case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_XRGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010: case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN #if G_BYTE_ORDER == G_LITTLE_ENDIAN