godot-changes-noexcept.patch 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. diff --git a/thirdparty/embree/common/algorithms/parallel_for.h b/thirdparty/embree/common/algorithms/parallel_for.h
  2. index f052d8b468..645681ac63 100644
  3. --- a/thirdparty/embree/common/algorithms/parallel_for.h
  4. +++ b/thirdparty/embree/common/algorithms/parallel_for.h
  5. @@ -21,7 +21,10 @@ namespace embree
  6. func(r.begin());
  7. });
  8. if (!TaskScheduler::wait())
  9. - throw std::runtime_error("task cancelled");
  10. + // -- GODOT start --
  11. + // throw std::runtime_error("task cancelled");
  12. + abort();
  13. + // -- GODOT end --
  14. }
  15. #elif defined(TASKING_TBB)
  16. @@ -31,13 +34,19 @@ namespace embree
  17. func(i);
  18. },context);
  19. if (context.is_group_execution_cancelled())
  20. - throw std::runtime_error("task cancelled");
  21. + // -- GODOT start --
  22. + // throw std::runtime_error("task cancelled");
  23. + abort();
  24. + // -- GODOT end --
  25. #else
  26. tbb::parallel_for(Index(0),N,Index(1),[&](Index i) {
  27. func(i);
  28. });
  29. if (tbb::task::self().is_cancelled())
  30. - throw std::runtime_error("task cancelled");
  31. + // -- GODOT start --
  32. + // throw std::runtime_error("task cancelled");
  33. + abort();
  34. + // -- GODOT end --
  35. #endif
  36. #elif defined(TASKING_PPL)
  37. @@ -57,7 +66,10 @@ namespace embree
  38. #if defined(TASKING_INTERNAL)
  39. TaskScheduler::spawn(first,last,minStepSize,func);
  40. if (!TaskScheduler::wait())
  41. - throw std::runtime_error("task cancelled");
  42. + // -- GODOT start --
  43. + // throw std::runtime_error("task cancelled");
  44. + abort();
  45. + // -- GODOT end --
  46. #elif defined(TASKING_TBB)
  47. #if TBB_INTERFACE_VERSION >= 12002
  48. @@ -66,13 +78,19 @@ namespace embree
  49. func(range<Index>(r.begin(),r.end()));
  50. },context);
  51. if (context.is_group_execution_cancelled())
  52. - throw std::runtime_error("task cancelled");
  53. + // -- GODOT start --
  54. + // throw std::runtime_error("task cancelled");
  55. + abort();
  56. + // -- GODOT end --
  57. #else
  58. tbb::parallel_for(tbb::blocked_range<Index>(first,last,minStepSize),[&](const tbb::blocked_range<Index>& r) {
  59. func(range<Index>(r.begin(),r.end()));
  60. });
  61. if (tbb::task::self().is_cancelled())
  62. - throw std::runtime_error("task cancelled");
  63. + // -- GODOT start --
  64. + // throw std::runtime_error("task cancelled");
  65. + abort();
  66. + // -- GODOT end --
  67. #endif
  68. #elif defined(TASKING_PPL)
  69. @@ -104,13 +122,19 @@ namespace embree
  70. func(i);
  71. },tbb::simple_partitioner(),context);
  72. if (context.is_group_execution_cancelled())
  73. - throw std::runtime_error("task cancelled");
  74. + // -- GODOT start --
  75. + // throw std::runtime_error("task cancelled");
  76. + abort();
  77. + // -- GODOT end --
  78. #else
  79. tbb::parallel_for(Index(0),N,Index(1),[&](Index i) {
  80. func(i);
  81. },tbb::simple_partitioner());
  82. if (tbb::task::self().is_cancelled())
  83. - throw std::runtime_error("task cancelled");
  84. + // -- GODOT start --
  85. + // throw std::runtime_error("task cancelled");
  86. + abort();
  87. + // -- GODOT end --
  88. #endif
  89. }
  90. @@ -125,13 +149,19 @@ namespace embree
  91. func(i);
  92. },ap,context);
  93. if (context.is_group_execution_cancelled())
  94. - throw std::runtime_error("task cancelled");
  95. + // -- GODOT start --
  96. + // throw std::runtime_error("task cancelled");
  97. + abort();
  98. + // -- GODOT end --
  99. #else
  100. tbb::parallel_for(Index(0),N,Index(1),[&](Index i) {
  101. func(i);
  102. },ap);
  103. if (tbb::task::self().is_cancelled())
  104. - throw std::runtime_error("task cancelled");
  105. + // -- GODOT start --
  106. + // throw std::runtime_error("task cancelled");
  107. + abort();
  108. + // -- GODOT end --
  109. #endif
  110. }
  111. diff --git a/thirdparty/embree/common/algorithms/parallel_reduce.h b/thirdparty/embree/common/algorithms/parallel_reduce.h
  112. index f42ae2ec50..8271372ea4 100644
  113. --- a/thirdparty/embree/common/algorithms/parallel_reduce.h
  114. +++ b/thirdparty/embree/common/algorithms/parallel_reduce.h
  115. @@ -58,15 +58,19 @@ namespace embree
  116. const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
  117. [&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); },
  118. reduction,context);
  119. - if (context.is_group_execution_cancelled())
  120. - throw std::runtime_error("task cancelled");
  121. + // -- GODOT start --
  122. + // if (context.is_group_execution_cancelled())
  123. + // throw std::runtime_error("task cancelled");
  124. + // -- GODOT end --
  125. return v;
  126. #else
  127. const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
  128. [&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); },
  129. reduction);
  130. - if (tbb::task::self().is_cancelled())
  131. - throw std::runtime_error("task cancelled");
  132. + // -- GODOT start --
  133. + // if (tbb::task::self().is_cancelled())
  134. + // throw std::runtime_error("task cancelled");
  135. + // -- GODOT end --
  136. return v;
  137. #endif
  138. #else // TASKING_PPL
  139. diff --git a/thirdparty/embree/common/lexers/stringstream.cpp b/thirdparty/embree/common/lexers/stringstream.cpp
  140. index 42ffb10176..a037869506 100644
  141. --- a/thirdparty/embree/common/lexers/stringstream.cpp
  142. +++ b/thirdparty/embree/common/lexers/stringstream.cpp
  143. @@ -39,7 +39,10 @@ namespace embree
  144. std::vector<char> str; str.reserve(64);
  145. while (cin->peek() != EOF && !isSeparator(cin->peek())) {
  146. int c = cin->get();
  147. - if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
  148. + // -- GODOT start --
  149. + // if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
  150. + if (!isValidChar(c)) abort();
  151. + // -- GODOT end --
  152. str.push_back((char)c);
  153. }
  154. str.push_back(0);
  155. diff --git a/thirdparty/embree/common/sys/alloc.cpp b/thirdparty/embree/common/sys/alloc.cpp
  156. index 1bc30fe9a5..abdd269069 100644
  157. --- a/thirdparty/embree/common/sys/alloc.cpp
  158. +++ b/thirdparty/embree/common/sys/alloc.cpp
  159. @@ -21,7 +21,10 @@ namespace embree
  160. void* ptr = _mm_malloc(size,align);
  161. if (size != 0 && ptr == nullptr)
  162. - throw std::bad_alloc();
  163. + // -- GODOT start --
  164. + // throw std::bad_alloc();
  165. + abort();
  166. + // -- GODOT end --
  167. return ptr;
  168. }
  169. @@ -128,7 +131,10 @@ namespace embree
  170. /* fall back to 4k pages */
  171. int flags = MEM_COMMIT | MEM_RESERVE;
  172. char* ptr = (char*) VirtualAlloc(nullptr,bytes,flags,PAGE_READWRITE);
  173. - if (ptr == nullptr) throw std::bad_alloc();
  174. + // -- GODOT start --
  175. + // if (ptr == nullptr) throw std::bad_alloc();
  176. + if (ptr == nullptr) abort();
  177. + // -- GODOT end --
  178. hugepages = false;
  179. return ptr;
  180. }
  181. @@ -145,7 +151,10 @@ namespace embree
  182. return bytesOld;
  183. if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
  184. - throw std::bad_alloc();
  185. + // -- GODOT start --
  186. + // throw std::bad_alloc();
  187. + abort();
  188. + // -- GODOT end --
  189. return bytesNew;
  190. }
  191. @@ -156,7 +165,10 @@ namespace embree
  192. return;
  193. if (!VirtualFree(ptr,0,MEM_RELEASE))
  194. - throw std::bad_alloc();
  195. + // -- GODOT start --
  196. + // throw std::bad_alloc();
  197. + abort();
  198. + // -- GODOT end --
  199. }
  200. void os_advise(void *ptr, size_t bytes)
  201. @@ -260,7 +272,10 @@ namespace embree
  202. /* fallback to 4k pages */
  203. void* ptr = (char*) mmap(0, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
  204. - if (ptr == MAP_FAILED) throw std::bad_alloc();
  205. + // -- GODOT start --
  206. + // if (ptr == MAP_FAILED) throw std::bad_alloc();
  207. + if (ptr == MAP_FAILED) abort();
  208. + // -- GODOT end --
  209. hugepages = false;
  210. /* advise huge page hint for THP */
  211. @@ -277,7 +292,10 @@ namespace embree
  212. return bytesOld;
  213. if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
  214. - throw std::bad_alloc();
  215. + // -- GODOT start --
  216. + // throw std::bad_alloc();
  217. + abort();
  218. + // -- GODOT end --
  219. return bytesNew;
  220. }
  221. @@ -291,7 +309,10 @@ namespace embree
  222. const size_t pageSize = hugepages ? PAGE_SIZE_2M : PAGE_SIZE_4K;
  223. bytes = (bytes+pageSize-1) & ~(pageSize-1);
  224. if (munmap(ptr,bytes) == -1)
  225. - throw std::bad_alloc();
  226. + // -- GODOT start --
  227. + // throw std::bad_alloc();
  228. + abort();
  229. + // -- GODOT end --
  230. }
  231. /* hint for transparent huge pages (THP) */
  232. diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h
  233. index 8a6d9fa0a9..697e07bb86 100644
  234. --- a/thirdparty/embree/common/sys/platform.h
  235. +++ b/thirdparty/embree/common/sys/platform.h
  236. @@ -179,11 +179,19 @@
  237. #define PRINT4(x,y,z,w) embree_cout << STRING(x) << " = " << (x) << ", " << STRING(y) << " = " << (y) << ", " << STRING(z) << " = " << (z) << ", " << STRING(w) << " = " << (w) << embree_endl
  238. #if defined(DEBUG) // only report file and line in debug mode
  239. + // -- GODOT start --
  240. + // #define THROW_RUNTIME_ERROR(str)
  241. + // throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
  242. #define THROW_RUNTIME_ERROR(str) \
  243. - throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
  244. + printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort();
  245. + // -- GODOT end --
  246. #else
  247. + // -- GODOT start --
  248. + // #define THROW_RUNTIME_ERROR(str)
  249. + // throw std::runtime_error(str);
  250. #define THROW_RUNTIME_ERROR(str) \
  251. - throw std::runtime_error(str);
  252. + abort();
  253. + // -- GODOT end --
  254. #endif
  255. #define FATAL(x) THROW_RUNTIME_ERROR(x)
  256. diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
  257. index dca835a716..ad438588a3 100644
  258. --- a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
  259. +++ b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
  260. @@ -48,13 +48,15 @@ namespace embree
  261. {
  262. Task* prevTask = thread.task;
  263. thread.task = this;
  264. - try {
  265. - if (thread.scheduler->cancellingException == nullptr)
  266. + // -- GODOT start --
  267. + // try {
  268. + // if (thread.scheduler->cancellingException == nullptr)
  269. closure->execute();
  270. - } catch (...) {
  271. - if (thread.scheduler->cancellingException == nullptr)
  272. - thread.scheduler->cancellingException = std::current_exception();
  273. - }
  274. + // } catch (...) {
  275. + // if (thread.scheduler->cancellingException == nullptr)
  276. + // thread.scheduler->cancellingException = std::current_exception();
  277. + // }
  278. + // -- GODOT end --
  279. thread.task = prevTask;
  280. add_dependencies(-1);
  281. }
  282. @@ -291,8 +293,11 @@ namespace embree
  283. size_t threadIndex = allocThreadIndex();
  284. condition.wait(mutex, [&] () { return hasRootTask.load(); });
  285. mutex.unlock();
  286. - std::exception_ptr except = thread_loop(threadIndex);
  287. - if (except != nullptr) std::rethrow_exception(except);
  288. + // -- GODOT start --
  289. + // std::exception_ptr except = thread_loop(threadIndex);
  290. + // if (except != nullptr) std::rethrow_exception(except);
  291. + thread_loop(threadIndex);
  292. + // -- GODOT end --
  293. }
  294. void TaskScheduler::reset() {
  295. @@ -324,7 +329,10 @@ namespace embree
  296. return thread->scheduler->cancellingException == nullptr;
  297. }
  298. - std::exception_ptr TaskScheduler::thread_loop(size_t threadIndex)
  299. +// -- GODOT start --
  300. +// std::exception_ptr TaskScheduler::thread_loop(size_t threadIndex)
  301. + void TaskScheduler::thread_loop(size_t threadIndex)
  302. +// -- GODOT end --
  303. {
  304. /* allocate thread structure */
  305. std::unique_ptr<Thread> mthread(new Thread(threadIndex,this)); // too large for stack allocation
  306. @@ -347,9 +355,10 @@ namespace embree
  307. swapThread(oldThread);
  308. /* remember exception to throw */
  309. - std::exception_ptr except = nullptr;
  310. - if (cancellingException != nullptr) except = cancellingException;
  311. -
  312. + // -- GODOT start --
  313. + // std::exception_ptr except = nullptr;
  314. + // if (cancellingException != nullptr) except = cancellingException;
  315. + // -- GODOT end --
  316. /* wait for all threads to terminate */
  317. threadCounter--;
  318. #if defined(__WIN32__)
  319. @@ -367,7 +376,10 @@ namespace embree
  320. yield();
  321. #endif
  322. }
  323. - return except;
  324. + // -- GODOT start --
  325. + // return except;
  326. + return;
  327. + // -- GODOT end --
  328. }
  329. bool TaskScheduler::steal_from_other_threads(Thread& thread)
  330. diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.h b/thirdparty/embree/common/tasking/taskschedulerinternal.h
  331. index c766a0bb6a..8fa6bb12fa 100644
  332. --- a/thirdparty/embree/common/tasking/taskschedulerinternal.h
  333. +++ b/thirdparty/embree/common/tasking/taskschedulerinternal.h
  334. @@ -123,7 +123,10 @@ namespace embree
  335. {
  336. size_t ofs = bytes + ((align - stackPtr) & (align-1));
  337. if (stackPtr + ofs > CLOSURE_STACK_SIZE)
  338. - throw std::runtime_error("closure stack overflow");
  339. + // -- GODOT start --
  340. + // throw std::runtime_error("closure stack overflow");
  341. + abort();
  342. + // -- GODOT end --
  343. stackPtr += ofs;
  344. return &stack[stackPtr-bytes];
  345. }
  346. @@ -132,7 +135,10 @@ namespace embree
  347. __forceinline void push_right(Thread& thread, const size_t size, const Closure& closure)
  348. {
  349. if (right >= TASK_STACK_SIZE)
  350. - throw std::runtime_error("task stack overflow");
  351. + // -- GODOT start --
  352. + // throw std::runtime_error("task stack overflow");
  353. + abort();
  354. + // -- GODOT end --
  355. /* allocate new task on right side of stack */
  356. size_t oldStackPtr = stackPtr;
  357. @@ -238,7 +244,10 @@ namespace embree
  358. void wait_for_threads(size_t threadCount);
  359. /*! thread loop for all worker threads */
  360. - std::exception_ptr thread_loop(size_t threadIndex);
  361. + // -- GODOT start --
  362. + // std::exception_ptr thread_loop(size_t threadIndex);
  363. + void thread_loop(size_t threadIndex);
  364. + // -- GODOT end --
  365. /*! steals a task from a different thread */
  366. bool steal_from_other_threads(Thread& thread);
  367. diff --git a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
  368. index d8da78eed7..d857ff7d95 100644
  369. --- a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
  370. +++ b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
  371. @@ -150,7 +150,10 @@ namespace embree
  372. }
  373. }
  374. else {
  375. - throw std::runtime_error("not supported node type in bvh_statistics");
  376. + // -- GODOT start --
  377. + // throw std::runtime_error("not supported node type in bvh_statistics");
  378. + abort();
  379. + // -- GODOT end --
  380. }
  381. return s;
  382. }
  383. diff --git a/thirdparty/embree/kernels/common/rtcore.cpp b/thirdparty/embree/kernels/common/rtcore.cpp
  384. index 74e9fb335c..94b3819e42 100644
  385. --- a/thirdparty/embree/kernels/common/rtcore.cpp
  386. +++ b/thirdparty/embree/kernels/common/rtcore.cpp
  387. @@ -197,7 +197,10 @@ RTC_NAMESPACE_BEGIN;
  388. if (quality != RTC_BUILD_QUALITY_LOW &&
  389. quality != RTC_BUILD_QUALITY_MEDIUM &&
  390. quality != RTC_BUILD_QUALITY_HIGH)
  391. - throw std::runtime_error("invalid build quality");
  392. + // -- GODOT start --
  393. + // throw std::runtime_error("invalid build quality");
  394. + abort();
  395. + // -- GODOT end --
  396. scene->setBuildQuality(quality);
  397. RTC_CATCH_END2(scene);
  398. }
  399. @@ -1350,7 +1353,10 @@ RTC_NAMESPACE_BEGIN;
  400. quality != RTC_BUILD_QUALITY_MEDIUM &&
  401. quality != RTC_BUILD_QUALITY_HIGH &&
  402. quality != RTC_BUILD_QUALITY_REFIT)
  403. - throw std::runtime_error("invalid build quality");
  404. + // -- GODOT start --
  405. + // throw std::runtime_error("invalid build quality");
  406. + abort();
  407. + // -- GODOT end --
  408. geometry->setBuildQuality(quality);
  409. RTC_CATCH_END2(geometry);
  410. }
  411. diff --git a/thirdparty/embree/kernels/common/rtcore.h b/thirdparty/embree/kernels/common/rtcore.h
  412. index 4e4b24e9c2..373e49a689 100644
  413. --- a/thirdparty/embree/kernels/common/rtcore.h
  414. +++ b/thirdparty/embree/kernels/common/rtcore.h
  415. @@ -25,52 +25,58 @@ namespace embree
  416. #endif
  417. /*! Macros used in the rtcore API implementation */
  418. -#define RTC_CATCH_BEGIN try {
  419. +// -- GODOT start --
  420. +// #define RTC_CATCH_BEGIN try {
  421. +#define RTC_CATCH_BEGIN
  422. -#define RTC_CATCH_END(device) \
  423. - } catch (std::bad_alloc&) { \
  424. - Device::process_error(device,RTC_ERROR_OUT_OF_MEMORY,"out of memory"); \
  425. - } catch (rtcore_error& e) { \
  426. - Device::process_error(device,e.error,e.what()); \
  427. - } catch (std::exception& e) { \
  428. - Device::process_error(device,RTC_ERROR_UNKNOWN,e.what()); \
  429. - } catch (...) { \
  430. - Device::process_error(device,RTC_ERROR_UNKNOWN,"unknown exception caught"); \
  431. - }
  432. +// #define RTC_CATCH_END(device) \
  433. +// } catch (std::bad_alloc&) { \
  434. +// Device::process_error(device,RTC_ERROR_OUT_OF_MEMORY,"out of memory"); \
  435. +// } catch (rtcore_error& e) { \
  436. +// Device::process_error(device,e.error,e.what()); \
  437. +// } catch (std::exception& e) { \
  438. +// Device::process_error(device,RTC_ERROR_UNKNOWN,e.what()); \
  439. +// } catch (...) { \
  440. +// Device::process_error(device,RTC_ERROR_UNKNOWN,"unknown exception caught"); \
  441. +// }
  442. +#define RTC_CATCH_END(device)
  443. -#define RTC_CATCH_END2(scene) \
  444. - } catch (std::bad_alloc&) { \
  445. - Device* device = scene ? scene->device : nullptr; \
  446. - Device::process_error(device,RTC_ERROR_OUT_OF_MEMORY,"out of memory"); \
  447. - } catch (rtcore_error& e) { \
  448. - Device* device = scene ? scene->device : nullptr; \
  449. - Device::process_error(device,e.error,e.what()); \
  450. - } catch (std::exception& e) { \
  451. - Device* device = scene ? scene->device : nullptr; \
  452. - Device::process_error(device,RTC_ERROR_UNKNOWN,e.what()); \
  453. - } catch (...) { \
  454. - Device* device = scene ? scene->device : nullptr; \
  455. - Device::process_error(device,RTC_ERROR_UNKNOWN,"unknown exception caught"); \
  456. - }
  457. +// #define RTC_CATCH_END2(scene) \
  458. +// } catch (std::bad_alloc&) { \
  459. +// Device* device = scene ? scene->device : nullptr; \
  460. +// Device::process_error(device,RTC_ERROR_OUT_OF_MEMORY,"out of memory"); \
  461. +// } catch (rtcore_error& e) { \
  462. +// Device* device = scene ? scene->device : nullptr; \
  463. +// Device::process_error(device,e.error,e.what()); \
  464. +// } catch (std::exception& e) { \
  465. +// Device* device = scene ? scene->device : nullptr; \
  466. +// Device::process_error(device,RTC_ERROR_UNKNOWN,e.what()); \
  467. +// } catch (...) { \
  468. +// Device* device = scene ? scene->device : nullptr; \
  469. +// Device::process_error(device,RTC_ERROR_UNKNOWN,"unknown exception caught"); \
  470. +// }
  471. +#define RTC_CATCH_END2(scene)
  472. -#define RTC_CATCH_END2_FALSE(scene) \
  473. - } catch (std::bad_alloc&) { \
  474. - Device* device = scene ? scene->device : nullptr; \
  475. - Device::process_error(device,RTC_ERROR_OUT_OF_MEMORY,"out of memory"); \
  476. - return false; \
  477. - } catch (rtcore_error& e) { \
  478. - Device* device = scene ? scene->device : nullptr; \
  479. - Device::process_error(device,e.error,e.what()); \
  480. - return false; \
  481. - } catch (std::exception& e) { \
  482. - Device* device = scene ? scene->device : nullptr; \
  483. - Device::process_error(device,RTC_ERROR_UNKNOWN,e.what()); \
  484. - return false; \
  485. - } catch (...) { \
  486. - Device* device = scene ? scene->device : nullptr; \
  487. - Device::process_error(device,RTC_ERROR_UNKNOWN,"unknown exception caught"); \
  488. - return false; \
  489. - }
  490. +// #define RTC_CATCH_END2_FALSE(scene) \
  491. +// } catch (std::bad_alloc&) { \
  492. +// Device* device = scene ? scene->device : nullptr; \
  493. +// Device::process_error(device,RTC_ERROR_OUT_OF_MEMORY,"out of memory"); \
  494. +// return false; \
  495. +// } catch (rtcore_error& e) { \
  496. +// Device* device = scene ? scene->device : nullptr; \
  497. +// Device::process_error(device,e.error,e.what()); \
  498. +// return false; \
  499. +// } catch (std::exception& e) { \
  500. +// Device* device = scene ? scene->device : nullptr; \
  501. +// Device::process_error(device,RTC_ERROR_UNKNOWN,e.what()); \
  502. +// return false; \
  503. +// } catch (...) { \
  504. +// Device* device = scene ? scene->device : nullptr; \
  505. +// Device::process_error(device,RTC_ERROR_UNKNOWN,"unknown exception caught"); \
  506. +// return false; \
  507. +// }
  508. +#define RTC_CATCH_END2_FALSE(scene) return false;
  509. +// -- GODOT end --
  510. #define RTC_VERIFY_HANDLE(handle) \
  511. if (handle == nullptr) { \
  512. @@ -97,28 +103,38 @@ namespace embree
  513. #define RTC_TRACE(x)
  514. #endif
  515. - /*! used to throw embree API errors */
  516. - struct rtcore_error : public std::exception
  517. - {
  518. - __forceinline rtcore_error(RTCError error, const std::string& str)
  519. - : error(error), str(str) {}
  520. -
  521. - ~rtcore_error() throw() {}
  522. -
  523. - const char* what () const throw () {
  524. - return str.c_str();
  525. - }
  526. -
  527. - RTCError error;
  528. - std::string str;
  529. - };
  530. +// -- GODOT begin --
  531. +// /*! used to throw embree API errors */
  532. +// struct rtcore_error : public std::exception
  533. +// {
  534. +// __forceinline rtcore_error(RTCError error, const std::string& str)
  535. +// : error(error), str(str) {}
  536. +//
  537. +// ~rtcore_error() throw() {}
  538. +//
  539. +// const char* what () const throw () {
  540. +// return str.c_str();
  541. +// }
  542. +//
  543. +// RTCError error;
  544. +// std::string str;
  545. +// };
  546. +// -- GODOT end --
  547. #if defined(DEBUG) // only report file and line in debug mode
  548. + // -- GODOT begin --
  549. + // #define throw_RTCError(error,str) \
  550. + // throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
  551. #define throw_RTCError(error,str) \
  552. - throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
  553. + printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort();
  554. + // -- GODOT end --
  555. #else
  556. + // -- GODOT begin --
  557. + // #define throw_RTCError(error,str) \
  558. + // throw rtcore_error(error,str);
  559. #define throw_RTCError(error,str) \
  560. - throw rtcore_error(error,str);
  561. + abort();
  562. + // -- GODOT end --
  563. #endif
  564. #define RTC_BUILD_ARGUMENTS_HAS(settings,member) \
  565. diff --git a/thirdparty/embree/kernels/common/scene.cpp b/thirdparty/embree/kernels/common/scene.cpp
  566. index 0149055f2c..408d7eae6f 100644
  567. --- a/thirdparty/embree/kernels/common/scene.cpp
  568. +++ b/thirdparty/embree/kernels/common/scene.cpp
  569. @@ -792,16 +792,18 @@ namespace embree
  570. }
  571. /* initiate build */
  572. - try {
  573. + // -- GODOT start --
  574. + // try {
  575. scheduler->spawn_root([&]() { commit_task(); Lock<MutexSys> lock(schedulerMutex); this->scheduler = nullptr; }, 1, !join);
  576. - }
  577. - catch (...) {
  578. - accels_clear();
  579. - updateInterface();
  580. - Lock<MutexSys> lock(schedulerMutex);
  581. - this->scheduler = nullptr;
  582. - throw;
  583. - }
  584. + // }
  585. + // catch (...) {
  586. + // accels_clear();
  587. + // updateInterface();
  588. + // Lock<MutexSys> lock(schedulerMutex);
  589. + // this->scheduler = nullptr;
  590. + // throw;
  591. + // }
  592. + // -- GODOT end --
  593. }
  594. #endif