2012-06-16 00:52:36 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// Copyright 2013 Pixar
|
2012-06-16 00:52:36 +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-06-16 00:52:36 +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-06-16 00:52:36 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// You may obtain a copy of the Apache License at
|
2012-06-16 00:52:36 +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-06-16 00:52:36 +00:00
|
|
|
//
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
struct Vertex {
|
|
|
|
float v[LENGTH];
|
2012-06-16 00:52:36 +00:00
|
|
|
};
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
static void clear(struct Vertex *vertex) {
|
|
|
|
for (int i = 0; i < LENGTH; i++) {
|
|
|
|
vertex->v[i] = 0.0f;
|
2012-06-16 00:52:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-09 00:20:54 +00:00
|
|
|
static void addWithWeight(struct Vertex *dst,
|
|
|
|
__global float *srcOrigin,
|
|
|
|
int index, float weight) {
|
2012-06-16 00:52:36 +00:00
|
|
|
|
2015-05-07 23:11:00 +00:00
|
|
|
__global float *src = srcOrigin + index * SRC_STRIDE;
|
2014-09-05 22:07:46 +00:00
|
|
|
for (int i = 0; i < LENGTH; ++i) {
|
2014-05-09 00:20:54 +00:00
|
|
|
dst->v[i] += src[i] * weight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void writeVertex(__global float *dstOrigin,
|
|
|
|
int index,
|
|
|
|
struct Vertex *src) {
|
|
|
|
|
2015-05-07 23:11:00 +00:00
|
|
|
__global float *dst = dstOrigin + index * DST_STRIDE;
|
2014-09-05 22:07:46 +00:00
|
|
|
for (int i = 0; i < LENGTH; ++i) {
|
2014-05-09 00:20:54 +00:00
|
|
|
dst[i] = src->v[i];
|
2012-06-16 00:52:36 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-28 00:23:36 +00:00
|
|
|
static void writeVertexStride(__global float *dstOrigin,
|
|
|
|
int index,
|
|
|
|
struct Vertex *src,
|
|
|
|
int stride) {
|
2012-06-16 00:52:36 +00:00
|
|
|
|
2015-05-28 00:23:36 +00:00
|
|
|
__global float *dst = dstOrigin + index * stride;
|
|
|
|
for (int i = 0; i < LENGTH; ++i) {
|
|
|
|
dst[i] = src->v[i];
|
|
|
|
}
|
|
|
|
}
|
2012-06-16 00:52:36 +00:00
|
|
|
|
2015-05-28 00:23:36 +00:00
|
|
|
|
|
|
|
__kernel void computeStencils(
|
|
|
|
__global float * src, int srcOffset,
|
|
|
|
__global float * dst, int dstOffset,
|
|
|
|
__global int * sizes,
|
|
|
|
__global int * offsets,
|
|
|
|
__global int * indices,
|
|
|
|
__global float * weights,
|
|
|
|
int batchStart, int batchEnd) {
|
2012-06-16 00:52:36 +00:00
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
int current = get_global_id(0) + batchStart;
|
2014-05-13 23:06:58 +00:00
|
|
|
|
2015-05-07 23:11:00 +00:00
|
|
|
if (current>=batchEnd) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Vertex v;
|
|
|
|
clear(&v);
|
2014-05-13 23:06:58 +00:00
|
|
|
|
2015-05-19 17:16:56 +00:00
|
|
|
int size = sizes[current],
|
2014-09-05 22:07:46 +00:00
|
|
|
offset = offsets[current];
|
2014-05-13 23:06:58 +00:00
|
|
|
|
2015-05-07 23:11:00 +00:00
|
|
|
src += srcOffset;
|
|
|
|
dst += dstOffset;
|
2014-05-13 23:06:58 +00:00
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
for (int i=0; i<size; ++i) {
|
2015-05-07 23:11:00 +00:00
|
|
|
addWithWeight(&v, src, indices[offset+i], weights[offset+i]);
|
2014-05-13 23:06:58 +00:00
|
|
|
}
|
|
|
|
|
2015-05-07 23:11:00 +00:00
|
|
|
writeVertex(dst, current, &v);
|
2012-12-11 01:15:13 +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
|
|
|
|
2015-05-28 00:23:36 +00:00
|
|
|
__kernel void computeStencilsDerivatives(
|
|
|
|
__global float * src, int srcOffset,
|
|
|
|
__global float * dst, int dstOffset,
|
|
|
|
__global float * du, int duOffset, int duStride,
|
|
|
|
__global float * dv, int dvOffset, int dvStride,
|
2017-01-26 22:36:30 +00:00
|
|
|
__global float * duu, int duuOffset, int duuStride,
|
|
|
|
__global float * duv, int duvOffset, int duvStride,
|
|
|
|
__global float * dvv, int dvvOffset, int dvvStride,
|
2015-05-28 00:23:36 +00:00
|
|
|
__global int * sizes,
|
|
|
|
__global int * offsets,
|
|
|
|
__global int * indices,
|
|
|
|
__global float * weights,
|
|
|
|
__global float * duWeights,
|
|
|
|
__global float * dvWeights,
|
2017-01-26 22:36:30 +00:00
|
|
|
__global float * duuWeights,
|
|
|
|
__global float * duvWeights,
|
|
|
|
__global float * dvvWeights,
|
2015-05-28 00:23:36 +00:00
|
|
|
int batchStart, int batchEnd) {
|
|
|
|
|
|
|
|
int current = get_global_id(0) + batchStart;
|
|
|
|
|
|
|
|
if (current>=batchEnd) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:36:30 +00:00
|
|
|
struct Vertex v, vdu, vdv, vduu, vduv, vdvv;
|
2015-05-28 00:23:36 +00:00
|
|
|
clear(&v);
|
|
|
|
clear(&vdu);
|
|
|
|
clear(&vdv);
|
2017-01-26 22:36:30 +00:00
|
|
|
clear(&vduu);
|
|
|
|
clear(&vduv);
|
|
|
|
clear(&vdvv);
|
2015-05-28 00:23:36 +00:00
|
|
|
|
|
|
|
int size = sizes[current],
|
|
|
|
offset = offsets[current];
|
|
|
|
|
|
|
|
if (src) src += srcOffset;
|
|
|
|
if (dst) dst += dstOffset;
|
|
|
|
if (du) du += duOffset;
|
|
|
|
if (dv) dv += dvOffset;
|
2017-01-26 22:36:30 +00:00
|
|
|
if (duu) duu += duuOffset;
|
|
|
|
if (duv) duv += duvOffset;
|
|
|
|
if (dvv) dvv += dvvOffset;
|
2015-05-28 00:23:36 +00:00
|
|
|
|
|
|
|
for (int i=0; i<size; ++i) {
|
|
|
|
int ofs = offset + i;
|
|
|
|
int vid = indices[ofs];
|
|
|
|
if (weights) addWithWeight( &v, src, vid, weights[ofs]);
|
|
|
|
if (duWeights) addWithWeight(&vdu, src, vid, duWeights[ofs]);
|
|
|
|
if (dvWeights) addWithWeight(&vdv, src, vid, dvWeights[ofs]);
|
2017-01-26 22:36:30 +00:00
|
|
|
if (duuWeights) addWithWeight(&vduu, src, vid, duuWeights[ofs]);
|
|
|
|
if (duvWeights) addWithWeight(&vduv, src, vid, duvWeights[ofs]);
|
|
|
|
if (dvvWeights) addWithWeight(&vdvv, src, vid, dvvWeights[ofs]);
|
2015-05-28 00:23:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dst) writeVertex (dst, current, &v);
|
|
|
|
if (du) writeVertexStride(du, current, &vdu, duStride);
|
|
|
|
if (dv) writeVertexStride(dv, current, &vdv, dvStride);
|
2017-01-26 22:36:30 +00:00
|
|
|
if (duu) writeVertexStride(duu, current, &vduu, duuStride);
|
|
|
|
if (duv) writeVertexStride(duv, current, &vduv, duvStride);
|
|
|
|
if (dvv) writeVertexStride(dvv, current, &vdvv, dvvStride);
|
2015-05-28 00:23:36 +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
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
__kernel void computePatches(__global float *src, int srcOffset,
|
|
|
|
__global float *dst, int dstOffset,
|
2015-05-26 18:13:30 +00:00
|
|
|
__global float *du, int duOffset, int duStride,
|
|
|
|
__global float *dv, int dvOffset, int dvStride,
|
2017-01-26 22:36:30 +00:00
|
|
|
__global float *duu, int duuOffset, int duuStride,
|
|
|
|
__global float *duv, int duvOffset, int duvStride,
|
|
|
|
__global float *dvv, int dvvOffset, int dvvStride,
|
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
|
|
|
__global struct OsdPatchCoord *patchCoords,
|
|
|
|
__global struct OsdPatchArray *patchArrayBuffer,
|
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
|
|
|
__global int *patchIndexBuffer,
|
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
|
|
|
__global struct OsdPatchParam *patchParamBuffer) {
|
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 current = get_global_id(0);
|
|
|
|
|
2015-05-26 18:13:30 +00:00
|
|
|
if (src) src += srcOffset;
|
|
|
|
if (dst) dst += dstOffset;
|
2017-01-26 22:36:30 +00:00
|
|
|
if (du) du += duOffset;
|
|
|
|
if (dv) dv += dvOffset;
|
|
|
|
if (duu) duu += duuOffset;
|
|
|
|
if (duv) duv += duvOffset;
|
|
|
|
if (dvv) dvv += dvvOffset;
|
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
|
|
|
|
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
|
|
|
struct OsdPatchCoord coord = patchCoords[current];
|
|
|
|
struct OsdPatchArray array = patchArrayBuffer[coord.arrayIndex];
|
|
|
|
struct OsdPatchParam param = patchParamBuffer[coord.patchIndex];
|
|
|
|
|
|
|
|
int patchType = OsdPatchParamIsRegular(param) ? array.regDesc : array.desc;
|
|
|
|
|
|
|
|
float wP[20], wDu[20], wDv[20], wDuu[20], wDuv[20], wDvv[20];
|
|
|
|
int nPoints = OsdEvaluatePatchBasis(patchType, 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
|
|
|
|
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
|
|
|
int indexBase = array.indexBase + array.stride *
|
2016-09-29 16:56:15 +00:00
|
|
|
(coord.patchIndex - array.primitiveIdBase);
|
2015-05-26 18:13:30 +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 Vertex v;
|
|
|
|
clear(&v);
|
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
|
|
|
for (int i = 0; i < nPoints; ++i) {
|
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 index = patchIndexBuffer[indexBase + i];
|
|
|
|
addWithWeight(&v, src, index, wP[i]);
|
|
|
|
}
|
|
|
|
writeVertex(dst, current, &v);
|
2015-05-26 18:13:30 +00:00
|
|
|
|
|
|
|
if (du) {
|
|
|
|
struct Vertex vdu;
|
|
|
|
clear(&vdu);
|
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
|
|
|
for (int i = 0; i < nPoints; ++i) {
|
2015-05-26 18:13:30 +00:00
|
|
|
int index = patchIndexBuffer[indexBase + i];
|
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
|
|
|
addWithWeight(&vdu, src, index, wDu[i]);
|
2015-05-26 18:13:30 +00:00
|
|
|
}
|
2015-05-28 00:23:36 +00:00
|
|
|
writeVertexStride(du, current, &vdu, duStride);
|
2015-05-26 18:13:30 +00:00
|
|
|
}
|
|
|
|
if (dv) {
|
|
|
|
struct Vertex vdv;
|
|
|
|
clear(&vdv);
|
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
|
|
|
for (int i = 0; i < nPoints; ++i) {
|
2015-05-26 18:13:30 +00:00
|
|
|
int index = patchIndexBuffer[indexBase + i];
|
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
|
|
|
addWithWeight(&vdv, src, index, wDv[i]);
|
2015-05-26 18:13:30 +00:00
|
|
|
}
|
2015-05-28 00:23:36 +00:00
|
|
|
writeVertexStride(dv, current, &vdv, dvStride);
|
2015-05-26 18:13:30 +00:00
|
|
|
}
|
2017-01-26 22:36:30 +00:00
|
|
|
if (duu) {
|
|
|
|
struct Vertex vduu;
|
|
|
|
clear(&vduu);
|
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
|
|
|
for (int i = 0; i < nPoints; ++i) {
|
2017-01-26 22:36:30 +00:00
|
|
|
int index = patchIndexBuffer[indexBase + i];
|
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
|
|
|
addWithWeight(&vduu, src, index, wDuu[i]);
|
2017-01-26 22:36:30 +00:00
|
|
|
}
|
|
|
|
writeVertexStride(duu, current, &vduu, duuStride);
|
|
|
|
}
|
|
|
|
if (duv) {
|
|
|
|
struct Vertex vduv;
|
|
|
|
clear(&vduv);
|
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
|
|
|
for (int i = 0; i < nPoints; ++i) {
|
2017-01-26 22:36:30 +00:00
|
|
|
int index = patchIndexBuffer[indexBase + i];
|
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
|
|
|
addWithWeight(&vduv, src, index, wDuv[i]);
|
2017-01-26 22:36:30 +00:00
|
|
|
}
|
|
|
|
writeVertexStride(duv, current, &vduv, duvStride);
|
|
|
|
}
|
|
|
|
if (dvv) {
|
|
|
|
struct Vertex vdvv;
|
|
|
|
clear(&vdvv);
|
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
|
|
|
for (int i = 0; i < nPoints; ++i) {
|
2017-01-26 22:36:30 +00:00
|
|
|
int index = patchIndexBuffer[indexBase + i];
|
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
|
|
|
addWithWeight(&vdvv, src, index, wDvv[i]);
|
2017-01-26 22:36:30 +00:00
|
|
|
}
|
|
|
|
writeVertexStride(dvv, current, &vdvv, dvvStride);
|
|
|
|
}
|
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
|
|
|
}
|