OpenSubdiv: opensubdiv/osd/d3d11VertexBuffer.h Source File

| OpenSubdiv

Loading...
Searching...
No Matches
d3d11VertexBuffer.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_D3D11_VERTEX_BUFFER_H
9#define OPENSUBDIV3_OSD_D3D11_VERTEX_BUFFER_H
10
11#include "../version.h"
12
13struct ID3D11Buffer;
14struct ID3D11Device;
15struct ID3D11DeviceContext;
16struct ID3D11UnorderedAccessView;
17
18namespace OpenSubdiv {
19namespace OPENSUBDIV_VERSION {
20
21namespace Osd {
22
29 class D3D11VertexBuffer {
30public:
32 static D3D11VertexBuffer * Create(int numElements, int numVertices,
33 ID3D11DeviceContext *deviceContext);
34
36 virtual ~D3D11VertexBuffer();
37
40 void UpdateData(const float *src, int startVertex, int numVertices,
41 ID3D11DeviceContext *deviceContext);
42
44 int GetNumElements() const;
45
47 int GetNumVertices() const;
48
50 ID3D11Buffer *BindD3D11Buffer(ID3D11DeviceContext *deviceContext);
51
53 ID3D11Buffer *BindVBO(ID3D11DeviceContext *deviceContext) {
54 return BindD3D11Buffer(deviceContext);
55 }
56
58 ID3D11UnorderedAccessView *BindD3D11UAV(ID3D11DeviceContext *deviceContext);
59
60protected:
62 D3D11VertexBuffer(int numElements, int numVertices);
63
64 // Allocates D3D11 buffer
65 bool allocate(ID3D11Device *device);
66
67private:
68 int _numElements;
69 int _numVertices;
70 ID3D11Buffer *_buffer;
71 ID3D11Buffer *_uploadBuffer;
72 ID3D11UnorderedAccessView *_uav;
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_D3D11_VERTEX_BUFFER_H
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Osd
Definition bufferDescriptor.h:17
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::GetNumElements
int GetNumElements() const
Returns how many elements defined in this vertex buffer.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::UpdateData
void UpdateData(const float *src, int startVertex, int numVertices, ID3D11DeviceContext *deviceContext)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::Create
static D3D11VertexBuffer * Create(int numElements, int numVertices, ID3D11DeviceContext *deviceContext)
Creator. Returns NULL if error.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::D3D11VertexBuffer
D3D11VertexBuffer(int numElements, int numVertices)
Constructor.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::GetNumVertices
int GetNumVertices() const
Returns how many vertices allocated in this vertex buffer.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::BindD3D11Buffer
ID3D11Buffer * BindD3D11Buffer(ID3D11DeviceContext *deviceContext)
Returns the D3D11 buffer object.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::~D3D11VertexBuffer
virtual ~D3D11VertexBuffer()
Destructor.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::BindD3D11UAV
ID3D11UnorderedAccessView * BindD3D11UAV(ID3D11DeviceContext *deviceContext)
Returns the D3D11 UAV.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::allocate
bool allocate(ID3D11Device *device)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::D3D11VertexBuffer::BindVBO
ID3D11Buffer * BindVBO(ID3D11DeviceContext *deviceContext)
Returns the D3D11 buffer object (for Osd::Mesh interface).
Definition d3d11VertexBuffer.h:53