MCPcopy Create free account
hub / github.com/RenderKit/embree / PatchEvalSimd

Method PatchEvalSimd

kernels/subdiv/patch_eval_simd.h:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 typedef CatmullClarkPatchT<Vertex,Vertex_t> CatmullClarkPatch;
21
22 PatchEvalSimd (SharedLazyTessellationCache::CacheEntry& entry, size_t commitCounter,
23 const HalfEdge* edge, const char* vertices, size_t stride, const vbool& valid0, const vfloat& u, const vfloat& v,
24 float* P, float* dPdu, float* dPdv, float* ddPdudu, float* ddPdvdv, float* ddPdudv, const size_t dstride, const size_t N)
25 : P(P), dPdu(dPdu), dPdv(dPdv), ddPdudu(ddPdudu), ddPdvdv(ddPdvdv), ddPdudv(ddPdudv), dstride(dstride), N(N)
26 {
27 /* conservative time for the very first allocation */
28 auto time = SharedLazyTessellationCache::sharedLazyTessellationCache.getTime(commitCounter);
29
30 Ref patch = SharedLazyTessellationCache::lookup(entry,commitCounter,[&] () {
31 auto alloc = [](size_t bytes) { return SharedLazyTessellationCache::malloc(bytes); };
32 return Patch::create(alloc,edge,vertices,stride);
33 }, true);
34
35 auto curTime = SharedLazyTessellationCache::sharedLazyTessellationCache.getTime(commitCounter);
36 const bool allAllocationsValid = SharedLazyTessellationCache::validTime(time,curTime);
37
38 patch = allAllocationsValid ? patch : nullptr;
39
40 /* use cached data structure for calculations */
41 const vbool valid1 = patch ? eval(valid0,patch,u,v,1.0f,0) : vbool(false);
42 SharedLazyTessellationCache::unlock();
43 const vbool valid2 = valid0 & !valid1;
44 if (any(valid2)) {
45 FeatureAdaptiveEvalSimd<vbool,vint,vfloat,Vertex,Vertex_t>(edge,vertices,stride,valid2,u,v,P,dPdu,dPdv,ddPdudu,ddPdvdv,ddPdudv,dstride,N);
46 }
47 }
48
49 vbool eval_quad(const vbool& valid, const typename Patch::SubdividedQuadPatch* This, const vfloat& u, const vfloat& v, const float dscale, const size_t depth)
50 {

Callers

nothing calls this directly

Calls 7

lookupFunction · 0.85
mallocFunction · 0.85
createFunction · 0.85
validTimeFunction · 0.85
unlockFunction · 0.85
evalFunction · 0.70
anyFunction · 0.50

Tested by

no test coverage detected