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

Function renderFrameStandard

tutorials/forest/forest_device.cpp:445–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

make_nd_rangeFunction · 0.85
parallel_forFunction · 0.85
renderPixelStandardFunction · 0.70
renderTileTaskFunction · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected