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"
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);
138 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
142 STENCIL_TABLE
const *stencilTable,
144 ID3D11DeviceContext * deviceContext) {
153 instance =
Create(srcDesc, dstDesc,
171 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
175 STENCIL_TABLE
const *stencilTable,
176 ID3D11DeviceContext *deviceContext)
const {
177 return EvalStencils(srcBuffer->BindD3D11UAV(deviceContext), srcDesc,
178 dstBuffer->BindD3D11UAV(deviceContext), dstDesc,
179 stencilTable->GetSizesSRV(),
180 stencilTable->GetOffsetsSRV(),
181 stencilTable->GetIndicesSRV(),
182 stencilTable->GetWeightsSRV(),
184 stencilTable->GetNumStencils(),
192 ID3D11UnorderedAccessView *dstUAV,
194 ID3D11ShaderResourceView *sizesSRV,
195 ID3D11ShaderResourceView *offsetsSRV,
196 ID3D11ShaderResourceView *indicesSRV,
197 ID3D11ShaderResourceView *weightsSRV,
200 ID3D11DeviceContext *deviceContext)
const;
205 ID3D11DeviceContext *deviceContext);
208 static void Synchronize(ID3D11DeviceContext *deviceContext);
211 ID3D11ComputeShader * _computeShader;
212 ID3D11ClassLinkage * _classLinkage;
213 ID3D11ClassInstance * _singleBufferKernel;
214 ID3D11ClassInstance * _separateBufferKernel;
215 ID3D11Buffer * _uniformArgs;
223 using namespace OPENSUBDIV_VERSION;
228 #endif // OPENSUBDIV3_OSD_D3D11_COMPUTE_EVALUATOR_H
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.
static D3D11StencilTable * Create(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext)
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, ID3D11DeviceContext *deviceContext) const
D3D11StencilTable(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext)
static D3D11ComputeEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, ID3D11DeviceContext *deviceContext)
ID3D11ShaderResourceView * GetWeightsSRV() const
int GetNumStencils() const
Table of subdivision stencils.
ID3D11ShaderResourceView * GetOffsetsSRV() const
static void Synchronize(ID3D11DeviceContext *deviceContext)
Wait the dispatched kernel finishes.
D3D11ComputeEvaluator()
Constructor.
ID3D11ShaderResourceView * GetSizesSRV() const
ID3D11ShaderResourceView * GetIndicesSRV() const
static D3D11StencilTable * Create(Far::StencilTable const *stencilTable, DEVICE_CONTEXT context)
bool Compile(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, ID3D11DeviceContext *deviceContext)
Configure DX kernel. Returns false if it fails to compile the kernel.
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...
~D3D11ComputeEvaluator()
Destructor.