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

Function renderFrameStandard

tutorials/pathtracer/pathtracer_device.cpp:1740–1791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1738} // device_init
1739
1740extern "C" void renderFrameStandard (int* pixels,
1741 const unsigned int width,
1742 const unsigned int height,
1743 const float time,
1744 const ISPCCamera& camera)
1745{
1746/* render image */
1747#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION)
1748 TutorialData ldata = data;
1749
1750#if defined(USE_SPECIALIZATION_CONSTANTS)
1751 sycl::event event = global_gpu_queue->submit([=](sycl::handler& cgh){
1752 cgh.set_specialization_constant<rtc_feature_mask>(g_used_features);
1753 const sycl::nd_range<2> nd_range = make_nd_range(height,width);
1754 cgh.parallel_for(nd_range,[=](sycl::nd_item<2> item, sycl::kernel_handler kh) {
1755 const RTCFeatureFlags feature_mask = kh.get_specialization_constant<rtc_feature_mask>();
1756 const unsigned int x = item.get_global_id(1); if (x >= width ) return;
1757 const unsigned int y = item.get_global_id(0); if (y >= height) return;
1758 RayStats stats;
1759 renderPixelStandard(ldata,x,y,pixels,width,height,time,camera,stats,feature_mask);
1760 });
1761 });
1762 global_gpu_queue->wait_and_throw();
1763#else
1764 sycl::event event = global_gpu_queue->submit([=](sycl::handler& cgh) {
1765 const sycl::nd_range<2> nd_range = make_nd_range(height,width);
1766 cgh.parallel_for(nd_range,[=](sycl::nd_item<2> item) {
1767 const unsigned int x = item.get_global_id(1); if (x >= width ) return;
1768 const unsigned int y = item.get_global_id(0); if (y >= height) return;
1769 RayStats stats;
1770 const RTCFeatureFlags feature_mask = RTC_FEATURE_FLAG_ALL;
1771 renderPixelStandard(ldata,x,y,pixels,width,height,time,camera,stats,feature_mask);
1772 });
1773 });
1774 global_gpu_queue->wait_and_throw();
1775#endif
1776
1777 const auto t0 = event.template get_profiling_info<sycl::info::event_profiling::command_start>();
1778 const auto t1 = event.template get_profiling_info<sycl::info::event_profiling::command_end>();
1779 const double dt = (t1-t0)*1E-9;
1780 ((ISPCCamera*)&camera)->render_time = dt;
1781
1782#else
1783 const int numTilesX = (width +TILE_SIZE_X-1)/TILE_SIZE_X;
1784 const int numTilesY = (height+TILE_SIZE_Y-1)/TILE_SIZE_Y;
1785 parallel_for(size_t(0),size_t(numTilesX*numTilesY),[&](const range<size_t>& range) {
1786 const int threadIndex = (int)TaskScheduler::threadIndex();
1787 for (size_t i=range.begin(); i<range.end(); i++)
1788 renderTileTask((int)i,threadIndex,pixels,width,height,time,camera,numTilesX,numTilesY);
1789 });
1790#endif
1791}
1792
1793/* called by the C++ code to render */
1794extern "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