cogl: Add private feature flags for 10 bpc and 16 bpc formats

10 bpc are enabled for OpenGL and GLES 2 with the right extension. 16
bpc (half float) are enabled for OpenGL 3 and higher, and GLES 2 with
the right extension.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
This commit is contained in:
Jonas Ådahl 2019-09-19 21:32:04 +02:00 committed by Robert Mader
parent 598f536c51
commit 2fc8841416
3 changed files with 18 additions and 0 deletions

View File

@ -46,6 +46,8 @@ typedef enum
COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL, COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL,
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL, COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT,
COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE,
COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS,
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT, COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT,

View File

@ -506,6 +506,14 @@ _cogl_driver_update_features (CoglContext *ctx,
COGL_FEATURE_ID_TEXTURE_RG, COGL_FEATURE_ID_TEXTURE_RG,
TRUE); TRUE);
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102, TRUE);
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 3, 0))
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT,
TRUE);
/* Cache features */ /* Cache features */
for (i = 0; i < G_N_ELEMENTS (private_features); i++) for (i = 0; i < G_N_ELEMENTS (private_features); i++)
ctx->private_features[i] |= private_features[i]; ctx->private_features[i] |= private_features[i];

View File

@ -355,6 +355,14 @@ _cogl_driver_update_features (CoglContext *context,
COGL_FLAGS_SET (private_features, COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888, TRUE); COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888, TRUE);
if (_cogl_check_extension ("GL_EXT_texture_type_2_10_10_10_REV", gl_extensions))
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102, TRUE);
if (_cogl_check_extension ("GL_OES_texture_half_float", gl_extensions))
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT, TRUE);
if (_cogl_check_extension ("GL_EXT_unpack_subimage", gl_extensions)) if (_cogl_check_extension ("GL_EXT_unpack_subimage", gl_extensions))
COGL_FLAGS_SET (private_features, COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, TRUE); COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, TRUE);