From f60c485117dabb859ed5bf25cc8a4070ab9b69b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 5 May 2020 17:05:36 +0200 Subject: [PATCH] cogl: Make private BLIT_FRAMEBUFFER feature public Will be a requirement for enabling shadow buffers. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237 --- cogl/cogl/cogl-blit.c | 2 +- cogl/cogl/cogl-context.h | 3 +++ cogl/cogl/cogl-framebuffer.c | 2 +- cogl/cogl/cogl-framebuffer.h | 2 +- cogl/cogl/cogl-private.h | 1 - cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 4 ++-- cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 4 ++-- cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 4 ++-- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cogl/cogl/cogl-blit.c b/cogl/cogl/cogl-blit.c index 0946f26d0..3ddc3eba2 100644 --- a/cogl/cogl/cogl-blit.c +++ b/cogl/cogl/cogl-blit.c @@ -158,7 +158,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data) supported. */ if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) != (_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) || - !_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER)) + !cogl_has_feature (ctx, COGL_FEATURE_ID_BLIT_FRAMEBUFFER)) return FALSE; dst_offscreen = _cogl_offscreen_new_with_texture_full diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h index ed0923d0f..2807f2a5a 100644 --- a/cogl/cogl/cogl-context.h +++ b/cogl/cogl/cogl-context.h @@ -193,6 +193,8 @@ cogl_is_context (void *object); * expected to return age values other than 0. * @COGL_FEATURE_ID_PRESENTATION_TIME: Whether frame presentation * time stamps will be recorded in #CoglFrameInfo objects. + * @COGL_FEATURE_ID_BLIT_FRAMEBUFFER: Whether blitting using + * cogl_blit_framebuffer() is supported. * * All the capabilities that can vary between different GPUs supported * by Cogl. Applications that depend on any of these features should explicitly @@ -211,6 +213,7 @@ typedef enum _CoglFeatureID COGL_FEATURE_ID_TEXTURE_RG, COGL_FEATURE_ID_BUFFER_AGE, COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL, + COGL_FEATURE_ID_BLIT_FRAMEBUFFER, /*< private >*/ _COGL_N_FEATURE_IDS /*< skip >*/ diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index 6edb7f042..a79a46756 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -1292,7 +1292,7 @@ cogl_blit_framebuffer (CoglFramebuffer *src, int src_x1, src_y1, src_x2, src_y2; int dst_x1, dst_y1, dst_x2, dst_y2; - if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER)) + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_BLIT_FRAMEBUFFER)) { g_set_error_literal (error, COGL_SYSTEM_ERROR, COGL_SYSTEM_ERROR_UNSUPPORTED, diff --git a/cogl/cogl/cogl-framebuffer.h b/cogl/cogl/cogl-framebuffer.h index a4bbcf7e4..77c678384 100644 --- a/cogl/cogl/cogl-framebuffer.h +++ b/cogl/cogl/cogl-framebuffer.h @@ -1509,7 +1509,7 @@ cogl_is_framebuffer (void *object); * * This blits a region of the color buffer of the source buffer * to the destination buffer. This function should only be - * called if the COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER feature is + * called if the COGL_FEATURE_ID_BLIT_FRAMEBUFFER feature is * advertised. * * The source and destination rectangles are defined in offscreen diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h index 76829d454..91569b4ec 100644 --- a/cogl/cogl/cogl-private.h +++ b/cogl/cogl/cogl-private.h @@ -42,7 +42,6 @@ typedef enum { COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, COGL_PRIVATE_FEATURE_MESA_PACK_INVERT, - COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, COGL_PRIVATE_FEATURE_PBOS, COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL, COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL, diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index e4d215ea2..68e2e44e1 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -388,8 +388,8 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer, { /* NB: Currently we only take advantage of binding separate * read/write buffers for framebuffer blit purposes. */ - g_return_if_fail (_cogl_has_private_feature - (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER)); + g_return_if_fail (cogl_has_feature + (ctx, COGL_FEATURE_ID_BLIT_FRAMEBUFFER)); _cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER); _cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER); diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index bb780cec5..220c581e9 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -455,8 +455,8 @@ _cogl_driver_update_features (CoglContext *ctx, TRUE); if (ctx->glBlitFramebuffer) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_BLIT_FRAMEBUFFER, TRUE); COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_PBOS, TRUE); diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index ca98823e8..daaaec44f 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -318,8 +318,8 @@ _cogl_driver_update_features (CoglContext *context, COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, TRUE); if (context->glBlitFramebuffer) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_BLIT_FRAMEBUFFER, TRUE); if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions)) {