25 #ifndef OSD_D3D11_COMPUTE_CONTROLLER_H
26 #define OSD_D3D11_COMPUTE_CONTROLLER_H
28 #include "../version.h"
30 #include "../far/kernelBatchDispatcher.h"
31 #include "../osd/d3d11ComputeContext.h"
32 #include "../osd/vertexDescriptor.h"
36 struct ID3D11DeviceContext;
38 struct ID3D11UnorderedAccessView;
40 namespace OpenSubdiv {
41 namespace OPENSUBDIV_VERSION {
87 template<
class VERTEX_BUFFER,
class VARYING_BUFFER>
90 VERTEX_BUFFER * vertexBuffer,
91 VARYING_BUFFER * varyingBuffer,
95 if (batches.empty())
return;
98 bind(vertexBuffer, vertexDesc);
106 bind(varyingBuffer, varyingDesc);
127 template<
class VERTEX_BUFFER>
130 VERTEX_BUFFER *vertexBuffer) {
132 Compute<VERTEX_BUFFER>(context, batches, vertexBuffer, (VERTEX_BUFFER*)0);
145 template<
class BUFFER>
154 _currentBindState.desc = *desc;
156 int numElements = buffer ? buffer->GetNumElements() : 0;
157 _currentBindState.desc =
161 _currentBindState.buffer = buffer->BindD3D11UAV(_deviceContext);
163 _currentBindState.kernelBundle = getKernel(_currentBindState.desc);
171 _currentBindState.Reset();
184 ID3D11DeviceContext *_deviceContext;
193 BindState() : buffer(0), kernelBundle(0) { }
201 ID3D11UnorderedAccessView * buffer;
203 VertexBufferDescriptor desc;
205 KernelBundle
const * kernelBundle;
208 BindState _currentBindState;
210 typedef std::vector<KernelBundle *> KernelRegistry;
212 KernelBundle
const * getKernel(VertexBufferDescriptor
const &desc);
214 KernelRegistry _kernelRegistry;
220 using namespace OPENSUBDIV_VERSION;
224 #endif // OSD_D3D11_COMPUTE_CONTROLLER_H
A GP Compute Kernel descriptor.
D3D11ComputeContext ComputeContext
void ApplyStencilTableKernel(Far::KernelBatch const &batch, ComputeContext const *context) const
Describes vertex elements in interleaved data buffers.
std::vector< KernelBatch > KernelBatchVector
void BindVaryingStencilTables(ID3D11DeviceContext *deviceContext) const
void Compute(D3D11ComputeContext const *context, Far::KernelBatchVector const &batches, VERTEX_BUFFER *vertexBuffer, VARYING_BUFFER *varyingBuffer, VertexBufferDescriptor const *vertexDesc=NULL, VertexBufferDescriptor const *varyingDesc=NULL)
void bind(BUFFER *buffer, VertexBufferDescriptor const *desc)
D3D11ComputeController(ID3D11DeviceContext *deviceContext)
void Compute(D3D11ComputeContext const *context, Far::KernelBatchVector const &batches, VERTEX_BUFFER *vertexBuffer)
static void Apply(CONTROLLER *controller, CONTEXT *context, KernelBatchVector const &batches, int maxlevel)
Launches the processing of a vector of kernel batches this is a convenient API for controllers which ...
Compute controller for launching D3D11 Compute subdivision kernels.
void BindVertexStencilTables(ID3D11DeviceContext *deviceContext) const
void UnbindStencilTables(ID3D11DeviceContext *deviceContext) const
~D3D11ComputeController()
Destructor.
void Synchronize()
Waits until all running subdivision kernels finish.
Subdivision refinement encapsulation layer.