25#ifndef OPENSUBDIV3_OSD_D3D11_COMPUTE_EVALUATOR_H
26#define OPENSUBDIV3_OSD_D3D11_COMPUTE_EVALUATOR_H
28#include "../version.h"
30struct ID3D11DeviceContext;
32struct ID3D11ComputeShader;
33struct ID3D11ClassLinkage;
34struct ID3D11ClassInstance;
35struct ID3D11ShaderResourceView;
36struct ID3D11UnorderedAccessView;
38#include "../osd/bufferDescriptor.h"
41namespace 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);
220 ID3D11ComputeShader * _computeShader;
221 ID3D11ClassLinkage * _classLinkage;
222 ID3D11ClassInstance * _singleBufferKernel;
223 ID3D11ClassInstance * _separateBufferKernel;
224 ID3D11Buffer * _uniformArgs;
232using namespace OPENSUBDIV_VERSION;
Stencil table class wrapping the template for compatibility.
BufferDescriptor is a struct which describes buffer elements in interleaved data buffers....
static D3D11StencilTable * Create(Far::StencilTable const *stencilTable, DEVICE_CONTEXT context)
ID3D11ShaderResourceView * GetOffsetsSRV() const
int GetNumStencils() const
ID3D11ShaderResourceView * GetIndicesSRV() const
D3D11StencilTable(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext)
static D3D11StencilTable * Create(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext)
ID3D11ShaderResourceView * GetSizesSRV() const
ID3D11ShaderResourceView * GetWeightsSRV() const
static D3D11ComputeEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, ID3D11DeviceContext *deviceContext)
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...
static D3D11ComputeEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, BufferDescriptor const &duuDesc, BufferDescriptor const &duvDesc, BufferDescriptor const &dvvDesc, ID3D11DeviceContext *deviceContext)
static void Synchronize(ID3D11DeviceContext *deviceContext)
Wait the dispatched kernel finishes.
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, ID3D11DeviceContext *deviceContext) const
bool Compile(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, ID3D11DeviceContext *deviceContext)
Configure DX kernel. Returns false if it fails to compile the kernel.
D3D11ComputeEvaluator()
Constructor.
~D3D11ComputeEvaluator()
Destructor.
bool EvalStencils(ID3D11UnorderedAccessView *srcSRV, BufferDescriptor const &srcDesc, ID3D11UnorderedAccessView *dstUAV, BufferDescriptor const &dstDesc, ID3D11ShaderResourceView *sizesSRV, ID3D11ShaderResourceView *offsetsSRV, ID3D11ShaderResourceView *indicesSRV, ID3D11ShaderResourceView *weightsSRV, int start, int end, ID3D11DeviceContext *deviceContext) const