25 #ifndef OPENSUBDIV3_OSD_CL_VERTEX_BUFFER_H
26 #define OPENSUBDIV3_OSD_CL_VERTEX_BUFFER_H
28 #include "../version.h"
29 #include "../osd/opencl.h"
31 namespace OpenSubdiv {
32 namespace OPENSUBDIV_VERSION {
48 template <
typename DEVICE_CONTEXT>
50 DEVICE_CONTEXT context) {
51 return Create(numElements, numVertices, context->GetContext());
59 void UpdateData(
const float *src,
int startVertex,
int numVertices, cl_command_queue clQueue,
60 cl_event* startEvents = NULL,
unsigned int numStartEvents = 0, cl_event* endEvent = NULL);
62 template<
typename DEVICE_CONTEXT>
63 void UpdateData(
const float *src,
int startVertex,
int numVertices,
64 DEVICE_CONTEXT context,
65 cl_event* startEvents = NULL,
unsigned int numStartEvents = 0, cl_event* endEvent = NULL) {
66 UpdateData(src, startVertex, numVertices, context->GetCommandQueue(), startEvents, numStartEvents, endEvent);
80 CLVertexBuffer(
int numElements,
int numVertices, cl_context clContext);
95 using namespace OPENSUBDIV_VERSION;
99 #endif // OPENSUBDIV3_OSD_CL_VERTEX_BUFFER_H
bool allocate(cl_context clContext)
int GetNumElements() const
Returns how many elements defined in this vertex buffer.
~CLVertexBuffer()
Destructor.
Concrete vertex buffer class for OpenCL subdivision.
cl_mem BindCLBuffer(cl_command_queue queue)
Returns the CL memory object.
CLVertexBuffer(int numElements, int numVertices, cl_context clContext)
Constructor.
void UpdateData(const float *src, int startVertex, int numVertices, cl_command_queue clQueue, cl_event *startEvents=NULL, unsigned int numStartEvents=0, cl_event *endEvent=NULL)
int GetNumVertices() const
Returns how many vertices allocated in this vertex buffer.
void UpdateData(const float *src, int startVertex, int numVertices, DEVICE_CONTEXT context, cl_event *startEvents=NULL, unsigned int numStartEvents=0, cl_event *endEvent=NULL)
static CLVertexBuffer * Create(int numElements, int numVertices, DEVICE_CONTEXT context)
static CLVertexBuffer * Create(int numElements, int numVertices, cl_context clContext)
Creator. Returns NULL if error.