godot-changes.patch 26 KB

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