/// <summary> /// <para>cgDestroyBuffer deletes a buffer.</para> /// <para>The buffer object is not actually destroyed until no more programs are bound to the buffer object and any pending use of the buffer has completed.</para> /// <para>However, the handle buffer no longer refers to the buffer object (although it may be subsequently allocated to a different created resource).</para> /// <para>ERROR: CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.</para> /// <para>VERSION: cgDestroyBuffer was introduced in Cg 2.0.</para> /// </summary> /// <param name="buffer">The buffer to delete.</param> public static void DestroyBuffer(CgBuffer buffer) { cgDestroyBuffer(buffer); }
/// <summary> /// <para>cgGetBufferSize returns the size in bytes of buffer.</para> /// <para>ERROR: CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.</para> /// <para>VERSION: cgGetBufferSize was introduced in Cg 2.0.</para> /// </summary> /// <param name="buffer">The buffer for which the size will be retrieved.</param> /// <returns>Returns the size in bytes of buffer. Returns -1 if an error occurs.</returns> public static int GetBufferSize(CgBuffer buffer) { return cgGetBufferSize(buffer); }
/// <summary> /// <para>cgSetProgramBuffer sets the buffer for a given buffer index of a program.</para> /// <para>A NULL buffer handle means the given buffer index should not be bound to a buffer.</para> /// <para>ERROR: CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle. CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer. CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR is generated if bufferIndex is not within the valid range of buffer indices for program.</para> /// <para>VERSION: cgSetProgramBuffer was introduced in Cg 2.0.</para> /// </summary> /// <param name="program">The program for which the buffer will be set.</param> /// <param name="bufferIndex">The buffer index of program to which buffer will be bound.</param> /// <param name="buffer">The buffer to be bound.</param> public static void SetProgramBuffer(CgProgram program, int bufferIndex, CgBuffer buffer) { cgSetProgramBuffer(program, bufferIndex, buffer); }
/// <summary> /// <para>cgUnmapBuffer unmaps a buffer from the application's address space.</para> /// <para>ERROR: CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.</para> /// <para>VERSION: cgUnmapBuffer was introduced in Cg 2.0.</para> /// </summary> /// <param name="buffer">The buffer which will be unmapped from the application's address space.</param> public static void UnmapBuffer(CgBuffer buffer) { cgUnmapBuffer(buffer); }
/// <summary> /// <para>cgSetBufferSubData resizes and partially updates an existing buffer object.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgSetBufferSubData was introduced in Cg 2.0.</para> /// </summary> /// <param name="buffer">Buffer being updated.</param> /// <param name="offset">Buffer offset in bytes of the beginning of the partial update.</param> /// <param name="size">Number of buffer bytes to be updated. Zero means no update.</param> /// <param name="data">Pointer to the start of the data being copied into the buffer.</param> public static void SetBufferSubData(CgBuffer buffer, int offset, int size, [In]IntPtr data) { cgSetBufferSubData(buffer, offset, size, data); }
/// <summary> /// <para>The cgSetEffectParameterBuffer allows the application with a single API call to set a Cg buffer to an effect parameter using the BUFFER semantic for each program in the effect that uses this effect parameter.</para> /// <para>ERROR: CG_INVALID_PARAMETER_ERROR is generated if param is not a valid parameter.</para> /// <para>VERSION: cgSetEffectParameterBuffer was introduced in Cg 3.0.</para> /// </summary> /// <param name="param">The effect parameter used by programs in the effect as a buffer parameter.</param> /// <param name="buffer">The Cg buffer being set to param for each program in the effect that uses param.</param> public static void SetEffectParameterBuffer(CgParameter param, CgBuffer buffer) { cgSetEffectParameterBuffer(param, buffer); }
/// <summary> /// <para>cgMapBuffer maps a buffer into the application's address space for memory-mapped updating of the buffer's data.</para> /// <para>The application should call cgUnmapBuffer|cgUnmapBuffer when it's done updating or querying the buffer.</para> /// <para>ERROR: CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer. CG_INVALID_ENUMERANT_ERROR is generated if access is not CG_READ_ONLY, CG_WRITE_ONLY, or CG_READ_WRITE. CG_BUFFER_ALREADY_MAPPED_ERROR is generated if buffer is already mapped.</para> /// <para>VERSION: cgMapBuffer was introduced in Cg 2.0.</para> /// </summary> /// <param name="buffer">The buffer which will be mapped into the application's address space.</param> /// <param name="access">An enumerant indicating the operations the client may perform on the data store through the pointer while the buffer data is mapped.</param> /// <returns>Returns a pointer through which the application can read or write the buffer's data store. Returns NULL if an error occurs.</returns> public static IntPtr MapBuffer(CgBuffer buffer, CgBufferAccess access) { return cgMapBuffer(buffer, access); }
/// <summary> /// <para>cgSetBufferData resizes and completely updates an existing buffer object.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgSetBufferData was introduced in Cg 2.0.</para> /// </summary> /// <param name="buffer">The buffer which will be updated.</param> /// <param name="size">Specifies a new size for the buffer object. Zero for size means use the existing size of the buffer as the effective size.</param> /// <param name="data">Pointer to the data to copy into the buffer. The number of bytes to copy is determined by the size param.</param> public static void SetBufferData(CgBuffer buffer, int size, [In]IntPtr data) { cgSetBufferData(buffer, size, data); }
private static extern void cgDestroyBuffer(CgBuffer buffer);
private static extern int cgGetBufferSize(CgBuffer buffer);
private static extern void cgUnmapBuffer(CgBuffer buffer);
private static extern void cgSetProgramBuffer(CgProgram program, int bufferIndex, CgBuffer buffer);
private static extern void cgSetEffectParameterBuffer(CgParameter param, CgBuffer buffer);
private static extern void cgSetBufferSubData(CgBuffer buffer, int offset, int size, [In] IntPtr data);
private static extern IntPtr cgMapBuffer(CgBuffer buffer, CgBufferAccess access);