OpenSubdiv
Loading...
Searching...
No Matches
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
36namespace OpenSubdiv {
37namespace OPENSUBDIV_VERSION {
38
39namespace Osd {
40
42: private NonCopyable<MTLLegacyGregoryPatchTable>
43{
44public:
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
72 {
74 return _quadOffsetsBase[1];
75 return _quadOffsetsBase[0];
76 }
77
78private:
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
88using namespace OPENSUBDIV_VERSION;
89
90} //end namespace OpenSuddiv
91
92#endif // OPENSUBDIV3_OSD_MTL_LEGACY_GREGORY_PATCH_TABLE_H
Container for arrays of parametric patches.
Definition: patchTable.h:55
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)