OpenSubdiv: opensubdiv/osd/d3d11PatchTable.h Source File

| 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>
14#include "../far/patchDescriptor.h"
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
32 class D3D11PatchTable : private NonCopyable<D3D11PatchTable> {
33public:
34 using VertexBufferBinding = ID3D11Buffer*; // buffer binding type
35
36 D3D11PatchTable();
37 ~D3D11PatchTable();
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
48 PatchArrayVector const &GetPatchArrays() const {
49 return _patchArrays;
50 }
51
53 ID3D11Buffer* GetPatchIndexBuffer() const {
54 return _indexBuffer;
55 }
56
58 ID3D11ShaderResourceView* GetPatchParamSRV() const {
59 return _patchParamBufferSRV;
60 }
61
62protected:
63 // allocate buffers from patchTable
64 bool allocate(Far::PatchTable const *farPatchTable,
65 ID3D11DeviceContext *deviceContext);
66
67 PatchArrayVector _patchArrays;
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
patchDescriptor.h
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Far
Definition refinerSurfaceFactory.h:19
OpenSubdiv::OPENSUBDIV_VERSION::Osd
Definition bufferDescriptor.h:17
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArrayVector
std::vector< PatchArray > PatchArrayVector
Definition types.h:115
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition patchTable.h:38
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::Create
static D3D11PatchTable * Create(Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context)
Definition d3d11PatchTable.h:40
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::GetPatchArrays
PatchArrayVector const & GetPatchArrays() const
Definition d3d11PatchTable.h:48
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::allocate
bool allocate(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::~D3D11PatchTable
~D3D11PatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::GetPatchIndexBuffer
ID3D11Buffer * GetPatchIndexBuffer() const
Returns the index buffer containing the patch control vertices.
Definition d3d11PatchTable.h:53
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::_patchArrays
PatchArrayVector _patchArrays
Definition d3d11PatchTable.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::VertexBufferBinding
ID3D11Buffer * VertexBufferBinding
Definition d3d11PatchTable.h:34
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::_indexBuffer
ID3D11Buffer * _indexBuffer
Definition d3d11PatchTable.h:69
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::Create
static D3D11PatchTable * Create(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::_patchParamBufferSRV
ID3D11ShaderResourceView * _patchParamBufferSRV
Definition d3d11PatchTable.h:71
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::_patchParamBuffer
ID3D11Buffer * _patchParamBuffer
Definition d3d11PatchTable.h:70
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::GetPatchParamSRV
ID3D11ShaderResourceView * GetPatchParamSRV() const
Returns the SRV containing the patch parameter.
Definition d3d11PatchTable.h:58
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11PatchTable::D3D11PatchTable
D3D11PatchTable()
types.h