| 826 | } |
| 827 | |
| 828 | void Scene::commit_task () |
| 829 | { |
| 830 | checkIfModifiedAndSet(); |
| 831 | if (!isModified()) return; |
| 832 | |
| 833 | |
| 834 | /* print scene statistics */ |
| 835 | if (device->verbosity(2)) |
| 836 | printStatistics(); |
| 837 | |
| 838 | progress_monitor_counter = 0; |
| 839 | |
| 840 | /* gather scene stats and call preCommit function of each geometry */ |
| 841 | this->world = parallel_reduce (size_t(0), geometries.size(), GeometryCounts (), |
| 842 | [this](const range<size_t>& r)->GeometryCounts |
| 843 | { |
| 844 | GeometryCounts c; |
| 845 | for (auto i=r.begin(); i<r.end(); ++i) |
| 846 | { |
| 847 | if (geometries[i] && geometries[i]->isEnabled()) |
| 848 | { |
| 849 | geometries[i]->preCommit(); |
| 850 | geometries[i]->addElementsToCount (c); |
| 851 | c.numFilterFunctions += (int) geometries[i]->hasArgumentFilterFunctions(); |
| 852 | c.numFilterFunctions += (int) geometries[i]->hasGeometryFilterFunctions(); |
| 853 | } |
| 854 | } |
| 855 | return c; |
| 856 | }, |
| 857 | std::plus<GeometryCounts>() |
| 858 | ); |
| 859 | |
| 860 | /* calculate maximal number of motion blur time segments in scene */ |
| 861 | maxTimeSegments = 1; |
| 862 | for (size_t geomID=0; geomID<size(); geomID++) |
| 863 | { |
| 864 | Geometry* geom = get(geomID); |
| 865 | if (geom == nullptr) continue; |
| 866 | maxTimeSegments = std::max(maxTimeSegments, geom->numTimeSegments()); |
| 867 | } |
| 868 | |
| 869 | #if defined(EMBREE_SYCL_SUPPORT) |
| 870 | DeviceGPU* gpu_device = dynamic_cast<DeviceGPU*>(device); |
| 871 | if (gpu_device) |
| 872 | build_gpu_accels(); |
| 873 | else |
| 874 | #endif |
| 875 | build_cpu_accels(); |
| 876 | |
| 877 | /* call postCommit function of each geometry */ |
| 878 | parallel_for(geometries.size(), [&] ( const size_t i ) { |
| 879 | if (geometries[i] && geometries[i]->isEnabled()) { |
| 880 | geometries[i]->postCommit(); |
| 881 | vertices[i] = geometries[i]->getCompactVertexArray(); |
| 882 | geometryModCounters_[i] = geometries[i]->getModCounter(); |
| 883 | } |
| 884 | }); |
| 885 |
nothing calls this directly
no test coverage detected