OpenSubdiv: opensubdiv/osd/cudaPatchTable.h Source File

| 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
34 class CudaPatchTable : private NonCopyable<CudaPatchTable> {
35public:
37 static CudaPatchTable *Create(Far::PatchTable const *patchTable,
38 void *deviceContext = NULL);
40 ~CudaPatchTable();
41
43 void *GetPatchArrayBuffer() const { return _patchArrays; }
44
46 void *GetPatchIndexBuffer() const { return _indexBuffer; }
47
49 void *GetPatchParamBuffer() const { return _patchParamBuffer; }
50
52 void *GetVaryingPatchArrayBuffer() const {
53 return _varyingPatchArrays;
54 }
55
56 void *GetVaryingPatchIndexBuffer() const {
57 return _varyingIndexBuffer;
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:
79 CudaPatchTable();
80
81 bool allocate(Far::PatchTable const *patchTable);
82
83 void *_patchArrays;
84 void *_indexBuffer;
85 void *_patchParamBuffer;
86
87 void *_varyingPatchArrays;
88 void *_varyingIndexBuffer;
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
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Far
Definition refinerSurfaceFactory.h:19
OpenSubdiv::OPENSUBDIV_VERSION::Osd
Definition bufferDescriptor.h:17
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition patchTable.h:38
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetFVarPatchArrayBuffer
void * GetFVarPatchArrayBuffer(int fvarChannel) const
Returns the cuda memory of the array of Osd::PatchArray buffer.
Definition cudaPatchTable.h:64
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_fvarParamBuffers
std::vector< void * > _fvarParamBuffers
Definition cudaPatchTable.h:92
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::Create
static CudaPatchTable * Create(Far::PatchTable const *patchTable, void *deviceContext=NULL)
Creator. Returns NULL if error.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_varyingPatchArrays
void * _varyingPatchArrays
Definition cudaPatchTable.h:87
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetVaryingPatchIndexBuffer
void * GetVaryingPatchIndexBuffer() const
Returns the cuda memory of the array of varying control vertices.
Definition cudaPatchTable.h:56
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_fvarIndexBuffers
std::vector< void * > _fvarIndexBuffers
Definition cudaPatchTable.h:91
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetVaryingPatchArrayBuffer
void * GetVaryingPatchArrayBuffer() const
Returns the cuda memory of the array of Osd::PatchArray buffer.
Definition cudaPatchTable.h:52
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_varyingIndexBuffer
void * _varyingIndexBuffer
Definition cudaPatchTable.h:88
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::~CudaPatchTable
~CudaPatchTable()
Destructor.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetPatchArrayBuffer
void * GetPatchArrayBuffer() const
Returns the cuda memory of the array of Osd::PatchArray buffer.
Definition cudaPatchTable.h:43
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_fvarPatchArrays
std::vector< void * > _fvarPatchArrays
Definition cudaPatchTable.h:90
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::allocate
bool allocate(Far::PatchTable const *patchTable)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetPatchIndexBuffer
void * GetPatchIndexBuffer() const
Returns the cuda memory of the patch control vertices.
Definition cudaPatchTable.h:46
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetNumFVarChannels
int GetNumFVarChannels() const
Returns the number of face-varying channels buffers.
Definition cudaPatchTable.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_patchArrays
void * _patchArrays
Definition cudaPatchTable.h:83
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetPatchParamBuffer
void * GetPatchParamBuffer() const
Returns the cuda memory of the array of Osd::PatchParam buffer.
Definition cudaPatchTable.h:49
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetFVarPatchIndexBuffer
void * GetFVarPatchIndexBuffer(int fvarChannel=0) const
Returns the cuda memory of the array of face-varying control vertices.
Definition cudaPatchTable.h:69
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetFVarPatchParamBuffer
void * GetFVarPatchParamBuffer(int fvarChannel=0) const
Returns the cuda memory of the array of face-varying param.
Definition cudaPatchTable.h:74
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::CudaPatchTable
CudaPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_patchParamBuffer
void * _patchParamBuffer
Definition cudaPatchTable.h:85
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_indexBuffer
void * _indexBuffer
Definition cudaPatchTable.h:84
types.h