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

Function renderFrameStandard

tutorials/grid_geometry/grid_geometry_device.cpp:665–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663}
664
665extern "C" void renderFrameStandard (int* pixels,
666 const unsigned int width,
667 const unsigned int height,
668 const float time,
669 const ISPCCamera& camera)
670{
671 /* render image */
672#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION)
673 TutorialData ldata = data;
674 sycl::event event = global_gpu_queue->submit([=](sycl::handler& cgh){
675 const sycl::nd_range<2> nd_range = make_nd_range(height,width);
676 cgh.parallel_for(nd_range,[=](sycl::nd_item<2> item) {
677 const unsigned int x = item.get_global_id(1); if (x >= width ) return;
678 const unsigned int y = item.get_global_id(0); if (y >= height) return;
679 RayStats stats;
680 renderPixelStandard(ldata,x,y,pixels,width,height,time,camera,stats);
681 });
682 });
683 global_gpu_queue->wait_and_throw();
684
685 const auto t0 = event.template get_profiling_info<sycl::info::event_profiling::command_start>();
686 const auto t1 = event.template get_profiling_info<sycl::info::event_profiling::command_end>();
687 const double dt = (t1-t0)*1E-9;
688 ((ISPCCamera*)&camera)->render_time = dt;
689
690#else
691 const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X;
692 const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y;
693 parallel_for(size_t(0),size_t(numTilesX*numTilesY),[&](const range<size_t>& range) {
694 const int threadIndex = (int)TaskScheduler::threadIndex();
695 for (size_t i=range.begin(); i<range.end(); i++)
696 renderTileTask((int)i,threadIndex,pixels,width,height,time,camera,numTilesX,numTilesY);
697 });
698#endif
699}
700
701/* called by the C++ code to render */
702extern "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