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

Function evalGrid

kernels/subdiv/subdivpatch1base_eval.cpp:65–211  ·  view source on GitHub ↗

eval grid over patch and stich edges when required */

Source from the content-addressed store, hash-verified

63
64 /* eval grid over patch and stich edges when required */
65 void evalGrid(const SubdivPatch1Base& patch,
66 const unsigned x0, const unsigned x1,
67 const unsigned y0, const unsigned y1,
68 const unsigned swidth, const unsigned sheight,
69 float *__restrict__ const grid_x,
70 float *__restrict__ const grid_y,
71 float *__restrict__ const grid_z,
72 float *__restrict__ const grid_u,
73 float *__restrict__ const grid_v,
74 const SubdivMesh* const geom)
75 {
76 const unsigned dwidth = x1-x0+1;
77 const unsigned dheight = y1-y0+1;
78 const unsigned M = dwidth*dheight+VSIZEX;
79 const unsigned grid_size_simd_blocks = (M-1)/VSIZEX;
80
81 if (unlikely(patch.type == SubdivPatch1Base::EVAL_PATCH))
82 {
83 const bool displ = geom->displFunc;
84 const unsigned N = displ ? M : 0;
85 dynamic_large_stack_array(float,grid_Ng_x,N,32*32*sizeof(float));
86 dynamic_large_stack_array(float,grid_Ng_y,N,32*32*sizeof(float));
87 dynamic_large_stack_array(float,grid_Ng_z,N,32*32*sizeof(float));
88
89 if (geom->patch_eval_trees.size())
90 {
91 feature_adaptive_eval_grid<PatchEvalGrid>
92 (geom->patch_eval_trees[geom->numTimeSteps*patch.primID()+patch.time()], patch.subPatch(), patch.needsStitching() ? patch.level : nullptr,
93 x0,x1,y0,y1,swidth,sheight,
94 grid_x,grid_y,grid_z,grid_u,grid_v,
95 displ ? (float*)grid_Ng_x : nullptr, displ ? (float*)grid_Ng_y : nullptr, displ ? (float*)grid_Ng_z : nullptr,
96 dwidth,dheight);
97 }
98 else
99 {
100 GeneralCatmullClarkPatch3fa ccpatch(patch.edge(),geom->getVertexBuffer(patch.time()));
101
102 feature_adaptive_eval_grid<FeatureAdaptiveEvalGrid,GeneralCatmullClarkPatch3fa>
103 (ccpatch, patch.subPatch(), patch.needsStitching() ? patch.level : nullptr,
104 x0,x1,y0,y1,swidth,sheight,
105 grid_x,grid_y,grid_z,grid_u,grid_v,
106 displ ? (float*)grid_Ng_x : nullptr, displ ? (float*)grid_Ng_y : nullptr, displ ? (float*)grid_Ng_z : nullptr,
107 dwidth,dheight);
108 }
109
110 /* convert sub-patch UVs to patch UVs*/
111 const Vec2f uv0 = patch.getUV(0);
112 const Vec2f uv1 = patch.getUV(1);
113 const Vec2f uv2 = patch.getUV(2);
114 const Vec2f uv3 = patch.getUV(3);
115 for (unsigned i=0; i<grid_size_simd_blocks; i++)
116 {
117 const vfloatx u = vfloatx::load(&grid_u[i*VSIZEX]);
118 const vfloatx v = vfloatx::load(&grid_v[i*VSIZEX]);
119 const vfloatx patch_u = lerp2(uv0.x,uv1.x,uv3.x,uv2.x,u,v);
120 const vfloatx patch_v = lerp2(uv0.y,uv1.y,uv3.y,uv2.y,u,v);
121 vfloatx::store(&grid_u[i*VSIZEX],patch_u);
122 vfloatx::store(&grid_v[i*VSIZEX],patch_v);

Callers 1

GridSOAMethod · 0.85

Calls 11

storeFunction · 0.85
gridUVTessellatorFunction · 0.85
stitchUVGridFunction · 0.85
patchEvalFunction · 0.85
patchNormalFunction · 0.85
timeMethod · 0.80
loadFunction · 0.70
lerp2Function · 0.50
normalize_safeFunction · 0.50
sizeMethod · 0.45
primIDMethod · 0.45

Tested by

no test coverage detected