| OpenSubdiv

Loading...
Searching...
No Matches
d3d11LegacyGregoryPatchTable.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_D3D11_LEGACY_GREGORY_PATCH_TABLE_H
9#define OPENSUBDIV3_OSD_D3D11_LEGACY_GREGORY_PATCH_TABLE_H
10
11#include "../version.h"
12
13#include "../far/patchTable.h"
14#include "../osd/nonCopyable.h"
15
16 struct ID3D11Buffer;
17 struct ID3D11ShaderResourceView;
18 struct ID3D11Device;
19 struct ID3D11DeviceContext;
20
21 namespace OpenSubdiv {
22 namespace OPENSUBDIV_VERSION {
23
24 namespace Osd {
25
26 class D3D11LegacyGregoryPatchTable
27 : private NonCopyable<D3D11LegacyGregoryPatchTable> {
28 public:
29 ~D3D11LegacyGregoryPatchTable();
30
31 template<typename DEVICE_CONTEXT>
32 static D3D11LegacyGregoryPatchTable *Create(
33 Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context) {
34 return Create(farPatchTable, context->GetDeviceContext());
35 }
36
37 static D3D11LegacyGregoryPatchTable *Create(
38 Far::PatchTable const *farPatchTable,
39 ID3D11DeviceContext *deviceContext);
40
41 void UpdateVertexBuffer(ID3D11Buffer *vbo,
42 int numVertices, int numVertexElements,
43 ID3D11DeviceContext *pd3d11DeviceContext);
44
45 ID3D11ShaderResourceView* GetVertexSRV() const {
46 return _vertexSRV;
47 }
48
49 ID3D11ShaderResourceView* GetVertexValenceSRV() const {
50 return _vertexValenceSRV;
51 }
52
53 ID3D11ShaderResourceView* GetQuadOffsetsSRV() const {
54 return _quadOffsetsSRV;
55 }
56
57 int GetQuadOffsetsBase(Far::PatchDescriptor::Type type) {
58 if (type == Far::PatchDescriptor::GREGORY_BOUNDARY) {
59 return _quadOffsetsBase[1];
60 }
61 return _quadOffsetsBase[0];
62 }
63
64 protected:
65 D3D11LegacyGregoryPatchTable();
66
67 private:
68 ID3D11Buffer* _vertexValenceBuffer;
69 ID3D11Buffer* _quadOffsetsBuffer;
70 ID3D11ShaderResourceView* _vertexSRV;
71 ID3D11ShaderResourceView* _vertexValenceSRV;
72 ID3D11ShaderResourceView* _quadOffsetsSRV;
73 int _quadOffsetsBase[2]; // gregory, boundaryGregory
74};
75
76
77
78} // end namespace Osd
79
80} // end namespace OPENSUBDIV_VERSION
81 using namespace OPENSUBDIV_VERSION;
82
83} // end namespace OpenSubdiv
84
85#endif // OPENSUBDIV3_OSD_D3D11_LEGACY_GREGORY_PATCH_TABLE_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::D3D11LegacyGregoryPatchTable::UpdateVertexBuffer
void UpdateVertexBuffer(ID3D11Buffer *vbo, int numVertices, int numVertexElements, ID3D11DeviceContext *pd3d11DeviceContext)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::GetQuadOffsetsBase
int GetQuadOffsetsBase(Far::PatchDescriptor::Type type)
Definition d3d11LegacyGregoryPatchTable.h:57
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::~D3D11LegacyGregoryPatchTable
~D3D11LegacyGregoryPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::Create
static D3D11LegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::GetVertexSRV
ID3D11ShaderResourceView * GetVertexSRV() const
Definition d3d11LegacyGregoryPatchTable.h:45
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::Create
static D3D11LegacyGregoryPatchTable * Create(Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context)
Definition d3d11LegacyGregoryPatchTable.h:32
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::GetVertexValenceSRV
ID3D11ShaderResourceView * GetVertexValenceSRV() const
Definition d3d11LegacyGregoryPatchTable.h:49
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::GetQuadOffsetsSRV
ID3D11ShaderResourceView * GetQuadOffsetsSRV() const
Definition d3d11LegacyGregoryPatchTable.h:53
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11LegacyGregoryPatchTable::D3D11LegacyGregoryPatchTable
D3D11LegacyGregoryPatchTable()