2015-05-09 00:31:26 +00:00
|
|
|
//
|
|
|
|
// Copyright 2015 Pixar
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
// with the following modification; you may not use this file except in
|
|
|
|
// compliance with the Apache License and the following modification to it:
|
|
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
|
|
|
//
|
|
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
// the License and to reproduce the content of the NOTICE file.
|
|
|
|
//
|
|
|
|
// You may obtain a copy of the Apache License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the Apache License with the above modification is
|
|
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
|
|
// language governing permissions and limitations under the Apache License.
|
|
|
|
//
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
#ifndef OPENSUBDIV3_OSD_CL_EVALUATOR_H
|
|
|
|
#define OPENSUBDIV3_OSD_CL_EVALUATOR_H
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
#include "../osd/opencl.h"
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
#include "../osd/types.h"
|
2015-05-29 16:21:14 +00:00
|
|
|
#include "../osd/bufferDescriptor.h"
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
|
|
|
namespace Far {
|
2017-01-26 22:35:16 +00:00
|
|
|
class PatchTable;
|
2015-05-22 18:50:01 +00:00
|
|
|
class StencilTable;
|
2017-01-26 22:35:16 +00:00
|
|
|
class LimitStencilTable;
|
2015-05-09 00:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Osd {
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
/// \brief OpenCL stencil table
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
2015-05-22 18:50:01 +00:00
|
|
|
/// This class is an OpenCL buffer representation of Far::StencilTable.
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
|
|
|
/// CLCompute consumes this table to apply stencils
|
|
|
|
///
|
|
|
|
///
|
2015-05-22 18:50:01 +00:00
|
|
|
class CLStencilTable {
|
2015-05-09 00:31:26 +00:00
|
|
|
public:
|
|
|
|
template <typename DEVICE_CONTEXT>
|
2015-05-22 18:50:01 +00:00
|
|
|
static CLStencilTable *Create(Far::StencilTable const *stencilTable,
|
|
|
|
DEVICE_CONTEXT context) {
|
|
|
|
return new CLStencilTable(stencilTable, context->GetContext());
|
2015-05-09 00:31:26 +00:00
|
|
|
}
|
|
|
|
|
2015-05-28 00:23:36 +00:00
|
|
|
template <typename DEVICE_CONTEXT>
|
|
|
|
static CLStencilTable *Create(
|
|
|
|
Far::LimitStencilTable const *limitStencilTable,
|
|
|
|
DEVICE_CONTEXT context) {
|
|
|
|
return new CLStencilTable(limitStencilTable, context->GetContext());
|
|
|
|
}
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
CLStencilTable(Far::StencilTable const *stencilTable,
|
|
|
|
cl_context clContext);
|
2015-05-28 00:23:36 +00:00
|
|
|
CLStencilTable(Far::LimitStencilTable const *limitStencilTable,
|
|
|
|
cl_context clContext);
|
2015-05-22 18:50:01 +00:00
|
|
|
~CLStencilTable();
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
// interfaces needed for CLComputeKernel
|
2017-01-26 22:35:16 +00:00
|
|
|
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; }
|
2017-01-26 22:36:30 +00:00
|
|
|
cl_mem GetDuuWeightsBuffer() const { return _duuWeights; }
|
|
|
|
cl_mem GetDuvWeightsBuffer() const { return _duvWeights; }
|
|
|
|
cl_mem GetDvvWeightsBuffer() const { return _dvvWeights; }
|
2017-01-26 22:35:16 +00:00
|
|
|
int GetNumStencils() const { return _numStencils; }
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
cl_mem _sizes;
|
|
|
|
cl_mem _offsets;
|
|
|
|
cl_mem _indices;
|
|
|
|
cl_mem _weights;
|
2015-05-28 00:23:36 +00:00
|
|
|
cl_mem _duWeights;
|
|
|
|
cl_mem _dvWeights;
|
2017-01-26 22:36:30 +00:00
|
|
|
cl_mem _duuWeights;
|
|
|
|
cl_mem _duvWeights;
|
|
|
|
cl_mem _dvvWeights;
|
2015-05-09 00:31:26 +00:00
|
|
|
int _numStencils;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class CLEvaluator {
|
|
|
|
public:
|
|
|
|
typedef bool Instantiatable;
|
|
|
|
|
|
|
|
/// Generic creator template.
|
|
|
|
template <typename DEVICE_CONTEXT>
|
2015-05-29 16:21:14 +00:00
|
|
|
static CLEvaluator *Create(BufferDescriptor const &srcDesc,
|
|
|
|
BufferDescriptor const &dstDesc,
|
|
|
|
BufferDescriptor const &duDesc,
|
|
|
|
BufferDescriptor const &dvDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
DEVICE_CONTEXT deviceContext) {
|
2015-05-28 00:23:36 +00:00
|
|
|
return Create(srcDesc, dstDesc, duDesc, dvDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
deviceContext->GetContext(),
|
|
|
|
deviceContext->GetCommandQueue());
|
|
|
|
}
|
|
|
|
|
2015-05-29 16:21:14 +00:00
|
|
|
static CLEvaluator * Create(BufferDescriptor const &srcDesc,
|
|
|
|
BufferDescriptor const &dstDesc,
|
|
|
|
BufferDescriptor const &duDesc,
|
|
|
|
BufferDescriptor const &dvDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
cl_context clContext,
|
|
|
|
cl_command_queue clCommandQueue) {
|
2017-01-26 22:35:16 +00:00
|
|
|
CLEvaluator *instance = new CLEvaluator(clContext, clCommandQueue);
|
|
|
|
if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc))
|
|
|
|
return instance;
|
|
|
|
delete instance;
|
2015-05-09 00:31:26 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:36:30 +00:00
|
|
|
/// Generic creator template.
|
|
|
|
template <typename DEVICE_CONTEXT>
|
|
|
|
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) {
|
|
|
|
return Create(srcDesc, dstDesc, duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc,
|
|
|
|
deviceContext->GetContext(),
|
|
|
|
deviceContext->GetCommandQueue());
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
CLEvaluator *instance = new CLEvaluator(clContext, clCommandQueue);
|
|
|
|
if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc))
|
|
|
|
return instance;
|
|
|
|
delete instance;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// Constructor.
|
|
|
|
CLEvaluator(cl_context context, cl_command_queue queue);
|
|
|
|
|
|
|
|
/// Destructor.
|
|
|
|
~CLEvaluator();
|
|
|
|
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// Stencil evaluations with StencilTable
|
|
|
|
///
|
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \brief Generic static stencil function. This function has a same
|
2015-05-09 00:31:26 +00:00
|
|
|
/// signature as other device kernels have so that it can be called
|
|
|
|
/// transparently from OsdMesh template interface.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
2015-06-19 01:11:23 +00:00
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for read
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2015-06-19 01:11:23 +00:00
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for results to be written
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2015-05-22 18:50:01 +00:00
|
|
|
/// @param stencilTable stencil table to be applied. The table must have
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
/// SSBO interfaces.
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
2015-11-23 09:54:03 +00:00
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2015-11-23 09:54:03 +00:00
|
|
|
/// 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.
|
|
|
|
///
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename STENCIL_TABLE, typename DEVICE_CONTEXT>
|
|
|
|
static bool EvalStencils(
|
2015-05-29 16:21:14 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
STENCIL_TABLE const *stencilTable,
|
|
|
|
CLEvaluator const *instance,
|
2015-11-23 09:54:03 +00:00
|
|
|
DEVICE_CONTEXT deviceContext,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) {
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
|
2015-05-09 00:31:26 +00:00
|
|
|
if (instance) {
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
return instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
2015-11-23 09:54:03 +00:00
|
|
|
stencilTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
2015-05-09 00:31:26 +00:00
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
2015-05-28 00:23:36 +00:00
|
|
|
instance = Create(srcDesc, dstDesc,
|
2015-05-29 16:21:14 +00:00
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor(),
|
2015-05-28 00:23:36 +00:00
|
|
|
deviceContext);
|
2015-05-09 00:31:26 +00:00
|
|
|
if (instance) {
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
bool r = instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
2015-11-23 09:54:03 +00:00
|
|
|
stencilTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
2015-05-09 00:31:26 +00:00
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \brief Generic static stencil function. This function has a same
|
2015-05-28 00:23:36 +00:00
|
|
|
/// signature as other device kernels have so that it can be called
|
|
|
|
/// transparently from OsdMesh template interface.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
2015-06-19 01:11:23 +00:00
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for read
|
2015-05-28 00:23:36 +00:00
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2015-06-19 01:11:23 +00:00
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for results to be written
|
2015-05-28 00:23:36 +00:00
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
2015-06-19 01:11:23 +00:00
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for du results to be written
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
2015-06-19 01:11:23 +00:00
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
2015-06-19 01:11:23 +00:00
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for dv results to be written
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
2015-06-19 01:11:23 +00:00
|
|
|
///
|
2015-05-28 00:23:36 +00:00
|
|
|
/// @param stencilTable stencil table to be applied. The table must have
|
|
|
|
/// SSBO interfaces.
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
2015-11-23 09:54:03 +00:00
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2015-11-23 09:54:03 +00:00
|
|
|
/// 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.
|
|
|
|
///
|
2015-05-28 00:23:36 +00:00
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename STENCIL_TABLE, typename DEVICE_CONTEXT>
|
|
|
|
static bool EvalStencils(
|
2015-05-29 16:21:14 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
2017-01-26 22:35:16 +00:00
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
2015-05-28 00:23:36 +00:00
|
|
|
STENCIL_TABLE const *stencilTable,
|
|
|
|
CLEvaluator const *instance,
|
2015-11-23 09:54:03 +00:00
|
|
|
DEVICE_CONTEXT deviceContext,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) {
|
2015-05-28 00:23:36 +00:00
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
2015-11-23 09:54:03 +00:00
|
|
|
stencilTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
2015-05-28 00:23:36 +00:00
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
instance = Create(srcDesc, dstDesc, duDesc, dvDesc,
|
|
|
|
deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
2015-11-23 09:54:03 +00:00
|
|
|
stencilTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
2015-05-28 00:23:36 +00:00
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:36:30 +00:00
|
|
|
/// \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 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 duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for du results to be written
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for du results to be written
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for dv results to be written
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
|
|
|
/// @param stencilTable stencil table to be applied. The table must have
|
|
|
|
/// SSBO interfaces.
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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, typename DEVICE_CONTEXT>
|
|
|
|
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) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
stencilTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc,
|
|
|
|
deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
stencilTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
STENCIL_TABLE const *stencilTable,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) const {
|
|
|
|
return EvalStencils(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
stencilTable->GetSizesBuffer(),
|
|
|
|
stencilTable->GetOffsetsBuffer(),
|
|
|
|
stencilTable->GetIndicesBuffer(),
|
|
|
|
stencilTable->GetWeightsBuffer(),
|
|
|
|
0,
|
|
|
|
stencilTable->GetNumStencils(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \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
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @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
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @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.
|
|
|
|
///
|
2015-05-28 00:23:36 +00:00
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
|
|
|
|
bool EvalStencils(
|
2015-05-29 16:21:14 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
2015-11-23 09:54:03 +00:00
|
|
|
STENCIL_TABLE const *stencilTable,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) const {
|
2015-05-28 00:23:36 +00:00
|
|
|
return EvalStencils(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
2015-05-28 00:23:36 +00:00
|
|
|
stencilTable->GetSizesBuffer(),
|
|
|
|
stencilTable->GetOffsetsBuffer(),
|
|
|
|
stencilTable->GetIndicesBuffer(),
|
|
|
|
stencilTable->GetWeightsBuffer(),
|
2017-01-26 22:36:30 +00:00
|
|
|
stencilTable->GetDuWeightsBuffer(),
|
|
|
|
stencilTable->GetDvWeightsBuffer(),
|
2015-05-28 00:23:36 +00:00
|
|
|
0,
|
2015-11-23 09:54:03 +00:00
|
|
|
stencilTable->GetNumStencils(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
2015-05-28 00:23:36 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \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
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for du results to be written
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for du results to be written
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning the
|
|
|
|
/// cl_mem object for dv results to be written
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @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.
|
|
|
|
///
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
|
|
|
|
bool EvalStencils(
|
2015-05-29 16:21:14 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
|
|
|
|
DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
|
|
|
|
DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
|
2015-11-23 09:54:03 +00:00
|
|
|
STENCIL_TABLE const *stencilTable,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) const {
|
2015-05-28 00:23:36 +00:00
|
|
|
return EvalStencils(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
|
|
|
|
duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
|
|
|
|
dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
stencilTable->GetSizesBuffer(),
|
|
|
|
stencilTable->GetOffsetsBuffer(),
|
|
|
|
stencilTable->GetIndicesBuffer(),
|
|
|
|
stencilTable->GetWeightsBuffer(),
|
2015-05-28 00:23:36 +00:00
|
|
|
stencilTable->GetDuWeightsBuffer(),
|
|
|
|
stencilTable->GetDvWeightsBuffer(),
|
2017-01-26 22:36:30 +00:00
|
|
|
stencilTable->GetDuuWeightsBuffer(),
|
|
|
|
stencilTable->GetDuvWeightsBuffer(),
|
|
|
|
stencilTable->GetDvvWeightsBuffer(),
|
2015-05-09 00:31:26 +00:00
|
|
|
0,
|
2015-11-23 09:54:03 +00:00
|
|
|
stencilTable->GetNumStencils(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
2015-05-09 00:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Dispatch the CL compute kernel asynchronously.
|
|
|
|
/// returns false if the kernel hasn't been compiled yet.
|
2015-05-29 16:21:14 +00:00
|
|
|
bool EvalStencils(cl_mem src, BufferDescriptor const &srcDesc,
|
|
|
|
cl_mem dst, BufferDescriptor const &dstDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
cl_mem sizes,
|
|
|
|
cl_mem offsets,
|
|
|
|
cl_mem indices,
|
|
|
|
cl_mem weights,
|
|
|
|
int start,
|
2015-11-23 09:54:03 +00:00
|
|
|
int end,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) const;
|
2015-05-09 00:31:26 +00:00
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \brief Dispatch the CL compute kernel asynchronously.
|
2015-05-28 00:23:36 +00:00
|
|
|
/// returns false if the kernel hasn't been compiled yet.
|
2017-01-26 22:35:16 +00:00
|
|
|
///
|
|
|
|
/// @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.
|
|
|
|
///
|
2015-05-29 16:21:14 +00:00
|
|
|
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,
|
2015-05-28 00:23:36 +00:00
|
|
|
cl_mem sizes,
|
|
|
|
cl_mem offsets,
|
|
|
|
cl_mem indices,
|
|
|
|
cl_mem weights,
|
|
|
|
cl_mem duWeights,
|
|
|
|
cl_mem dvWeights,
|
|
|
|
int start,
|
2015-11-23 09:54:03 +00:00
|
|
|
int end,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) const;
|
2015-05-28 00:23:36 +00:00
|
|
|
|
2017-01-26 22:36:30 +00:00
|
|
|
/// \brief Dispatch the CL compute kernel asynchronously.
|
|
|
|
/// returns false if the kernel hasn't been compiled yet.
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param src CL buffer of input primvar source data
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param srcDesc vertex buffer descriptor for the srcBuffer
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dst CL buffer of output primvar destination data
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dstDesc vertex buffer descriptor for the dstBuffer
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param du CL buffer of output derivative wrt u
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dv CL buffer of output derivative wrt v
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duu CL buffer of output 2nd derivative wrt u
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duv CL buffer of output 2nd derivative wrt u and v
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
2015-11-23 09:54:03 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dvv CL buffer of output 2nd derivative wrt v
|
2015-11-23 09:54:03 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
|
|
|
/// @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 duuWeights CL buffer of the duu weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param duvWeights CL buffer of the duv weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param dvvWeights CL buffer of the dvv 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,
|
|
|
|
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;
|
|
|
|
|
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// 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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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
|
2015-11-23 09:54:03 +00:00
|
|
|
/// reference count and should be released via
|
|
|
|
/// clReleaseEvent(). NULL if not required.
|
|
|
|
///
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE,
|
|
|
|
typename DEVICE_CONTEXT>
|
|
|
|
static bool EvalPatches(
|
2015-05-29 16:21:14 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
CLEvaluator const *instance,
|
2015-11-23 09:54:03 +00:00
|
|
|
DEVICE_CONTEXT deviceContext,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) {
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
2015-11-23 09:54:03 +00:00
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
2015-05-28 00:23:36 +00:00
|
|
|
instance = Create(srcDesc, dstDesc,
|
2015-05-29 16:21:14 +00:00
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor(),
|
2015-05-28 00:23:36 +00:00
|
|
|
deviceContext);
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
2015-11-23 09:54:03 +00:00
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE,
|
|
|
|
typename DEVICE_CONTEXT>
|
|
|
|
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) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE,
|
|
|
|
typename DEVICE_CONTEXT>
|
|
|
|
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) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc,
|
|
|
|
deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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 {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
|
|
|
patchTable->GetPatchArrayBuffer(),
|
|
|
|
patchTable->GetPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \brief Generic limit eval function with derivatives. This function has
|
|
|
|
/// a same signature as other device kernels have so that it can be
|
|
|
|
/// called in the same way.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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 {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
|
|
|
patchTable->GetPatchArrayBuffer(),
|
|
|
|
patchTable->GetPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \brief Generic limit eval function with derivatives. This function has
|
|
|
|
/// a same signature as other device kernels have so that it can be
|
|
|
|
/// called in the same way.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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 {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
|
|
|
duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
|
|
|
|
duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
|
|
|
|
dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
|
|
|
patchTable->GetPatchArrayBuffer(),
|
|
|
|
patchTable->GetPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
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 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;
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE,
|
|
|
|
typename DEVICE_CONTEXT>
|
|
|
|
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) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor(),
|
|
|
|
deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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 {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
|
|
|
patchTable->GetVaryingPatchArrayBuffer(),
|
|
|
|
patchTable->GetVaryingPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE,
|
|
|
|
typename DEVICE_CONTEXT>
|
|
|
|
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) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc,
|
|
|
|
deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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 {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
|
|
|
patchTable->GetVaryingPatchArrayBuffer(),
|
|
|
|
patchTable->GetVaryingPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE,
|
|
|
|
typename DEVICE_CONTEXT>
|
|
|
|
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) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc,
|
|
|
|
deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @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 PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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 {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
|
|
|
duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
|
|
|
|
duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
|
|
|
|
dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
|
|
|
patchTable->GetVaryingPatchArrayBuffer(),
|
|
|
|
patchTable->GetVaryingPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer(),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindCLBuffer() method returning a CL
|
2017-01-26 22:36:30 +00:00
|
|
|
/// buffer object of source data
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dstBuffer Output primvar buffer
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
2017-01-26 22:36:30 +00:00
|
|
|
/// array of PatchCoord struct.
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
2015-11-23 09:54:03 +00:00
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2015-11-23 09:54:03 +00:00
|
|
|
/// 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.
|
|
|
|
///
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE,
|
|
|
|
typename DEVICE_CONTEXT>
|
2017-01-26 22:36:30 +00:00
|
|
|
static bool EvalPatchesFaceVarying(
|
2015-05-29 16:21:14 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
2017-01-26 22:36:30 +00:00
|
|
|
int fvarChannel,
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
CLEvaluator const *instance,
|
2015-11-23 09:54:03 +00:00
|
|
|
DEVICE_CONTEXT deviceContext,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) {
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
|
|
|
|
if (instance) {
|
2017-01-26 22:36:30 +00:00
|
|
|
return instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
2017-01-26 22:36:30 +00:00
|
|
|
patchTable, fvarChannel,
|
2015-11-23 09:54:03 +00:00
|
|
|
numStartEvents, startEvents, endEvent);
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
2017-01-26 22:36:30 +00:00
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor(),
|
|
|
|
deviceContext);
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
if (instance) {
|
2017-01-26 22:36:30 +00:00
|
|
|
bool r = instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
2017-01-26 22:36:30 +00:00
|
|
|
patchTable, fvarChannel,
|
2015-11-23 09:54:03 +00:00
|
|
|
numStartEvents, startEvents, endEvent);
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
2015-11-23 09:54:03 +00:00
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2015-11-23 09:54:03 +00:00
|
|
|
/// 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.
|
|
|
|
///
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
2017-01-26 22:36:30 +00:00
|
|
|
bool EvalPatchesFaceVarying(
|
2015-05-29 16:21:14 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
2015-11-23 09:54:03 +00:00
|
|
|
PATCH_TABLE *patchTable,
|
2017-01-26 22:36:30 +00:00
|
|
|
int fvarChannel = 0,
|
2015-11-23 09:54:03 +00:00
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) const {
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
2015-05-29 16:21:14 +00:00
|
|
|
0, BufferDescriptor(),
|
|
|
|
0, BufferDescriptor(),
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
2017-01-26 22:36:30 +00:00
|
|
|
patchTable->GetFVarPatchArrayBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchIndexBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchParamBuffer(fvarChannel),
|
2015-11-23 09:54:03 +00:00
|
|
|
numStartEvents, startEvents, endEvent);
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
}
|
|
|
|
|
2016-09-29 16:56:15 +00:00
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2016-09-29 16:56:15 +00:00
|
|
|
/// 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,
|
|
|
|
typename DEVICE_CONTEXT>
|
2017-01-26 22:36:30 +00:00
|
|
|
static bool EvalPatchesFaceVarying(
|
2016-09-29 16:56:15 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
2017-01-26 22:36:30 +00:00
|
|
|
int fvarChannel,
|
2016-09-29 16:56:15 +00:00
|
|
|
CLEvaluator const *instance,
|
|
|
|
DEVICE_CONTEXT deviceContext,
|
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
2017-01-26 22:36:30 +00:00
|
|
|
return instance->EvalPatchesFaceVarying(
|
2016-09-29 16:56:15 +00:00
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
numPatchCoords, patchCoords,
|
2017-01-26 22:36:30 +00:00
|
|
|
patchTable, fvarChannel,
|
2016-09-29 16:56:15 +00:00
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duDesc, dvDesc, deviceContext);
|
2016-09-29 16:56:15 +00:00
|
|
|
if (instance) {
|
2017-01-26 22:36:30 +00:00
|
|
|
bool r = instance->EvalPatchesFaceVarying(
|
2016-09-29 16:56:15 +00:00
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
numPatchCoords, patchCoords,
|
2017-01-26 22:36:30 +00:00
|
|
|
patchTable, fvarChannel,
|
2016-09-29 16:56:15 +00:00
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2016-09-29 16:56:15 +00:00
|
|
|
/// 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>
|
2017-01-26 22:36:30 +00:00
|
|
|
bool EvalPatchesFaceVarying(
|
2016-09-29 16:56:15 +00:00
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
2017-01-26 22:36:30 +00:00
|
|
|
int fvarChannel = 0,
|
2016-09-29 16:56:15 +00:00
|
|
|
unsigned int numStartEvents=0,
|
|
|
|
const cl_event* startEvents=NULL,
|
|
|
|
cl_event* endEvent=NULL) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
2017-01-26 22:36:30 +00:00
|
|
|
patchTable->GetFVarPatchArrayBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchIndexBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchParamBuffer(fvarChannel),
|
2016-09-29 16:56:15 +00:00
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
|
|
|
/// @param instance cached compiled instance. Clients are supposed to
|
|
|
|
/// pre-compile an instance of this class and provide
|
|
|
|
/// to this function. If it's null the kernel still
|
|
|
|
/// compute by instantiating on-demand kernel although
|
|
|
|
/// it may cause a performance problem.
|
|
|
|
///
|
|
|
|
/// @param deviceContext client providing context class which supports
|
|
|
|
/// cL_context GetContext()
|
|
|
|
/// cl_command_queue GetCommandQueue()
|
|
|
|
/// methods.
|
|
|
|
///
|
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2016-09-29 16:56:15 +00:00
|
|
|
/// 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,
|
|
|
|
typename DEVICE_CONTEXT>
|
|
|
|
static bool EvalPatchesFaceVarying(
|
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
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,
|
2016-09-29 16:56:15 +00:00
|
|
|
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) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
deviceContext);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel,
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer Output buffer 2nd derivative wrt u and v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindCLBuffer() method returning a CL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindCLBuffer() method returning an
|
|
|
|
/// array of PatchCoord struct.
|
|
|
|
///
|
|
|
|
/// @param patchTable CLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
|
|
|
/// @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.
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param endEvent pointer to a cl_event which will receive a copy of
|
2016-09-29 16:56:15 +00:00
|
|
|
/// 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>
|
|
|
|
bool EvalPatchesFaceVarying(
|
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
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,
|
2016-09-29 16:56:15 +00:00
|
|
|
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 {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindCLBuffer(_clCommandQueue), srcDesc,
|
|
|
|
dstBuffer->BindCLBuffer(_clCommandQueue), dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer->BindCLBuffer(_clCommandQueue), duDesc,
|
|
|
|
dvBuffer->BindCLBuffer(_clCommandQueue), dvDesc,
|
|
|
|
duuBuffer->BindCLBuffer(_clCommandQueue), duuDesc,
|
|
|
|
duvBuffer->BindCLBuffer(_clCommandQueue), duvDesc,
|
|
|
|
dvvBuffer->BindCLBuffer(_clCommandQueue), dvvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindCLBuffer(_clCommandQueue),
|
|
|
|
patchTable->GetFVarPatchArrayBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchIndexBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchParamBuffer(fvarChannel),
|
|
|
|
numStartEvents, startEvents, endEvent);
|
|
|
|
}
|
|
|
|
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// Other methods
|
|
|
|
///
|
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
|
2015-05-09 00:31:26 +00:00
|
|
|
/// Configure OpenCL kernel.
|
|
|
|
/// Returns false if it fails to compile the kernel.
|
2015-05-29 16:21:14 +00:00
|
|
|
bool Compile(BufferDescriptor const &srcDesc,
|
|
|
|
BufferDescriptor const &dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
BufferDescriptor const &duDesc = BufferDescriptor(),
|
|
|
|
BufferDescriptor const &dvDesc = BufferDescriptor(),
|
|
|
|
BufferDescriptor const &duuDesc = BufferDescriptor(),
|
|
|
|
BufferDescriptor const &duvDesc = BufferDescriptor(),
|
|
|
|
BufferDescriptor const &dvvDesc = BufferDescriptor());
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
/// Wait the OpenCL kernels finish.
|
|
|
|
template <typename DEVICE_CONTEXT>
|
|
|
|
static void Synchronize(DEVICE_CONTEXT deviceContext) {
|
|
|
|
Synchronize(deviceContext->GetCommandQueue());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Synchronize(cl_command_queue queue);
|
|
|
|
|
|
|
|
private:
|
|
|
|
cl_context _clContext;
|
|
|
|
cl_command_queue _clCommandQueue;
|
|
|
|
cl_program _program;
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
cl_kernel _stencilKernel;
|
2015-05-28 00:23:36 +00:00
|
|
|
cl_kernel _stencilDerivKernel;
|
Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.
with this change, Eval API in the osd layer consists of following parts:
- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
implements EvalStencils and EvalPatches(*). Both supports derivatives
(not fully implemented though)
- Interop vertex buffer classes (optional, same as before)
Note that these classes are not necessary to use Evaluators.
All evaluators have EvalStencils/Patches which take device-specific
buffer objects. For example, GLXFBEvaluator can take GLuint directly
for both stencil tables and input primvars. Although using these
interop classes makes it easy to integrate osd into relatively
simple applications.
- device-dependent StencilTable and PatchTable (optional)
These are also optional, but can be used simply a substitute of
Far::StencilTable and Far::PatchTable for osd evaluators.
- PatchArray, PatchCoord, PatchParam
They are tiny structs used for GPU based patch evaluation.
(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
There's a technical difficulty for the multi-stream output.
2015-05-26 04:51:55 +00:00
|
|
|
cl_kernel _patchKernel;
|
2015-05-09 00:31:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace Osd
|
|
|
|
|
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
using namespace OPENSUBDIV_VERSION;
|
|
|
|
|
|
|
|
} // end namespace OpenSubdiv
|
|
|
|
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
#endif // OPENSUBDIV3_OSD_CL_EVALUATOR_H
|