25 #ifndef OPENSUBDIV3_OSD_D3D11_COMPUTE_EVALUATOR_H
26 #define OPENSUBDIV3_OSD_D3D11_COMPUTE_EVALUATOR_H
28 #include "../version.h"
30 struct ID3D11DeviceContext;
32 struct ID3D11ComputeShader;
33 struct ID3D11ClassLinkage;
34 struct ID3D11ClassInstance;
35 struct ID3D11ShaderResourceView;
36 struct ID3D11UnorderedAccessView;
38 #include "../osd/bufferDescriptor.h"
40 namespace OpenSubdiv {
41 namespace OPENSUBDIV_VERSION {
58 template <
typename DEVICE_CONTEXT>
60 DEVICE_CONTEXT context) {
65 ID3D11DeviceContext *deviceContext) {
70 ID3D11DeviceContext *deviceContext);
75 ID3D11ShaderResourceView *
GetSizesSRV()
const {
return _sizes; }
82 ID3D11ShaderResourceView *_sizes;
83 ID3D11ShaderResourceView *_offsets;
84 ID3D11ShaderResourceView *_indices;
85 ID3D11ShaderResourceView *_weights;
86 ID3D11Buffer *_sizesBuffer;
87 ID3D11Buffer *_offsetsBuffer;
88 ID3D11Buffer *_indicesBuffer;
89 ID3D11Buffer *_weightsBuffer;
103 ID3D11DeviceContext *deviceContext);
112 ID3D11DeviceContext *deviceContext);
147 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
151 STENCIL_TABLE
const *stencilTable,
153 ID3D11DeviceContext * deviceContext) {
162 instance =
Create(srcDesc, dstDesc,
180 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
184 STENCIL_TABLE
const *stencilTable,
185 ID3D11DeviceContext *deviceContext)
const {
186 return EvalStencils(srcBuffer->BindD3D11UAV(deviceContext), srcDesc,
187 dstBuffer->BindD3D11UAV(deviceContext), dstDesc,
188 stencilTable->GetSizesSRV(),
189 stencilTable->GetOffsetsSRV(),
190 stencilTable->GetIndicesSRV(),
191 stencilTable->GetWeightsSRV(),
193 stencilTable->GetNumStencils(),
201 ID3D11UnorderedAccessView *dstUAV,
203 ID3D11ShaderResourceView *sizesSRV,
204 ID3D11ShaderResourceView *offsetsSRV,
205 ID3D11ShaderResourceView *indicesSRV,
206 ID3D11ShaderResourceView *weightsSRV,
209 ID3D11DeviceContext *deviceContext)
const;
214 ID3D11DeviceContext *deviceContext);
217 static void Synchronize(ID3D11DeviceContext *deviceContext);
220 ID3D11ComputeShader * _computeShader;
221 ID3D11ClassLinkage * _classLinkage;
222 ID3D11ClassInstance * _singleBufferKernel;
223 ID3D11ClassInstance * _separateBufferKernel;
224 ID3D11Buffer * _uniformArgs;
232 using namespace OPENSUBDIV_VERSION;
237 #endif // OPENSUBDIV3_OSD_D3D11_COMPUTE_EVALUATOR_H
ID3D11ShaderResourceView * GetWeightsSRV() const
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, D3D11ComputeEvaluator const *instance, ID3D11DeviceContext *deviceContext)
Generic static compute function. This function has a same signature as other device kernels have so t...
BufferDescriptor is a struct which describes buffer elements in interleaved data buffers. Almost all Osd Evaluator APIs take BufferDescriptors along with device-specific buffer objects.
ID3D11ShaderResourceView * GetOffsetsSRV() const
bool Compile(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, ID3D11DeviceContext *deviceContext)
Configure DX kernel. Returns false if it fails to compile the kernel.
int GetNumStencils() const
ID3D11ShaderResourceView * GetIndicesSRV() const
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, ID3D11DeviceContext *deviceContext) const
static D3D11StencilTable * Create(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext)
static D3D11StencilTable * Create(Far::StencilTable const *stencilTable, DEVICE_CONTEXT context)
D3D11ComputeEvaluator()
Constructor.
D3D11StencilTable(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext)
Stencil table class wrapping the template for compatibility.
static void Synchronize(ID3D11DeviceContext *deviceContext)
Wait the dispatched kernel finishes.
~D3D11ComputeEvaluator()
Destructor.
ID3D11ShaderResourceView * GetSizesSRV() const
static D3D11ComputeEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, ID3D11DeviceContext *deviceContext)