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.
|
|
|
|
//
|
|
|
|
|
2015-05-19 18:22:37 +00:00
|
|
|
#ifndef OPENSUBDIV3_OSD_GL_COMPUTE_EVALUATOR_H
|
|
|
|
#define OPENSUBDIV3_OSD_GL_COMPUTE_EVALUATOR_H
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
#include "../osd/opengl.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 {
|
2015-05-28 00:23:36 +00:00
|
|
|
class PatchTable;
|
2015-05-22 18:50:01 +00:00
|
|
|
class StencilTable;
|
2015-05-28 00:23:36 +00:00
|
|
|
class LimitStencilTable;
|
2015-05-09 00:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Osd {
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
/// \brief GL stencil table (Shader Storage buffer)
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
2015-05-22 18:50:01 +00:00
|
|
|
/// This class is a GLSL SSBO representation of Far::StencilTable.
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
|
|
|
/// GLSLComputeKernel consumes this table to apply stencils
|
|
|
|
///
|
2015-05-22 18:50:01 +00:00
|
|
|
class GLStencilTableSSBO {
|
2015-05-09 00:31:26 +00:00
|
|
|
public:
|
2015-05-22 18:50:01 +00:00
|
|
|
static GLStencilTableSSBO *Create(Far::StencilTable const *stencilTable,
|
2015-05-09 00:31:26 +00:00
|
|
|
void *deviceContext = NULL) {
|
|
|
|
(void)deviceContext; // unused
|
2015-05-22 18:50:01 +00:00
|
|
|
return new GLStencilTableSSBO(stencilTable);
|
2015-05-09 00:31:26 +00:00
|
|
|
}
|
2015-05-28 00:23:36 +00:00
|
|
|
static GLStencilTableSSBO *Create(
|
|
|
|
Far::LimitStencilTable const *limitStencilTable,
|
|
|
|
void *deviceContext = NULL) {
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
return new GLStencilTableSSBO(limitStencilTable);
|
|
|
|
}
|
2015-05-09 00:31:26 +00:00
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
explicit GLStencilTableSSBO(Far::StencilTable const *stencilTable);
|
2015-05-28 00:23:36 +00:00
|
|
|
explicit GLStencilTableSSBO(Far::LimitStencilTable const *limitStencilTable);
|
2015-05-22 18:50:01 +00:00
|
|
|
~GLStencilTableSSBO();
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
// interfaces needed for GLSLComputeKernel
|
|
|
|
GLuint GetSizesBuffer() const { return _sizes; }
|
|
|
|
GLuint GetOffsetsBuffer() const { return _offsets; }
|
|
|
|
GLuint GetIndicesBuffer() const { return _indices; }
|
|
|
|
GLuint GetWeightsBuffer() const { return _weights; }
|
2015-05-28 00:23:36 +00:00
|
|
|
GLuint GetDuWeightsBuffer() const { return _duWeights; }
|
|
|
|
GLuint GetDvWeightsBuffer() const { return _dvWeights; }
|
2017-01-26 22:36:30 +00:00
|
|
|
GLuint GetDuuWeightsBuffer() const { return _duuWeights; }
|
|
|
|
GLuint GetDuvWeightsBuffer() const { return _duvWeights; }
|
|
|
|
GLuint GetDvvWeightsBuffer() const { return _dvvWeights; }
|
2015-05-09 00:31:26 +00:00
|
|
|
int GetNumStencils() const { return _numStencils; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
GLuint _sizes;
|
|
|
|
GLuint _offsets;
|
|
|
|
GLuint _indices;
|
|
|
|
GLuint _weights;
|
2015-05-28 00:23:36 +00:00
|
|
|
GLuint _duWeights;
|
|
|
|
GLuint _dvWeights;
|
2017-01-26 22:36:30 +00:00
|
|
|
GLuint _duuWeights;
|
|
|
|
GLuint _duvWeights;
|
|
|
|
GLuint _dvvWeights;
|
2015-05-09 00:31:26 +00:00
|
|
|
int _numStencils;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class GLComputeEvaluator {
|
|
|
|
public:
|
|
|
|
typedef bool Instantiatable;
|
2015-05-29 16:21:14 +00:00
|
|
|
static GLComputeEvaluator * Create(BufferDescriptor const &srcDesc,
|
|
|
|
BufferDescriptor const &dstDesc,
|
|
|
|
BufferDescriptor const &duDesc,
|
|
|
|
BufferDescriptor const &dvDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
void * deviceContext = NULL) {
|
2017-01-26 22:36:30 +00:00
|
|
|
return Create(srcDesc, dstDesc, duDesc, dvDesc,
|
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor(),
|
|
|
|
deviceContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GLComputeEvaluator * Create(BufferDescriptor const &srcDesc,
|
|
|
|
BufferDescriptor const &dstDesc,
|
|
|
|
BufferDescriptor const &duDesc,
|
|
|
|
BufferDescriptor const &dvDesc,
|
|
|
|
BufferDescriptor const &duuDesc,
|
|
|
|
BufferDescriptor const &duvDesc,
|
|
|
|
BufferDescriptor const &dvvDesc,
|
|
|
|
void * deviceContext = NULL) {
|
2015-05-09 00:31:26 +00:00
|
|
|
(void)deviceContext; // not used
|
|
|
|
GLComputeEvaluator *instance = new GLComputeEvaluator();
|
2017-01-26 22:36:30 +00:00
|
|
|
if (instance->Compile(srcDesc, dstDesc, duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc))
|
2017-01-26 22:35:16 +00:00
|
|
|
return instance;
|
2015-05-09 00:31:26 +00:00
|
|
|
delete instance;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Constructor.
|
|
|
|
GLComputeEvaluator();
|
|
|
|
|
|
|
|
/// Destructor. note that the GL context must be made current.
|
|
|
|
~GLComputeEvaluator();
|
|
|
|
|
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.
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
2015-05-09 00:31:26 +00:00
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param stencilTable stencil table to be applied. The table must have
|
|
|
|
/// SSBO interfaces.
|
|
|
|
///
|
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
|
2015-05-09 00:31:26 +00:00
|
|
|
/// 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 not used in the GLSL kernel
|
|
|
|
///
|
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>
|
|
|
|
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,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
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-05-09 00:31:26 +00:00
|
|
|
stencilTable);
|
|
|
|
} else {
|
2017-01-26 22:35:16 +00:00
|
|
|
// Create an instance on demand (slow)
|
2015-05-09 00:31:26 +00:00
|
|
|
(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
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
stencilTable);
|
|
|
|
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.
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
2015-05-28 00:23:36 +00:00
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
2015-05-28 00:23:36 +00:00
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the dstBuffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
2015-05-28 00:23:36 +00:00
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
2015-05-28 00:23:36 +00:00
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @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 not used in the GLSL kernel
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
|
|
|
|
static 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,
|
2015-05-28 00:23:36 +00:00
|
|
|
STENCIL_TABLE const *stencilTable,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
stencilTable);
|
|
|
|
} else {
|
2017-01-26 22:35:16 +00:00
|
|
|
// Create an instance on demand (slow)
|
2015-05-28 00:23:36 +00:00
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
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-05-28 00:23:36 +00:00
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
stencilTable);
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the dstBuffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @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 not used in the GLSL kernel
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
|
|
|
|
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,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
stencilTable);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc, duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalStencils(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
stencilTable);
|
|
|
|
delete instance;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \brief Generic stencil function.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param stencilTable stencil table to be applied. The table must have
|
|
|
|
/// SSBO interfaces.
|
|
|
|
///
|
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,
|
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) const {
|
2015-05-28 00:23:36 +00:00
|
|
|
return EvalStencils(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
2015-05-29 16:21:14 +00:00
|
|
|
0, BufferDescriptor(),
|
|
|
|
0, BufferDescriptor(),
|
2015-05-09 00:31:26 +00:00
|
|
|
stencilTable->GetSizesBuffer(),
|
|
|
|
stencilTable->GetOffsetsBuffer(),
|
|
|
|
stencilTable->GetIndicesBuffer(),
|
|
|
|
stencilTable->GetWeightsBuffer(),
|
2015-05-28 00:23:36 +00:00
|
|
|
0,
|
|
|
|
0,
|
|
|
|
/* start = */ 0,
|
|
|
|
/* end = */ stencilTable->GetNumStencils());
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \brief Generic stencil function.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the dstBuffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param stencilTable stencil table to be applied. The table must have
|
|
|
|
/// SSBO interfaces.
|
|
|
|
///
|
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,
|
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
2015-05-28 00:23:36 +00:00
|
|
|
STENCIL_TABLE const *stencilTable) const {
|
|
|
|
return EvalStencils(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
|
|
|
stencilTable->GetSizesBuffer(),
|
|
|
|
stencilTable->GetOffsetsBuffer(),
|
|
|
|
stencilTable->GetIndicesBuffer(),
|
|
|
|
stencilTable->GetWeightsBuffer(),
|
|
|
|
stencilTable->GetDuWeightsBuffer(),
|
|
|
|
stencilTable->GetDvWeightsBuffer(),
|
2015-05-09 00:31:26 +00:00
|
|
|
/* start = */ 0,
|
|
|
|
/* end = */ stencilTable->GetNumStencils());
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:36:30 +00:00
|
|
|
/// \brief Generic stencil function.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer Input primvar buffer.
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the dstBuffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
|
|
|
/// @param stencilTable stencil table to be applied. The table must have
|
|
|
|
/// SSBO interfaces.
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER, typename STENCIL_TABLE>
|
|
|
|
bool EvalStencils(
|
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
|
|
|
DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
|
|
|
|
DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
|
|
|
|
DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
|
|
|
|
STENCIL_TABLE const *stencilTable) const {
|
|
|
|
return EvalStencils(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
|
|
|
duuBuffer->BindVBO(), duuDesc,
|
|
|
|
duvBuffer->BindVBO(), duvDesc,
|
|
|
|
dvvBuffer->BindVBO(), dvvDesc,
|
|
|
|
stencilTable->GetSizesBuffer(),
|
|
|
|
stencilTable->GetOffsetsBuffer(),
|
|
|
|
stencilTable->GetIndicesBuffer(),
|
|
|
|
stencilTable->GetWeightsBuffer(),
|
|
|
|
stencilTable->GetDuWeightsBuffer(),
|
|
|
|
stencilTable->GetDvWeightsBuffer(),
|
|
|
|
stencilTable->GetDuuWeightsBuffer(),
|
|
|
|
stencilTable->GetDuvWeightsBuffer(),
|
|
|
|
stencilTable->GetDvvWeightsBuffer(),
|
|
|
|
/* start = */ 0,
|
|
|
|
/* end = */ stencilTable->GetNumStencils());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \brief Dispatch the GLSL compute kernel on GPU asynchronously
|
|
|
|
/// returns false if the kernel hasn't been compiled yet.
|
|
|
|
///
|
|
|
|
/// @param srcBuffer GL buffer of input primvar source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the srcBuffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer GL buffer of output primvar destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the dstBuffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer GL buffer of output derivative wrt u
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer GL buffer of output derivative wrt v
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param sizesBuffer GL buffer of the sizes in the stencil table
|
|
|
|
///
|
|
|
|
/// @param offsetsBuffer GL buffer of the offsets in the stencil table
|
|
|
|
///
|
|
|
|
/// @param indicesBuffer GL buffer of the indices in the stencil table
|
|
|
|
///
|
|
|
|
/// @param weightsBuffer GL buffer of the weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param duWeightsBuffer GL buffer of the du weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param dvWeightsBuffer GL buffer of the dv weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param start start index of stencil table
|
|
|
|
///
|
|
|
|
/// @param end end index of stencil table
|
|
|
|
///
|
|
|
|
bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
GLuint dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
GLuint duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
GLuint dvBuffer, BufferDescriptor const &dvDesc,
|
|
|
|
GLuint sizesBuffer,
|
|
|
|
GLuint offsetsBuffer,
|
|
|
|
GLuint indicesBuffer,
|
|
|
|
GLuint weightsBuffer,
|
|
|
|
GLuint duWeightsBuffer,
|
|
|
|
GLuint dvWeightsBuffer,
|
|
|
|
int start,
|
|
|
|
int end) const;
|
|
|
|
|
2017-01-26 22:35:16 +00:00
|
|
|
/// \brief Dispatch the GLSL compute kernel on GPU asynchronously
|
2015-05-09 00:31:26 +00:00
|
|
|
/// returns false if the kernel hasn't been compiled yet.
|
2017-01-26 22:35:16 +00:00
|
|
|
///
|
|
|
|
/// @param srcBuffer GL buffer of input primvar source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the srcBuffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer GL buffer of output primvar destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the dstBuffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer GL buffer of output derivative wrt u
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer GL buffer of output derivative wrt v
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duuBuffer GL buffer of output 2nd derivative wrt u
|
|
|
|
///
|
|
|
|
/// @param duuDesc vertex buffer descriptor for the duuBuffer
|
|
|
|
///
|
|
|
|
/// @param duvBuffer GL buffer of output 2nd derivative wrt u and v
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer GL buffer of output 2nd derivative wrt v
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param sizesBuffer GL buffer of the sizes in the stencil table
|
|
|
|
///
|
|
|
|
/// @param offsetsBuffer GL buffer of the offsets in the stencil table
|
|
|
|
///
|
|
|
|
/// @param indicesBuffer GL buffer of the indices in the stencil table
|
|
|
|
///
|
|
|
|
/// @param weightsBuffer GL buffer of the weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param duWeightsBuffer GL buffer of the du weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param dvWeightsBuffer GL buffer of the dv weights in the stencil table
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duuWeightsBuffer GL buffer of the duu weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param duvWeightsBuffer GL buffer of the duv weights in the stencil table
|
|
|
|
///
|
|
|
|
/// @param dvvWeightsBuffer GL buffer of the dvv weights in the stencil table
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param start start index of stencil table
|
|
|
|
///
|
|
|
|
/// @param end end index of stencil table
|
|
|
|
///
|
2015-05-29 16:21:14 +00:00
|
|
|
bool EvalStencils(GLuint srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
GLuint dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
GLuint duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
GLuint dvBuffer, BufferDescriptor const &dvDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
GLuint duuBuffer, BufferDescriptor const &duuDesc,
|
|
|
|
GLuint duvBuffer, BufferDescriptor const &duvDesc,
|
|
|
|
GLuint dvvBuffer, BufferDescriptor const &dvvDesc,
|
2015-05-09 00:31:26 +00:00
|
|
|
GLuint sizesBuffer,
|
|
|
|
GLuint offsetsBuffer,
|
|
|
|
GLuint indicesBuffer,
|
|
|
|
GLuint weightsBuffer,
|
2015-05-28 00:23:36 +00:00
|
|
|
GLuint duWeightsBuffer,
|
|
|
|
GLuint dvWeightsBuffer,
|
2017-01-26 22:36:30 +00:00
|
|
|
GLuint duuWeightsBuffer,
|
|
|
|
GLuint duvWeightsBuffer,
|
|
|
|
GLuint dvvWeightsBuffer,
|
2015-05-09 00:31:26 +00:00
|
|
|
int start,
|
|
|
|
int end) 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
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// Limit evaluations with PatchTable
|
|
|
|
///
|
|
|
|
/// ----------------------------------------------------------------------
|
2016-09-29 16:56:15 +00:00
|
|
|
|
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
|
|
|
/// \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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
} 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());
|
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,
|
|
|
|
patchTable);
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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:35:16 +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:35:16 +00:00
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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:35:16 +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
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
static bool EvalPatches(
|
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,
|
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,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
2017-01-26 22:35:16 +00:00
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc);
|
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,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
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.
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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
|
|
|
///
|
|
|
|
/// @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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
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 BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
2017-01-26 22:36:30 +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 not used in the GLXFB evaluator
|
|
|
|
///
|
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
|
|
|
static bool EvalPatches(
|
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,
|
|
|
|
DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
|
|
|
|
DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
|
|
|
|
DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
|
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,
|
2017-01-26 22:36:30 +00:00
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = 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
|
|
|
|
2017-01-26 22:36:30 +00:00
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatches(srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
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) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetPatchArrays(),
|
|
|
|
patchTable->GetPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
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) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetPatchArrays(),
|
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
|
|
|
patchTable->GetPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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.
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
2017-01-26 22:35:16 +00:00
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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
|
|
|
///
|
|
|
|
/// @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 BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvvDesc vertex buffer descriptor for the dvvBuffer
|
|
|
|
///
|
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.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
bool EvalPatches(
|
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,
|
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) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duuBuffer->BindVBO(), duuDesc,
|
|
|
|
duvBuffer->BindVBO(), duvDesc,
|
|
|
|
dvvBuffer->BindVBO(), dvvDesc,
|
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->BindVBO(),
|
|
|
|
patchTable->GetPatchArrays(),
|
|
|
|
patchTable->GetPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer());
|
|
|
|
}
|
|
|
|
|
2015-05-29 16:21:14 +00:00
|
|
|
bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
GLuint dstBuffer, BufferDescriptor const &dstDesc,
|
2017-01-26 22:35:16 +00:00
|
|
|
GLuint duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
GLuint dvBuffer, BufferDescriptor const &dvDesc,
|
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,
|
|
|
|
GLuint patchCoordsBuffer,
|
|
|
|
const PatchArrayVector &patchArrays,
|
|
|
|
GLuint patchIndexBuffer,
|
|
|
|
GLuint patchParamsBuffer) const;
|
|
|
|
|
2017-01-26 22:36:30 +00:00
|
|
|
bool EvalPatches(GLuint srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
GLuint dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
GLuint duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
GLuint dvBuffer, BufferDescriptor const &dvDesc,
|
|
|
|
GLuint duuBuffer, BufferDescriptor const &duuDesc,
|
|
|
|
GLuint duvBuffer, BufferDescriptor const &duvDesc,
|
|
|
|
GLuint dvvBuffer, BufferDescriptor const &dvvDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
GLuint patchCoordsBuffer,
|
|
|
|
const PatchArrayVector &patchArrays,
|
|
|
|
GLuint patchIndexBuffer,
|
|
|
|
GLuint patchParamsBuffer) const;
|
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
static bool EvalPatchesVarying(
|
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor());
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
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.
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
2016-09-29 16:56:15 +00:00
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
2016-09-29 16:56:15 +00:00
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
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) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetVaryingPatchArrays(),
|
|
|
|
patchTable->GetVaryingPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
2017-01-26 22:36:30 +00:00
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
2017-01-26 22:36:30 +00:00
|
|
|
static bool EvalPatchesVarying(
|
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,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
2017-01-26 22:36:30 +00:00
|
|
|
return instance->EvalPatchesVarying(
|
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);
|
2016-09-29 16:56:15 +00:00
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duDesc, dvDesc);
|
2016-09-29 16:56:15 +00:00
|
|
|
if (instance) {
|
2017-01-26 22:36:30 +00:00
|
|
|
bool r = instance->EvalPatchesVarying(
|
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);
|
2016-09-29 16:56:15 +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.
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
2016-09-29 16:56:15 +00:00
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
2017-01-26 22:35:16 +00:00
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
2016-09-29 16:56:15 +00:00
|
|
|
///
|
|
|
|
/// @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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
2016-09-29 16:56:15 +00:00
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
2017-01-26 22:36:30 +00:00
|
|
|
bool EvalPatchesVarying(
|
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,
|
2017-01-26 22:36:30 +00:00
|
|
|
PATCH_TABLE *patchTable) const {
|
2016-09-29 16:56:15 +00:00
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetVaryingPatchArrays(),
|
|
|
|
patchTable->GetVaryingPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
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,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable);
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
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) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
|
|
|
duuBuffer->BindVBO(), duuDesc,
|
|
|
|
duvBuffer->BindVBO(), duvDesc,
|
|
|
|
dvvBuffer->BindVBO(), dvvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetVaryingPatchArrays(),
|
|
|
|
patchTable->GetVaryingPatchIndexBuffer(),
|
|
|
|
patchTable->GetPatchParamBuffer());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
static bool EvalPatchesFaceVarying(
|
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
int fvarChannel,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
BufferDescriptor(),
|
|
|
|
BufferDescriptor());
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel);
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
|
|
|
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,
|
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
int fvarChannel = 0) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
0, BufferDescriptor(),
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetFVarPatchArrays(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchIndexBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchParamBuffer(fvarChannel));
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
static bool EvalPatchesFaceVarying(
|
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
int fvarChannel,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel);
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param numPatchCoords number of patchCoords.
|
|
|
|
///
|
|
|
|
/// @param patchCoords array of locations to be evaluated.
|
|
|
|
/// must have BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
|
|
|
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,
|
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
int fvarChannel = 0) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetFVarPatchArrays(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchIndexBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchParamBuffer(fvarChannel));
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable 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 not used in the GLXFB evaluator
|
|
|
|
///
|
|
|
|
template <typename SRC_BUFFER, typename DST_BUFFER,
|
|
|
|
typename PATCHCOORD_BUFFER, typename PATCH_TABLE>
|
|
|
|
static bool EvalPatchesFaceVarying(
|
|
|
|
SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc,
|
|
|
|
DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc,
|
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
|
|
|
DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
|
|
|
|
DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
|
|
|
|
DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
int fvarChannel,
|
|
|
|
GLComputeEvaluator const *instance,
|
|
|
|
void * deviceContext = NULL) {
|
|
|
|
|
|
|
|
if (instance) {
|
|
|
|
return instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel);
|
|
|
|
} else {
|
|
|
|
// Create an instance on demand (slow)
|
|
|
|
(void)deviceContext; // unused
|
|
|
|
instance = Create(srcDesc, dstDesc,
|
|
|
|
duDesc, dvDesc,
|
|
|
|
duuDesc, duvDesc, dvvDesc);
|
|
|
|
if (instance) {
|
|
|
|
bool r = instance->EvalPatchesFaceVarying(
|
|
|
|
srcBuffer, srcDesc,
|
|
|
|
dstBuffer, dstDesc,
|
|
|
|
duBuffer, duDesc,
|
|
|
|
dvBuffer, dvDesc,
|
|
|
|
duuBuffer, duuDesc,
|
|
|
|
duvBuffer, duvDesc,
|
|
|
|
dvvBuffer, dvvDesc,
|
|
|
|
numPatchCoords, patchCoords,
|
|
|
|
patchTable, fvarChannel);
|
|
|
|
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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of source data
|
|
|
|
///
|
|
|
|
/// @param srcDesc vertex buffer descriptor for the input buffer
|
|
|
|
///
|
|
|
|
/// @param dstBuffer Output primvar buffer
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dstDesc vertex buffer descriptor for the output buffer
|
|
|
|
///
|
|
|
|
/// @param duBuffer Output buffer derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duDesc vertex buffer descriptor for the duBuffer
|
|
|
|
///
|
|
|
|
/// @param dvBuffer Output buffer derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param dvDesc vertex buffer descriptor for the dvBuffer
|
|
|
|
///
|
|
|
|
/// @param duuBuffer Output buffer 2nd derivative wrt u
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning a GL
|
|
|
|
/// buffer object of destination data
|
|
|
|
///
|
|
|
|
/// @param duvDesc vertex buffer descriptor for the duvBuffer
|
|
|
|
///
|
|
|
|
/// @param dvvBuffer Output buffer 2nd derivative wrt v
|
|
|
|
/// must have BindVBO() method returning a GL
|
|
|
|
/// 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 BindVBO() method returning an
|
|
|
|
/// array of PatchCoord struct in VBO.
|
|
|
|
///
|
|
|
|
/// @param patchTable GLPatchTable or equivalent
|
|
|
|
///
|
|
|
|
/// @param fvarChannel face-varying channel
|
|
|
|
///
|
|
|
|
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,
|
|
|
|
DST_BUFFER *duBuffer, BufferDescriptor const &duDesc,
|
|
|
|
DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc,
|
|
|
|
DST_BUFFER *duuBuffer, BufferDescriptor const &duuDesc,
|
|
|
|
DST_BUFFER *duvBuffer, BufferDescriptor const &duvDesc,
|
|
|
|
DST_BUFFER *dvvBuffer, BufferDescriptor const &dvvDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
PATCHCOORD_BUFFER *patchCoords,
|
|
|
|
PATCH_TABLE *patchTable,
|
|
|
|
int fvarChannel = 0) const {
|
|
|
|
|
|
|
|
return EvalPatches(srcBuffer->BindVBO(), srcDesc,
|
|
|
|
dstBuffer->BindVBO(), dstDesc,
|
|
|
|
duBuffer->BindVBO(), duDesc,
|
|
|
|
dvBuffer->BindVBO(), dvDesc,
|
|
|
|
duuBuffer->BindVBO(), duuDesc,
|
|
|
|
duvBuffer->BindVBO(), duvDesc,
|
|
|
|
dvvBuffer->BindVBO(), dvvDesc,
|
2016-09-29 16:56:15 +00:00
|
|
|
numPatchCoords,
|
|
|
|
patchCoords->BindVBO(),
|
|
|
|
patchTable->GetFVarPatchArrays(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchIndexBuffer(fvarChannel),
|
|
|
|
patchTable->GetFVarPatchParamBuffer(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
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// Other methods
|
|
|
|
///
|
|
|
|
/// ----------------------------------------------------------------------
|
|
|
|
|
2015-05-09 00:31:26 +00:00
|
|
|
/// Configure GLSL kernel. A valid GL context must be made current before
|
|
|
|
/// calling this function. 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 dispatched kernel finishes.
|
|
|
|
static void Synchronize(void *deviceContext);
|
|
|
|
|
|
|
|
private:
|
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
|
|
|
struct _StencilKernel {
|
2015-05-28 00:23:36 +00:00
|
|
|
_StencilKernel();
|
|
|
|
~_StencilKernel();
|
2015-05-29 16:21:14 +00:00
|
|
|
bool Compile(BufferDescriptor const &srcDesc,
|
|
|
|
BufferDescriptor const &dstDesc,
|
|
|
|
BufferDescriptor const &duDesc,
|
|
|
|
BufferDescriptor const &dvDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
BufferDescriptor const &duuDesc,
|
|
|
|
BufferDescriptor const &duvDesc,
|
|
|
|
BufferDescriptor const &dvvDesc,
|
2015-05-28 00:23:36 +00:00
|
|
|
int workGroupSize);
|
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
|
|
|
GLuint program;
|
|
|
|
GLuint uniformStart;
|
|
|
|
GLuint uniformEnd;
|
|
|
|
GLuint uniformSrcOffset;
|
|
|
|
GLuint uniformDstOffset;
|
2015-05-28 00:23:36 +00:00
|
|
|
GLuint uniformDuDesc;
|
|
|
|
GLuint uniformDvDesc;
|
2017-01-26 22:36:30 +00:00
|
|
|
GLuint uniformDuuDesc;
|
|
|
|
GLuint uniformDuvDesc;
|
|
|
|
GLuint uniformDvvDesc;
|
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
|
|
|
} _stencilKernel;
|
2015-05-09 00:31:26 +00:00
|
|
|
|
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
|
|
|
struct _PatchKernel {
|
2015-05-28 00:23:36 +00:00
|
|
|
_PatchKernel();
|
|
|
|
~_PatchKernel();
|
2015-05-29 16:21:14 +00:00
|
|
|
bool Compile(BufferDescriptor const &srcDesc,
|
|
|
|
BufferDescriptor const &dstDesc,
|
|
|
|
BufferDescriptor const &duDesc,
|
|
|
|
BufferDescriptor const &dvDesc,
|
2017-01-26 22:36:30 +00:00
|
|
|
BufferDescriptor const &duuDesc,
|
|
|
|
BufferDescriptor const &duvDesc,
|
|
|
|
BufferDescriptor const &dvvDesc,
|
2015-05-28 00:23:36 +00:00
|
|
|
int workGroupSize);
|
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
|
|
|
GLuint program;
|
|
|
|
GLuint uniformSrcOffset;
|
|
|
|
GLuint uniformDstOffset;
|
|
|
|
GLuint uniformPatchArray;
|
|
|
|
GLuint uniformDuDesc;
|
|
|
|
GLuint uniformDvDesc;
|
2017-01-26 22:36:30 +00:00
|
|
|
GLuint uniformDuuDesc;
|
|
|
|
GLuint uniformDuvDesc;
|
|
|
|
GLuint uniformDvvDesc;
|
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
|
|
|
} _patchKernel;
|
2015-05-09 00:31:26 +00:00
|
|
|
|
|
|
|
int _workGroupSize;
|
Improved patch basis eval for Osd to match Far
This updates the patch basis evaluation functions in Osd
to match recent changes to far/patchBasis.
This also exposes a common facility for dealing with PatchCoord,
PatchArray, and PatchParam. These are exposed as global functions
operating on struct data, since C++ style class methods are not
supported by all of the Osd shader and kernel execution envirionments.
Changes:
- Merged far/patchBasis.cpp to osd/patchBasisCommon{,Types,Eval}.h
- Exposed PatchCoord, PatchArray, and PatchParam to Osd kernels
- exposed OsdEvaluatePatchBasis and OsdEvaluatePatchBasisNormalized
- Updated CPU, TBB, Omp, CUDA, OpenCL, GLSL, HLSL, and Metal evaluators
- Updated glFVarViewer
2018-10-30 07:37:25 +00:00
|
|
|
GLuint _patchArraysSSBO;
|
2015-05-09 00:31:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace Osd
|
|
|
|
|
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
using namespace OPENSUBDIV_VERSION;
|
|
|
|
|
|
|
|
} // end namespace OpenSubdiv
|
|
|
|
|
|
|
|
|
2015-05-19 18:22:37 +00:00
|
|
|
#endif // OPENSUBDIV3_OSD_GL_COMPUTE_EVALUATOR_H
|