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

Function renderFrameStandard

tutorials/user_geometry/user_geometry_device.cpp:865–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

863}
864
865extern "C" void renderFrameStandard (int* pixels,
866 const unsigned int width,
867 const unsigned int height,
868 const float time,
869 const ISPCCamera& camera)
870{
871#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION)
872 TutorialData ldata = data;
873 sycl::event event = global_gpu_queue->submit([=](sycl::handler& cgh){
874 const sycl::nd_range<2> nd_range = make_nd_range(height,width);
875 cgh.parallel_for(nd_range,[=](sycl::nd_item<2> item) {
876 const unsigned int x = item.get_global_id(1); if (x >= width ) return;
877 const unsigned int y = item.get_global_id(0); if (y >= height) return;
878 RayStats stats;
879 renderPixelStandard(ldata,x,y,pixels,width,height,time,camera,stats);
880 });
881 });
882 global_gpu_queue->wait_and_throw();
883
884 const auto t0 = event.template get_profiling_info<sycl::info::event_profiling::command_start>();
885 const auto t1 = event.template get_profiling_info<sycl::info::event_profiling::command_end>();
886 const double dt = (t1-t0)*1E-9;
887 ((ISPCCamera*)&camera)->render_time = dt;
888
889#else
890 /* render all pixels */
891 const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X;
892 const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y;
893 parallel_for(size_t(0),size_t(numTilesX*numTilesY),[&](const range<size_t>& range) {
894 const int threadIndex = (int)TaskScheduler::threadIndex();
895 for (size_t i=range.begin(); i<range.end(); i++)
896 renderTileTask((int)i,threadIndex,pixels,width,height,time,camera,numTilesX,numTilesY);
897 });
898#endif
899}
900
901
902/* called by the C++ code to render */

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