Cg Core Runtime API cgMapBuffer(3)
NAME
cgapBuffer - map buffer into application's address space
SYNOPSIS
#include
void * cgMapBuffer( CGbuffer buffer,
CGbufferaccess access );
PARAMETERS
buffer The buffer which will be mapped into the
application's address space.
access An enumerant indicating the operations the client
may perform on the data store through the pointer
while the buffer data is mapped.
The following enumerants are allowed:
CGMAPREAD
The application can read but not write through
the data pointer.
CGMAPWRITE
The application can write but not read through
the data pointer.
CGMAPREADWRITE
The application can read and write through the
data pointer.
CGMAPWRITEDISCARD
Same as CGMAPREADWRITE if using a GL buffer.
CGMAPWRITENOVERWRITE
Same as CGMAPREADWRITE if using a GL buffer.
RETURN VALUES
Returns a pointer through which the application can read or
write the buffer's data store.
Returns NUL if an error occurs.
DESCRIPTION
cgapBuffer maps a buffer into the application's address
space for memory-mapped updating of the buffer's data. The
application should call cgUnmapBuffercgUnmapBuffer when
it's done updating or querying the buffer.
EXAMPLES
Cg Toolkit 2.1 Last change: 1
Cg Core Runtime API cgMapBuffer(3)
unsigned char *bufferPtr = cgMapBuffer( myBuffer, CGMAPREADWRITE );
memcpy( ptr, bufferPtr, size );
cgUnmapBuffer( myBuffer );
ERORS
CGINVALIDBUFERHANDLEROR is generated if buffer is not
a valid buffer.
CGINVALIDENUMERANTEROR is generated if access is not
CGREADONLY, CGWRITEONLY, or CGREADWRITE.
CGBUFERALREADYMAPEDEROR is generated if buffer is
already mapped.
HISTORY
cgapBuffer was introduced in Cg 2.0.
SEE ALSO
cgUnmapBuffer, cgSetBufferData, cgSetBufferSubData,
cgSetParameter
Cg Toolkit 2.1 Last change: 2
|