mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-17 22:21:07 +00:00
Merge pull request #929 from davidgyu/dev_osd_eval_fixes
Fixed Cpu Omp and GLXFB EvalStencils w/ deriv
This commit is contained in:
commit
a9dfea5bb8
@ -211,9 +211,9 @@ CpuEvalStencils(float const * src, BufferDescriptor const &srcDesc,
|
|||||||
float * result = (float*)alloca(nOutLength * sizeof(float));
|
float * result = (float*)alloca(nOutLength * sizeof(float));
|
||||||
float * resultDu = result + dstDesc.length;
|
float * resultDu = result + dstDesc.length;
|
||||||
float * resultDv = resultDu + dstDuDesc.length;
|
float * resultDv = resultDu + dstDuDesc.length;
|
||||||
float * resultDuu = resultDv + dstDuuDesc.length;
|
float * resultDuu = resultDv + dstDvDesc.length;
|
||||||
float * resultDuv = resultDuu + dstDuvDesc.length;
|
float * resultDuv = resultDuu + dstDuuDesc.length;
|
||||||
float * resultDvv = resultDuv + dstDvvDesc.length;
|
float * resultDvv = resultDuv + dstDuvDesc.length;
|
||||||
|
|
||||||
int nStencils = end - start;
|
int nStencils = end - start;
|
||||||
for (int i = 0; i < nStencils; ++i, ++sizes) {
|
for (int i = 0; i < nStencils; ++i, ++sizes) {
|
||||||
@ -234,7 +234,7 @@ CpuEvalStencils(float const * src, BufferDescriptor const &srcDesc,
|
|||||||
copy(dstDu, i, resultDu, dstDuDesc);
|
copy(dstDu, i, resultDu, dstDuDesc);
|
||||||
copy(dstDv, i, resultDv, dstDvDesc);
|
copy(dstDv, i, resultDv, dstDvDesc);
|
||||||
copy(dstDuu, i, resultDuu, dstDuuDesc);
|
copy(dstDuu, i, resultDuu, dstDuuDesc);
|
||||||
copy(dstDuv, i, resultDuu, dstDuvDesc);
|
copy(dstDuv, i, resultDuv, dstDuvDesc);
|
||||||
copy(dstDvv, i, resultDvv, dstDvvDesc);
|
copy(dstDvv, i, resultDvv, dstDvvDesc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,14 +540,12 @@ GLXFBEvaluator::EvalStencils(
|
|||||||
bindTexture(_stencilKernel.uniformDuWeightsTexture, duWeightsTexture, 5);
|
bindTexture(_stencilKernel.uniformDuWeightsTexture, duWeightsTexture, 5);
|
||||||
if (_stencilKernel.uniformDvWeightsTexture >= 0 && dvWeightsTexture)
|
if (_stencilKernel.uniformDvWeightsTexture >= 0 && dvWeightsTexture)
|
||||||
bindTexture(_stencilKernel.uniformDvWeightsTexture, dvWeightsTexture, 6);
|
bindTexture(_stencilKernel.uniformDvWeightsTexture, dvWeightsTexture, 6);
|
||||||
if (_stencilKernel.uniformDuWeightsTexture >= 0 && duWeightsTexture)
|
|
||||||
bindTexture(_stencilKernel.uniformDuWeightsTexture, duWeightsTexture, 5);
|
|
||||||
if (_stencilKernel.uniformDuuWeightsTexture >= 0 && duuWeightsTexture)
|
if (_stencilKernel.uniformDuuWeightsTexture >= 0 && duuWeightsTexture)
|
||||||
bindTexture(_stencilKernel.uniformDuuWeightsTexture, duuWeightsTexture, 5);
|
bindTexture(_stencilKernel.uniformDuuWeightsTexture, duuWeightsTexture, 7);
|
||||||
if (_stencilKernel.uniformDuvWeightsTexture >= 0 && duvWeightsTexture)
|
if (_stencilKernel.uniformDuvWeightsTexture >= 0 && duvWeightsTexture)
|
||||||
bindTexture(_stencilKernel.uniformDuvWeightsTexture, duvWeightsTexture, 6);
|
bindTexture(_stencilKernel.uniformDuvWeightsTexture, duvWeightsTexture, 8);
|
||||||
if (_stencilKernel.uniformDvvWeightsTexture >= 0 && dvvWeightsTexture)
|
if (_stencilKernel.uniformDvvWeightsTexture >= 0 && dvvWeightsTexture)
|
||||||
bindTexture(_stencilKernel.uniformDvvWeightsTexture, dvvWeightsTexture, 6);
|
bindTexture(_stencilKernel.uniformDvvWeightsTexture, dvvWeightsTexture, 9);
|
||||||
|
|
||||||
// set batch range
|
// set batch range
|
||||||
glUniform1i(_stencilKernel.uniformStart, start);
|
glUniform1i(_stencilKernel.uniformStart, start);
|
||||||
|
@ -84,6 +84,50 @@ OmpEvaluator::EvalStencils(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
bool
|
||||||
|
OmpEvaluator::EvalStencils(
|
||||||
|
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,
|
||||||
|
const int * sizes,
|
||||||
|
const int * offsets,
|
||||||
|
const int * indices,
|
||||||
|
const float * weights,
|
||||||
|
const float * duWeights,
|
||||||
|
const float * dvWeights,
|
||||||
|
const float * duuWeights,
|
||||||
|
const float * duvWeights,
|
||||||
|
const float * dvvWeights,
|
||||||
|
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;
|
||||||
|
if (srcDesc.length != duuDesc.length) return false;
|
||||||
|
if (srcDesc.length != duvDesc.length) return false;
|
||||||
|
if (srcDesc.length != dvvDesc.length) return false;
|
||||||
|
|
||||||
|
OmpEvalStencils(src, srcDesc,
|
||||||
|
dst, dstDesc,
|
||||||
|
du, duDesc,
|
||||||
|
dv, dvDesc,
|
||||||
|
duu, duuDesc,
|
||||||
|
duv, duvDesc,
|
||||||
|
dvv, dvvDesc,
|
||||||
|
sizes, offsets, indices,
|
||||||
|
weights, duWeights, dvWeights,
|
||||||
|
duuWeights, duvWeights, dvvWeights,
|
||||||
|
start, end);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct BufferAdapter {
|
struct BufferAdapter {
|
||||||
BufferAdapter(T *p, int length, int stride) :
|
BufferAdapter(T *p, int length, int stride) :
|
||||||
|
Loading…
Reference in New Issue
Block a user