Merge pull request #929 from davidgyu/dev_osd_eval_fixes

Fixed Cpu Omp and GLXFB EvalStencils w/ deriv
This commit is contained in:
Takahito Tejima 2017-01-31 10:59:55 -08:00 committed by GitHub
commit a9dfea5bb8
3 changed files with 51 additions and 9 deletions

View File

@ -211,9 +211,9 @@ CpuEvalStencils(float const * src, BufferDescriptor const &srcDesc,
float * result = (float*)alloca(nOutLength * sizeof(float));
float * resultDu = result + dstDesc.length;
float * resultDv = resultDu + dstDuDesc.length;
float * resultDuu = resultDv + dstDuuDesc.length;
float * resultDuv = resultDuu + dstDuvDesc.length;
float * resultDvv = resultDuv + dstDvvDesc.length;
float * resultDuu = resultDv + dstDvDesc.length;
float * resultDuv = resultDuu + dstDuuDesc.length;
float * resultDvv = resultDuv + dstDuvDesc.length;
int nStencils = end - start;
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(dstDv, i, resultDv, dstDvDesc);
copy(dstDuu, i, resultDuu, dstDuuDesc);
copy(dstDuv, i, resultDuu, dstDuvDesc);
copy(dstDuv, i, resultDuv, dstDuvDesc);
copy(dstDvv, i, resultDvv, dstDvvDesc);
}
}

View File

@ -540,14 +540,12 @@ GLXFBEvaluator::EvalStencils(
bindTexture(_stencilKernel.uniformDuWeightsTexture, duWeightsTexture, 5);
if (_stencilKernel.uniformDvWeightsTexture >= 0 && dvWeightsTexture)
bindTexture(_stencilKernel.uniformDvWeightsTexture, dvWeightsTexture, 6);
if (_stencilKernel.uniformDuWeightsTexture >= 0 && duWeightsTexture)
bindTexture(_stencilKernel.uniformDuWeightsTexture, duWeightsTexture, 5);
if (_stencilKernel.uniformDuuWeightsTexture >= 0 && duuWeightsTexture)
bindTexture(_stencilKernel.uniformDuuWeightsTexture, duuWeightsTexture, 5);
bindTexture(_stencilKernel.uniformDuuWeightsTexture, duuWeightsTexture, 7);
if (_stencilKernel.uniformDuvWeightsTexture >= 0 && duvWeightsTexture)
bindTexture(_stencilKernel.uniformDuvWeightsTexture, duvWeightsTexture, 6);
bindTexture(_stencilKernel.uniformDuvWeightsTexture, duvWeightsTexture, 8);
if (_stencilKernel.uniformDvvWeightsTexture >= 0 && dvvWeightsTexture)
bindTexture(_stencilKernel.uniformDvvWeightsTexture, dvvWeightsTexture, 6);
bindTexture(_stencilKernel.uniformDvvWeightsTexture, dvvWeightsTexture, 9);
// set batch range
glUniform1i(_stencilKernel.uniformStart, start);

View File

@ -84,6 +84,50 @@ OmpEvaluator::EvalStencils(
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>
struct BufferAdapter {
BufferAdapter(T *p, int length, int stride) :