summaryrefslogtreecommitdiff
path: root/cogl/cogl-context.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-01-13 15:35:30 +0000
committerNeil Roberts <neil@linux.intel.com>2011-01-13 16:36:32 +0000
commita8216aff2f3daa56225aec56ff27317af6d0eba8 (patch)
tree951638e1906b56dc220f0807c02b9c2ed26f0e3e /cogl/cogl-context.h
parentac81f3b936b7efb287d4c81973f5fd84166f52d5 (diff)
downloadcogl-a8216aff2f3daa56225aec56ff27317af6d0eba8.tar.gz
cogl: Fallback to set_data when mapping a buffer to fill it
In the journal code and when generating the stroke path the vertices are generated on the fly and stored in a CoglBuffer using cogl_buffer_map. However cogl_buffer_map is allowed to fail but it wasn't checking for a NULL return value. In particular on GLES it will always fail because glMapBuffer is only provided by an extension. This adds a new pair of internal functions called _cogl_buffer_{un,}map_for_fill_or_fallback which wrap cogl_buffer_map. If the map fails then it will instead return a pointer into a GByteArray attached to the context. When the buffer is unmapped the array is copied into the buffer using cogl_buffer_set_data.
Diffstat (limited to 'cogl/cogl-context.h')
-rw-r--r--cogl/cogl-context.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h
index 1d55923d..31f129fc 100644
--- a/cogl/cogl-context.h
+++ b/cogl/cogl-context.h
@@ -229,6 +229,12 @@ typedef struct
stencil buffer */
gboolean current_clip_stack_uses_stencil;
+ /* This is used as a temporary buffer to fill a CoglBuffer when
+ cogl_buffer_map fails and we only want to map to fill it with new
+ data */
+ GByteArray *buffer_map_fallback_array;
+ gboolean buffer_map_fallback_in_use;
+
CoglContextDriver drv;
CoglContextWinsys winsys;
} CoglContext;