From 2fc8841416e73cb7ee01975f6b82307a6ec35d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 19 Sep 2019 21:32:04 +0200 Subject: [PATCH] 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 --- cogl/cogl/cogl-private.h | 2 ++ cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 8 ++++++++ cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h index 91569b4ec..769510289 100644 --- a/cogl/cogl/cogl-private.h +++ b/cogl/cogl/cogl-private.h @@ -46,6 +46,8 @@ typedef enum COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL, COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL, 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_SAMPLER_OBJECTS, COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT, diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index 3c2231ebc..320005355 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -506,6 +506,14 @@ _cogl_driver_update_features (CoglContext *ctx, COGL_FEATURE_ID_TEXTURE_RG, 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 */ for (i = 0; i < G_N_ELEMENTS (private_features); i++) ctx->private_features[i] |= private_features[i]; diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index 3cb11af69..4c69bf56e 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -355,6 +355,14 @@ _cogl_driver_update_features (CoglContext *context, COGL_FLAGS_SET (private_features, 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)) COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, TRUE);