25 #ifndef OPENSUBDIV3_OSD_GL_XFB_EVALUATOR_H
26 #define OPENSUBDIV3_OSD_GL_XFB_EVALUATOR_H
28 #include "../version.h"
30 #include "../osd/opengl.h"
31 #include "../osd/types.h"
32 #include "../osd/bufferDescriptor.h"
35 namespace OPENSUBDIV_VERSION {
40 class LimitStencilTable;
62 void *deviceContext = NULL) {
99 void * deviceContext = NULL) {
102 if (instance->
Compile(srcDesc, dstDesc, duDesc, dvDesc))
147 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
151 STENCIL_TABLE
const *stencilTable,
153 void * deviceContext = NULL) {
162 instance =
Create(srcDesc, dstDesc,
215 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
221 STENCIL_TABLE
const *stencilTable,
223 void * deviceContext = NULL) {
234 instance =
Create(srcDesc, dstDesc, duDesc, dvDesc);
264 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
268 STENCIL_TABLE
const *stencilTable)
const {
271 dstBuffer->BindVBO(), dstDesc,
274 stencilTable->GetSizesTexture(),
275 stencilTable->GetOffsetsTexture(),
276 stencilTable->GetIndicesTexture(),
277 stencilTable->GetWeightsTexture(),
281 stencilTable->GetNumStencils());
308 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
314 STENCIL_TABLE
const *stencilTable)
const {
317 dstBuffer->BindVBO(), dstDesc,
318 duBuffer->BindVBO(), duDesc,
319 dvBuffer->BindVBO(), dvDesc,
320 stencilTable->GetSizesTexture(),
321 stencilTable->GetOffsetsTexture(),
322 stencilTable->GetIndicesTexture(),
323 stencilTable->GetWeightsTexture(),
324 stencilTable->GetDuWeightsTexture(),
325 stencilTable->GetDvWeightsTexture(),
327 stencilTable->GetNumStencils());
370 GLuint offsetsBuffer,
371 GLuint indicesBuffer,
372 GLuint weightsBuffer,
373 GLuint duWeightsBuffer,
374 GLuint dvWeightsBuffer,
416 template <
typename SRC_BUFFER,
typename DST_BUFFER,
417 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
422 PATCHCOORD_BUFFER *patchCoords,
423 PATCH_TABLE *patchTable,
425 void * deviceContext = NULL) {
430 numPatchCoords, patchCoords,
435 instance =
Create(srcDesc, dstDesc,
441 numPatchCoords, patchCoords,
490 template <
typename SRC_BUFFER,
typename DST_BUFFER,
491 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
498 PATCHCOORD_BUFFER *patchCoords,
499 PATCH_TABLE *patchTable,
501 void * deviceContext = NULL) {
508 numPatchCoords, patchCoords,
513 instance =
Create(srcDesc, dstDesc, duDesc, dvDesc);
519 numPatchCoords, patchCoords,
552 template <
typename SRC_BUFFER,
typename DST_BUFFER,
553 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
558 PATCHCOORD_BUFFER *patchCoords,
559 PATCH_TABLE *patchTable)
const {
562 dstBuffer->BindVBO(), dstDesc,
566 patchCoords->BindVBO(),
567 patchTable->GetPatchArrays(),
568 patchTable->GetPatchIndexTextureBuffer(),
569 patchTable->GetPatchParamTextureBuffer());
606 template <
typename SRC_BUFFER,
typename DST_BUFFER,
607 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
614 PATCHCOORD_BUFFER *patchCoords,
615 PATCH_TABLE *patchTable)
const {
618 dstBuffer->BindVBO(), dstDesc,
619 duBuffer->BindVBO(), duDesc,
620 dvBuffer->BindVBO(), dvDesc,
622 patchCoords->BindVBO(),
623 patchTable->GetPatchArrays(),
624 patchTable->GetPatchIndexTextureBuffer(),
625 patchTable->GetPatchParamTextureBuffer());
633 GLuint patchCoordsBuffer,
635 GLuint patchIndexBuffer,
636 GLuint patchParamsBuffer)
const;
655 GLuint _srcBufferTexture;
657 struct _StencilKernel {
665 GLint uniformSrcBufferTexture;
666 GLint uniformSrcOffset;
668 GLint uniformSizesTexture;
669 GLint uniformOffsetsTexture;
670 GLint uniformIndicesTexture;
671 GLint uniformWeightsTexture;
672 GLint uniformDuWeightsTexture;
673 GLint uniformDvWeightsTexture;
678 struct _PatchKernel {
681 bool Compile(BufferDescriptor
const &srcDesc,
682 BufferDescriptor
const &dstDesc,
683 BufferDescriptor
const &duDesc,
684 BufferDescriptor
const &dvDesc);
686 GLint uniformSrcBufferTexture;
687 GLint uniformSrcOffset;
689 GLint uniformPatchArray;
690 GLint uniformPatchParamTexture;
691 GLint uniformPatchIndexTexture;
699 using namespace OPENSUBDIV_VERSION;
704 #endif // OPENSUBDIV3_OSD_GL_XFB_EVALUATOR_H
bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable) const
Generic limit eval function with derivatives. This function has a same signature as other device kern...
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
GL TextureBuffer stencil table.
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 GLStencilTableTBO * Create(Far::StencilTable const *stencilTable, void *deviceContext=NULL)
GLuint GetOffsetsTexture() const
GLuint GetDvWeightsTexture() const
std::vector< PatchArray > PatchArrayVector
~GLXFBEvaluator()
Destructor. note that the GL context must be made current.
int GetNumStencils() const
static GLStencilTableTBO * Create(Far::LimitStencilTable const *limitStencilTable, void *deviceContext=NULL)
bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, STENCIL_TABLE const *stencilTable) const
Generic eval stencils function with derivative evaluation.
static void Synchronize(void *kernel)
Wait the dispatched kernel finishes.
Table of subdivision stencils.
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, STENCIL_TABLE const *stencilTable, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
GLXFBEvaluator()
Constructor.
GLuint GetIndicesTexture() const
GLuint GetWeightsTexture() const
GLuint GetDuWeightsTexture() const
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool Compile(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc)
GLuint GetSizesTexture() const
bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable) const
Generic eval stencils function.
GLStencilTableTBO(Far::StencilTable const *stencilTable)
static GLXFBEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, void *deviceContext=NULL)
Table of limit subdivision stencils.
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, GLXFBEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...