My Project: opensubdiv/osd/mtlLegacyGregoryPatchTable.h Source File

| My Project

mtlLegacyGregoryPatchTable.h
Go to the documentation of this file.
1 //
2 // Copyright 2013 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24
25 #ifndef OPENSUBDIV3_OSD_MTL_LEGACY_GREGORY_PATCH_TABLE_H
26 #define OPENSUBDIV3_OSD_MTL_LEGACY_GREGORY_PATCH_TABLE_H
27
28 #include "../version.h"
29 #include "../far/patchTable.h"
30 #include "../osd/nonCopyable.h"
31 #include "../osd/mtlCommon.h"
32
33 @protocol MTLDevice;
34 @protocol MTLBuffer;
35
36 namespace OpenSubdiv {
37 namespace OPENSUBDIV_VERSION {
38
39 namespace Osd {
40
41 class MTLLegacyGregoryPatchTable
42 : private NonCopyable<MTLLegacyGregoryPatchTable>
43 {
44 public:
45 ~MTLLegacyGregoryPatchTable();
46
47 template<typename DEVICE_CONTEXT>
48 static MTLLegacyGregoryPatchTable* Create(Far::PatchTable const* farPatchTable, DEVICE_CONTEXT context) {
49 return Create(farPatchTable, context);
50 }
51
52 static MTLLegacyGregoryPatchTable* Create(Far::PatchTable const* farPatchTable, MTLContext* context);
53
54 void UpdateVertexBuffer(id<MTLBuffer> vbo, int numVertices, int numVertexElements, MTLContext* context);
55
56 id<MTLBuffer> GetVertexBuffer() const
57 {
58 return _vertexBuffer;
59 }
60
61 id<MTLBuffer> GetVertexValenceBuffer() const
62 {
63 return _vertexValenceBuffer;
64 }
65
66 id<MTLBuffer> GetQuadOffsetsBuffer() const
67 {
68 return _quadOffsetsBuffer;
69 }
70
71 int GetQuadOffsetsBase(Far::PatchDescriptor::Type type)
72 {
73 if(type == Far::PatchDescriptor::GREGORY_BOUNDARY)
74 return _quadOffsetsBase[1];
75 return _quadOffsetsBase[0];
76 }
77
78 private:
79 id<MTLBuffer> _vertexBuffer;
80 id<MTLBuffer> _vertexValenceBuffer;
81 id<MTLBuffer> _quadOffsetsBuffer;
82 int _quadOffsetsBase[2];
83 };
84
85 } //end namespace Osd
86
87 } //end namespace OPENSUBDIV_VERSION
88 using namespace OPENSUBDIV_VERSION;
89
90 } //end namespace OpenSuddiv
91
92 #endif // OPENSUBDIV3_OSD_MTL_LEGACY_GREGORY_PATCH_TABLE_H
OpenSubdiv
Definition: error.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetVertexBuffer
id< MTLBuffer > GetVertexBuffer() const
Definition: mtlLegacyGregoryPatchTable.h:56
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::~MTLLegacyGregoryPatchTable
~MTLLegacyGregoryPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::Create
static MTLLegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context)
Definition: mtlLegacyGregoryPatchTable.h:48
OpenSubdiv::OPENSUBDIV_VERSION::Osd::NonCopyable< MTLLegacyGregoryPatchTable >
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchDescriptor::GREGORY_BOUNDARY
@ GREGORY_BOUNDARY
Definition: patchDescriptor.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::UpdateVertexBuffer
void UpdateVertexBuffer(id< MTLBuffer > vbo, int numVertices, int numVertexElements, MTLContext *context)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetVertexValenceBuffer
id< MTLBuffer > GetVertexValenceBuffer() const
Definition: mtlLegacyGregoryPatchTable.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetQuadOffsetsBase
int GetQuadOffsetsBase(Far::PatchDescriptor::Type type)
Definition: mtlLegacyGregoryPatchTable.h:71
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::Create
static MTLLegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, MTLContext *context)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetQuadOffsetsBuffer
id< MTLBuffer > GetQuadOffsetsBuffer() const
Definition: mtlLegacyGregoryPatchTable.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition: patchTable.h:55
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable
Definition: mtlLegacyGregoryPatchTable.h:43
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLContext
Definition: mtlCommon.h:40
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchDescriptor::Type
Type
Definition: patchDescriptor.h:48