OpenSubdiv
Loading...
Searching...
No Matches
cudaPatchTable.h
Go to the documentation of this file.
1//
2// Copyright 2015 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_PATCH_TABLE_H
9#define OPENSUBDIV3_OSD_CUDA_PATCH_TABLE_H
10
11#include "../version.h"
12
13#include "../osd/nonCopyable.h"
14#include "../osd/types.h"
15
16#include <vector>
17
18namespace OpenSubdiv {
19namespace OPENSUBDIV_VERSION {
20
21namespace Far{
22 class PatchTable;
23};
24
25namespace Osd {
26
34class CudaPatchTable : private NonCopyable<CudaPatchTable> {
35public:
37 static CudaPatchTable *Create(Far::PatchTable const *patchTable,
38 void *deviceContext = NULL);
41
43 void *GetPatchArrayBuffer() const { return _patchArrays; }
44
46 void *GetPatchIndexBuffer() const { return _indexBuffer; }
47
49 void *GetPatchParamBuffer() const { return _patchParamBuffer; }
50
54 }
58 }
59
61 int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
62
64 void *GetFVarPatchArrayBuffer(int fvarChannel) const {
65 return _fvarPatchArrays[fvarChannel];
66 }
67
69 void *GetFVarPatchIndexBuffer(int fvarChannel = 0) const {
70 return _fvarIndexBuffers[fvarChannel];
71 }
72
74 void *GetFVarPatchParamBuffer(int fvarChannel = 0) const {
75 return _fvarParamBuffers[fvarChannel];
76 }
77
78protected:
80
81 bool allocate(Far::PatchTable const *patchTable);
82
86
89
90 std::vector<void *> _fvarPatchArrays;
91 std::vector<void *> _fvarIndexBuffers;
92 std::vector<void *> _fvarParamBuffers;
93};
94
95} // end namespace Osd
96
97} // end namespace OPENSUBDIV_VERSION
98using namespace OPENSUBDIV_VERSION;
99
100} // end namespace OpenSubdiv
101
102#endif // OPENSUBDIV3_OSD_CUDA_PATCH_TABLE_H
Container for arrays of parametric patches.
Definition patchTable.h:38
void * GetFVarPatchArrayBuffer(int fvarChannel) const
Returns the cuda memory of the array of Osd::PatchArray buffer.
static CudaPatchTable * Create(Far::PatchTable const *patchTable, void *deviceContext=NULL)
Creator. Returns NULL if error.
void * GetVaryingPatchIndexBuffer() const
Returns the cuda memory of the array of varying control vertices.
void * GetVaryingPatchArrayBuffer() const
Returns the cuda memory of the array of Osd::PatchArray buffer.
void * GetPatchArrayBuffer() const
Returns the cuda memory of the array of Osd::PatchArray buffer.
bool allocate(Far::PatchTable const *patchTable)
void * GetPatchIndexBuffer() const
Returns the cuda memory of the patch control vertices.
int GetNumFVarChannels() const
Returns the number of face-varying channels buffers.
void * GetPatchParamBuffer() const
Returns the cuda memory of the array of Osd::PatchParam buffer.
void * GetFVarPatchIndexBuffer(int fvarChannel=0) const
Returns the cuda memory of the array of face-varying control vertices.
void * GetFVarPatchParamBuffer(int fvarChannel=0) const
Returns the cuda memory of the array of face-varying param.