0.2.0-dev Download ZIP
349 lines ·13.3 KB Raw
| 1 | diff --git a/thirdparty/embree/common/algorithms/parallel_reduce.h b/thirdparty/embree/common/algorithms/parallel_reduce.h |
| 2 | index b52b1e2e13..fbff38f660 100644 |
| 3 | --- a/thirdparty/embree/common/algorithms/parallel_reduce.h |
| 4 | +++ b/thirdparty/embree/common/algorithms/parallel_reduce.h |
| 5 | @@ -58,15 +58,15 @@ namespace embree |
| 6 | const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity, |
| 7 | [&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); }, |
| 8 | reduction,context); |
| 9 | - if (context.is_group_execution_cancelled()) |
| 10 | - throw std::runtime_error("task cancelled"); |
| 11 | + //if (context.is_group_execution_cancelled()) |
| 12 | + // throw std::runtime_error("task cancelled"); |
| 13 | return v; |
| 14 | #else |
| 15 | const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity, |
| 16 | [&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); }, |
| 17 | reduction); |
| 18 | - if (tbb::task::self().is_cancelled()) |
| 19 | - throw std::runtime_error("task cancelled"); |
| 20 | + //if (tbb::task::self().is_cancelled()) |
| 21 | + // throw std::runtime_error("task cancelled"); |
| 22 | return v; |
| 23 | #endif |
| 24 | #else // TASKING_PPL |
| 25 | diff --git a/thirdparty/embree/common/lexers/stringstream.cpp b/thirdparty/embree/common/lexers/stringstream.cpp |
| 26 | index 42ffb10176..9779fc74c7 100644 |
| 27 | --- a/thirdparty/embree/common/lexers/stringstream.cpp |
| 28 | +++ b/thirdparty/embree/common/lexers/stringstream.cpp |
| 29 | @@ -39,7 +39,7 @@ namespace embree |
| 30 | std::vector<char> str; str.reserve(64); |
| 31 | while (cin->peek() != EOF && !isSeparator(cin->peek())) { |
| 32 | int c = cin->get(); |
| 33 | - if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input"); |
| 34 | + if (!isValidChar(c)) abort(); //throw std::runtime_error("invalid character "+std::string(1,c)+" in input"); |
| 35 | str.push_back((char)c); |
| 36 | } |
| 37 | str.push_back(0); |
| 38 | diff --git a/thirdparty/embree/common/sys/alloc.cpp b/thirdparty/embree/common/sys/alloc.cpp |
| 39 | index c92bb99ece..2288df76ef 100644 |
| 40 | --- a/thirdparty/embree/common/sys/alloc.cpp |
| 41 | +++ b/thirdparty/embree/common/sys/alloc.cpp |
| 42 | @@ -20,7 +20,7 @@ namespace embree |
| 43 | assert((align & (align-1)) == 0); |
| 44 | void* ptr = _mm_malloc(size,align); |
| 45 | if (size != 0 && ptr == nullptr) |
| 46 | - throw std::bad_alloc(); |
| 47 | + abort(); //throw std::bad_alloc(); |
| 48 | return ptr; |
| 49 | } |
| 50 | |
| 51 | @@ -50,7 +50,7 @@ namespace embree |
| 52 | ptr = sycl::aligned_alloc_shared(align,size,*device,*context); |
| 53 | |
| 54 | if (size != 0 && ptr == nullptr) |
| 55 | - throw std::bad_alloc(); |
| 56 | + abort(); //throw std::bad_alloc(); |
| 57 | |
| 58 | return ptr; |
| 59 | } |
| 60 | @@ -83,7 +83,7 @@ namespace embree |
| 61 | } |
| 62 | |
| 63 | if (size != 0 && ptr == nullptr) |
| 64 | - throw std::bad_alloc(); |
| 65 | + abort(); //throw std::bad_alloc(); |
| 66 | |
| 67 | return ptr; |
| 68 | } |
| 69 | @@ -199,7 +199,7 @@ namespace embree |
| 70 | /* fall back to 4k pages */ |
| 71 | int flags = MEM_COMMIT | MEM_RESERVE; |
| 72 | char* ptr = (char*) VirtualAlloc(nullptr,bytes,flags,PAGE_READWRITE); |
| 73 | - if (ptr == nullptr) throw std::bad_alloc(); |
| 74 | + if (ptr == nullptr) abort(); //throw std::bad_alloc(); |
| 75 | hugepages = false; |
| 76 | return ptr; |
| 77 | } |
| 78 | @@ -216,7 +216,7 @@ namespace embree |
| 79 | return bytesOld; |
| 80 | |
| 81 | if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT)) |
| 82 | - throw std::bad_alloc(); |
| 83 | + abort(); //throw std::bad_alloc(); |
| 84 | |
| 85 | return bytesNew; |
| 86 | } |
| 87 | @@ -227,7 +227,7 @@ namespace embree |
| 88 | return; |
| 89 | |
| 90 | if (!VirtualFree(ptr,0,MEM_RELEASE)) |
| 91 | - throw std::bad_alloc(); |
| 92 | + abort(); //throw std::bad_alloc(); |
| 93 | } |
| 94 | |
| 95 | void os_advise(void *ptr, size_t bytes) |
| 96 | @@ -331,7 +331,7 @@ namespace embree |
| 97 | |
| 98 | /* fallback to 4k pages */ |
| 99 | void* ptr = (char*) mmap(0, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); |
| 100 | - if (ptr == MAP_FAILED) throw std::bad_alloc(); |
| 101 | + if (ptr == MAP_FAILED) abort(); //throw std::bad_alloc(); |
| 102 | hugepages = false; |
| 103 | |
| 104 | /* advise huge page hint for THP */ |
| 105 | @@ -348,7 +348,7 @@ namespace embree |
| 106 | return bytesOld; |
| 107 | |
| 108 | if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1) |
| 109 | - throw std::bad_alloc(); |
| 110 | + abort(); //throw std::bad_alloc(); |
| 111 | |
| 112 | return bytesNew; |
| 113 | } |
| 114 | @@ -362,7 +362,7 @@ namespace embree |
| 115 | const size_t pageSize = hugepages ? PAGE_SIZE_2M : PAGE_SIZE_4K; |
| 116 | bytes = (bytes+pageSize-1) & ~(pageSize-1); |
| 117 | if (munmap(ptr,bytes) == -1) |
| 118 | - throw std::bad_alloc(); |
| 119 | + abort(); //throw std::bad_alloc(); |
| 120 | } |
| 121 | |
| 122 | /* hint for transparent huge pages (THP) */ |
| 123 | diff --git a/thirdparty/embree/common/sys/alloc.h b/thirdparty/embree/common/sys/alloc.h |
| 124 | index 5c63d0bfaf..1f6f230ed3 100644 |
| 125 | --- a/thirdparty/embree/common/sys/alloc.h |
| 126 | +++ b/thirdparty/embree/common/sys/alloc.h |
| 127 | @@ -131,7 +131,7 @@ namespace embree |
| 128 | typedef std::ptrdiff_t difference_type; |
| 129 | |
| 130 | __forceinline pointer allocate( size_type n ) { |
| 131 | - throw std::runtime_error("no allocation supported"); |
| 132 | + abort(); //throw std::runtime_error("no allocation supported"); |
| 133 | } |
| 134 | |
| 135 | __forceinline void deallocate( pointer p, size_type n ) { |
| 136 | diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h |
| 137 | index 6dc0cf3318..1e5b02550e 100644 |
| 138 | --- a/thirdparty/embree/common/sys/platform.h |
| 139 | +++ b/thirdparty/embree/common/sys/platform.h |
| 140 | @@ -214,10 +214,11 @@ |
| 141 | |
| 142 | #if defined(DEBUG) // only report file and line in debug mode |
| 143 | #define THROW_RUNTIME_ERROR(str) \ |
| 144 | - throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); |
| 145 | + printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort(); |
| 146 | + //throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); |
| 147 | #else |
| 148 | #define THROW_RUNTIME_ERROR(str) \ |
| 149 | - throw std::runtime_error(str); |
| 150 | + abort(); //throw std::runtime_error(str); |
| 151 | #endif |
| 152 | |
| 153 | #define FATAL(x) THROW_RUNTIME_ERROR(x) |
| 154 | diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp |
| 155 | index 83ead95122..e89ae04f8b 100644 |
| 156 | --- a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp |
| 157 | +++ b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp |
| 158 | @@ -48,13 +48,13 @@ namespace embree |
| 159 | { |
| 160 | Task* prevTask = thread.task; |
| 161 | thread.task = this; |
| 162 | - try { |
| 163 | - if (context->cancellingException == nullptr) |
| 164 | + //try { |
| 165 | + // if (context->cancellingException == nullptr) |
| 166 | closure->execute(); |
| 167 | - } catch (...) { |
| 168 | - if (context->cancellingException == nullptr) |
| 169 | - context->cancellingException = std::current_exception(); |
| 170 | - } |
| 171 | + //} catch (...) { |
| 172 | + // if (context->cancellingException == nullptr) |
| 173 | + // context->cancellingException = std::current_exception(); |
| 174 | + //} |
| 175 | thread.task = prevTask; |
| 176 | add_dependencies(-1); |
| 177 | } |
| 178 | diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.h b/thirdparty/embree/common/tasking/taskschedulerinternal.h |
| 179 | index b01bebf7c3..d4e0c7386b 100644 |
| 180 | --- a/thirdparty/embree/common/tasking/taskschedulerinternal.h |
| 181 | +++ b/thirdparty/embree/common/tasking/taskschedulerinternal.h |
| 182 | @@ -131,7 +131,7 @@ namespace embree |
| 183 | { |
| 184 | size_t ofs = bytes + ((align - stackPtr) & (align-1)); |
| 185 | if (stackPtr + ofs > CLOSURE_STACK_SIZE) |
| 186 | - throw std::runtime_error("closure stack overflow"); |
| 187 | + abort(); //throw std::runtime_error("closure stack overflow"); |
| 188 | stackPtr += ofs; |
| 189 | return &stack[stackPtr-bytes]; |
| 190 | } |
| 191 | @@ -140,7 +140,7 @@ namespace embree |
| 192 | __forceinline void push_right(Thread& thread, const size_t size, const Closure& closure, TaskGroupContext* context) |
| 193 | { |
| 194 | if (right >= TASK_STACK_SIZE) |
| 195 | - throw std::runtime_error("task stack overflow"); |
| 196 | + abort(); //throw std::runtime_error("task stack overflow"); |
| 197 | |
| 198 | /* allocate new task on right side of stack */ |
| 199 | size_t oldStackPtr = stackPtr; |
| 200 | diff --git a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp |
| 201 | index 40f9043736..f3b93e5925 100644 |
| 202 | --- a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp |
| 203 | +++ b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp |
| 204 | @@ -150,7 +150,7 @@ namespace embree |
| 205 | } |
| 206 | } |
| 207 | else { |
| 208 | - throw std::runtime_error("not supported node type in bvh_statistics"); |
| 209 | + abort(); //throw std::runtime_error("not supported node type in bvh_statistics"); |
| 210 | } |
| 211 | return s; |
| 212 | } |
| 213 | diff --git a/thirdparty/embree/kernels/common/alloc.h b/thirdparty/embree/kernels/common/alloc.h |
| 214 | index 2bd292de4d..10f629a244 100644 |
| 215 | --- a/thirdparty/embree/kernels/common/alloc.h |
| 216 | +++ b/thirdparty/embree/kernels/common/alloc.h |
| 217 | @@ -190,7 +190,7 @@ namespace embree |
| 218 | , primrefarray(device,0) |
| 219 | { |
| 220 | if (osAllocation && useUSM) |
| 221 | - throw std::runtime_error("USM allocation cannot be combined with OS allocation."); |
| 222 | + abort(); //throw std::runtime_error("USM allocation cannot be combined with OS allocation."); |
| 223 | |
| 224 | for (size_t i=0; i<MAX_THREAD_USED_BLOCK_SLOTS; i++) |
| 225 | { |
| 226 | @@ -503,7 +503,7 @@ namespace embree |
| 227 | if (myUsedBlocks) { |
| 228 | void* ptr = myUsedBlocks->malloc(device,bytes,align,partial); |
| 229 | if (ptr == nullptr && !blockAllocation) |
| 230 | - throw std::bad_alloc(); |
| 231 | + abort(); //throw std::bad_alloc(); |
| 232 | if (ptr) return ptr; |
| 233 | } |
| 234 | |
| 235 | diff --git a/thirdparty/embree/kernels/common/rtcore.cpp b/thirdparty/embree/kernels/common/rtcore.cpp |
| 236 | index 8da5c9d86c..a34eb2a0c4 100644 |
| 237 | --- a/thirdparty/embree/kernels/common/rtcore.cpp |
| 238 | +++ b/thirdparty/embree/kernels/common/rtcore.cpp |
| 239 | @@ -358,7 +358,7 @@ RTC_NAMESPACE_BEGIN; |
| 240 | if (quality != RTC_BUILD_QUALITY_LOW && |
| 241 | quality != RTC_BUILD_QUALITY_MEDIUM && |
| 242 | quality != RTC_BUILD_QUALITY_HIGH) |
| 243 | - throw std::runtime_error("invalid build quality"); |
| 244 | + abort(); //throw std::runtime_error("invalid build quality"); |
| 245 | scene->setBuildQuality(quality); |
| 246 | RTC_CATCH_END2(scene); |
| 247 | } |
| 248 | @@ -1831,7 +1831,7 @@ RTC_API void rtcSetGeometryTransform(RTCGeometry hgeometry, unsigned int timeSte |
| 249 | quality != RTC_BUILD_QUALITY_MEDIUM && |
| 250 | quality != RTC_BUILD_QUALITY_HIGH && |
| 251 | quality != RTC_BUILD_QUALITY_REFIT) |
| 252 | - throw std::runtime_error("invalid build quality"); |
| 253 | + abort(); //throw std::runtime_error("invalid build quality"); |
| 254 | geometry->setBuildQuality(quality); |
| 255 | RTC_CATCH_END2(geometry); |
| 256 | } |
| 257 | diff --git a/thirdparty/embree/kernels/common/rtcore.h b/thirdparty/embree/kernels/common/rtcore.h |
| 258 | index 73a061de11..cd7a6f4395 100644 |
| 259 | --- a/thirdparty/embree/kernels/common/rtcore.h |
| 260 | +++ b/thirdparty/embree/kernels/common/rtcore.h |
| 261 | @@ -13,7 +13,7 @@ namespace embree |
| 262 | __forceinline bool isIncoherent(RTCRayQueryFlags flags) { return (flags & RTC_RAY_QUERY_FLAG_COHERENT) == RTC_RAY_QUERY_FLAG_INCOHERENT; } |
| 263 | |
| 264 | /*! Macros used in the rtcore API implementation */ |
| 265 | -#if 0 |
| 266 | +#if 1 |
| 267 | # define RTC_CATCH_BEGIN |
| 268 | # define RTC_CATCH_END(device) |
| 269 | # define RTC_CATCH_END2(scene) |
| 270 | @@ -94,6 +94,7 @@ namespace embree |
| 271 | #define RTC_TRACE(x) |
| 272 | #endif |
| 273 | |
| 274 | +#if 0 |
| 275 | /*! used to throw embree API errors */ |
| 276 | struct rtcore_error : public std::exception |
| 277 | { |
| 278 | @@ -109,13 +110,16 @@ namespace embree |
| 279 | RTCError error; |
| 280 | std::string str; |
| 281 | }; |
| 282 | +#endif |
| 283 | |
| 284 | #if defined(DEBUG) // only report file and line in debug mode |
| 285 | #define throw_RTCError(error,str) \ |
| 286 | - throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); |
| 287 | + printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort(); |
| 288 | + //throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)); |
| 289 | #else |
| 290 | #define throw_RTCError(error,str) \ |
| 291 | - throw rtcore_error(error,str); |
| 292 | + abort(); |
| 293 | + //throw rtcore_error(error,str); |
| 294 | #endif |
| 295 | |
| 296 | #define RTC_BUILD_ARGUMENTS_HAS(settings,member) \ |
| 297 | diff --git a/thirdparty/embree/kernels/common/scene.cpp b/thirdparty/embree/kernels/common/scene.cpp |
| 298 | index 84a84f8c69..3bfcebd298 100644 |
| 299 | --- a/thirdparty/embree/kernels/common/scene.cpp |
| 300 | +++ b/thirdparty/embree/kernels/common/scene.cpp |
| 301 | @@ -962,16 +962,16 @@ namespace embree |
| 302 | } |
| 303 | |
| 304 | /* initiate build */ |
| 305 | - try { |
| 306 | + //try { |
| 307 | TaskScheduler::TaskGroupContext context; |
| 308 | scheduler->spawn_root([&]() { commit_task(); Lock<MutexSys> lock(taskGroup->schedulerMutex); taskGroup->scheduler = nullptr; }, &context, 1, !join); |
| 309 | - } |
| 310 | - catch (...) { |
| 311 | - accels_clear(); |
| 312 | - Lock<MutexSys> lock(taskGroup->schedulerMutex); |
| 313 | - taskGroup->scheduler = nullptr; |
| 314 | - throw; |
| 315 | - } |
| 316 | + //} |
| 317 | + //catch (...) { |
| 318 | + // accels_clear(); |
| 319 | + // Lock<MutexSys> lock(taskGroup->schedulerMutex); |
| 320 | + // taskGroup->scheduler = nullptr; |
| 321 | + // throw; |
| 322 | + //} |
| 323 | } |
| 324 | |
| 325 | #endif |
| 326 | diff --git a/thirdparty/embree/kernels/common/state.cpp b/thirdparty/embree/kernels/common/state.cpp |
| 327 | index cce5eafce1..509dbc7120 100644 |
| 328 | --- a/thirdparty/embree/kernels/common/state.cpp |
| 329 | +++ b/thirdparty/embree/kernels/common/state.cpp |
| 330 | @@ -199,13 +199,13 @@ namespace embree |
| 331 | bool State::parseFile(const FileName& fileName) |
| 332 | { |
| 333 | Ref<Stream<int> > file; |
| 334 | - try { |
| 335 | + //try { |
| 336 | file = new FileStream(fileName); |
| 337 | - } |
| 338 | - catch (std::runtime_error& e) { |
| 339 | - (void) e; |
| 340 | - return false; |
| 341 | - } |
| 342 | + //} |
| 343 | + //catch (std::runtime_error& e) { |
| 344 | + // (void) e; |
| 345 | + // return false; |
| 346 | + //} |
| 347 | |
| 348 | std::vector<std::string> syms; |
| 349 | for (size_t i=0; i<sizeof(symbols)/sizeof(void*); i++) |