25 #ifndef OPENSUBDIV3_OSD_OMP_EVALUATOR_H
26 #define OPENSUBDIV3_OSD_OMP_EVALUATOR_H
28 #include "../version.h"
29 #include "../osd/bufferDescriptor.h"
30 #include "../osd/types.h"
34 namespace OpenSubdiv {
35 namespace OPENSUBDIV_VERSION {
71 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
75 STENCIL_TABLE
const *stencilTable,
77 void * deviceContext = NULL) {
82 if (stencilTable->GetNumStencils() == 0)
86 dstBuffer->BindCpuBuffer(), dstDesc,
87 &stencilTable->GetSizes()[0],
88 &stencilTable->GetOffsets()[0],
89 &stencilTable->GetControlIndices()[0],
90 &stencilTable->GetWeights()[0],
92 stencilTable->GetNumStencils());
127 const float * weights,
167 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
173 STENCIL_TABLE
const *stencilTable,
175 void * deviceContext = NULL) {
180 return EvalStencils(srcBuffer->BindCpuBuffer(), srcDesc,
181 dstBuffer->BindCpuBuffer(), dstDesc,
182 duBuffer->BindCpuBuffer(), duDesc,
183 dvBuffer->BindCpuBuffer(), dvDesc,
184 &stencilTable->GetSizes()[0],
185 &stencilTable->GetOffsets()[0],
186 &stencilTable->GetControlIndices()[0],
187 &stencilTable->GetWeights()[0],
188 &stencilTable->GetDuWeights()[0],
189 &stencilTable->GetDvWeights()[0],
191 stencilTable->GetNumStencils());
242 const float * weights,
243 const float * duWeights,
244 const float * dvWeights,
302 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
311 STENCIL_TABLE
const *stencilTable,
313 void * deviceContext = NULL) {
318 return EvalStencils(srcBuffer->BindCpuBuffer(), srcDesc,
319 dstBuffer->BindCpuBuffer(), dstDesc,
320 duBuffer->BindCpuBuffer(), duDesc,
321 dvBuffer->BindCpuBuffer(), dvDesc,
322 duuBuffer->BindCpuBuffer(), duuDesc,
323 duvBuffer->BindCpuBuffer(), duvDesc,
324 dvvBuffer->BindCpuBuffer(), dvvDesc,
325 &stencilTable->GetSizes()[0],
326 &stencilTable->GetOffsets()[0],
327 &stencilTable->GetControlIndices()[0],
328 &stencilTable->GetWeights()[0],
329 &stencilTable->GetDuWeights()[0],
330 &stencilTable->GetDvWeights()[0],
331 &stencilTable->GetDuuWeights()[0],
332 &stencilTable->GetDuvWeights()[0],
333 &stencilTable->GetDvvWeights()[0],
335 stencilTable->GetNumStencils());
410 const float * weights,
411 const float * duWeights,
412 const float * dvWeights,
413 const float * duuWeights,
414 const float * duvWeights,
415 const float * dvvWeights,
452 template <
typename SRC_BUFFER,
typename DST_BUFFER,
453 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
458 PATCHCOORD_BUFFER *patchCoords,
459 PATCH_TABLE *patchTable,
461 void * deviceContext = NULL) {
466 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
467 dstBuffer->BindCpuBuffer(), dstDesc,
469 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
470 patchTable->GetPatchArrayBuffer(),
471 patchTable->GetPatchIndexBuffer(),
472 patchTable->GetPatchParamBuffer());
515 template <
typename SRC_BUFFER,
typename DST_BUFFER,
516 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
523 PATCHCOORD_BUFFER *patchCoords,
524 PATCH_TABLE *patchTable,
526 void * deviceContext = NULL) {
536 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
537 dstBuffer->BindCpuBuffer(), dstDesc,
538 duBuffer->BindCpuBuffer(), duDesc,
539 dvBuffer->BindCpuBuffer(), dvDesc,
541 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
542 patchTable->GetPatchArrayBuffer(),
543 patchTable->GetPatchIndexBuffer(),
544 patchTable->GetPatchParamBuffer());
605 template <
typename SRC_BUFFER,
typename DST_BUFFER,
606 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
616 PATCHCOORD_BUFFER *patchCoords,
617 PATCH_TABLE *patchTable,
619 void * deviceContext = NULL) {
629 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
630 dstBuffer->BindCpuBuffer(), dstDesc,
631 duBuffer->BindCpuBuffer(), duDesc,
632 dvBuffer->BindCpuBuffer(), dvDesc,
633 duuBuffer->BindCpuBuffer(), duuDesc,
634 duvBuffer->BindCpuBuffer(), duvDesc,
635 dvvBuffer->BindCpuBuffer(), dvvDesc,
637 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
638 patchTable->GetPatchArrayBuffer(),
639 patchTable->GetPatchIndexBuffer(),
640 patchTable->GetPatchParamBuffer());
676 const int *patchIndexBuffer,
724 const int *patchIndexBuffer,
790 const int *patchIndexBuffer,
821 template <
typename SRC_BUFFER,
typename DST_BUFFER,
822 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
827 PATCHCOORD_BUFFER *patchCoords,
828 PATCH_TABLE *patchTable,
830 void * deviceContext = NULL) {
835 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
836 dstBuffer->BindCpuBuffer(), dstDesc,
838 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
839 patchTable->GetVaryingPatchArrayBuffer(),
840 patchTable->GetVaryingPatchIndexBuffer(),
841 patchTable->GetPatchParamBuffer());
884 template <
typename SRC_BUFFER,
typename DST_BUFFER,
885 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
892 PATCHCOORD_BUFFER *patchCoords,
893 PATCH_TABLE *patchTable,
895 void * deviceContext = NULL) {
900 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
901 dstBuffer->BindCpuBuffer(), dstDesc,
902 duBuffer->BindCpuBuffer(), duDesc,
903 dvBuffer->BindCpuBuffer(), dvDesc,
905 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
906 patchTable->GetVaryingPatchArrayBuffer(),
907 patchTable->GetVaryingPatchIndexBuffer(),
908 patchTable->GetPatchParamBuffer());
969 template <
typename SRC_BUFFER,
typename DST_BUFFER,
970 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
980 PATCHCOORD_BUFFER *patchCoords,
981 PATCH_TABLE *patchTable,
983 void * deviceContext = NULL) {
988 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
989 dstBuffer->BindCpuBuffer(), dstDesc,
990 duBuffer->BindCpuBuffer(), duDesc,
991 dvBuffer->BindCpuBuffer(), dvDesc,
992 duuBuffer->BindCpuBuffer(), duuDesc,
993 duvBuffer->BindCpuBuffer(), duvDesc,
994 dvvBuffer->BindCpuBuffer(), dvvDesc,
996 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
997 patchTable->GetVaryingPatchArrayBuffer(),
998 patchTable->GetVaryingPatchIndexBuffer(),
999 patchTable->GetPatchParamBuffer());
1032 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1033 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1038 PATCHCOORD_BUFFER *patchCoords,
1039 PATCH_TABLE *patchTable,
1042 void * deviceContext = NULL) {
1045 (void)deviceContext;
1047 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
1048 dstBuffer->BindCpuBuffer(), dstDesc,
1050 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
1051 patchTable->GetFVarPatchArrayBuffer(fvarChannel),
1052 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1053 patchTable->GetFVarPatchParamBuffer(fvarChannel));
1098 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1099 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1106 PATCHCOORD_BUFFER *patchCoords,
1107 PATCH_TABLE *patchTable,
1110 void * deviceContext = NULL) {
1113 (void)deviceContext;
1115 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
1116 dstBuffer->BindCpuBuffer(), dstDesc,
1117 duBuffer->BindCpuBuffer(), duDesc,
1118 dvBuffer->BindCpuBuffer(), dvDesc,
1120 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
1121 patchTable->GetFVarPatchArrayBuffer(fvarChannel),
1122 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1123 patchTable->GetFVarPatchParamBuffer(fvarChannel));
1186 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1187 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1197 PATCHCOORD_BUFFER *patchCoords,
1198 PATCH_TABLE *patchTable,
1201 void * deviceContext = NULL) {
1204 (void)deviceContext;
1206 return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
1207 dstBuffer->BindCpuBuffer(), dstDesc,
1208 duBuffer->BindCpuBuffer(), duDesc,
1209 dvBuffer->BindCpuBuffer(), dvDesc,
1210 duuBuffer->BindCpuBuffer(), duuDesc,
1211 duvBuffer->BindCpuBuffer(), duvDesc,
1212 dvvBuffer->BindCpuBuffer(), dvvDesc,
1214 (
const PatchCoord*)patchCoords->BindCpuBuffer(),
1215 patchTable->GetFVarPatchArrayBuffer(fvarChannel),
1216 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1217 patchTable->GetFVarPatchParamBuffer(fvarChannel));
1226 static void Synchronize(
void *deviceContext = NULL);
1235 using namespace OPENSUBDIV_VERSION;
1240 #endif // OPENSUBDIV3_OSD_OMP_EVALUATOR_H
static void SetNumThreads(int numThreads)
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 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, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function with derivatives. This function has a same signature as other device kern...
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, const OmpEvaluator *instance=NULL, void *deviceContext=NULL)
Generic static eval stencils function. This function has a same signature as other device kernels hav...
static bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function with derivatives. This function has a same signature as other device kern...
static bool EvalPatchesFaceVarying(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, int fvarChannel, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static void Synchronize(void *deviceContext=NULL)
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, const OmpEvaluator *instance=NULL, void *deviceContext=NULL)
Generic static eval stencils function with derivatives. This function has a same signature as other d...
static bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, STENCIL_TABLE const *stencilTable, const OmpEvaluator *instance=NULL, void *deviceContext=NULL)
Generic static eval stencils function with derivatives. This function has a same signature as other d...
static bool EvalPatchesVarying(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, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, OmpEvaluator const *instance=NULL, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
Coordinates set on a patch table.