25 #ifndef OPENSUBDIV3_OSD_CUDA_EVALUATOR_H
26 #define OPENSUBDIV3_OSD_CUDA_EVALUATOR_H
28 #include "../version.h"
31 #include "../osd/bufferDescriptor.h"
32 #include "../osd/types.h"
34 namespace OpenSubdiv {
35 namespace OPENSUBDIV_VERSION {
40 class LimitStencilTable;
55 void *deviceContext = NULL) {
60 void *deviceContext = NULL) {
125 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
129 STENCIL_TABLE
const *stencilTable,
130 const void *instance = NULL,
131 void * deviceContext = NULL) {
135 return EvalStencils(srcBuffer->BindCudaBuffer(), srcDesc,
136 dstBuffer->BindCudaBuffer(), dstDesc,
137 (
int const *)stencilTable->GetSizesBuffer(),
138 (
int const *)stencilTable->GetOffsetsBuffer(),
139 (
int const *)stencilTable->GetIndicesBuffer(),
140 (
float const *)stencilTable->GetWeightsBuffer(),
142 stencilTable->GetNumStencils());
177 const float * weights,
217 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
223 STENCIL_TABLE
const *stencilTable,
225 void * deviceContext = NULL) {
230 return EvalStencils(srcBuffer->BindCudaBuffer(), srcDesc,
231 dstBuffer->BindCudaBuffer(), dstDesc,
232 duBuffer->BindCudaBuffer(), duDesc,
233 dvBuffer->BindCudaBuffer(), dvDesc,
234 (
int const *)stencilTable->GetSizesBuffer(),
235 (
int const *)stencilTable->GetOffsetsBuffer(),
236 (
int const *)stencilTable->GetIndicesBuffer(),
237 (
float const *)stencilTable->GetWeightsBuffer(),
238 (
float const *)stencilTable->GetDuWeightsBuffer(),
239 (
float const *)stencilTable->GetDvWeightsBuffer(),
241 stencilTable->GetNumStencils());
292 const float * weights,
293 const float * duWeights,
294 const float * dvWeights,
352 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
361 STENCIL_TABLE
const *stencilTable,
363 void * deviceContext = NULL) {
368 return EvalStencils(srcBuffer->BindCudaBuffer(), srcDesc,
369 dstBuffer->BindCudaBuffer(), dstDesc,
370 duBuffer->BindCudaBuffer(), duDesc,
371 dvBuffer->BindCudaBuffer(), dvDesc,
372 duuBuffer->BindCudaBuffer(), duuDesc,
373 duvBuffer->BindCudaBuffer(), duvDesc,
374 dvvBuffer->BindCudaBuffer(), dvvDesc,
375 (
int const *)stencilTable->GetSizesBuffer(),
376 (
int const *)stencilTable->GetOffsetsBuffer(),
377 (
int const *)stencilTable->GetIndicesBuffer(),
378 (
float const *)stencilTable->GetWeightsBuffer(),
379 (
float const *)stencilTable->GetDuWeightsBuffer(),
380 (
float const *)stencilTable->GetDvWeightsBuffer(),
381 (
float const *)stencilTable->GetDuuWeightsBuffer(),
382 (
float const *)stencilTable->GetDuvWeightsBuffer(),
383 (
float const *)stencilTable->GetDvvWeightsBuffer(),
385 stencilTable->GetNumStencils());
460 const float * weights,
461 const float * duWeights,
462 const float * dvWeights,
463 const float * duuWeights,
464 const float * duvWeights,
465 const float * dvvWeights,
502 template <
typename SRC_BUFFER,
typename DST_BUFFER,
503 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
508 PATCHCOORD_BUFFER *patchCoords,
509 PATCH_TABLE *patchTable,
511 void * deviceContext = NULL) {
516 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
517 dstBuffer->BindCudaBuffer(), dstDesc,
519 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
520 (
const PatchArray *)patchTable->GetPatchArrayBuffer(),
521 (
const int *)patchTable->GetPatchIndexBuffer(),
522 (
const PatchParam *)patchTable->GetPatchParamBuffer());
563 template <
typename SRC_BUFFER,
typename DST_BUFFER,
564 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
571 PATCHCOORD_BUFFER *patchCoords,
572 PATCH_TABLE *patchTable,
574 void * deviceContext = NULL) {
579 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
580 dstBuffer->BindCudaBuffer(), dstDesc,
581 duBuffer->BindCudaBuffer(), duDesc,
582 dvBuffer->BindCudaBuffer(), dvDesc,
584 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
585 (
const PatchArray *)patchTable->GetPatchArrayBuffer(),
586 (
const int *)patchTable->GetPatchIndexBuffer(),
587 (
const PatchParam *)patchTable->GetPatchParamBuffer());
646 template <
typename SRC_BUFFER,
typename DST_BUFFER,
647 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
657 PATCHCOORD_BUFFER *patchCoords,
658 PATCH_TABLE *patchTable,
660 void * deviceContext = NULL) {
665 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
666 dstBuffer->BindCudaBuffer(), dstDesc,
667 duBuffer->BindCudaBuffer(), duDesc,
668 dvBuffer->BindCudaBuffer(), dvDesc,
669 duuBuffer->BindCudaBuffer(), duuDesc,
670 duvBuffer->BindCudaBuffer(), duvDesc,
671 dvvBuffer->BindCudaBuffer(), dvvDesc,
673 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
674 (
const PatchArray *)patchTable->GetPatchArrayBuffer(),
675 (
const int *)patchTable->GetPatchIndexBuffer(),
676 (
const PatchParam *)patchTable->GetPatchParamBuffer());
712 const int *patchIndices,
760 const int *patchIndices,
826 const int *patchIndices,
857 template <
typename SRC_BUFFER,
typename DST_BUFFER,
858 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
863 PATCHCOORD_BUFFER *patchCoords,
864 PATCH_TABLE *patchTable,
866 void * deviceContext = NULL) {
871 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
872 dstBuffer->BindCudaBuffer(), dstDesc,
874 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
875 (
const PatchArray *)patchTable->GetVaryingPatchArrayBuffer(),
876 (
const int *)patchTable->GetVaryingPatchIndexBuffer(),
877 (
const PatchParam *)patchTable->GetPatchParamBuffer());
920 template <
typename SRC_BUFFER,
typename DST_BUFFER,
921 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
928 PATCHCOORD_BUFFER *patchCoords,
929 PATCH_TABLE *patchTable,
931 void * deviceContext = NULL) {
936 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
937 dstBuffer->BindCudaBuffer(), dstDesc,
938 duBuffer->BindCudaBuffer(), duDesc,
939 dvBuffer->BindCudaBuffer(), dvDesc,
941 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
942 (
const PatchArray *)patchTable->GetVaryingPatchArrayBuffer(),
943 (
const int *)patchTable->GetVaryingPatchIndexBuffer(),
944 (
const PatchParam *)patchTable->GetPatchParamBuffer());
1005 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1006 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1016 PATCHCOORD_BUFFER *patchCoords,
1017 PATCH_TABLE *patchTable,
1019 void * deviceContext = NULL) {
1022 (void)deviceContext;
1024 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
1025 dstBuffer->BindCudaBuffer(), dstDesc,
1026 duBuffer->BindCudaBuffer(), duDesc,
1027 dvBuffer->BindCudaBuffer(), dvDesc,
1028 duuBuffer->BindCudaBuffer(), duuDesc,
1029 duvBuffer->BindCudaBuffer(), duvDesc,
1030 dvvBuffer->BindCudaBuffer(), dvvDesc,
1032 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
1033 (
const PatchArray *)patchTable->GetVaryingPatchArrayBuffer(),
1034 (
const int *)patchTable->GetVaryingPatchIndexBuffer(),
1035 (
const PatchParam *)patchTable->GetPatchParamBuffer());
1068 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1069 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1074 PATCHCOORD_BUFFER *patchCoords,
1075 PATCH_TABLE *patchTable,
1078 void * deviceContext = NULL) {
1081 (void)deviceContext;
1083 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
1084 dstBuffer->BindCudaBuffer(), dstDesc,
1086 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
1087 (
const PatchArray *)patchTable->GetFVarPatchArrayBuffer(fvarChannel),
1088 (
const int *)patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1089 (
const PatchParam *)patchTable->GetFVarPatchParamBuffer(fvarChannel));
1134 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1135 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1142 PATCHCOORD_BUFFER *patchCoords,
1143 PATCH_TABLE *patchTable,
1146 void * deviceContext = NULL) {
1149 (void)deviceContext;
1151 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
1152 dstBuffer->BindCudaBuffer(), dstDesc,
1153 duBuffer->BindCudaBuffer(), duDesc,
1154 dvBuffer->BindCudaBuffer(), dvDesc,
1156 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
1157 (
const PatchArray *)patchTable->GetFVarPatchArrayBuffer(fvarChannel),
1158 (
const int *)patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1159 (
const PatchParam *)patchTable->GetFVarPatchParamBuffer(fvarChannel));
1222 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1223 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1233 PATCHCOORD_BUFFER *patchCoords,
1234 PATCH_TABLE *patchTable,
1237 void * deviceContext = NULL) {
1240 (void)deviceContext;
1242 return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
1243 dstBuffer->BindCudaBuffer(), dstDesc,
1244 duBuffer->BindCudaBuffer(), duDesc,
1245 dvBuffer->BindCudaBuffer(), dvDesc,
1246 duuBuffer->BindCudaBuffer(), duuDesc,
1247 duvBuffer->BindCudaBuffer(), duvDesc,
1248 dvvBuffer->BindCudaBuffer(), dvvDesc,
1250 (
const PatchCoord *)patchCoords->BindCudaBuffer(),
1251 (
const PatchArray *)patchTable->GetFVarPatchArrayBuffer(fvarChannel),
1252 (
const int *)patchTable->GetFVarPatchIndexBuffer(fvarChannel),
1253 (
const PatchParam *)patchTable->GetFVarPatchParamBuffer(fvarChannel));
1261 static void Synchronize(
void *deviceContext = NULL);
1268 using namespace OPENSUBDIV_VERSION;
1273 #endif // OPENSUBDIV3_OSD_CUDA_EVALUATOR_H
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, CudaEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
CudaStencilTable(Far::StencilTable const *stencilTable)
static bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, CudaEvaluator const *instance, 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 CudaEvaluator *instance=NULL, void *deviceContext=NULL)
Generic static eval stencils function with derivatives. This function has a same signature as other d...
void * GetIndicesBuffer() const
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 void Synchronize(void *deviceContext=NULL)
Limit stencil table class wrapping the template for compatibility.
void * GetDvvWeightsBuffer() const
void * GetDuWeightsBuffer() const
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, CudaEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
void * GetDvWeightsBuffer() const
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, CudaEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, CudaEvaluator const *instance, 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 void *instance=NULL, void *deviceContext=NULL)
Generic static compute function. This function has a same signature as other device kernels have so t...
void * GetSizesBuffer() const
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, CudaEvaluator const *instance, 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, 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, CudaEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function with derivatives. This function has a same signature as other device kern...
int GetNumStencils() const
static CudaStencilTable * Create(Far::StencilTable const *stencilTable, void *deviceContext=NULL)
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, CudaEvaluator const *instance, void *deviceContext=NULL)
Generic limit eval function with derivatives. This function has a same signature as other device kern...
void * GetDuuWeightsBuffer() const
void * GetOffsetsBuffer() const
void * GetWeightsBuffer() const
static CudaStencilTable * Create(Far::LimitStencilTable const *limitStencilTable, void *deviceContext=NULL)
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, CudaEvaluator const *instance, 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, STENCIL_TABLE const *stencilTable, const CudaEvaluator *instance=NULL, void *deviceContext=NULL)
Generic static eval stencils function with derivatives. This function has a same signature as other d...
Stencil table class wrapping the template for compatibility.
void * GetDuvWeightsBuffer() const
Coordinates set on a patch table.