diff --git a/cogl/cogl/cogl-bitmap-conversion.c b/cogl/cogl/cogl-bitmap-conversion.c index 06e12b497..045393fa0 100644 --- a/cogl/cogl/cogl-bitmap-conversion.c +++ b/cogl/cogl/cogl-bitmap-conversion.c @@ -316,6 +316,8 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format) floats */ switch (format) { + case COGL_PIXEL_FORMAT_G_16: + case COGL_PIXEL_FORMAT_RG_1616: case COGL_PIXEL_FORMAT_DEPTH_16: case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: diff --git a/cogl/cogl/cogl-bitmap-packing.h b/cogl/cogl/cogl-bitmap-packing.h index 12cc1c7f7..d4f313de4 100644 --- a/cogl/cogl/cogl-bitmap-packing.h +++ b/cogl/cogl/cogl-bitmap-packing.h @@ -536,6 +536,8 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format, case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE: G_PASTE (_cogl_unpack_argb_fp_16161616_, component_size) (src, dst, width); break; + case COGL_PIXEL_FORMAT_G_16: + case COGL_PIXEL_FORMAT_RG_1616: case COGL_PIXEL_FORMAT_DEPTH_16: case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: @@ -1037,6 +1039,8 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format, case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE: G_PASTE (_cogl_pack_argb_fp_16161616_, component_size) (src, dst, width); break; + case COGL_PIXEL_FORMAT_G_16: + case COGL_PIXEL_FORMAT_RG_1616: case COGL_PIXEL_FORMAT_DEPTH_16: case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: diff --git a/cogl/cogl/cogl-pixel-format.c b/cogl/cogl/cogl-pixel-format.c index 93665146e..ca36a5499 100644 --- a/cogl/cogl/cogl-pixel-format.c +++ b/cogl/cogl/cogl-pixel-format.c @@ -98,6 +98,13 @@ static const CoglPixelFormatInfo format_info_table[] = { .aligned = 1, .bpp = { 1 }, }, + { + .cogl_format = COGL_PIXEL_FORMAT_G_16, + .format_str = "G_16", + .n_planes = 1, + .aligned = 1, + .bpp = { 2 }, + }, { .cogl_format = COGL_PIXEL_FORMAT_RG_88, .format_str = "RG_88", @@ -105,6 +112,13 @@ static const CoglPixelFormatInfo format_info_table[] = { .aligned = 1, .bpp = { 2 }, }, + { + .cogl_format = COGL_PIXEL_FORMAT_RG_1616, + .format_str = "RG_1616", + .n_planes = 1, + .aligned = 1, + .bpp = { 4 }, + }, { .cogl_format = COGL_PIXEL_FORMAT_RGB_888, .format_str = "RGB_888", diff --git a/cogl/cogl/cogl-pixel-format.h b/cogl/cogl/cogl-pixel-format.h index 1b7cd0971..161b8c3c1 100644 --- a/cogl/cogl/cogl-pixel-format.h +++ b/cogl/cogl/cogl-pixel-format.h @@ -105,7 +105,8 @@ G_BEGIN_DECLS * 11 = 8 bpp fp16 * 12 = 3 bpp, not aligned * 13 = 4 bpp, not aligned (e.g. 2101010) - * 14-15 = undefined + * 14 = 2 bpp, aligned (e.g. G_16) + * 15 = 4 bpp, aligned (e.g. RG_1616) * * Note: the gap at 10-11 is just because we wanted to maintain that * all non-aligned formats have the third bit set in case that's @@ -142,11 +143,13 @@ G_BEGIN_DECLS * @COGL_PIXEL_FORMAT_RG_88: RG, 16 bits. Note that red-green textures * are only available if %COGL_FEATURE_ID_TEXTURE_RG is advertised. * See cogl_texture_set_components() for details. + * @COGL_PIXEL_FORMAT_RG_1616: RG, 32 bits * @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits * @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits * @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits * @COGL_PIXEL_FORMAT_YUV: Not currently supported * @COGL_PIXEL_FORMAT_G_8: Single luminance component + * @COGL_PIXEL_FORMAT_G_16: Single luminance component, 16 bits * @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits * @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits * @COGL_PIXEL_FORMAT_RGBX_8888: RGBX, 32 bits @@ -213,8 +216,10 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/ COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT, COGL_PIXEL_FORMAT_YUV = 7, COGL_PIXEL_FORMAT_G_8 = 8, + COGL_PIXEL_FORMAT_G_16 = 14, COGL_PIXEL_FORMAT_RG_88 = 9, + COGL_PIXEL_FORMAT_RG_1616 = 15, COGL_PIXEL_FORMAT_RGB_888 = 2, COGL_PIXEL_FORMAT_BGR_888 = (2 | COGL_BGR_BIT), diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index fff4bb09e..62c15c4ec 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -377,6 +377,8 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context, gltype = GL_UNSIGNED_INT_24_8; break; + case COGL_PIXEL_FORMAT_G_16: + case COGL_PIXEL_FORMAT_RG_1616: case COGL_PIXEL_FORMAT_ANY: case COGL_PIXEL_FORMAT_YUV: g_assert_not_reached (); diff --git a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c index af50f103e..2b924abc2 100644 --- a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c @@ -452,6 +452,8 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx, return TRUE; else return FALSE; + case COGL_PIXEL_FORMAT_G_16: + case COGL_PIXEL_FORMAT_RG_1616: case COGL_PIXEL_FORMAT_DEPTH_16: case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index eda1e7275..32703e811 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -264,6 +264,8 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context, gltype = GL_UNSIGNED_INT_24_8; break; + case COGL_PIXEL_FORMAT_G_16: + case COGL_PIXEL_FORMAT_RG_1616: case COGL_PIXEL_FORMAT_ANY: case COGL_PIXEL_FORMAT_YUV: g_assert_not_reached (); diff --git a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c index bf4df399b..6abcd38dc 100644 --- a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c @@ -506,6 +506,8 @@ _cogl_texture_driver_upload_supported (CoglContext *ctx, return TRUE; else return FALSE; + case COGL_PIXEL_FORMAT_G_16: + case COGL_PIXEL_FORMAT_RG_1616: case COGL_PIXEL_FORMAT_DEPTH_16: case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: diff --git a/src/common/meta-cogl-drm-formats.h b/src/common/meta-cogl-drm-formats.h index f2918da02..efa20662a 100644 --- a/src/common/meta-cogl-drm-formats.h +++ b/src/common/meta-cogl-drm-formats.h @@ -40,7 +40,9 @@ static const CoglDrmFormatMap meta_cogl_drm_format_map[] = { /* DRM formats are defined as little-endian, not machine endian. */ #if G_BYTE_ORDER == G_LITTLE_ENDIAN { DRM_FORMAT_R8, COGL_PIXEL_FORMAT_G_8, META_MULTI_TEXTURE_FORMAT_INVALID }, + { DRM_FORMAT_R16, COGL_PIXEL_FORMAT_G_16, META_MULTI_TEXTURE_FORMAT_INVALID }, { DRM_FORMAT_GR88, COGL_PIXEL_FORMAT_RG_88, META_MULTI_TEXTURE_FORMAT_INVALID }, + { DRM_FORMAT_GR1616, COGL_PIXEL_FORMAT_RG_1616, META_MULTI_TEXTURE_FORMAT_INVALID }, { DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_XBGR_8888, META_MULTI_TEXTURE_FORMAT_SIMPLE }, { DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE },