OpenSubdiv
Loading...
Searching...
No Matches
d3d11PatchTable.h
Go to the documentation of this file.
1//
2// Copyright 2015 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_GL_PATCH_TABLE_H
9#define OPENSUBDIV3_OSD_GL_PATCH_TABLE_H
10
11#include "../version.h"
12
13#include <vector>
15#include "../osd/nonCopyable.h"
16#include "../osd/types.h"
17
18struct ID3D11Buffer;
19struct ID3D11ShaderResourceView;
20struct ID3D11Device;
21struct ID3D11DeviceContext;
22
23namespace OpenSubdiv {
24namespace OPENSUBDIV_VERSION {
25
26namespace Far{
27 class PatchTable;
28};
29
30namespace Osd {
31
32class D3D11PatchTable : private NonCopyable<D3D11PatchTable> {
33public:
34 using VertexBufferBinding = ID3D11Buffer*; // buffer binding type
35
38
39 template<typename DEVICE_CONTEXT>
40 static D3D11PatchTable *Create(Far::PatchTable const *farPatchTable,
41 DEVICE_CONTEXT context) {
42 return Create(farPatchTable, context->GetDeviceContext());
43 }
44
45 static D3D11PatchTable *Create(Far::PatchTable const *farPatchTable,
46 ID3D11DeviceContext *deviceContext);
47
49 return _patchArrays;
50 }
51
53 ID3D11Buffer* GetPatchIndexBuffer() const {
54 return _indexBuffer;
55 }
56
58 ID3D11ShaderResourceView* GetPatchParamSRV() const {
60 }
61
62protected:
63 // allocate buffers from patchTable
64 bool allocate(Far::PatchTable const *farPatchTable,
65 ID3D11DeviceContext *deviceContext);
66
68
69 ID3D11Buffer *_indexBuffer;
70 ID3D11Buffer *_patchParamBuffer;
71 ID3D11ShaderResourceView *_patchParamBufferSRV;
72};
73
74
75} // end namespace Osd
76
77} // end namespace OPENSUBDIV_VERSION
78using namespace OPENSUBDIV_VERSION;
79
80} // end namespace OpenSubdiv
81
82#endif // OPENSUBDIV3_OSD_GL_PATCH_TABLE_H
std::vector< PatchArray > PatchArrayVector
Definition types.h:115
Container for arrays of parametric patches.
Definition patchTable.h:38
static D3D11PatchTable * Create(Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context)
bool allocate(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext)
ID3D11Buffer * GetPatchIndexBuffer() const
Returns the index buffer containing the patch control vertices.
static D3D11PatchTable * Create(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext)
ID3D11ShaderResourceView * GetPatchParamSRV() const
Returns the SRV containing the patch parameter.