feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -58,19 +58,15 @@ namespace embree
|
|||
const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
|
||||
[&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); },
|
||||
reduction,context);
|
||||
// -- GODOT start --
|
||||
// if (context.is_group_execution_cancelled())
|
||||
// throw std::runtime_error("task cancelled");
|
||||
// -- GODOT end --
|
||||
//if (context.is_group_execution_cancelled())
|
||||
// throw std::runtime_error("task cancelled");
|
||||
return v;
|
||||
#else
|
||||
const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
|
||||
[&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); },
|
||||
reduction);
|
||||
// -- GODOT start --
|
||||
// if (tbb::task::self().is_cancelled())
|
||||
// throw std::runtime_error("task cancelled");
|
||||
// -- GODOT end --
|
||||
//if (tbb::task::self().is_cancelled())
|
||||
// throw std::runtime_error("task cancelled");
|
||||
return v;
|
||||
#endif
|
||||
#else // TASKING_PPL
|
||||
|
|
|
|||
|
|
@ -39,12 +39,10 @@ namespace embree
|
|||
std::vector<char> str; str.reserve(64);
|
||||
while (cin->peek() != EOF && !isSeparator(cin->peek())) {
|
||||
int c = cin->get();
|
||||
// -- GODOT start --
|
||||
// if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
|
||||
//if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
|
||||
if (!isValidChar(c)) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
str.push_back((char)c);
|
||||
}
|
||||
str.push_back(0);
|
||||
|
|
|
|||
|
|
@ -102,9 +102,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// -- GODOT start --
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
// -- GODOT end --
|
||||
/* Definitions for _mm_{malloc,free} are provided by <malloc.h>
|
||||
* from both MinGW-w64 and MSVC.
|
||||
*/
|
||||
|
|
@ -1890,13 +1888,11 @@ FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b)
|
|||
#if !defined(SSE2NEON_ALLOC_DEFINED)
|
||||
FORCE_INLINE void _mm_free(void *addr)
|
||||
{
|
||||
// -- GODOT start --
|
||||
#if defined(_WIN32)
|
||||
_aligned_free(addr);
|
||||
#else
|
||||
free(addr);
|
||||
#endif
|
||||
// -- GODOT end --
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2088,7 +2084,6 @@ FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
|
|||
return malloc(size);
|
||||
if (align == 2 || (sizeof(void *) == 8 && align == 4))
|
||||
align = sizeof(void *);
|
||||
// -- GODOT start --
|
||||
#if defined(_WIN32)
|
||||
ptr = _aligned_malloc(size, align);
|
||||
if (ptr)
|
||||
|
|
@ -2097,7 +2092,6 @@ FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
|
|||
if (!posix_memalign(&ptr, align, size))
|
||||
return ptr;
|
||||
#endif
|
||||
// -- GODOT end --
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
62
engine/thirdparty/embree/common/sys/alloc.cpp
vendored
62
engine/thirdparty/embree/common/sys/alloc.cpp
vendored
|
|
@ -24,32 +24,28 @@ namespace embree
|
|||
|
||||
void enableUSMAllocEmbree(sycl::context* context, sycl::device* device)
|
||||
{
|
||||
// -- GODOT start --
|
||||
// if (tls_context_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
|
||||
// if (tls_device_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
|
||||
//if (tls_context_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
|
||||
//if (tls_device_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
|
||||
if (tls_context_embree != nullptr) {
|
||||
abort();
|
||||
}
|
||||
if (tls_device_embree != nullptr) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
tls_context_embree = context;
|
||||
tls_device_embree = device;
|
||||
}
|
||||
|
||||
void disableUSMAllocEmbree()
|
||||
{
|
||||
// -- GODOT start --
|
||||
// if (tls_context_embree == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
// if (tls_device_embree == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
//if (tls_context_embree == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
//if (tls_device_embree == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
if (tls_context_embree == nullptr) {
|
||||
abort();
|
||||
}
|
||||
if (tls_device_embree == nullptr) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
tls_context_embree = nullptr;
|
||||
tls_device_embree = nullptr;
|
||||
}
|
||||
|
|
@ -64,16 +60,14 @@ namespace embree
|
|||
|
||||
void disableUSMAllocTutorial()
|
||||
{
|
||||
// -- GODOT start --
|
||||
// if (tls_context_tutorial == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
// if (tls_device_tutorial == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
//if (tls_context_tutorial == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
//if (tls_device_tutorial == nullptr) throw std::runtime_error("USM allocation not enabled");
|
||||
if (tls_context_tutorial == nullptr) {
|
||||
abort();
|
||||
}
|
||||
if (tls_device_tutorial == nullptr) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
|
||||
tls_context_tutorial = nullptr;
|
||||
tls_device_tutorial = nullptr;
|
||||
|
|
@ -88,13 +82,11 @@ namespace embree
|
|||
|
||||
assert((align & (align-1)) == 0);
|
||||
void* ptr = _mm_malloc(size,align);
|
||||
// -- GODOT start --
|
||||
// if (size != 0 && ptr == nullptr)
|
||||
// throw std::bad_alloc();
|
||||
//if (size != 0 && ptr == nullptr)
|
||||
// throw std::bad_alloc();
|
||||
if (size != 0 && ptr == nullptr) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
@ -123,13 +115,11 @@ namespace embree
|
|||
else
|
||||
ptr = sycl::aligned_alloc_shared(align,size,*device,*context);
|
||||
|
||||
// -- GODOT start --
|
||||
// if (size != 0 && ptr == nullptr)
|
||||
// throw std::bad_alloc();
|
||||
//if (size != 0 && ptr == nullptr)
|
||||
// throw std::bad_alloc();
|
||||
if (size != 0 && ptr == nullptr) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
|
@ -275,12 +265,10 @@ namespace embree
|
|||
/* fall back to 4k pages */
|
||||
int flags = MEM_COMMIT | MEM_RESERVE;
|
||||
char* ptr = (char*) VirtualAlloc(nullptr,bytes,flags,PAGE_READWRITE);
|
||||
// -- GODOT start --
|
||||
// if (ptr == nullptr) throw std::bad_alloc();
|
||||
//if (ptr == nullptr) throw std::bad_alloc();
|
||||
if (ptr == nullptr) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
hugepages = false;
|
||||
return ptr;
|
||||
}
|
||||
|
|
@ -296,13 +284,11 @@ namespace embree
|
|||
if (bytesNew >= bytesOld)
|
||||
return bytesOld;
|
||||
|
||||
// -- GODOT start --
|
||||
// if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
|
||||
// throw std::bad_alloc();
|
||||
//if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
|
||||
// throw std::bad_alloc();
|
||||
if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT)) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
|
||||
return bytesNew;
|
||||
}
|
||||
|
|
@ -312,13 +298,11 @@ namespace embree
|
|||
if (bytes == 0)
|
||||
return;
|
||||
|
||||
// -- GODOT start --
|
||||
// if (!VirtualFree(ptr,0,MEM_RELEASE))
|
||||
// throw std::bad_alloc();
|
||||
//if (!VirtualFree(ptr,0,MEM_RELEASE))
|
||||
// throw std::bad_alloc();
|
||||
if (!VirtualFree(ptr,0,MEM_RELEASE)) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
}
|
||||
|
||||
void os_advise(void *ptr, size_t bytes)
|
||||
|
|
@ -422,12 +406,10 @@ namespace embree
|
|||
|
||||
/* fallback to 4k pages */
|
||||
void* ptr = (char*) mmap(0, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
// -- GODOT start --
|
||||
// if (ptr == MAP_FAILED) throw std::bad_alloc();
|
||||
//if (ptr == MAP_FAILED) throw std::bad_alloc();
|
||||
if (ptr == MAP_FAILED) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
hugepages = false;
|
||||
|
||||
/* advise huge page hint for THP */
|
||||
|
|
@ -443,13 +425,11 @@ namespace embree
|
|||
if (bytesNew >= bytesOld)
|
||||
return bytesOld;
|
||||
|
||||
// -- GODOT start --
|
||||
// if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
|
||||
// throw std::bad_alloc();
|
||||
//if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
|
||||
// throw std::bad_alloc();
|
||||
if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
|
||||
return bytesNew;
|
||||
}
|
||||
|
|
@ -462,13 +442,11 @@ namespace embree
|
|||
/* for hugepages we need to also align the size */
|
||||
const size_t pageSize = hugepages ? PAGE_SIZE_2M : PAGE_SIZE_4K;
|
||||
bytes = (bytes+pageSize-1) & ~(pageSize-1);
|
||||
// -- GODOT start --
|
||||
// if (munmap(ptr,bytes) == -1)
|
||||
// throw std::bad_alloc();
|
||||
//if (munmap(ptr,bytes) == -1)
|
||||
// throw std::bad_alloc();
|
||||
if (munmap(ptr,bytes) == -1) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
}
|
||||
|
||||
/* hint for transparent huge pages (THP) */
|
||||
|
|
|
|||
4
engine/thirdparty/embree/common/sys/alloc.h
vendored
4
engine/thirdparty/embree/common/sys/alloc.h
vendored
|
|
@ -160,10 +160,8 @@ namespace embree
|
|||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
__forceinline pointer allocate( size_type n ) {
|
||||
// -- GODOT start --
|
||||
// throw std::runtime_error("no allocation supported");
|
||||
//throw std::runtime_error("no allocation supported");
|
||||
abort();
|
||||
// -- GODOT end --
|
||||
}
|
||||
|
||||
__forceinline void deallocate( pointer p, size_type n ) {
|
||||
|
|
|
|||
12
engine/thirdparty/embree/common/sys/platform.h
vendored
12
engine/thirdparty/embree/common/sys/platform.h
vendored
|
|
@ -213,19 +213,15 @@
|
|||
#define UPRINT4(x,y,z,w) embree_cout_uniform << STRING(x) << " = " << (x) << ", " << STRING(y) << " = " << (y) << ", " << STRING(z) << " = " << (z) << ", " << STRING(w) << " = " << (w) << embree_endl
|
||||
|
||||
#if defined(DEBUG) // only report file and line in debug mode
|
||||
// -- GODOT start --
|
||||
// #define THROW_RUNTIME_ERROR(str) \
|
||||
// throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
|
||||
//#define THROW_RUNTIME_ERROR(str) \
|
||||
// throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
|
||||
#define THROW_RUNTIME_ERROR(str) \
|
||||
printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
|
||||
// -- GODOT end --
|
||||
#else
|
||||
// -- GODOT start --
|
||||
// #define THROW_RUNTIME_ERROR(str) \
|
||||
// throw std::runtime_error(str);
|
||||
//#define THROW_RUNTIME_ERROR(str) \
|
||||
// throw std::runtime_error(str);
|
||||
#define THROW_RUNTIME_ERROR(str) \
|
||||
abort();
|
||||
// -- GODOT end --
|
||||
#endif
|
||||
|
||||
#define FATAL(x) THROW_RUNTIME_ERROR(x)
|
||||
|
|
|
|||
21
engine/thirdparty/embree/common/sys/sysinfo.cpp
vendored
21
engine/thirdparty/embree/common/sys/sysinfo.cpp
vendored
|
|
@ -647,11 +647,9 @@ namespace embree
|
|||
#if defined(__EMSCRIPTEN__)
|
||||
#include <emscripten.h>
|
||||
|
||||
// -- GODOT start --
|
||||
extern "C" {
|
||||
extern int godot_js_os_hw_concurrency_get();
|
||||
}
|
||||
// -- GODOT end --
|
||||
#endif
|
||||
|
||||
namespace embree
|
||||
|
|
@ -665,9 +663,24 @@ namespace embree
|
|||
nThreads = sysconf(_SC_NPROCESSORS_ONLN); // does not work in Linux LXC container
|
||||
assert(nThreads);
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
// -- GODOT start --
|
||||
nThreads = godot_js_os_hw_concurrency_get();
|
||||
// -- GODOT end --
|
||||
#if 0
|
||||
// WebAssembly supports pthreads, but not pthread_getaffinity_np. Get the number of logical
|
||||
// threads from the browser or Node.js using JavaScript.
|
||||
nThreads = MAIN_THREAD_EM_ASM_INT({
|
||||
const isBrowser = typeof window !== 'undefined';
|
||||
const isNode = typeof process !== 'undefined' && process.versions != null &&
|
||||
process.versions.node != null;
|
||||
if (isBrowser) {
|
||||
// Return 1 if the browser does not expose hardwareConcurrency.
|
||||
return window.navigator.hardwareConcurrency || 1;
|
||||
} else if (isNode) {
|
||||
return require('os').cpus().length;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
#else
|
||||
cpu_set_t set;
|
||||
if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)
|
||||
|
|
|
|||
|
|
@ -48,15 +48,13 @@ namespace embree
|
|||
{
|
||||
Task* prevTask = thread.task;
|
||||
thread.task = this;
|
||||
// -- GODOT start --
|
||||
// try {
|
||||
// if (context->cancellingException == nullptr)
|
||||
//try {
|
||||
// if (context->cancellingException == nullptr)
|
||||
closure->execute();
|
||||
// } catch (...) {
|
||||
// if (context->cancellingException == nullptr)
|
||||
// context->cancellingException = std::current_exception();
|
||||
// }
|
||||
// -- GODOT end --
|
||||
//} catch (...) {
|
||||
// if (context->cancellingException == nullptr)
|
||||
// context->cancellingException = std::current_exception();
|
||||
//}
|
||||
thread.task = prevTask;
|
||||
add_dependencies(-1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,13 +130,11 @@ namespace embree
|
|||
__forceinline void* alloc(size_t bytes, size_t align = 64)
|
||||
{
|
||||
size_t ofs = bytes + ((align - stackPtr) & (align-1));
|
||||
// -- GODOT start --
|
||||
// if (stackPtr + ofs > CLOSURE_STACK_SIZE)
|
||||
// throw std::runtime_error("closure stack overflow");
|
||||
//if (stackPtr + ofs > CLOSURE_STACK_SIZE)
|
||||
// throw std::runtime_error("closure stack overflow");
|
||||
if (stackPtr + ofs > CLOSURE_STACK_SIZE) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
stackPtr += ofs;
|
||||
return &stack[stackPtr-bytes];
|
||||
}
|
||||
|
|
@ -144,13 +142,11 @@ namespace embree
|
|||
template<typename Closure>
|
||||
__forceinline void push_right(Thread& thread, const size_t size, const Closure& closure, TaskGroupContext* context)
|
||||
{
|
||||
// -- GODOT start --
|
||||
// if (right >= TASK_STACK_SIZE)
|
||||
// throw std::runtime_error("task stack overflow");
|
||||
//if (right >= TASK_STACK_SIZE)
|
||||
// throw std::runtime_error("task stack overflow");
|
||||
if (right >= TASK_STACK_SIZE) {
|
||||
abort();
|
||||
}
|
||||
// -- GODOT end --
|
||||
|
||||
/* allocate new task on right side of stack */
|
||||
size_t oldStackPtr = stackPtr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue