25 #ifndef OPENSUBDIV3_OSD_MTL_PATCH_TABLE_H
26 #define OPENSUBDIV3_OSD_MTL_PATCH_TABLE_H
28 #include "../version.h"
29 #include "../far/patchDescriptor.h"
30 #include "../osd/nonCopyable.h"
31 #include "../osd/types.h"
32 #include "../osd/mtlCommon.h"
37 namespace OpenSubdiv {
38 namespace OPENSUBDIV_VERSION {
46 class MTLPatchTable :
private NonCopyable<MTLPatchTable> {
48 typedef id<MTLBuffer> VertexBufferBinding;
53 template<
typename DEVICE_CONTEXT>
54 static MTLPatchTable *Create(Far::PatchTable
const *farPatchTable, DEVICE_CONTEXT context)
56 return Create(farPatchTable, context);
59 static MTLPatchTable *Create(Far::PatchTable
const *farPatchTable, MTLContext* context);
62 id<MTLBuffer> GetPatchIndexBuffer()
const {
return _indexBuffer; }
63 id<MTLBuffer> GetPatchParamBuffer()
const {
return _patchParamBuffer; }
65 PatchArrayVector const &GetVaryingPatchArrays()
const {
return _varyingPatchArrays; }
66 id<MTLBuffer> GetVaryingPatchIndexBuffer()
const {
return _varyingPatchIndexBuffer; }
68 int GetNumFVarChannels()
const {
return (
int)_fvarPatchArrays.size(); }
69 PatchArrayVector const &GetFVarPatchArrays(
int fvarChannel = 0)
const {
return _fvarPatchArrays[fvarChannel]; }
70 id<MTLBuffer> GetFVarPatchIndexBuffer(
int fvarChannel = 0)
const {
return _fvarIndexBuffers[fvarChannel]; }
71 id<MTLBuffer> GetFVarPatchParamBuffer(
int fvarChannel = 0)
const {
return _fvarParamBuffers[fvarChannel]; }
74 bool allocate(Far::PatchTable
const *farPatchTable, MTLContext* context);
78 id<MTLBuffer> _indexBuffer;
79 id<MTLBuffer> _patchParamBuffer;
83 id<MTLBuffer> _varyingPatchIndexBuffer;
85 std::vector<PatchArrayVector> _fvarPatchArrays;
86 std::vector<id<MTLBuffer>> _fvarIndexBuffers;
87 std::vector<id<MTLBuffer>> _fvarParamBuffers;
93 using namespace OPENSUBDIV_VERSION;
97 #endif //end OPENSUBDIV3_OSD_MTL_PATCH_TABLE_H
std::vector< PatchArray > PatchArrayVector