renders a single screen tile */
| 308 | |
| 309 | /* renders a single screen tile */ |
| 310 | void 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 */ |
| 341 | void renderTileTask (int taskIndex, int threadIndex, int* pixels, |
no test coverage detected