cgSetBufferSubData
Keywords: cgSetBufferSubData, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgSetBufferSubData - partially update a Cg buffer object

> ## Synopsis

>     #include <Cg/cg.h>

>     void cgSetBufferSubData( CGbuffer buffer,
>                              int offset,
>                              int size,
>                              const void * data );

> ## Parameters

> buffer
>   Buffer being updated.
> offset
>   Buffer offset in bytes of the beginning of the partial update.
> size
>   Number of buffer bytes to be updated. Zero means no update.
> data
>   Pointer to the start of the data being copied into the buffer.

> ## Return Values

> None.

> ## Description

> cgSetBufferSubData resizes and partially updates an existing buffer object.

> A buffer which has been mapped into an applications address space with cgMapBuffer must be unmapped using cgUnmapBuffer before it can be updated with cgSetBufferSubData.

> ## Examples

> cgSetBufferSubData( myBuffer, 16, sizeof( myData ), myData );

> ## Errors

> CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.

> CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR is generated if buffer is currently mapped.

> CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR is generated if offset or size is out of range.

> ## History

> cgSetBufferSubData was introduced in Cg 2.0.

> ## See Also

> cgCreateBuffer, cgGLCreateBuffer, cgSetBufferData, cgMapBuffer, cgUnmapBuffer