Updated doxygen comments for Osd Evaluator classes

This commit is contained in:
David G Yu 2017-01-26 14:35:16 -08:00
parent 044b25e818
commit 432b6b235f
7 changed files with 523 additions and 313 deletions

View File

@ -22,8 +22,8 @@
// language governing permissions and limitations under the Apache License.
//
#ifndef OPENSUBDIV_OPENSUBDIV3_OSD_CL_EVALUATOR_H
#define OPENSUBDIV_OPENSUBDIV3_OSD_CL_EVALUATOR_H
#ifndef OPENSUBDIV3_OSD_CL_EVALUATOR_H
#define OPENSUBDIV3_OSD_CL_EVALUATOR_H
#include "../version.h"
@ -35,7 +35,9 @@ namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
namespace Far {
class PatchTable;
class StencilTable;
class LimitStencilTable;
}
namespace Osd {
@ -69,13 +71,13 @@ public:
~CLStencilTable();
// interfaces needed for CLComputeKernel
cl_mem GetSizesBuffer() const { return _sizes; }
cl_mem GetOffsetsBuffer() const { return _offsets; }
cl_mem GetIndicesBuffer() const { return _indices; }
cl_mem GetWeightsBuffer() const { return _weights; }
cl_mem GetDuWeightsBuffer() const { return _duWeights; }
cl_mem GetDvWeightsBuffer() const { return _dvWeights; }
int GetNumStencils() const { return _numStencils; }
cl_mem GetSizesBuffer() const { return _sizes; }
cl_mem GetOffsetsBuffer() const { return _offsets; }
cl_mem GetIndicesBuffer() const { return _indices; }
cl_mem GetWeightsBuffer() const { return _weights; }
cl_mem GetDuWeightsBuffer() const { return _duWeights; }
cl_mem GetDvWeightsBuffer() const { return _dvWeights; }
int GetNumStencils() const { return _numStencils; }
private:
cl_mem _sizes;
@ -92,11 +94,6 @@ private:
class CLEvaluator {
public:
typedef bool Instantiatable;
/// Constructor.
CLEvaluator(cl_context context, cl_command_queue queue);
/// Destructor.
~CLEvaluator();
/// Generic creator template.
template <typename DEVICE_CONTEXT>
@ -116,19 +113,26 @@ public:
BufferDescriptor const &dvDesc,
cl_context clContext,
cl_command_queue clCommandQueue) {
CLEvaluator *kernel = new CLEvaluator(clContext, clCommandQueue);
if (kernel->Compile(srcDesc, dstDesc, duDesc, dvDesc)) return kernel;
delete kernel;
CLEvaluator *instance = new CLEvaluator(clContext, clCommandQueue);
if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc))
return instance;
delete instance;
return NULL;
}
/// Constructor.
CLEvaluator(cl_context context, cl_command_queue queue);
/// Destructor.
~CLEvaluator();
/// ----------------------------------------------------------------------
///
/// Stencil evaluations with StencilTable
///
/// ----------------------------------------------------------------------
/// \brief Generic static compute function. This function has a same
/// \brief Generic static stencil function. This function has a same
/// signature as other device kernels have so that it can be called
/// transparently from OsdMesh template interface.
///
@ -165,7 +169,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -206,7 +210,7 @@ public:
}
}
/// \brief Generic static compute function. This function has a same
/// \brief Generic static stencil function. This function has a same
/// signature as other device kernels have so that it can be called
/// transparently from OsdMesh template interface.
///
@ -222,17 +226,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivative buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCLBuffer() method returning the
/// cl_mem object for du results to be written
///
/// @param duDesc vertex buffer descriptor for the du output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivative buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCLBuffer() method returning the
/// cl_mem object for dv results to be written
///
/// @param dvDesc vertex buffer descriptor for the dv output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable stencil table to be applied. The table must have
/// SSBO interfaces.
@ -255,7 +259,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -266,8 +270,8 @@ public:
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 *duBuffer, BufferDescriptor const &duDesc,
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
STENCIL_TABLE const *stencilTable,
CLEvaluator const *instance,
DEVICE_CONTEXT deviceContext,
@ -300,9 +304,36 @@ public:
}
}
/// Generic compute function.
/// Dispatch the CL compute kernel asynchronously.
/// Returns false if the kernel hasn't been compiled yet.
/// \brief Generic stencil function.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindCLBuffer() method returning the
/// cl_mem object for read
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindCLBuffer() method returning the
/// cl_mem object for results to be written
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param stencilTable stencil table to be applied. The table must have
/// SSBO interfaces.
///
/// @param numStartEvents the number of events in the array pointed to by
/// startEvents.
///
/// @param startEvents points to an array of cl_event which will determine
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
/// clReleaseEvent(). NULL if not required.
///
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
bool EvalStencils(
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
@ -322,9 +353,48 @@ public:
numStartEvents, startEvents, endEvent);
}
/// Generic compute function.
/// Dispatch the CL compute kernel asynchronously.
/// Returns false if the kernel hasn't been compiled yet.
/// \brief Generic stencil function.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindCLBuffer() method returning the
/// cl_mem object for read
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindCLBuffer() method returning the
/// cl_mem object for results to be written
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCLBuffer() method returning the
/// cl_mem object for du results to be written
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCLBuffer() method returning the
/// cl_mem object for dv results to be written
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable stencil table to be applied. The table must have
/// SSBO interfaces.
///
/// @param numStartEvents the number of events in the array pointed to by
/// startEvents.
///
/// @param startEvents points to an array of cl_event which will determine
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
/// clReleaseEvent(). NULL if not required.
///
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
bool EvalStencils(
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
@ -364,8 +434,54 @@ public:
const cl_event* startEvents=NULL,
cl_event* endEvent=NULL) const;
/// Dispatch the CL compute kernel asynchronously.
/// \brief Dispatch the CL compute kernel asynchronously.
/// returns false if the kernel hasn't been compiled yet.
///
/// @param src CL buffer of input primvar source data
///
/// @param srcDesc vertex buffer descriptor for the srcBuffer
///
/// @param dst CL buffer of output primvar destination data
///
/// @param dstDesc vertex buffer descriptor for the dstBuffer
///
/// @param du CL buffer of output derivative wrt u
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv CL buffer of output derivative wrt v
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param sizes CL buffer of the sizes in the stencil table
///
/// @param offsets CL buffer of the offsets in the stencil table
///
/// @param indices CL buffer of the indices in the stencil table
///
/// @param weights CL buffer of the weights in the stencil table
///
/// @param duWeights CL buffer of the du weights in the stencil table
///
/// @param dvWeights CL buffer of the dv weights in the stencil table
///
/// @param start start index of stencil table
///
/// @param end end index of stencil table
///
/// @param numStartEvents the number of events in the array pointed to by
/// startEvents.
///
/// @param startEvents points to an array of cl_event which will determine
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
/// clReleaseEvent(). NULL if not required.
///
bool EvalStencils(cl_mem src, BufferDescriptor const &srcDesc,
cl_mem dst, BufferDescriptor const &dstDesc,
cl_mem du, BufferDescriptor const &duDesc,
@ -387,7 +503,7 @@ public:
/// Limit evaluations with PatchTable
///
/// ----------------------------------------------------------------------
///
/// \brief Generic limit eval function. This function has a same
/// signature as other device kernels have so that it can be called
/// in the same way.
@ -430,7 +546,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -493,13 +609,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCLBuffer() method returning a CL
/// buffer object of destination data
///
/// @param duDesc
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCLBuffer() method returning a CL
/// buffer object of destination data
///
/// @param dvDesc
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param numPatchCoords number of patchCoords.
///
@ -527,7 +647,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -608,7 +728,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -654,15 +774,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivatives buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCLBuffer() method returning a CL
/// buffer object of destination data of Du
/// buffer object of destination data
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivatives buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCLBuffer() method returning a CL
/// buffer object of destination data of Dv
/// buffer object of destination data
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
@ -672,18 +792,18 @@ public:
///
/// @param patchTable CLPatchTable or equivalent
///
/// @param numStartEvents the number of events in the array pointed to by
/// startEvents.
/// @param numStartEvents the number of events in the array pointed to by
/// startEvents.
///
/// @param startEvents points to an array of cl_event which will determine
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
/// @param startEvents points to an array of cl_event which will determine
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
/// clReleaseEvent(). NULL if not required.
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
/// clReleaseEvent(). NULL if not required.
///
template <typename SRC_BUFFER, typename DST_BUFFER,
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
@ -766,7 +886,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -846,7 +966,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -920,7 +1040,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -1003,7 +1123,7 @@ public:
/// when it is safe for the OpenCL device to begin work
/// or NULL if it can begin immediately.
///
/// @param endEvent pointer to a cl_event which will recieve a copy of
/// @param endEvent pointer to a cl_event which will receive a copy of
/// the cl_event which indicates when all work for this
/// call has completed. This cl_event has an incremented
/// reference count and should be released via
@ -1064,7 +1184,6 @@ private:
cl_kernel _patchKernel;
};
} // end namespace Osd
} // end namespace OPENSUBDIV_VERSION
@ -1073,4 +1192,4 @@ using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif // OPENSUBDIV_OPENSUBDIV3_OSD_CL_EVALUATOR_H
#endif // OPENSUBDIV3_OSD_CL_EVALUATOR_H

