2012-08-10 22:14:02 +00:00
|
|
|
//
|
2015-05-09 00:31:26 +00:00
|
|
|
// Copyright 2015 Pixar
|
2012-08-10 22:14:02 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// 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:
|
2012-08-10 22:14:02 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// 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.
|
2012-08-10 22:14:02 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// You may obtain a copy of the Apache License at
|
2012-08-10 22:14:02 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2013-07-18 21:19:50 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// 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.
|
2012-08-10 22:14:02 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
|
2015-05-09 00:31:26 +00:00
|
|
|
#include "../osd/ompEvaluator.h"
|
|
|
|
#include "../osd/ompKernel.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 "../far/patchBasis.h"
|
2015-05-09 00:31:26 +00:00
|
|
|
#include <omp.h>
|
2012-08-10 22:14:02 +00:00
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
namespace Osd {
|
|
|
|
|
2015-05-09 00:31:26 +00:00
|
|
|
/* static */
|
|
|
|
bool
|
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
|
|
|
OmpEvaluator::EvalStencils(
|
2015-05-29 16:21:14 +00:00
|
|
|
const float *src, BufferDescriptor const &srcDesc,
|
|
|
|
float *dst, 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
|
|
|
const int * sizes,
|
|
|
|
const int * offsets,
|
|
|
|
const int * indices,
|
|
|
|
const float * weights,
|
|
|
|
int start, int end) {
|
|
|
|
|
2015-05-09 00:31:26 +00:00
|
|
|
if (end <= start) return true;
|
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 (srcDesc.length != dstDesc.length) return false;
|
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
|
|
|
// XXX: we can probably expand cpuKernel.cpp to here.
|
2015-05-09 00:31:26 +00:00
|
|
|
OmpEvalStencils(src, srcDesc, dst, dstDesc,
|
|
|
|
sizes, offsets, indices, weights, start, end);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* static */
|
|
|
|
bool
|
|
|
|
OmpEvaluator::EvalStencils(
|
2015-05-29 16:21:14 +00:00
|
|
|
const float *src, BufferDescriptor const &srcDesc,
|
|
|
|
float *dst, BufferDescriptor const &dstDesc,
|
|
|
|
float *du, BufferDescriptor const &duDesc,
|
|
|
|
float *dv, 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
|
|
|
const int * sizes,
|
|
|
|
const int * offsets,
|
|
|
|
const int * indices,
|
|
|
|
const float * weights,
|
|
|
|
const float * duWeights,
|
|
|
|
const float * dvWeights,
|
|
|
|
int start, int end) {
|
|
|
|
|
|
|
|
if (end <= start) return true;
|
|
|
|
if (srcDesc.length != dstDesc.length) return false;
|
|
|
|
if (srcDesc.length != duDesc.length) return false;
|
|
|
|
if (srcDesc.length != dvDesc.length) return false;
|
|
|
|
|
|
|
|
OmpEvalStencils(src, srcDesc,
|
|
|
|
dst, dstDesc,
|
|
|
|
du, duDesc,
|
|
|
|
dv, dvDesc,
|
|
|
|
sizes, offsets, indices,
|
|
|
|
weights, duWeights, dvWeights,
|
|
|
|
start, end);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct BufferAdapter {
|
|
|
|
BufferAdapter(T *p, int length, int stride) :
|
|
|
|
_p(p), _length(length), _stride(stride) { }
|
|
|
|
void Clear() {
|
|
|
|
for (int i = 0; i < _length; ++i) _p[i] = 0;
|
|
|
|
}
|
|
|
|
void AddWithWeight(T const *src, float w) {
|
|
|
|
if (_p) {
|
|
|
|
// TODO: derivatives.
|
|
|
|
for (int i = 0; i < _length; ++i) {
|
|
|
|
_p[i] += src[i] * w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const T *operator[] (int index) const {
|
|
|
|
return _p + _stride * index;
|
|
|
|
}
|
|
|
|
BufferAdapter<T> & operator ++() {
|
|
|
|
if (_p) {
|
|
|
|
_p += _stride;
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
T *_p;
|
|
|
|
int _length;
|
|
|
|
int _stride;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* static */
|
|
|
|
bool
|
|
|
|
OmpEvaluator::EvalPatches(
|
2015-05-29 16:21:14 +00:00
|
|
|
const float *src, BufferDescriptor const &srcDesc,
|
|
|
|
float *dst, 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,
|
|
|
|
const PatchCoord *patchCoords,
|
|
|
|
const PatchArray *patchArrays,
|
|
|
|
const int *patchIndexBuffer,
|
|
|
|
const PatchParam *patchParamBuffer){
|
|
|
|
|
|
|
|
src += srcDesc.offset;
|
|
|
|
if (dst) dst += dstDesc.offset;
|
|
|
|
else return false;
|
|
|
|
BufferAdapter<const float> srcT(src, srcDesc.length, srcDesc.stride);
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
for (int i = 0; i < numPatchCoords; ++i) {
|
|
|
|
BufferAdapter<float> dstT(dst + dstDesc.stride*i, dstDesc.length, dstDesc.stride);
|
|
|
|
|
|
|
|
float wP[20], wDs[20], wDt[20];
|
|
|
|
PatchCoord const &coord = patchCoords[i];
|
|
|
|
PatchArray const &array = patchArrays[coord.handle.arrayIndex];
|
|
|
|
|
2016-09-29 16:38:32 +00:00
|
|
|
Far::PatchParam const & param =
|
|
|
|
patchParamBuffer[coord.handle.patchIndex];
|
2016-09-29 16:56:15 +00:00
|
|
|
int patchType = param.IsRegular()
|
|
|
|
? Far::PatchDescriptor::REGULAR
|
|
|
|
: array.GetPatchType();
|
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 numControlVertices = 0;
|
|
|
|
if (patchType == Far::PatchDescriptor::REGULAR) {
|
2015-06-11 20:18:25 +00:00
|
|
|
Far::internal::GetBSplineWeights(param,
|
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
|
|
|
coord.s, coord.t, wP, wDs, wDt);
|
|
|
|
numControlVertices = 16;
|
|
|
|
} else if (patchType == Far::PatchDescriptor::GREGORY_BASIS) {
|
2015-06-11 20:18:25 +00:00
|
|
|
Far::internal::GetGregoryWeights(param,
|
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
|
|
|
coord.s, coord.t, wP, wDs, wDt);
|
|
|
|
numControlVertices = 20;
|
|
|
|
} else if (patchType == Far::PatchDescriptor::QUADS) {
|
2015-06-11 20:18:25 +00:00
|
|
|
Far::internal::GetBilinearWeights(param,
|
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
|
|
|
coord.s, coord.t, wP, wDs, wDt);
|
|
|
|
numControlVertices = 4;
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
2016-09-29 16:56:15 +00:00
|
|
|
|
|
|
|
int indexStride = Far::PatchDescriptor(array.GetPatchType()).GetNumControlVertices();
|
|
|
|
int indexBase = array.GetIndexBase() + indexStride *
|
|
|
|
(coord.handle.patchIndex - array.GetPrimitiveIdBase());
|
|
|
|
|
|
|
|
const int *cvs = &patchIndexBuffer[indexBase];
|
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
|
|
|
|
|
|
|
dstT.Clear();
|
|
|
|
for (int j = 0; j < numControlVertices; ++j) {
|
|
|
|
dstT.AddWithWeight(srcT[cvs[j]], wP[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
|
|
|
bool
|
|
|
|
OmpEvaluator::EvalPatches(
|
2015-05-29 16:21:14 +00:00
|
|
|
const float *src, BufferDescriptor const &srcDesc,
|
|
|
|
float *dst, BufferDescriptor const &dstDesc,
|
|
|
|
float *du, BufferDescriptor const &duDesc,
|
|
|
|
float *dv, 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 const *patchCoords,
|
|
|
|
PatchArray const *patchArrays,
|
|
|
|
const int *patchIndexBuffer,
|
|
|
|
PatchParam const *patchParamBuffer) {
|
|
|
|
|
|
|
|
src += srcDesc.offset;
|
|
|
|
if (dst) dst += dstDesc.offset;
|
|
|
|
if (du) du += duDesc.offset;
|
|
|
|
if (dv) dv += dvDesc.offset;
|
|
|
|
|
|
|
|
BufferAdapter<const float> srcT(src, srcDesc.length, srcDesc.stride);
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
for (int i = 0; i < numPatchCoords; ++i) {
|
2017-01-26 22:36:30 +00:00
|
|
|
float wP[20], wDu[20], wDv[20];
|
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
|
|
|
BufferAdapter<float> dstT(dst + dstDesc.stride*i, dstDesc.length, dstDesc.stride);
|
|
|
|
BufferAdapter<float> duT(du + duDesc.stride*i, duDesc.length, duDesc.stride);
|
|
|
|
BufferAdapter<float> dvT(dv + dvDesc.stride*i, dvDesc.length, dvDesc.stride);
|
|
|
|
|
|
|
|
PatchCoord const &coord = patchCoords[i];
|
|
|
|
PatchArray const &array = patchArrays[coord.handle.arrayIndex];
|
|
|
|
|
2016-09-29 16:38:32 +00:00
|
|
|
Far::PatchParam const & param =
|
|
|
|
patchParamBuffer[coord.handle.patchIndex];
|
2016-09-29 16:56:15 +00:00
|
|
|
int patchType = param.IsRegular()
|
|
|
|
? Far::PatchDescriptor::REGULAR
|
|
|
|
: array.GetPatchType();
|
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 numControlVertices = 0;
|
|
|
|
if (patchType == Far::PatchDescriptor::REGULAR) {
|
2015-06-11 20:18:25 +00:00
|
|
|
Far::internal::GetBSplineWeights(param,
|
2017-01-26 22:36:30 +00:00
|
|
|
coord.s, coord.t, wP, wDu, wDv);
|
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
|
|
|
numControlVertices = 16;
|
|
|
|
} else if (patchType == Far::PatchDescriptor::GREGORY_BASIS) {
|
2015-06-11 20:18:25 +00:00
|
|
|
Far::internal::GetGregoryWeights(param,
|
2017-01-26 22:36:30 +00:00
|
|
|
coord.s, coord.t, wP, wDu, wDv);
|
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
|
|
|
numControlVertices = 20;
|
|
|
|
} else if (patchType == Far::PatchDescriptor::QUADS) {
|
2015-06-11 20:18:25 +00:00
|
|
|
Far::internal::GetBilinearWeights(param,
|
2017-01-26 22:36:30 +00:00
|
|
|
coord.s, coord.t, wP, wDu, wDv);
|
|
|
|
numControlVertices = 4;
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
int indexStride = Far::PatchDescriptor(array.GetPatchType()).GetNumControlVertices();
|
|
|
|
int indexBase = array.GetIndexBase() + indexStride *
|
|
|
|
(coord.handle.patchIndex - array.GetPrimitiveIdBase());
|
|
|
|
|
|
|
|
const int *cvs = &patchIndexBuffer[indexBase];
|
|
|
|
|
|
|
|
dstT.Clear();
|
|
|
|
duT.Clear();
|
|
|
|
dvT.Clear();
|
|
|
|
for (int j = 0; j < numControlVertices; ++j) {
|
|
|
|
dstT.AddWithWeight(srcT[cvs[j]], wP[j]);
|
|
|
|
duT.AddWithWeight(srcT[cvs[j]], wDu[j]);
|
|
|
|
dvT.AddWithWeight(srcT[cvs[j]], wDv[j]);
|
|
|
|
}
|
|
|
|
++dstT;
|
|
|
|
++duT;
|
|
|
|
++dvT;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
|
|
|
bool
|
|
|
|
OmpEvaluator::EvalPatches(
|
|
|
|
const float *src, BufferDescriptor const &srcDesc,
|
|
|
|
float *dst, BufferDescriptor const &dstDesc,
|
|
|
|
float *du, BufferDescriptor const &duDesc,
|
|
|
|
float *dv, BufferDescriptor const &dvDesc,
|
|
|
|
float *duu, BufferDescriptor const &duuDesc,
|
|
|
|
float *duv, BufferDescriptor const &duvDesc,
|
|
|
|
float *dvv, BufferDescriptor const &dvvDesc,
|
|
|
|
int numPatchCoords,
|
|
|
|
PatchCoord const *patchCoords,
|
|
|
|
PatchArray const *patchArrays,
|
|
|
|
const int *patchIndexBuffer,
|
|
|
|
PatchParam const *patchParamBuffer) {
|
|
|
|
|
|
|
|
src += srcDesc.offset;
|
|
|
|
if (dst) dst += dstDesc.offset;
|
|
|
|
if (du) du += duDesc.offset;
|
|
|
|
if (dv) dv += dvDesc.offset;
|
|
|
|
if (duu) duu += duuDesc.offset;
|
|
|
|
if (duv) duv += duvDesc.offset;
|
|
|
|
if (dvv) dvv += dvvDesc.offset;
|
|
|
|
|
|
|
|
BufferAdapter<const float> srcT(src, srcDesc.length, srcDesc.stride);
|
|
|
|
|
|
|
|
#pragma omp parallel for
|
|
|
|
for (int i = 0; i < numPatchCoords; ++i) {
|
|
|
|
float wP[20], wDu[20], wDv[20], wDuu[20], wDuv[20], wDvv[20];
|
|
|
|
BufferAdapter<float> dstT(dst + dstDesc.stride*i, dstDesc.length, dstDesc.stride);
|
|
|
|
BufferAdapter<float> duT(du + duDesc.stride*i, duDesc.length, duDesc.stride);
|
|
|
|
BufferAdapter<float> dvT(dv + dvDesc.stride*i, dvDesc.length, dvDesc.stride);
|
|
|
|
BufferAdapter<float> duuT(duu + duuDesc.stride*i, duuDesc.length, duuDesc.stride);
|
|
|
|
BufferAdapter<float> duvT(duv + duvDesc.stride*i, duvDesc.length, duvDesc.stride);
|
|
|
|
BufferAdapter<float> dvvT(dvv + dvvDesc.stride*i, dvvDesc.length, dvvDesc.stride);
|
|
|
|
|
|
|
|
PatchCoord const &coord = patchCoords[i];
|
|
|
|
PatchArray const &array = patchArrays[coord.handle.arrayIndex];
|
|
|
|
|
|
|
|
Far::PatchParam const & param =
|
|
|
|
patchParamBuffer[coord.handle.patchIndex];
|
|
|
|
int patchType = param.IsRegular()
|
|
|
|
? Far::PatchDescriptor::REGULAR
|
|
|
|
: array.GetPatchType();
|
|
|
|
|
|
|
|
int numControlVertices = 0;
|
|
|
|
if (patchType == Far::PatchDescriptor::REGULAR) {
|
|
|
|
Far::internal::GetBSplineWeights(param,
|
|
|
|
coord.s, coord.t, wP,
|
|
|
|
wDu, wDv, wDuu, wDuv, wDvv);
|
|
|
|
numControlVertices = 16;
|
|
|
|
} else if (patchType == Far::PatchDescriptor::GREGORY_BASIS) {
|
|
|
|
Far::internal::GetGregoryWeights(param,
|
|
|
|
coord.s, coord.t, wP,
|
|
|
|
wDu, wDv, wDuu, wDuv, wDvv);
|
|
|
|
numControlVertices = 20;
|
|
|
|
} else if (patchType == Far::PatchDescriptor::QUADS) {
|
|
|
|
Far::internal::GetBilinearWeights(param,
|
|
|
|
coord.s, coord.t, wP,
|
|
|
|
wDu, wDv, wDuu, wDuv, wDvv);
|
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
|
|
|
numControlVertices = 4;
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
2016-09-29 16:56:15 +00:00
|
|
|
|
|
|
|
int indexStride = Far::PatchDescriptor(array.GetPatchType()).GetNumControlVertices();
|
|
|
|
int indexBase = array.GetIndexBase() + indexStride *
|
|
|
|
(coord.handle.patchIndex - array.GetPrimitiveIdBase());
|
|
|
|
|
|
|
|
const int *cvs = &patchIndexBuffer[indexBase];
|
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
|
|
|
|
|
|
|
dstT.Clear();
|
|
|
|
duT.Clear();
|
|
|
|
dvT.Clear();
|
2017-01-26 22:36:30 +00:00
|
|
|
duuT.Clear();
|
|
|
|
duvT.Clear();
|
|
|
|
dvvT.Clear();
|
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
|
|
|
for (int j = 0; j < numControlVertices; ++j) {
|
|
|
|
dstT.AddWithWeight(srcT[cvs[j]], wP[j]);
|
2017-01-26 22:36:30 +00:00
|
|
|
duT.AddWithWeight(srcT[cvs[j]], wDu[j]);
|
|
|
|
dvT.AddWithWeight(srcT[cvs[j]], wDv[j]);
|
|
|
|
duuT.AddWithWeight(srcT[cvs[j]], wDuu[j]);
|
|
|
|
duvT.AddWithWeight(srcT[cvs[j]], wDuv[j]);
|
|
|
|
dvvT.AddWithWeight(srcT[cvs[j]], wDvv[j]);
|
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
|
|
|
}
|
|
|
|
++dstT;
|
|
|
|
++duT;
|
|
|
|
++dvT;
|
2017-01-26 22:36:30 +00:00
|
|
|
++duuT;
|
|
|
|
++duvT;
|
|
|
|
++dvvT;
|
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 true;
|
|
|
|
}
|
|
|
|
|
2016-09-29 16:56:15 +00:00
|
|
|
|
2015-05-09 00:31:26 +00:00
|
|
|
/* static */
|
|
|
|
void
|
|
|
|
OmpEvaluator::Synchronize(void * /*deviceContext*/) {
|
|
|
|
// we use "omp parallel for" and it synchronizes by itself
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
|
|
|
void
|
|
|
|
OmpEvaluator::SetNumThreads(int numThreads) {
|
|
|
|
omp_set_num_threads(numThreads);
|
|
|
|
}
|
2012-08-10 22:14:02 +00:00
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
} // end namespace Osd
|
|
|
|
|
2012-12-11 01:15:13 +00:00
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
} // end namespace OpenSubdiv
|