summaryrefslogtreecommitdiff
path: root/cogl/cogl-driver.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-10-17 21:28:45 +0100
committerRobert Bragg <robert@linux.intel.com>2013-01-22 17:48:03 +0000
commitec03357e8813abec40f29292a0166f5478dd59ba (patch)
tree72233816a4b0361579d2b4952800f92cf83a8110 /cogl/cogl-driver.h
parent8a3fb7a10d7d04f5a3d74c593274c8f3dcabf4d4 (diff)
downloadcogl-ec03357e8813abec40f29292a0166f5478dd59ba.tar.gz
Add cogl_buffer_map_range()
This adds a buffer method to map a subregion of the buffer. This works using the GL_ARB_map_buffer_range extension. If the extension is not available then it will fallback to using glMapBuffer to map the entire buffer and then just add the offset to the returned pointer. cogl_buffer_map() is now just a wrapper which maps the entire range of the buffer. The driver backend functions have been renamed to map_range and they now all take the offset and size arguments. When the COGL_BUFFER_MAP_HINT_DISCARD hint is used and the map range extension is available instead of using glBufferData to invalidate the buffer it will instead pass the new GL_MAP_HINT_INVALIDATE_BUFFER flag. There is now additionally a COGL_BUFFER_MAP_HINT_DISCARD_REGION hint which can be used if the application only wants to discard the small region that is mapped. glMapBufferRange is always used if it is available even if the entire buffer is being mapped because it seems more robust to pass those flags then to call glBufferData. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 55ca02b5ca9cafc750251ec974e0d6a536cb80b8)
Diffstat (limited to 'cogl/cogl-driver.h')
-rw-r--r--cogl/cogl-driver.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/cogl/cogl-driver.h b/cogl/cogl-driver.h
index f9221110..36f4c7ad 100644
--- a/cogl/cogl-driver.h
+++ b/cogl/cogl-driver.h
@@ -240,9 +240,11 @@ struct _CoglDriverVtable
/* Maps a buffer into the CPU */
void *
- (* buffer_map) (CoglBuffer *buffer,
- CoglBufferAccess access,
- CoglBufferMapHint hints);
+ (* buffer_map_range) (CoglBuffer *buffer,
+ size_t offset,
+ size_t size,
+ CoglBufferAccess access,
+ CoglBufferMapHint hints);
/* Unmaps a buffer */
void