OpenSubdiv
Loading...
Searching...
No Matches
mtlLegacyGregoryPatchTable.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_MTL_LEGACY_GREGORY_PATCH_TABLE_H
9#define OPENSUBDIV3_OSD_MTL_LEGACY_GREGORY_PATCH_TABLE_H
10
11#include "../version.h"
12#include "../far/patchTable.h"
13#include "../osd/nonCopyable.h"
14#include "../osd/mtlCommon.h"
15
16@protocol MTLDevice;
17@protocol MTLBuffer;
18
19namespace OpenSubdiv {
20namespace OPENSUBDIV_VERSION {
21
22namespace Osd {
23
25: private NonCopyable<MTLLegacyGregoryPatchTable>
26{
27public:
29
30 template<typename DEVICE_CONTEXT>
31 static MTLLegacyGregoryPatchTable* Create(Far::PatchTable const* farPatchTable, DEVICE_CONTEXT context) {
32 return Create(farPatchTable, context);
33 }
34
35 static MTLLegacyGregoryPatchTable* Create(Far::PatchTable const* farPatchTable, MTLContext* context);
36
37 void UpdateVertexBuffer(id<MTLBuffer> vbo, int numVertices, int numVertexElements, MTLContext* context);
38
39 id<MTLBuffer> GetVertexBuffer() const
40 {
41 return _vertexBuffer;
42 }
43
44 id<MTLBuffer> GetVertexValenceBuffer() const
45 {
46 return _vertexValenceBuffer;
47 }
48
49 id<MTLBuffer> GetQuadOffsetsBuffer() const
50 {
51 return _quadOffsetsBuffer;
52 }
53
55 {
57 return _quadOffsetsBase[1];
58 return _quadOffsetsBase[0];
59 }
60
61private:
62 id<MTLBuffer> _vertexBuffer;
63 id<MTLBuffer> _vertexValenceBuffer;
64 id<MTLBuffer> _quadOffsetsBuffer;
65 int _quadOffsetsBase[2];
66};
67
68} //end namespace Osd
69
70} //end namespace OPENSUBDIV_VERSION
71using namespace OPENSUBDIV_VERSION;
72
73} //end namespace OpenSuddiv
74
75#endif // OPENSUBDIV3_OSD_MTL_LEGACY_GREGORY_PATCH_TABLE_H
Container for arrays of parametric patches.
Definition patchTable.h:38
static MTLLegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context)
static MTLLegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, MTLContext *context)
void UpdateVertexBuffer(id< MTLBuffer > vbo, int numVertices, int numVertexElements, MTLContext *context)