View File

@ -26,11 +26,11 @@
#define OPENSUBDIV3_OSD_CPU_EVALUATOR_H
#include "../version.h"
#include <cstddef>
#include "../osd/bufferDescriptor.h"
#include "../osd/types.h"
#include <cstddef>
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
@ -107,7 +107,6 @@ public:
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param sizes pointer to the sizes buffer of the stencil table
/// to apply for the range [start, end)
///
/// @param offsets pointer to the offsets buffer of the stencil table
///
@ -120,8 +119,8 @@ public:
/// @param end end index of stencil table
///
static bool EvalStencils(
const float *src, BufferDescriptor const &srcDesc,
float *dst, BufferDescriptor const &dstDesc,
const float *src, BufferDescriptor const &srcDesc,
float *dst, BufferDescriptor const &dstDesc,
const int * sizes,
const int * offsets,
const int * indices,
@ -145,17 +144,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivative buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivative buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable Far::StencilTable or equivalent
///
@ -206,15 +205,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output U-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output V-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param sizes pointer to the sizes buffer of the stencil table
///
@ -318,13 +317,13 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivatives buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivatives buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
@ -354,6 +353,7 @@ public:
PATCH_TABLE *patchTable,
CpuEvaluator const *instance = NULL,
void * deviceContext = NULL) {
(void)instance; // unused
(void)deviceContext; // unused
@ -423,15 +423,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output U-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the du buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output V-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the dv buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param numPatchCoords number of patchCoords.
///

View File

@ -188,17 +188,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivative buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCudaBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivative buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCudaBuffer() method returning a
/// float pointer for write
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable stencil table to be applied.
///
@ -218,8 +218,8 @@ public:
const CudaEvaluator *instance = NULL,
void * deviceContext = NULL) {
(void)instance; // unused
(void)deviceContext; // unused
(void)instance; // unused
(void)deviceContext; // unused
return EvalStencils(srcBuffer->BindCudaBuffer(), srcDesc,
dstBuffer->BindCudaBuffer(), dstDesc,
@ -249,15 +249,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output U-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output V-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param sizes pointer to the sizes buffer of the stencil table
///
@ -333,8 +333,8 @@ public:
CudaEvaluator const *instance,
void * deviceContext = NULL) {
(void)instance; // unused
(void)deviceContext; // unused
(void)instance; // unused
(void)deviceContext; // unused
return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
dstBuffer->BindCudaBuffer(), dstDesc,
@ -361,13 +361,13 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivatives buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCudaBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivatives buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCudaBuffer() method returning a
/// float pointer for write
///
@ -460,15 +460,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output U-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the du buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output V-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the dv buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param numPatchCoords number of patchCoords.
///
@ -587,8 +587,8 @@ public:
CudaEvaluator const *instance,
void * deviceContext = NULL) {
(void)instance; // unused
(void)deviceContext; // unused
(void)instance; // unused
(void)deviceContext; // unused
return EvalPatches(srcBuffer->BindCudaBuffer(), srcDesc,
dstBuffer->BindCudaBuffer(), dstDesc,

View File

@ -97,7 +97,8 @@ public:
void * deviceContext = NULL) {
(void)deviceContext; // not used
GLComputeEvaluator *instance = new GLComputeEvaluator();
if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc)) return instance;
if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc))
return instance;
delete instance;
return NULL;
}
@ -114,19 +115,19 @@ public:
///
/// ----------------------------------------------------------------------
/// \brief Generic static compute function. This function has a same
/// \brief Generic static stencil function. This function has a same
/// signature as other device kernels have so that it can be called
/// transparently from OsdMesh template interface.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// GL buffer object of source data
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// GL buffer object of destination data
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -154,7 +155,7 @@ public:
dstBuffer, dstDesc,
stencilTable);
} else {
// Create a kernel on demand (slow)
// Create an instance on demand (slow)
(void)deviceContext; // unused
instance = Create(srcDesc, dstDesc,
BufferDescriptor(),
@ -170,31 +171,31 @@ public:
}
}
/// \brief Generic static compute function. This function has a same
/// \brief Generic static stencil function. This function has a same
/// signature as other device kernels have so that it can be called
/// transparently from OsdMesh template interface.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// GL buffer object of source data
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// GL buffer object of destination data
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the dstBuffer
///
/// @param duBuffer Output U-derivative buffer
/// must have BindVBO() method returning a
/// GL buffer object of destination data
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivative buffer
/// must have BindVBO() method returning a
/// GL buffer object of destination data
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
@ -226,7 +227,7 @@ public:
dvBuffer, dvDesc,
stencilTable);
} else {
// Create a kernel on demand (slow)
// Create an instance on demand (slow)
(void)deviceContext; // unused
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
if (instance) {
@ -242,8 +243,23 @@ public:
}
}
/// Dispatch the GLSL compute kernel on GPU asynchronously.
/// returns false if the kernel hasn't been compiled yet.
/// \brief Generic stencil function.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param stencilTable stencil table to be applied. The table must have
/// SSBO interfaces.
///
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
bool EvalStencils(
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
@ -263,8 +279,35 @@ public:
/* end = */ stencilTable->GetNumStencils());
}
/// Dispatch the GLSL compute kernel on GPU asynchronously.
/// returns false if the kernel hasn't been compiled yet.
/// \brief Generic stencil function.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the dstBuffer
///
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable stencil table to be applied. The table must have
/// SSBO interfaces.
///
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
bool EvalStencils(
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
@ -286,8 +329,41 @@ public:
/* end = */ stencilTable->GetNumStencils());
}
/// Dispatch the GLSL compute kernel on GPU asynchronously.
/// \brief Dispatch the GLSL compute kernel on GPU asynchronously
/// returns false if the kernel hasn't been compiled yet.
///
/// @param srcBuffer GL buffer of input primvar source data
///
/// @param srcDesc vertex buffer descriptor for the srcBuffer
///
/// @param dstBuffer GL buffer of output primvar destination data
///
/// @param dstDesc vertex buffer descriptor for the dstBuffer
///
/// @param duBuffer GL buffer of output derivative wrt u
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer GL buffer of output derivative wrt v
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param sizesBuffer GL buffer of the sizes in the stencil table
///
/// @param offsetsBuffer GL buffer of the offsets in the stencil table
///
/// @param indicesBuffer GL buffer of the indices in the stencil table
///
/// @param weightsBuffer GL buffer of the weights in the stencil table
///
/// @param duWeightsBuffer GL buffer of the du weights in the stencil table
///
/// @param dvWeightsBuffer GL buffer of the dv weights in the stencil table
///
/// @param start start index of stencil table
///
/// @param end end index of stencil table
///
bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc,
GLuint dstBuffer, BufferDescriptor const &dstDesc,
GLuint duBuffer, BufferDescriptor const &duDesc,
@ -389,13 +465,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param numPatchCoords number of patchCoords.
///
@ -436,7 +516,8 @@ public:
} else {
// Create an instance on demand (slow)
(void)deviceContext; // unused
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
instance = Create(srcDesc, dstDesc,
duDesc, dvDesc);
if (instance) {
bool r = instance->EvalPatches(srcBuffer, srcDesc,
dstBuffer, dstDesc,
@ -456,14 +537,14 @@ public:
/// in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBOBuffer() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -500,26 +581,26 @@ public:
/// called in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivatives buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivatives buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
@ -553,8 +634,8 @@ public:
bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc,
GLuint dstBuffer, BufferDescriptor const &dstDesc,
GLuint duBuffer, BufferDescriptor const &duDesc,
GLuint dvBuffer, BufferDescriptor const &dvDesc,
GLuint duBuffer, BufferDescriptor const &duDesc,
GLuint dvBuffer, BufferDescriptor const &dvDesc,
int numPatchCoords,
GLuint patchCoordsBuffer,
const PatchArrayVector &patchArrays,
@ -634,14 +715,14 @@ public:
/// in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBOBuffer() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -749,14 +830,14 @@ public:
/// in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBOBuffer() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -839,7 +920,6 @@ private:
GLuint uniformPatchArray;
GLuint uniformDuDesc;
GLuint uniformDvDesc;
} _patchKernel;
int _workGroupSize;

View File

@ -122,14 +122,14 @@ public:
/// transparently from OsdMesh template interface.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -178,28 +178,28 @@ public:
/// transparently from OsdMesh template interface.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
/// @param dstDesc vertex buffer descriptor for the dstBuffer
///
/// @param duBuffer Output U-derivative buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc vertex buffer descriptor for the du output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivative buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc vertex buffer descriptor for the dv output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable stencil table to be applied. The table must have
/// Texture Buffer Object interfaces.
@ -216,8 +216,8 @@ public:
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 *duBuffer, BufferDescriptor const &duDesc,
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
STENCIL_TABLE const *stencilTable,
GLXFBEvaluator const *instance,
void * deviceContext = NULL) {
@ -235,8 +235,8 @@ public:
if (instance) {
bool r = instance->EvalStencils(srcBuffer, srcDesc,
dstBuffer, dstDesc,
duBuffer, duDesc,
dvBuffer, dvDesc,
duBuffer, duDesc,
dvBuffer, dvDesc,
stencilTable);
delete instance;
return r;
@ -245,7 +245,7 @@ public:
}
}
/// \brief Generic eval stencils function.
/// \brief Generic stencil function.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a GL
@ -255,11 +255,12 @@ public:
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a GL
/// buffer object for destination data
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param stencilTable stencil table to be applied.
/// @param stencilTable stencil table to be applied. The table must have
/// Texture Buffer Object interfaces.
///
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
bool EvalStencils(
@ -281,7 +282,7 @@ public:
/* end = */ stencilTable->GetNumStencils());
}
/// \brief Generic eval stencils function with derivative evaluation.
/// \brief Generic stencil function.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a GL
@ -291,19 +292,24 @@ public:
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a GL
/// buffer object for destination data
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
/// @param dstDesc vertex buffer descriptor for the dstBuffer
///
/// @param duBuffer GL buffer of output U-derivatives.
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer GL buffer of output V-derivatives.
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable stencil table to be applied.
/// @param stencilTable stencil table to be applied. The table must have
/// Texture Buffer Object interfaces.
///
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
bool EvalStencils(
@ -327,40 +333,40 @@ public:
/* end = */ stencilTable->GetNumStencils());
}
/// \brief dispatch eval stencils function with derivatives.
/// dispatch the GLSL XFB kernel on GPU asynchronously.
/// \brief Dispatch the GLSL XFB kernel on on GPU asynchronously
/// returns false if the kernel hasn't been compiled yet.
///
/// @param srcBuffer GL buffer of input primvars.
/// @param srcBuffer GL buffer of input primvar source data
///
/// @param srcDesc vertex buffer descriptor for the srcBuffer
/// @param srcDesc vertex buffer descriptor for the srcBuffer
///
/// @param dstBuffer GL buffer of output primvars.
/// @param dstBuffer GL buffer of output primvar destination data
///
/// @param dstDesc vertex buffer descriptor for the dstBuffer
/// @param dstDesc vertex buffer descriptor for the dstBuffer
///
/// @param duBuffer GL buffer of output U-derivatives.
/// @param duBuffer GL buffer of output derivative wrt u
///
/// @param duDesc vertex buffer descriptor for the duBuffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer GL buffer of output V-derivatives.
/// @param dvBuffer GL buffer of output derivative wrt v
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param sizesBuffer GL buffer of the sizes in the stencil table
/// @param sizesBuffer GL buffer of the sizes in the stencil table
///
/// @param offsetsBuffer GL buffer of the offsets in the stencil table
/// @param offsetsBuffer GL buffer of the offsets in the stencil table
///
/// @param indicesBuffer GL buffer of the indices in the stencil table
/// @param indicesBuffer GL buffer of the indices in the stencil table
///
/// @param weightsBuffer GL buffer of the weights in the stencil table
/// @param weightsBuffer GL buffer of the weights in the stencil table
///
/// @param duWeightsBuffer GL buffer of the du weights in the stencil table
/// @param duWeightsBuffer GL buffer of the du weights in the stencil table
///
/// @param dvWeightsBuffer GL buffer of the dv weights in the stencil table
/// @param dvWeightsBuffer GL buffer of the dv weights in the stencil table
///
/// @param start start index of stencil table
/// @param start start index of stencil table
///
/// @param end end index of stencil table
/// @param end end index of stencil table
///
bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc,
GLuint dstBuffer, BufferDescriptor const &dstDesc,
@ -463,13 +469,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param numPatchCoords number of patchCoords.
///
@ -530,14 +540,14 @@ public:
/// in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -545,7 +555,7 @@ public:
///
/// @param patchCoords array of locations to be evaluated.
/// must have BindVBO() method returning an
/// array of PatchCoord struct in cuda memory.
/// array of PatchCoord struct in VBO.
///
/// @param patchTable GLPatchTable or equivalent
///
@ -574,26 +584,26 @@ public:
/// called in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output s-derivatives buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// @param duBuffer Output buffer derivative wrt u
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output t-derivatives buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
@ -627,15 +637,14 @@ public:
bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc,
GLuint dstBuffer, BufferDescriptor const &dstDesc,
GLuint duBuffer, BufferDescriptor const &duDesc,
GLuint dvBuffer, BufferDescriptor const &dvDesc,
GLuint duBuffer, BufferDescriptor const &duDesc,
GLuint dvBuffer, BufferDescriptor const &dvDesc,
int numPatchCoords,
GLuint patchCoordsBuffer,
const PatchArrayVector &patchArrays,
GLuint patchIndexBuffer,
GLuint patchParamsBuffer) const;
///
/// \brief Generic limit eval function. This function has a same
/// signature as other device kernels have so that it can be called
/// in the same way.
@ -709,14 +718,14 @@ public:
/// in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -724,7 +733,7 @@ public:
///
/// @param patchCoords array of locations to be evaluated.
/// must have BindVBO() method returning an
/// array of PatchCoord struct in cuda memory.
/// array of PatchCoord struct in VBO.
///
/// @param patchTable GLPatchTable or equivalent
///
@ -748,7 +757,6 @@ public:
patchTable->GetPatchParamTextureBuffer());
}
///
/// \brief Generic limit eval function. This function has a same
/// signature as other device kernels have so that it can be called
/// in the same way.
@ -825,14 +833,14 @@ public:
/// in the same way.
///
/// @param srcBuffer Input primvar buffer.
/// must have BindVBO() method returning a
/// const float pointer for read
/// must have BindVBO() method returning a GL
/// buffer object of source data
///
/// @param srcDesc vertex buffer descriptor for the input buffer
///
/// @param dstBuffer Output primvar buffer
/// must have BindVBO() method returning a
/// float pointer for write
/// must have BindVBO() method returning a GL
/// buffer object of destination data
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
@ -840,7 +848,7 @@ public:
///
/// @param patchCoords array of locations to be evaluated.
/// must have BindVBO() method returning an
/// array of PatchCoord struct in cuda memory.
/// array of PatchCoord struct in VBO.
///
/// @param patchTable GLPatchTable or equivalent
///

