public static void* map_range (Buffer buffer, ulong offset, ulong size, BufferAccess access, BufferMapHint hints) throws Error

Maps a sub-region of the buffer into the application's address space for direct access.

It is strongly recommended that you pass cogl_buffer_map_hint_discard as a hint if you are going to replace all the buffer's data. This way if the buffer is currently being used by the GPU then the driver won't have to stall the CPU and wait for the hardware to finish because it can instead allocate a new buffer to map. You can pass cogl_buffer_map_hint_discard_range instead if you want the regions outside of the mapping to be retained.

The behaviour is undefined if you access the buffer in a way conflicting with the access mask you pass. It is also an error to release your last reference while the buffer is mapped.



a buffer object


Offset within the buffer to start the mapping


The size of data to map


how the mapped buffer will be used by the application


A mask of BufferMapHint<!-- -->s that tell Cogl how the data will be modified once mapped.


A pointer to the mapped memory or null is the call fails