25#ifndef OPENSUBDIV3_OSD_CL_EVALUATOR_H
26#define OPENSUBDIV3_OSD_CL_EVALUATOR_H
28#include "../version.h"
30#include "../osd/opencl.h"
31#include "../osd/types.h"
32#include "../osd/bufferDescriptor.h"
35namespace OPENSUBDIV_VERSION {
40 class LimitStencilTable;
54 template <
typename DEVICE_CONTEXT>
56 DEVICE_CONTEXT context) {
60 template <
typename DEVICE_CONTEXT>
63 DEVICE_CONTEXT context) {
64 return new CLStencilTable(limitStencilTable, context->GetContext());
68 cl_context clContext);
70 cl_context clContext);
105 template <
typename DEVICE_CONTEXT>
110 DEVICE_CONTEXT deviceContext) {
111 return Create(srcDesc, dstDesc, duDesc, dvDesc,
112 deviceContext->GetContext(),
113 deviceContext->GetCommandQueue());
120 cl_context clContext,
121 cl_command_queue clCommandQueue) {
123 if (instance->
Compile(srcDesc, dstDesc, duDesc, dvDesc))
130 template <
typename DEVICE_CONTEXT>
138 DEVICE_CONTEXT deviceContext) {
139 return Create(srcDesc, dstDesc, duDesc, dvDesc,
140 duuDesc, duvDesc, dvvDesc,
141 deviceContext->GetContext(),
142 deviceContext->GetCommandQueue());
152 cl_context clContext,
153 cl_command_queue clCommandQueue) {
155 if (instance->
Compile(srcDesc, dstDesc, duDesc, dvDesc,
156 duuDesc, duvDesc, dvvDesc))
217 template <
typename SRC_BUFFER,
typename DST_BUFFER,
218 typename STENCIL_TABLE,
typename DEVICE_CONTEXT>
222 STENCIL_TABLE
const *stencilTable,
224 DEVICE_CONTEXT deviceContext,
225 unsigned int numStartEvents=0,
226 const cl_event* startEvents=NULL,
227 cl_event* endEvent=NULL) {
233 numStartEvents, startEvents, endEvent);
236 instance =
Create(srcDesc, dstDesc,
244 numStartEvents, startEvents, endEvent);
307 template <
typename SRC_BUFFER,
typename DST_BUFFER,
308 typename STENCIL_TABLE,
typename DEVICE_CONTEXT>
314 STENCIL_TABLE
const *stencilTable,
316 DEVICE_CONTEXT deviceContext,
317 unsigned int numStartEvents=0,
318 const cl_event* startEvents=NULL,
319 cl_event* endEvent=NULL) {
327 numStartEvents, startEvents, endEvent);
330 instance =
Create(srcDesc, dstDesc, duDesc, dvDesc,
338 numStartEvents, startEvents, endEvent);
419 template <
typename SRC_BUFFER,
typename DST_BUFFER,
420 typename STENCIL_TABLE,
typename DEVICE_CONTEXT>
429 STENCIL_TABLE
const *stencilTable,
431 DEVICE_CONTEXT deviceContext,
432 unsigned int numStartEvents=0,
433 const cl_event* startEvents=NULL,
434 cl_event* endEvent=NULL) {
445 numStartEvents, startEvents, endEvent);
448 instance =
Create(srcDesc, dstDesc,
450 duuDesc, duvDesc, dvvDesc,
461 numStartEvents, startEvents, endEvent);
499 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
503 STENCIL_TABLE
const *stencilTable,
504 unsigned int numStartEvents=0,
505 const cl_event* startEvents=NULL,
506 cl_event* endEvent=NULL)
const {
507 return EvalStencils(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
508 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
509 stencilTable->GetSizesBuffer(),
510 stencilTable->GetOffsetsBuffer(),
511 stencilTable->GetIndicesBuffer(),
512 stencilTable->GetWeightsBuffer(),
514 stencilTable->GetNumStencils(),
515 numStartEvents, startEvents, endEvent);
560 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
566 STENCIL_TABLE
const *stencilTable,
567 unsigned int numStartEvents=0,
568 const cl_event* startEvents=NULL,
569 cl_event* endEvent=NULL)
const {
570 return EvalStencils(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
571 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
572 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
573 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
574 stencilTable->GetSizesBuffer(),
575 stencilTable->GetOffsetsBuffer(),
576 stencilTable->GetIndicesBuffer(),
577 stencilTable->GetWeightsBuffer(),
578 stencilTable->GetDuWeightsBuffer(),
579 stencilTable->GetDvWeightsBuffer(),
581 stencilTable->GetNumStencils(),
582 numStartEvents, startEvents, endEvent);
645 template <
typename SRC_BUFFER,
typename DST_BUFFER,
typename STENCIL_TABLE>
654 STENCIL_TABLE
const *stencilTable,
655 unsigned int numStartEvents=0,
656 const cl_event* startEvents=NULL,
657 cl_event* endEvent=NULL)
const {
658 return EvalStencils(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
659 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
660 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
661 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
662 duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
663 duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
664 dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
665 stencilTable->GetSizesBuffer(),
666 stencilTable->GetOffsetsBuffer(),
667 stencilTable->GetIndicesBuffer(),
668 stencilTable->GetWeightsBuffer(),
669 stencilTable->GetDuWeightsBuffer(),
670 stencilTable->GetDvWeightsBuffer(),
671 stencilTable->GetDuuWeightsBuffer(),
672 stencilTable->GetDuvWeightsBuffer(),
673 stencilTable->GetDvvWeightsBuffer(),
675 stencilTable->GetNumStencils(),
676 numStartEvents, startEvents, endEvent);
689 unsigned int numStartEvents=0,
690 const cl_event* startEvents=NULL,
691 cl_event* endEvent=NULL)
const;
753 unsigned int numStartEvents=0,
754 const cl_event* startEvents=NULL,
755 cl_event* endEvent=NULL)
const;
841 unsigned int numStartEvents=0,
842 const cl_event* startEvents=NULL,
843 cl_event* endEvent=NULL)
const;
899 template <
typename SRC_BUFFER,
typename DST_BUFFER,
900 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
901 typename DEVICE_CONTEXT>
906 PATCHCOORD_BUFFER *patchCoords,
907 PATCH_TABLE *patchTable,
909 DEVICE_CONTEXT deviceContext,
910 unsigned int numStartEvents=0,
911 const cl_event* startEvents=NULL,
912 cl_event* endEvent=NULL) {
917 numPatchCoords, patchCoords,
919 numStartEvents, startEvents, endEvent);
923 instance =
Create(srcDesc, dstDesc,
930 numPatchCoords, patchCoords,
932 numStartEvents, startEvents, endEvent);
1000 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1001 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
1002 typename DEVICE_CONTEXT>
1009 PATCHCOORD_BUFFER *patchCoords,
1010 PATCH_TABLE *patchTable,
1012 DEVICE_CONTEXT deviceContext,
1013 unsigned int numStartEvents=0,
1014 const cl_event* startEvents=NULL,
1015 cl_event* endEvent=NULL) {
1022 numPatchCoords, patchCoords,
1024 numStartEvents, startEvents, endEvent);
1027 (void)deviceContext;
1028 instance =
Create(srcDesc, dstDesc, duDesc, dvDesc, deviceContext);
1030 bool r = instance->
EvalPatches(srcBuffer, srcDesc,
1034 numPatchCoords, patchCoords,
1036 numStartEvents, startEvents, endEvent);
1122 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1123 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
1124 typename DEVICE_CONTEXT>
1134 PATCHCOORD_BUFFER *patchCoords,
1135 PATCH_TABLE *patchTable,
1137 DEVICE_CONTEXT deviceContext,
1138 unsigned int numStartEvents=0,
1139 const cl_event* startEvents=NULL,
1140 cl_event* endEvent=NULL) {
1150 numPatchCoords, patchCoords,
1152 numStartEvents, startEvents, endEvent);
1155 (void)deviceContext;
1156 instance =
Create(srcDesc, dstDesc,
1158 duuDesc, duvDesc, dvvDesc,
1161 bool r = instance->
EvalPatches(srcBuffer, srcDesc,
1168 numPatchCoords, patchCoords,
1170 numStartEvents, startEvents, endEvent);
1215 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1216 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1221 PATCHCOORD_BUFFER *patchCoords,
1222 PATCH_TABLE *patchTable,
1223 unsigned int numStartEvents=0,
1224 const cl_event* startEvents=NULL,
1225 cl_event* endEvent=NULL)
const {
1227 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
1228 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
1232 patchCoords->BindCLBuffer(_clCommandQueue),
1233 patchTable->GetPatchArrayBuffer(),
1234 patchTable->GetPatchIndexBuffer(),
1235 patchTable->GetPatchParamBuffer(),
1236 numStartEvents, startEvents, endEvent);
1286 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1287 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1294 PATCHCOORD_BUFFER *patchCoords,
1295 PATCH_TABLE *patchTable,
1296 unsigned int numStartEvents=0,
1297 const cl_event* startEvents=NULL,
1298 cl_event* endEvent=NULL)
const {
1300 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
1301 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
1302 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
1303 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
1305 patchCoords->BindCLBuffer(_clCommandQueue),
1306 patchTable->GetPatchArrayBuffer(),
1307 patchTable->GetPatchIndexBuffer(),
1308 patchTable->GetPatchParamBuffer(),
1309 numStartEvents, startEvents, endEvent);
1377 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1378 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1388 PATCHCOORD_BUFFER *patchCoords,
1389 PATCH_TABLE *patchTable,
1390 unsigned int numStartEvents=0,
1391 const cl_event* startEvents=NULL,
1392 cl_event* endEvent=NULL)
const {
1394 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
1395 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
1396 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
1397 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
1398 duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
1399 duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
1400 dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
1402 patchCoords->BindCLBuffer(_clCommandQueue),
1403 patchTable->GetPatchArrayBuffer(),
1404 patchTable->GetPatchIndexBuffer(),
1405 patchTable->GetPatchParamBuffer(),
1406 numStartEvents, startEvents, endEvent);
1414 cl_mem patchCoordsBuffer,
1415 cl_mem patchArrayBuffer,
1416 cl_mem patchIndexBuffer,
1417 cl_mem patchParamsBuffer,
1418 unsigned int numStartEvents=0,
1419 const cl_event* startEvents=NULL,
1420 cl_event* endEvent=NULL)
const;
1430 cl_mem patchCoordsBuffer,
1431 cl_mem patchArrayBuffer,
1432 cl_mem patchIndexBuffer,
1433 cl_mem patchParamsBuffer,
1434 unsigned int numStartEvents=0,
1435 const cl_event* startEvents=NULL,
1436 cl_event* endEvent=NULL)
const;
1486 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1487 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
1488 typename DEVICE_CONTEXT>
1493 PATCHCOORD_BUFFER *patchCoords,
1494 PATCH_TABLE *patchTable,
1496 DEVICE_CONTEXT deviceContext,
1497 unsigned int numStartEvents=0,
1498 const cl_event* startEvents=NULL,
1499 cl_event* endEvent=NULL) {
1505 numPatchCoords, patchCoords,
1507 numStartEvents, startEvents, endEvent);
1510 (void)deviceContext;
1511 instance =
Create(srcDesc, dstDesc,
1519 numPatchCoords, patchCoords,
1521 numStartEvents, startEvents, endEvent);
1566 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1567 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1572 PATCHCOORD_BUFFER *patchCoords,
1573 PATCH_TABLE *patchTable,
1574 unsigned int numStartEvents=0,
1575 const cl_event* startEvents=NULL,
1576 cl_event* endEvent=NULL)
const {
1578 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
1579 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
1583 patchCoords->BindCLBuffer(_clCommandQueue),
1584 patchTable->GetVaryingPatchArrayBuffer(),
1585 patchTable->GetVaryingPatchIndexBuffer(),
1586 patchTable->GetPatchParamBuffer(),
1587 numStartEvents, startEvents, endEvent);
1650 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1651 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
1652 typename DEVICE_CONTEXT>
1659 PATCHCOORD_BUFFER *patchCoords,
1660 PATCH_TABLE *patchTable,
1662 DEVICE_CONTEXT deviceContext,
1663 unsigned int numStartEvents=0,
1664 const cl_event* startEvents=NULL,
1665 cl_event* endEvent=NULL) {
1673 numPatchCoords, patchCoords,
1675 numStartEvents, startEvents, endEvent);
1678 (void)deviceContext;
1679 instance =
Create(srcDesc, dstDesc,
1688 numPatchCoords, patchCoords,
1690 numStartEvents, startEvents, endEvent);
1747 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1748 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1755 PATCHCOORD_BUFFER *patchCoords,
1756 PATCH_TABLE *patchTable,
1757 unsigned int numStartEvents=0,
1758 const cl_event* startEvents=NULL,
1759 cl_event* endEvent=NULL)
const {
1761 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
1762 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
1763 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
1764 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
1766 patchCoords->BindCLBuffer(_clCommandQueue),
1767 patchTable->GetVaryingPatchArrayBuffer(),
1768 patchTable->GetVaryingPatchIndexBuffer(),
1769 patchTable->GetPatchParamBuffer(),
1770 numStartEvents, startEvents, endEvent);
1851 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1852 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
1853 typename DEVICE_CONTEXT>
1863 PATCHCOORD_BUFFER *patchCoords,
1864 PATCH_TABLE *patchTable,
1866 DEVICE_CONTEXT deviceContext,
1867 unsigned int numStartEvents=0,
1868 const cl_event* startEvents=NULL,
1869 cl_event* endEvent=NULL) {
1880 numPatchCoords, patchCoords,
1882 numStartEvents, startEvents, endEvent);
1885 (void)deviceContext;
1886 instance =
Create(srcDesc, dstDesc,
1888 duuDesc, duvDesc, dvvDesc,
1899 numPatchCoords, patchCoords,
1901 numStartEvents, startEvents, endEvent);
1976 template <
typename SRC_BUFFER,
typename DST_BUFFER,
1977 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
1987 PATCHCOORD_BUFFER *patchCoords,
1988 PATCH_TABLE *patchTable,
1989 unsigned int numStartEvents=0,
1990 const cl_event* startEvents=NULL,
1991 cl_event* endEvent=NULL)
const {
1993 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
1994 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
1995 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
1996 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
1997 duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
1998 duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
1999 dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
2001 patchCoords->BindCLBuffer(_clCommandQueue),
2002 patchTable->GetVaryingPatchArrayBuffer(),
2003 patchTable->GetVaryingPatchIndexBuffer(),
2004 patchTable->GetPatchParamBuffer(),
2005 numStartEvents, startEvents, endEvent);
2058 template <
typename SRC_BUFFER,
typename DST_BUFFER,
2059 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
2060 typename DEVICE_CONTEXT>
2065 PATCHCOORD_BUFFER *patchCoords,
2066 PATCH_TABLE *patchTable,
2069 DEVICE_CONTEXT deviceContext,
2070 unsigned int numStartEvents=0,
2071 const cl_event* startEvents=NULL,
2072 cl_event* endEvent=NULL) {
2078 numPatchCoords, patchCoords,
2079 patchTable, fvarChannel,
2080 numStartEvents, startEvents, endEvent);
2083 (void)deviceContext;
2084 instance =
Create(srcDesc, dstDesc,
2092 numPatchCoords, patchCoords,
2093 patchTable, fvarChannel,
2094 numStartEvents, startEvents, endEvent);
2141 template <
typename SRC_BUFFER,
typename DST_BUFFER,
2142 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
2147 PATCHCOORD_BUFFER *patchCoords,
2148 PATCH_TABLE *patchTable,
2149 int fvarChannel = 0,
2150 unsigned int numStartEvents=0,
2151 const cl_event* startEvents=NULL,
2152 cl_event* endEvent=NULL)
const {
2154 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
2155 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
2159 patchCoords->BindCLBuffer(_clCommandQueue),
2160 patchTable->GetFVarPatchArrayBuffer(fvarChannel),
2161 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
2162 patchTable->GetFVarPatchParamBuffer(fvarChannel),
2163 numStartEvents, startEvents, endEvent);
2228 template <
typename SRC_BUFFER,
typename DST_BUFFER,
2229 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
2230 typename DEVICE_CONTEXT>
2237 PATCHCOORD_BUFFER *patchCoords,
2238 PATCH_TABLE *patchTable,
2241 DEVICE_CONTEXT deviceContext,
2242 unsigned int numStartEvents=0,
2243 const cl_event* startEvents=NULL,
2244 cl_event* endEvent=NULL) {
2252 numPatchCoords, patchCoords,
2253 patchTable, fvarChannel,
2254 numStartEvents, startEvents, endEvent);
2257 (void)deviceContext;
2258 instance =
Create(srcDesc, dstDesc,
2259 duDesc, dvDesc, deviceContext);
2266 numPatchCoords, patchCoords,
2267 patchTable, fvarChannel,
2268 numStartEvents, startEvents, endEvent);
2327 template <
typename SRC_BUFFER,
typename DST_BUFFER,
2328 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
2335 PATCHCOORD_BUFFER *patchCoords,
2336 PATCH_TABLE *patchTable,
2337 int fvarChannel = 0,
2338 unsigned int numStartEvents=0,
2339 const cl_event* startEvents=NULL,
2340 cl_event* endEvent=NULL)
const {
2342 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
2343 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
2344 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
2345 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
2347 patchCoords->BindCLBuffer(_clCommandQueue),
2348 patchTable->GetFVarPatchArrayBuffer(fvarChannel),
2349 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
2350 patchTable->GetFVarPatchParamBuffer(fvarChannel),
2351 numStartEvents, startEvents, endEvent);
2434 template <
typename SRC_BUFFER,
typename DST_BUFFER,
2435 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE,
2436 typename DEVICE_CONTEXT>
2446 PATCHCOORD_BUFFER *patchCoords,
2447 PATCH_TABLE *patchTable,
2450 DEVICE_CONTEXT deviceContext,
2451 unsigned int numStartEvents=0,
2452 const cl_event* startEvents=NULL,
2453 cl_event* endEvent=NULL) {
2464 numPatchCoords, patchCoords,
2465 patchTable, fvarChannel,
2466 numStartEvents, startEvents, endEvent);
2469 (void)deviceContext;
2470 instance =
Create(srcDesc, dstDesc,
2472 duuDesc, duvDesc, dvvDesc,
2483 numPatchCoords, patchCoords,
2484 patchTable, fvarChannel,
2485 numStartEvents, startEvents, endEvent);
2562 template <
typename SRC_BUFFER,
typename DST_BUFFER,
2563 typename PATCHCOORD_BUFFER,
typename PATCH_TABLE>
2573 PATCHCOORD_BUFFER *patchCoords,
2574 PATCH_TABLE *patchTable,
2575 int fvarChannel = 0,
2576 unsigned int numStartEvents=0,
2577 const cl_event* startEvents=NULL,
2578 cl_event* endEvent=NULL)
const {
2580 return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
2581 dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
2582 duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
2583 dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
2584 duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
2585 duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
2586 dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
2588 patchCoords->BindCLBuffer(_clCommandQueue),
2589 patchTable->GetFVarPatchArrayBuffer(fvarChannel),
2590 patchTable->GetFVarPatchIndexBuffer(fvarChannel),
2591 patchTable->GetFVarPatchParamBuffer(fvarChannel),
2592 numStartEvents, startEvents, endEvent);
2612 template <
typename DEVICE_CONTEXT>
2620 cl_context _clContext;
2621 cl_command_queue _clCommandQueue;
2622 cl_program _program;
2623 cl_kernel _stencilKernel;
2624 cl_kernel _stencilDerivKernel;
2625 cl_kernel _patchKernel;
2631using namespace OPENSUBDIV_VERSION;
Stencil table class wrapping the template for compatibility.
Limit stencil table class wrapping the template for compatibility.
BufferDescriptor is a struct which describes buffer elements in interleaved data buffers....
cl_mem GetDvvWeightsBuffer() const
CLStencilTable(Far::StencilTable const *stencilTable, cl_context clContext)
cl_mem GetOffsetsBuffer() const
static CLStencilTable * Create(Far::LimitStencilTable const *limitStencilTable, DEVICE_CONTEXT context)
cl_mem GetIndicesBuffer() const
int GetNumStencils() const
cl_mem GetSizesBuffer() const
cl_mem GetDuuWeightsBuffer() const
cl_mem GetDvWeightsBuffer() const
cl_mem GetDuvWeightsBuffer() const
cl_mem GetDuWeightsBuffer() const
static CLStencilTable * Create(Far::StencilTable const *stencilTable, DEVICE_CONTEXT context)
CLStencilTable(Far::LimitStencilTable const *limitStencilTable, cl_context clContext)
cl_mem GetWeightsBuffer() const
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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
static void Synchronize(cl_command_queue queue)
~CLEvaluator()
Destructor.
bool EvalStencils(cl_mem src, BufferDescriptor const &srcDesc, cl_mem dst, BufferDescriptor const &dstDesc, cl_mem du, BufferDescriptor const &duDesc, cl_mem dv, BufferDescriptor const &dvDesc, cl_mem sizes, cl_mem offsets, cl_mem indices, cl_mem weights, cl_mem duWeights, cl_mem dvWeights, int start, int end, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Dispatch the CL compute kernel asynchronously. returns false if the kernel hasn't been compiled yet.
static bool EvalStencils(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, STENCIL_TABLE const *stencilTable, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
static CLEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, cl_context clContext, cl_command_queue clCommandQueue)
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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalPatches(cl_mem src, BufferDescriptor const &srcDesc, cl_mem dst, BufferDescriptor const &dstDesc, cl_mem du, BufferDescriptor const &duDesc, cl_mem dv, BufferDescriptor const &dvDesc, int numPatchCoords, cl_mem patchCoordsBuffer, cl_mem patchArrayBuffer, cl_mem patchIndexBuffer, cl_mem patchParamsBuffer, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
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, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) 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, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Generic stencil function.
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, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Generic limit eval function with derivatives. This function has a same signature as other device kern...
static CLEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, DEVICE_CONTEXT deviceContext)
Generic creator template.
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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static CLEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, BufferDescriptor const &duuDesc, BufferDescriptor const &duvDesc, BufferDescriptor const &dvvDesc, DEVICE_CONTEXT deviceContext)
Generic creator template.
bool EvalPatches(cl_mem src, BufferDescriptor const &srcDesc, cl_mem dst, BufferDescriptor const &dstDesc, cl_mem du, BufferDescriptor const &duDesc, cl_mem dv, BufferDescriptor const &dvDesc, cl_mem duu, BufferDescriptor const &duuDesc, cl_mem duv, BufferDescriptor const &duvDesc, cl_mem dvv, BufferDescriptor const &dvvDesc, int numPatchCoords, cl_mem patchCoordsBuffer, cl_mem patchArrayBuffer, cl_mem patchIndexBuffer, cl_mem patchParamsBuffer, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
bool EvalStencils(cl_mem src, BufferDescriptor const &srcDesc, cl_mem dst, BufferDescriptor const &dstDesc, cl_mem du, BufferDescriptor const &duDesc, cl_mem dv, BufferDescriptor const &dvDesc, cl_mem duu, BufferDescriptor const &duuDesc, cl_mem duv, BufferDescriptor const &duvDesc, cl_mem dvv, BufferDescriptor const &dvvDesc, cl_mem sizes, cl_mem offsets, cl_mem indices, cl_mem weights, cl_mem duWeights, cl_mem dvWeights, cl_mem duuWeights, cl_mem duvWeights, cl_mem dvvWeights, int start, int end, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Dispatch the CL compute kernel asynchronously. returns false if the kernel hasn't been compiled yet.
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=0, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalPatches(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) 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, DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc, DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc, DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc, STENCIL_TABLE const *stencilTable, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Generic stencil function.
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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static void Synchronize(DEVICE_CONTEXT deviceContext)
Wait the OpenCL kernels finish.
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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic static stencil function. This function has a same signature as other device kernels have so t...
bool EvalStencils(cl_mem src, BufferDescriptor const &srcDesc, cl_mem dst, BufferDescriptor const &dstDesc, cl_mem sizes, cl_mem offsets, cl_mem indices, cl_mem weights, int start, int end, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
static bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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=0, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
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, 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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
static CLEvaluator * Create(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, BufferDescriptor const &duuDesc, BufferDescriptor const &duvDesc, BufferDescriptor const &dvvDesc, cl_context clContext, cl_command_queue clCommandQueue)
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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
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, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
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, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
Generic limit eval function. This function has a same signature as other device kernels have so that ...
bool EvalPatchesVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
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, CLEvaluator const *instance, DEVICE_CONTEXT deviceContext, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL)
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, STENCIL_TABLE const *stencilTable, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Generic stencil function.
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, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Generic limit eval function with derivatives. This function has a same signature as other device kern...
CLEvaluator(cl_context context, cl_command_queue queue)
Constructor.
bool Compile(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc=BufferDescriptor(), BufferDescriptor const &dvDesc=BufferDescriptor(), BufferDescriptor const &duuDesc=BufferDescriptor(), BufferDescriptor const &duvDesc=BufferDescriptor(), BufferDescriptor const &dvvDesc=BufferDescriptor())
bool EvalPatchesFaceVarying(SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, int numPatchCoords, PATCHCOORD_BUFFER *patchCoords, PATCH_TABLE *patchTable, int fvarChannel=0, unsigned int numStartEvents=0, const cl_event *startEvents=NULL, cl_event *endEvent=NULL) const
Generic limit eval function. This function has a same signature as other device kernels have so that ...