| 447 | } |
| 448 | |
| 449 | extern "C" void renderFrameStandard (int* pixels, |
| 450 | const unsigned int width, |
| 451 | const unsigned int height, |
| 452 | const float time, |
| 453 | const ISPCCamera& camera) |
| 454 | { |
| 455 | #if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION) |
| 456 | TutorialData ldata = data; |
| 457 | sycl::event event = global_gpu_queue->submit([=](sycl::handler& cgh){ |
| 458 | const sycl::nd_range<2> nd_range = make_nd_range(height,width); |
| 459 | cgh.parallel_for(nd_range,[=](sycl::nd_item<2> item) { |
| 460 | const unsigned int x = item.get_global_id(1); if (x >= width ) return; |
| 461 | const unsigned int y = item.get_global_id(0); if (y >= height) return; |
| 462 | RayStats stats; |
| 463 | renderPixelStandard(ldata,x,y,pixels,width,height,time,camera,stats); |
| 464 | }); |
| 465 | }); |
| 466 | global_gpu_queue->wait_and_throw(); |
| 467 | |
| 468 | const auto t0 = event.template get_profiling_info<sycl::info::event_profiling::command_start>(); |
| 469 | const auto t1 = event.template get_profiling_info<sycl::info::event_profiling::command_end>(); |
| 470 | const double dt = (t1-t0)*1E-9; |
| 471 | ((ISPCCamera*)&camera)->render_time = dt; |
| 472 | |
| 473 | #else |
| 474 | const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X; |
| 475 | const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y; |
| 476 | parallel_for(size_t(0),size_t(numTilesX*numTilesY),[&](const range<size_t>& range) { |
| 477 | const int threadIndex = (int)TaskScheduler::threadIndex(); |
| 478 | for (size_t i=range.begin(); i<range.end(); i++) |
| 479 | renderTileTask((int)i,threadIndex,pixels,width,height,time,camera,numTilesX,numTilesY); |
| 480 | }); |
| 481 | #endif |
| 482 | } |
| 483 | |
| 484 | /* called by the C++ code to render */ |
| 485 | extern "C" void device_render (int* pixels, |
nothing calls this directly
no test coverage detected