| OpenSubdiv

Loading...
Searching...
No Matches
clPatchTable.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_CL_PATCH_TABLE_H
9#define OPENSUBDIV3_OSD_CL_PATCH_TABLE_H
10
11#include "../version.h"
12
13#include "../osd/opencl.h"
14#include "../osd/nonCopyable.h"
15#include "../osd/types.h"
16
17#include <vector>
18
19 namespace OpenSubdiv {
20 namespace OPENSUBDIV_VERSION {
21
22 namespace Far{
23 class PatchTable;
24};
25
26 namespace Osd {
27
35 class CLPatchTable : private NonCopyable<CLPatchTable> {
36 public:
38 static CLPatchTable *Create(Far::PatchTable const *patchTable,
39 cl_context clContext);
40
41 template <typename DEVICE_CONTEXT>
42 static CLPatchTable * Create(Far::PatchTable const *patchTable,
43 DEVICE_CONTEXT context) {
44 return Create(patchTable, context->GetContext());
45 }
46
48 ~CLPatchTable();
49
51 cl_mem GetPatchArrayBuffer() const { return _patchArrays; }
52
54 cl_mem GetPatchIndexBuffer() const { return _indexBuffer; }
55
57 cl_mem GetPatchParamBuffer() const { return _patchParamBuffer; }
58
60 cl_mem GetVaryingPatchArrayBuffer() const { return _varyingPatchArrays; }
61
63 cl_mem GetVaryingPatchIndexBuffer() const { return _varyingIndexBuffer; }
64
66 int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
67
69 cl_mem GetFVarPatchArrayBuffer(int fvarChannel = 0) const { return _fvarPatchArrays[fvarChannel]; }
70
72 cl_mem GetFVarPatchIndexBuffer(int fvarChannel = 0) const { return _fvarIndexBuffers[fvarChannel]; }
73
75 cl_mem GetFVarPatchParamBuffer(int fvarChannel = 0) const { return _fvarParamBuffers[fvarChannel]; }
76
77 protected:
78 CLPatchTable();
79
80 bool allocate(Far::PatchTable const *patchTable, cl_context clContext);
81
82 cl_mem _patchArrays;
83 cl_mem _indexBuffer;
84 cl_mem _patchParamBuffer;
85
86 cl_mem _varyingPatchArrays;
87 cl_mem _varyingIndexBuffer;
88
89 std::vector<cl_mem> _fvarPatchArrays;
90 std::vector<cl_mem> _fvarIndexBuffers;
91 std::vector<cl_mem> _fvarParamBuffers;
92
93};
94
95} // end namespace Osd
96
97} // end namespace OPENSUBDIV_VERSION
98 using namespace OPENSUBDIV_VERSION;
99
100} // end namespace OpenSubdiv
101
102#endif // OPENSUBDIV3_OSD_CL_PATCH_TABLE_H
opencl.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::CLPatchTable::_fvarPatchArrays
std::vector< cl_mem > _fvarPatchArrays
Definition clPatchTable.h:89
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::~CLPatchTable
~CLPatchTable()
Destructor.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::_patchParamBuffer
cl_mem _patchParamBuffer
Definition clPatchTable.h:84
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetPatchParamBuffer
cl_mem GetPatchParamBuffer() const
Returns the CL memory of the array of Osd::PatchParam buffer.
Definition clPatchTable.h:57
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::_indexBuffer
cl_mem _indexBuffer
Definition clPatchTable.h:83
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetFVarPatchArrayBuffer
cl_mem GetFVarPatchArrayBuffer(int fvarChannel=0) const
Returns the CL memory of the array of Osd::PatchArray buffer.
Definition clPatchTable.h:69
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetPatchArrayBuffer
cl_mem GetPatchArrayBuffer() const
Returns the CL memory of the array of Osd::PatchArray buffer.
Definition clPatchTable.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::Create
static CLPatchTable * Create(Far::PatchTable const *patchTable, cl_context clContext)
Creator. Returns NULL if error.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::_patchArrays
cl_mem _patchArrays
Definition clPatchTable.h:82
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetFVarPatchIndexBuffer
cl_mem GetFVarPatchIndexBuffer(int fvarChannel=0) const
Returns the CL memory of the face-varying control vertices.
Definition clPatchTable.h:72
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::_varyingIndexBuffer
cl_mem _varyingIndexBuffer
Definition clPatchTable.h:87
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetVaryingPatchIndexBuffer
cl_mem GetVaryingPatchIndexBuffer() const
Returns the CL memory of the varying control vertices.
Definition clPatchTable.h:63
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetNumFVarChannels
int GetNumFVarChannels() const
Returns the number of face-varying channel buffers.
Definition clPatchTable.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetPatchIndexBuffer
cl_mem GetPatchIndexBuffer() const
Returns the CL memory of the patch control vertices.
Definition clPatchTable.h:54
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::Create
static CLPatchTable * Create(Far::PatchTable const *patchTable, DEVICE_CONTEXT context)
Definition clPatchTable.h:42
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetFVarPatchParamBuffer
cl_mem GetFVarPatchParamBuffer(int fvarChannel=0) const
Returns the CL memory of the array of Osd::PatchParam buffer.
Definition clPatchTable.h:75
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::CLPatchTable
CLPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::allocate
bool allocate(Far::PatchTable const *patchTable, cl_context clContext)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::_fvarParamBuffers
std::vector< cl_mem > _fvarParamBuffers
Definition clPatchTable.h:91
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::_fvarIndexBuffers
std::vector< cl_mem > _fvarIndexBuffers
Definition clPatchTable.h:90
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::_varyingPatchArrays
cl_mem _varyingPatchArrays
Definition clPatchTable.h:86
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CLPatchTable::GetVaryingPatchArrayBuffer
cl_mem GetVaryingPatchArrayBuffer() const
Returns the CL memory of the array of Osd::PatchArray buffer.
Definition clPatchTable.h:60
types.h