View File

@ -26,11 +26,11 @@
#define OPENSUBDIV3_OSD_OMP_EVALUATOR_H
#include "../version.h"
#include <cstddef>
#include "../osd/bufferDescriptor.h"
#include "../osd/types.h"
#include <cstddef>
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
@ -107,7 +107,6 @@ public:
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param sizes pointer to the sizes buffer of the stencil table
/// to apply for the range [start, end)
///
/// @param offsets pointer to the offsets buffer of the stencil table
///
@ -120,8 +119,8 @@ public:
/// @param end end index of stencil table
///
static bool EvalStencils(
const float *src, BufferDescriptor const &srcDesc,
float *dst, BufferDescriptor const &dstDesc,
const float *src, BufferDescriptor const &srcDesc,
float *dst, BufferDescriptor const &dstDesc,
const int * sizes,
const int * offsets,
const int * indices,
@ -145,17 +144,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivative buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivative buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable Far::StencilTable or equivalent
///
@ -206,15 +205,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output U-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output V-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param sizes pointer to the sizes buffer of the stencil table
///
@ -318,13 +317,13 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivatives buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivatives buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
@ -354,6 +353,7 @@ public:
PATCH_TABLE *patchTable,
OmpEvaluator const *instance = NULL,
void * deviceContext = NULL) {
(void)instance; // unused
(void)deviceContext; // unused
@ -423,15 +423,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output U-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the du buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output V-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the dv buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param numPatchCoords number of patchCoords.
///

View File

@ -26,9 +26,8 @@
#define OPENSUBDIV3_OSD_TBB_EVALUATOR_H
#include "../version.h"
#include "../osd/types.h"
#include "../osd/bufferDescriptor.h"
#include "../far/patchTable.h"
#include "../osd/types.h"
#include <cstddef>
@ -61,7 +60,7 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param stencilTable stencil table to be applied.
/// @param stencilTable Far::StencilTable or equivalent
///
/// @param instance not used in the tbb kernel
/// (declared as a typed pointer to prevent
@ -77,7 +76,7 @@ public:
TbbEvaluator const *instance = NULL,
void *deviceContext = NULL) {
(void)instance; // unused
(void)instance; // unused
(void)deviceContext; // unused
if (stencilTable->GetNumStencils() == 0)
@ -108,7 +107,6 @@ public:
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param sizes pointer to the sizes buffer of the stencil table
/// to apply for the range [start, end)
///
/// @param offsets pointer to the offsets buffer of the stencil table
///
@ -123,10 +121,10 @@ public:
static bool EvalStencils(
const float *src, BufferDescriptor const &srcDesc,
float *dst, BufferDescriptor const &dstDesc,
const int *sizes,
const int *offsets,
const int *indices,
const float *weights,
const int * sizes,
const int * offsets,
const int * indices,
const float * weights,
int start, int end);
/// \brief Generic static eval stencils function with derivatives.
@ -146,19 +144,19 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output U-derivative buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output V-derivative buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param stencilTable stencil table to be applied.
/// @param stencilTable Far::StencilTable or equivalent
///
/// @param instance not used in the tbb kernel
/// (declared as a typed pointer to prevent
@ -176,8 +174,8 @@ public:
const TbbEvaluator *instance = NULL,
void * deviceContext = NULL) {
(void)instance; // unused
(void)deviceContext; // unused
(void)instance; // unused
(void)deviceContext; // unused
return EvalStencils(srcBuffer->BindCpuBuffer(), srcDesc,
dstBuffer->BindCpuBuffer(), dstDesc,
@ -207,18 +205,17 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output s-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the output buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output t-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the output buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param sizes pointer to the sizes buffer of the stencil table
/// to apply for the range [start, end)
///
/// @param offsets pointer to the offsets buffer of the stencil table
///
@ -226,9 +223,9 @@ public:
///
/// @param weights pointer to the weights buffer of the stencil table
///
/// @param duWeights pointer to the u-weights buffer of the stencil table
/// @param duWeights pointer to the du-weights buffer of the stencil table
///
/// @param dvWeights pointer to the v-weights buffer of the stencil table
/// @param dvWeights pointer to the dv-weights buffer of the stencil table
///
/// @param start start index of stencil table
///
@ -273,7 +270,9 @@ public:
///
/// @param patchCoords array of locations to be evaluated.
///
/// @param patchTable Far::PatchTable
/// @param patchTable CpuPatchTable or equivalent
/// XXX: currently Far::PatchTable can't be used
/// due to interface mismatch
///
/// @param instance not used in the cpu evaluator
///
@ -293,10 +292,8 @@ public:
(void)instance; // unused
(void)deviceContext; // unused
return EvalPatches(srcBuffer->BindCpuBuffer(),
srcDesc,
dstBuffer->BindCpuBuffer(),
dstDesc,
return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
dstBuffer->BindCpuBuffer(), dstDesc,
numPatchCoords,
(const PatchCoord*)patchCoords->BindCpuBuffer(),
patchTable->GetPatchArrayBuffer(),
@ -320,13 +317,13 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param duBuffer Output s-derivatives buffer
/// @param duBuffer Output buffer derivative wrt u
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dvBuffer Output t-derivatives buffer
/// @param dvBuffer Output buffer derivative wrt v
/// must have BindCpuBuffer() method returning a
/// float pointer for write
///
@ -336,7 +333,9 @@ public:
///
/// @param patchCoords array of locations to be evaluated.
///
/// @param patchTable Far::PatchTable
/// @param patchTable CpuPatchTable or equivalent
/// XXX: currently Far::PatchTable can't be used
/// due to interface mismatch
///
/// @param instance not used in the cpu evaluator
///
@ -358,16 +357,20 @@ public:
(void)instance; // unused
(void)deviceContext; // unused
return EvalPatches(
srcBuffer->BindCpuBuffer(), srcDesc,
dstBuffer->BindCpuBuffer(), dstDesc,
duBuffer->BindCpuBuffer(), duDesc,
dvBuffer->BindCpuBuffer(), dvDesc,
numPatchCoords,
(const PatchCoord*)patchCoords->BindCpuBuffer(),
patchTable->GetPatchArrayBuffer(),
patchTable->GetPatchIndexBuffer(),
patchTable->GetPatchParamBuffer());
// XXX: PatchCoords is somewhat abusing vertex primvar buffer interop.
// ideally all buffer classes should have templated by datatype
// so that downcast isn't needed there.
// (e.g. Osd::CpuBuffer<PatchCoord> )
//
return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
dstBuffer->BindCpuBuffer(), dstDesc,
duBuffer->BindCpuBuffer(), duDesc,
dvBuffer->BindCpuBuffer(), dvDesc,
numPatchCoords,
(const PatchCoord*)patchCoords->BindCpuBuffer(),
patchTable->GetPatchArrayBuffer(),
patchTable->GetPatchIndexBuffer(),
patchTable->GetPatchParamBuffer());
}
/// \brief Static limit eval function. It takes an array of PatchCoord
@ -420,15 +423,15 @@ public:
///
/// @param dstDesc vertex buffer descriptor for the output buffer
///
/// @param du Output s-derivatives pointer. An offset of
/// @param du Output pointer derivative wrt u. An offset of
/// duDesc will be applied internally.
///
/// @param duDesc vertex buffer descriptor for the du buffer
/// @param duDesc vertex buffer descriptor for the duBuffer
///
/// @param dv Output t-derivatives pointer. An offset of
/// @param dv Output pointer derivative wrt v. An offset of
/// dvDesc will be applied internally.
///
/// @param dvDesc vertex buffer descriptor for the dv buffer
/// @param dvDesc vertex buffer descriptor for the dvBuffer
///
/// @param numPatchCoords number of patchCoords.
///
@ -449,10 +452,10 @@ public:
float *du, BufferDescriptor const &duDesc,
float *dv, BufferDescriptor const &dvDesc,
int numPatchCoords,
const PatchCoord *patchCoords,
const PatchArray *patchArrays,
PatchCoord const *patchCoords,
PatchArray const *patchArrays,
const int *patchIndexBuffer,
const PatchParam *patchParamBuffer);
PatchParam const *patchParamBuffer);
/// \brief Generic limit eval function. This function has a same
/// signature as other device kernels have so that it can be called
@ -474,7 +477,9 @@ public:
///
/// @param patchCoords array of locations to be evaluated.
///
/// @param patchTable Far::PatchTable
/// @param patchTable CpuPatchTable or equivalent
/// XXX: currently Far::PatchTable can't be used
/// due to interface mismatch
///
/// @param instance not used in the cpu evaluator
///
@ -494,10 +499,8 @@ public:
(void)instance; // unused
(void)deviceContext; // unused
return EvalPatches(srcBuffer->BindCpuBuffer(),
srcDesc,
dstBuffer->BindCpuBuffer(),
dstDesc,
return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
dstBuffer->BindCpuBuffer(), dstDesc,
numPatchCoords,
(const PatchCoord*)patchCoords->BindCpuBuffer(),
patchTable->GetVaryingPatchArrayBuffer(),
@ -525,7 +528,9 @@ public:
///
/// @param patchCoords array of locations to be evaluated.
///
/// @param patchTable Far::PatchTable
/// @param patchTable CpuPatchTable or equivalent
/// XXX: currently Far::PatchTable can't be used
/// due to interface mismatch
///
/// @param fvarChannel face-varying channel
///
@ -548,10 +553,8 @@ public:
(void)instance; // unused
(void)deviceContext; // unused
return EvalPatches(srcBuffer->BindCpuBuffer(),
srcDesc,
dstBuffer->BindCpuBuffer(),
dstDesc,
return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc,
dstBuffer->BindCpuBuffer(), dstDesc,
numPatchCoords,
(const PatchCoord*)patchCoords->BindCpuBuffer(),
patchTable->GetFVarPatchArrayBuffer(fvarChannel),