| 20 | typedef CatmullClarkPatchT<Vertex,Vertex_t> CatmullClarkPatch; |
| 21 | |
| 22 | PatchEval (SharedLazyTessellationCache::CacheEntry& entry, size_t commitCounter, |
| 23 | const HalfEdge* edge, const char* vertices, size_t stride, const float u, const float v, |
| 24 | Vertex* P, Vertex* dPdu, Vertex* dPdv, Vertex* ddPdudu, Vertex* ddPdvdv, Vertex* ddPdudv) |
| 25 | : P(P), dPdu(dPdu), dPdv(dPdv), ddPdudu(ddPdudu), ddPdvdv(ddPdvdv), ddPdudv(ddPdudv) |
| 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 | if (patch && allAllocationsValid && eval(patch,u,v,1.0f,0)) { |
| 39 | SharedLazyTessellationCache::unlock(); |
| 40 | return; |
| 41 | } |
| 42 | SharedLazyTessellationCache::unlock(); |
| 43 | FeatureAdaptiveEval<Vertex,Vertex_t>(edge,vertices,stride,u,v,P,dPdu,dPdv,ddPdudu,ddPdvdv,ddPdudv); |
| 44 | PATCH_DEBUG_SUBDIVISION(edge,c,-1,-1); |
| 45 | } |
| 46 | |
| 47 | __forceinline bool eval_quad(const typename Patch::SubdividedQuadPatch* This, const float u, const float v, const float dscale, const size_t depth) |
| 48 | { |