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

Function renderTileStandard

tutorials/lazy_geometry/lazy_geometry_device.cpp:310–338  ·  view source on GitHub ↗

renders a single screen tile */

Source from the content-addressed store, hash-verified

308
309/* renders a single screen tile */
310void renderTileStandard(int taskIndex,
311 int threadIndex,
312 int* pixels,
313 const unsigned int width,
314 const unsigned int height,
315 const float time,
316 const ISPCCamera& camera,
317 const int numTilesX,
318 const int numTilesY)
319{
320 const unsigned int tileY = taskIndex / numTilesX;
321 const unsigned int tileX = taskIndex - tileY * numTilesX;
322 const unsigned int x0 = tileX * TILE_SIZE_X;
323 const unsigned int x1 = min(x0+TILE_SIZE_X,width);
324 const unsigned int y0 = tileY * TILE_SIZE_Y;
325 const unsigned int y1 = min(y0+TILE_SIZE_Y,height);
326
327 for (unsigned int y=y0; y<y1; y++) for (unsigned int x=x0; x<x1; x++)
328 {
329 /* calculate pixel color */
330 Vec3fa color = renderPixelStandard((float)x,(float)y,camera,g_stats[threadIndex]);
331
332 /* write color to framebuffer */
333 unsigned int r = (unsigned int) (255.0f * clamp(color.x,0.0f,1.0f));
334 unsigned int g = (unsigned int) (255.0f * clamp(color.y,0.0f,1.0f));
335 unsigned int b = (unsigned int) (255.0f * clamp(color.z,0.0f,1.0f));
336 pixels[y*width+x] = (b << 16) + (g << 8) + r;
337 }
338}
339
340/* task that renders a single screen tile */
341void renderTileTask (int taskIndex, int threadIndex, int* pixels,

Callers 1

renderTileTaskFunction · 0.70

Calls 3

renderPixelStandardFunction · 0.70
minFunction · 0.50
clampFunction · 0.50

Tested by

no test coverage detected