From 5253264f2f76d1c5074e581f46a3326877a6930d Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 23 Sep 2015 12:11:50 +0100 Subject: [PATCH] GLES: Support glMapBufferRange from ES3 ES3 provides glMapBufferRange as core, with the added bonus that it also supports read mappings. Use this where possible. Signed-off-by: Daniel Stone https://bugzilla.gnome.org/show_bug.cgi?id=728355 --- cogl/driver/gl/gles/cogl-driver-gles.c | 11 +++++++++++ cogl/gl-prototypes/cogl-all-functions.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c index f144ba358..e94449f4a 100644 --- a/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/driver/gl/gles/cogl-driver-gles.c @@ -404,6 +404,17 @@ _cogl_driver_update_features (CoglContext *context, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, TRUE); } + if (context->glMapBufferRange) + { + /* MapBufferRange in ES3+ does support mapping for read */ + flags |= (COGL_FEATURE_MAP_BUFFER_FOR_WRITE | + COGL_FEATURE_MAP_BUFFER_FOR_READ); + COGL_FLAGS_SET(context->features, + COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, TRUE); + COGL_FLAGS_SET(context->features, + COGL_FEATURE_ID_MAP_BUFFER_FOR_READ, TRUE); + } + if (context->glEGLImageTargetTexture2D) COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, TRUE); diff --git a/cogl/gl-prototypes/cogl-all-functions.h b/cogl/gl-prototypes/cogl-all-functions.h index dda08f762..7ac9022b7 100644 --- a/cogl/gl-prototypes/cogl-all-functions.h +++ b/cogl/gl-prototypes/cogl-all-functions.h @@ -295,7 +295,7 @@ COGL_EXT_FUNCTION (void, glGenVertexArrays, COGL_EXT_END () COGL_EXT_BEGIN (map_region, 3, 0, - 0, /* not in either GLES */ + COGL_EXT_IN_GLES3, "ARB:\0", "map_buffer_range\0") COGL_EXT_FUNCTION (GLvoid *, glMapBufferRange,