OpenSubdiv: opensubdiv/osd/mtlLegacyGregoryPatchTable.h Source File

| 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
24 class MTLLegacyGregoryPatchTable
25: private NonCopyable<MTLLegacyGregoryPatchTable>
26{
27public:
28 ~MTLLegacyGregoryPatchTable();
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
54 int GetQuadOffsetsBase(Far::PatchDescriptor::Type type)
55 {
56 if(type == Far::PatchDescriptor::GREGORY_BOUNDARY)
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
mtlCommon.h
patchTable.h
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Osd
Definition bufferDescriptor.h:17
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchDescriptor::Type
Type
Definition patchDescriptor.h:31
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchDescriptor::GREGORY_BOUNDARY
@ GREGORY_BOUNDARY
Definition patchDescriptor.h:44
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition patchTable.h:38
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLContext
Definition mtlCommon.h:23
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable
Definition mtlLegacyGregoryPatchTable.h:26
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetQuadOffsetsBase
int GetQuadOffsetsBase(Far::PatchDescriptor::Type type)
Definition mtlLegacyGregoryPatchTable.h:54
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::Create
static MTLLegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context)
Definition mtlLegacyGregoryPatchTable.h:31
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetVertexValenceBuffer
id< MTLBuffer > GetVertexValenceBuffer() const
Definition mtlLegacyGregoryPatchTable.h:44
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetQuadOffsetsBuffer
id< MTLBuffer > GetQuadOffsetsBuffer() const
Definition mtlLegacyGregoryPatchTable.h:49
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::Create
static MTLLegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, MTLContext *context)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::UpdateVertexBuffer
void UpdateVertexBuffer(id< MTLBuffer > vbo, int numVertices, int numVertexElements, MTLContext *context)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::~MTLLegacyGregoryPatchTable
~MTLLegacyGregoryPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MTLLegacyGregoryPatchTable::GetVertexBuffer
id< MTLBuffer > GetVertexBuffer() const
Definition mtlLegacyGregoryPatchTable.h:39