OpenSubdiv
Loading...
Searching...
No Matches
cudaVertexBuffer.h
Go to the documentation of this file.
1//
2// Copyright 2013 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://opensubdiv.org/license.
6//
7
8#ifndef OPENSUBDIV3_OSD_CUDA_VERTEX_BUFFER_H
9#define OPENSUBDIV3_OSD_CUDA_VERTEX_BUFFER_H
10
11#include "../version.h"
12
13#include <cstddef>
14
15namespace OpenSubdiv {
16namespace OPENSUBDIV_VERSION {
17
18namespace Osd {
19
26
27public:
29 static CudaVertexBuffer * Create(int numElements, int numVertices,
30 void *deviceContext = NULL);
31
34
37 void UpdateData(const float *src, int startVertex, int numVertices,
38 void *deviceContext=NULL);
39
41 int GetNumElements() const;
42
44 int GetNumVertices() const;
45
47 float * BindCudaBuffer();
48
49protected:
51 CudaVertexBuffer(int numElements, int numVertices);
52
55 bool allocate();
56
57private:
58 int _numElements;
59 int _numVertices;
60 void *_cudaMem;
61
62};
63
64} // end namespace Osd
65
66} // end namespace OPENSUBDIV_VERSION
67using namespace OPENSUBDIV_VERSION;
68
69} // end namespace OpenSubdiv
70
71#endif // OPENSUBDIV3_OSD_CUDA_VERTEX_BUFFER_H
Concrete vertex buffer class for Cuda subdivision.
int GetNumElements() const
Returns how many elements defined in this vertex buffer.
void UpdateData(const float *src, int startVertex, int numVertices, void *deviceContext=NULL)
int GetNumVertices() const
Returns how many vertices allocated in this vertex buffer.
static CudaVertexBuffer * Create(int numElements, int numVertices, void *deviceContext=NULL)
Creator. Returns NULL if error.
CudaVertexBuffer(int numElements, int numVertices)
Constructor.