map


Description:

public static void* map (Buffer buffer, BufferAccess access, BufferMapHint hints)

Maps the buffer into the application address space for direct access.

This is equivalent to calling map_range with zero as the offset and the size of the entire buffer as the size.

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.

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.

Parameters:

buffer

a buffer object

access

how the mapped buffer will be used by the application

hints

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

Returns:

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