25 #ifndef OSD_GLSL_TRANSFORM_FEEDBACK_COMPUTE_CONTROLLER_H
26 #define OSD_GLSL_TRANSFORM_FEEDBACK_COMPUTE_CONTROLLER_H
28 #include "../version.h"
30 #include "../far/kernelBatchDispatcher.h"
31 #include "../osd/glslTransformFeedbackComputeContext.h"
32 #include "../osd/vertexDescriptor.h"
36 namespace OpenSubdiv {
37 namespace OPENSUBDIV_VERSION {
41 class GLSLTransformFeedbackKernelBundle;
85 template<
class VERTEX_BUFFER,
class VARYING_BUFFER>
88 VERTEX_BUFFER * vertexBuffer,
89 VARYING_BUFFER * varyingBuffer,
93 if (batches.empty())
return;
97 bind(vertexBuffer, vertexDesc, _vertexTexture);
106 bind(varyingBuffer, varyingDesc, _varyingTexture);
125 template<
class VERTEX_BUFFER>
128 VERTEX_BUFFER *vertexBuffer) {
130 Compute<VERTEX_BUFFER>(context, batches, vertexBuffer, (VERTEX_BUFFER*)0);
143 template<
class BUFFER>
145 GLuint feedbackTexture ) {
152 _currentBindState.desc = *desc;
154 int numElements = buffer ? buffer->GetNumElements() : 0;
155 _currentBindState.desc =
159 _currentBindState.buffer = buffer->BindVBO();
161 _currentBindState.kernelBundle = getKernel(_currentBindState.desc);
168 _currentBindState.Reset();
189 BindState() : buffer(0), kernelBundle(0) { }
199 VertexBufferDescriptor desc;
201 KernelBundle
const * kernelBundle;
204 BindState _currentBindState;
206 typedef std::vector<KernelBundle *> KernelRegistry;
208 KernelBundle
const * getKernel(VertexBufferDescriptor
const &desc);
210 KernelRegistry _kernelRegistry;
212 GLuint _vertexTexture,
220 using namespace OPENSUBDIV_VERSION;
224 #endif // OSD_GLSL_TRANSFORM_FEEDBACK_COMPUTE_CONTROLLER_H
void bind(BUFFER *buffer, VertexBufferDescriptor const *desc, GLuint feedbackTexture)
A GP Compute Kernel descriptor.
Describes vertex elements in interleaved data buffers.
Compute controller for launching GLSLTransformFeedback transform feedback subdivision kernels...
~GLSLTransformFeedbackComputeController()
Destructor.
std::vector< KernelBatch > KernelBatchVector
void Compute(GLSLTransformFeedbackComputeContext const *context, Far::KernelBatchVector const &batches, VERTEX_BUFFER *vertexBuffer, VARYING_BUFFER *varyingBuffer, VertexBufferDescriptor const *vertexDesc=NULL, VertexBufferDescriptor const *varyingDesc=NULL)
void bindBufferAndProgram(GLuint &texture)
GLSL-Compute(transform-feedback) Refine Context.
GLSLTransformFeedbackComputeContext ComputeContext
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 ...
void Synchronize()
Waits until all running subdivision kernels finish.
void bindContextStencilTables(ComputeContext const *context, bool varying=false)
void ApplyStencilTableKernel(Far::KernelBatch const &batch, ComputeContext const *context) const
Subdivision refinement encapsulation layer.
void Compute(GLSLTransformFeedbackComputeContext const *context, Far::KernelBatchVector const &batches, VERTEX_BUFFER *vertexBuffer)
GLSLTransformFeedbackComputeController()
Constructor.