initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled

This commit is contained in:
2025-09-16 20:46:46 -04:00
commit 9d30169a8d
13378 changed files with 7050105 additions and 0 deletions

View File

@@ -0,0 +1,349 @@
diff --git a/thirdparty/embree/common/algorithms/parallel_reduce.h b/thirdparty/embree/common/algorithms/parallel_reduce.h
index b52b1e2e13..fbff38f660 100644
--- a/thirdparty/embree/common/algorithms/parallel_reduce.h
+++ b/thirdparty/embree/common/algorithms/parallel_reduce.h
@@ -58,15 +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);
- if (context.is_group_execution_cancelled())
- throw std::runtime_error("task cancelled");
+ //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);
- if (tbb::task::self().is_cancelled())
- throw std::runtime_error("task cancelled");
+ //if (tbb::task::self().is_cancelled())
+ // throw std::runtime_error("task cancelled");
return v;
#endif
#else // TASKING_PPL
diff --git a/thirdparty/embree/common/lexers/stringstream.cpp b/thirdparty/embree/common/lexers/stringstream.cpp
index 42ffb10176..9779fc74c7 100644
--- a/thirdparty/embree/common/lexers/stringstream.cpp
+++ b/thirdparty/embree/common/lexers/stringstream.cpp
@@ -39,7 +39,7 @@ namespace embree
std::vector<char> str; str.reserve(64);
while (cin->peek() != EOF && !isSeparator(cin->peek())) {
int c = cin->get();
- if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
+ if (!isValidChar(c)) abort(); //throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
str.push_back((char)c);
}
str.push_back(0);
diff --git a/thirdparty/embree/common/sys/alloc.cpp b/thirdparty/embree/common/sys/alloc.cpp
index c92bb99ece..2288df76ef 100644
--- a/thirdparty/embree/common/sys/alloc.cpp
+++ b/thirdparty/embree/common/sys/alloc.cpp
@@ -20,7 +20,7 @@ namespace embree
assert((align & (align-1)) == 0);
void* ptr = _mm_malloc(size,align);
if (size != 0 && ptr == nullptr)
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
return ptr;
}
@@ -50,7 +50,7 @@ namespace embree
ptr = sycl::aligned_alloc_shared(align,size,*device,*context);
if (size != 0 && ptr == nullptr)
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
return ptr;
}
@@ -83,7 +83,7 @@ namespace embree
}
if (size != 0 && ptr == nullptr)
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
return ptr;
}
@@ -199,7 +199,7 @@ namespace embree
/* fall back to 4k pages */
int flags = MEM_COMMIT | MEM_RESERVE;
char* ptr = (char*) VirtualAlloc(nullptr,bytes,flags,PAGE_READWRITE);
- if (ptr == nullptr) throw std::bad_alloc();
+ if (ptr == nullptr) abort(); //throw std::bad_alloc();
hugepages = false;
return ptr;
}
@@ -216,7 +216,7 @@ namespace embree
return bytesOld;
if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
return bytesNew;
}
@@ -227,7 +227,7 @@ namespace embree
return;
if (!VirtualFree(ptr,0,MEM_RELEASE))
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
}
void os_advise(void *ptr, size_t bytes)
@@ -331,7 +331,7 @@ namespace embree
/* fallback to 4k pages */
void* ptr = (char*) mmap(0, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
- if (ptr == MAP_FAILED) throw std::bad_alloc();
+ if (ptr == MAP_FAILED) abort(); //throw std::bad_alloc();
hugepages = false;
/* advise huge page hint for THP */
@@ -348,7 +348,7 @@ namespace embree
return bytesOld;
if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
return bytesNew;
}
@@ -362,7 +362,7 @@ namespace embree
const size_t pageSize = hugepages ? PAGE_SIZE_2M : PAGE_SIZE_4K;
bytes = (bytes+pageSize-1) & ~(pageSize-1);
if (munmap(ptr,bytes) == -1)
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
}
/* hint for transparent huge pages (THP) */
diff --git a/thirdparty/embree/common/sys/alloc.h b/thirdparty/embree/common/sys/alloc.h
index 5c63d0bfaf..1f6f230ed3 100644
--- a/thirdparty/embree/common/sys/alloc.h
+++ b/thirdparty/embree/common/sys/alloc.h
@@ -131,7 +131,7 @@ namespace embree
typedef std::ptrdiff_t difference_type;
__forceinline pointer allocate( size_type n ) {
- throw std::runtime_error("no allocation supported");
+ abort(); //throw std::runtime_error("no allocation supported");
}
__forceinline void deallocate( pointer p, size_type n ) {
diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h
index 6dc0cf3318..1e5b02550e 100644
--- a/thirdparty/embree/common/sys/platform.h
+++ b/thirdparty/embree/common/sys/platform.h
@@ -214,10 +214,11 @@
#if defined(DEBUG) // only report file and line in debug mode
#define THROW_RUNTIME_ERROR(str) \
- throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
+ printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
+ //throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
#else
#define THROW_RUNTIME_ERROR(str) \
- throw std::runtime_error(str);
+ abort(); //throw std::runtime_error(str);
#endif
#define FATAL(x) THROW_RUNTIME_ERROR(x)
diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
index 83ead95122..e89ae04f8b 100644
--- a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
+++ b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
@@ -48,13 +48,13 @@ namespace embree
{
Task* prevTask = thread.task;
thread.task = this;
- try {
- if (context->cancellingException == nullptr)
+ //try {
+ // if (context->cancellingException == nullptr)
closure->execute();
- } catch (...) {
- if (context->cancellingException == nullptr)
- context->cancellingException = std::current_exception();
- }
+ //} catch (...) {
+ // if (context->cancellingException == nullptr)
+ // context->cancellingException = std::current_exception();
+ //}
thread.task = prevTask;
add_dependencies(-1);
}
diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.h b/thirdparty/embree/common/tasking/taskschedulerinternal.h
index b01bebf7c3..d4e0c7386b 100644
--- a/thirdparty/embree/common/tasking/taskschedulerinternal.h
+++ b/thirdparty/embree/common/tasking/taskschedulerinternal.h
@@ -131,7 +131,7 @@ namespace embree
{
size_t ofs = bytes + ((align - stackPtr) & (align-1));
if (stackPtr + ofs > CLOSURE_STACK_SIZE)
- throw std::runtime_error("closure stack overflow");
+ abort(); //throw std::runtime_error("closure stack overflow");
stackPtr += ofs;
return &stack[stackPtr-bytes];
}
@@ -140,7 +140,7 @@ namespace embree
__forceinline void push_right(Thread& thread, const size_t size, const Closure& closure, TaskGroupContext* context)
{
if (right >= TASK_STACK_SIZE)
- throw std::runtime_error("task stack overflow");
+ abort(); //throw std::runtime_error("task stack overflow");
/* allocate new task on right side of stack */
size_t oldStackPtr = stackPtr;
diff --git a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
index 40f9043736..f3b93e5925 100644
--- a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
+++ b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
@@ -150,7 +150,7 @@ namespace embree
}
}
else {
- throw std::runtime_error("not supported node type in bvh_statistics");
+ abort(); //throw std::runtime_error("not supported node type in bvh_statistics");
}
return s;
}
diff --git a/thirdparty/embree/kernels/common/alloc.h b/thirdparty/embree/kernels/common/alloc.h
index 2bd292de4d..10f629a244 100644
--- a/thirdparty/embree/kernels/common/alloc.h
+++ b/thirdparty/embree/kernels/common/alloc.h
@@ -190,7 +190,7 @@ namespace embree
, primrefarray(device,0)
{
if (osAllocation && useUSM)
- throw std::runtime_error("USM allocation cannot be combined with OS allocation.");
+ abort(); //throw std::runtime_error("USM allocation cannot be combined with OS allocation.");
for (size_t i=0; i<MAX_THREAD_USED_BLOCK_SLOTS; i++)
{
@@ -503,7 +503,7 @@ namespace embree
if (myUsedBlocks) {
void* ptr = myUsedBlocks->malloc(device,bytes,align,partial);
if (ptr == nullptr && !blockAllocation)
- throw std::bad_alloc();
+ abort(); //throw std::bad_alloc();
if (ptr) return ptr;
}
diff --git a/thirdparty/embree/kernels/common/rtcore.cpp b/thirdparty/embree/kernels/common/rtcore.cpp
index 8da5c9d86c..a34eb2a0c4 100644
--- a/thirdparty/embree/kernels/common/rtcore.cpp
+++ b/thirdparty/embree/kernels/common/rtcore.cpp
@@ -358,7 +358,7 @@ RTC_NAMESPACE_BEGIN;
if (quality != RTC_BUILD_QUALITY_LOW &&
quality != RTC_BUILD_QUALITY_MEDIUM &&
quality != RTC_BUILD_QUALITY_HIGH)
- throw std::runtime_error("invalid build quality");
+ abort(); //throw std::runtime_error("invalid build quality");
scene->setBuildQuality(quality);
RTC_CATCH_END2(scene);
}
@@ -1831,7 +1831,7 @@ RTC_API void rtcSetGeometryTransform(RTCGeometry hgeometry, unsigned int timeSte
quality != RTC_BUILD_QUALITY_MEDIUM &&
quality != RTC_BUILD_QUALITY_HIGH &&
quality != RTC_BUILD_QUALITY_REFIT)
- throw std::runtime_error("invalid build quality");
+ abort(); //throw std::runtime_error("invalid build quality");
geometry->setBuildQuality(quality);
RTC_CATCH_END2(geometry);
}
diff --git a/thirdparty/embree/kernels/common/rtcore.h b/thirdparty/embree/kernels/common/rtcore.h
index 73a061de11..cd7a6f4395 100644
--- a/thirdparty/embree/kernels/common/rtcore.h
+++ b/thirdparty/embree/kernels/common/rtcore.h
@@ -13,7 +13,7 @@ namespace embree
__forceinline bool isIncoherent(RTCRayQueryFlags flags) { return (flags & RTC_RAY_QUERY_FLAG_COHERENT) == RTC_RAY_QUERY_FLAG_INCOHERENT; }
/*! Macros used in the rtcore API implementation */
-#if 0
+#if 1
# define RTC_CATCH_BEGIN
# define RTC_CATCH_END(device)
# define RTC_CATCH_END2(scene)
@@ -94,6 +94,7 @@ namespace embree
#define RTC_TRACE(x)
#endif
+#if 0
/*! used to throw embree API errors */
struct rtcore_error : public std::exception
{
@@ -109,13 +110,16 @@ namespace embree
RTCError error;
std::string str;
};
+#endif
#if defined(DEBUG) // only report file and line in debug mode
#define throw_RTCError(error,str) \
- throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
+ printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
+ //throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
#else
#define throw_RTCError(error,str) \
- throw rtcore_error(error,str);
+ abort();
+ //throw rtcore_error(error,str);
#endif
#define RTC_BUILD_ARGUMENTS_HAS(settings,member) \
diff --git a/thirdparty/embree/kernels/common/scene.cpp b/thirdparty/embree/kernels/common/scene.cpp
index 84a84f8c69..3bfcebd298 100644
--- a/thirdparty/embree/kernels/common/scene.cpp
+++ b/thirdparty/embree/kernels/common/scene.cpp
@@ -962,16 +962,16 @@ namespace embree
}
/* initiate build */
- try {
+ //try {
TaskScheduler::TaskGroupContext context;
scheduler->spawn_root([&]() { commit_task(); Lock<MutexSys> lock(taskGroup->schedulerMutex); taskGroup->scheduler = nullptr; }, &context, 1, !join);
- }
- catch (...) {
- accels_clear();
- Lock<MutexSys> lock(taskGroup->schedulerMutex);
- taskGroup->scheduler = nullptr;
- throw;
- }
+ //}
+ //catch (...) {
+ // accels_clear();
+ // Lock<MutexSys> lock(taskGroup->schedulerMutex);
+ // taskGroup->scheduler = nullptr;
+ // throw;
+ //}
}
#endif
diff --git a/thirdparty/embree/kernels/common/state.cpp b/thirdparty/embree/kernels/common/state.cpp
index cce5eafce1..509dbc7120 100644
--- a/thirdparty/embree/kernels/common/state.cpp
+++ b/thirdparty/embree/kernels/common/state.cpp
@@ -199,13 +199,13 @@ namespace embree
bool State::parseFile(const FileName& fileName)
{
Ref<Stream<int> > file;
- try {
+ //try {
file = new FileStream(fileName);
- }
- catch (std::runtime_error& e) {
- (void) e;
- return false;
- }
+ //}
+ //catch (std::runtime_error& e) {
+ // (void) e;
+ // return false;
+ //}
std::vector<std::string> syms;
for (size_t i=0; i<sizeof(symbols)/sizeof(void*); i++)

View File

@@ -0,0 +1,102 @@
diff --git a/thirdparty/embree/include/embree4/rtcore_config.h b/thirdparty/embree/include/embree4/rtcore_config.h
index eba966989e..91cf129dc6 100644
--- a/thirdparty/embree/include/embree4/rtcore_config.h
+++ b/thirdparty/embree/include/embree4/rtcore_config.h
@@ -4,7 +4,7 @@
#pragma once
#if !defined(EMBREE_SYCL_SUPPORT)
-#cmakedefine EMBREE_SYCL_SUPPORT
+// #cmakedefine EMBREE_SYCL_SUPPORT
#endif
#define RTC_VERSION_MAJOR 4
@@ -13,28 +13,28 @@
#define RTC_VERSION 40400
#define RTC_VERSION_STRING "4.4.0"
-#define RTC_MAX_INSTANCE_LEVEL_COUNT @EMBREE_MAX_INSTANCE_LEVEL_COUNT@
+#define RTC_MAX_INSTANCE_LEVEL_COUNT 1
-#cmakedefine EMBREE_GEOMETRY_INSTANCE_ARRAY
+// #cmakedefine EMBREE_GEOMETRY_INSTANCE_ARRAY
#if defined(EMBREE_GEOMETRY_INSTANCE_ARRAY)
#define RTC_GEOMETRY_INSTANCE_ARRAY
#endif
-#cmakedefine01 EMBREE_SYCL_GEOMETRY_CALLBACK
+// #cmakedefine01 EMBREE_SYCL_GEOMETRY_CALLBACK
-#cmakedefine01 EMBREE_MIN_WIDTH
+#define EMBREE_MIN_WIDTH 0
#define RTC_MIN_WIDTH EMBREE_MIN_WIDTH
#if !defined(EMBREE_STATIC_LIB)
-#cmakedefine EMBREE_STATIC_LIB
+#define EMBREE_STATIC_LIB
#endif
-#cmakedefine EMBREE_API_NAMESPACE
+// #cmakedefine EMBREE_API_NAMESPACE
#if defined(EMBREE_API_NAMESPACE)
-# define RTC_NAMESPACE @EMBREE_API_NAMESPACE@
-# define RTC_NAMESPACE_BEGIN namespace @EMBREE_API_NAMESPACE@ {
+# define RTC_NAMESPACE
+# define RTC_NAMESPACE_BEGIN namespace {
# define RTC_NAMESPACE_END }
-# define RTC_NAMESPACE_USE using namespace @EMBREE_API_NAMESPACE@;
+# define RTC_NAMESPACE_USE using namespace;
# define RTC_API_EXTERN_C
# define RTC_API_EXTERN_CPP
# undef EMBREE_API_NAMESPACE
diff --git a/thirdparty/embree/kernels/config.h b/thirdparty/embree/kernels/config.h
index 1669c4af72..5979b543c9 100644
--- a/thirdparty/embree/kernels/config.h
+++ b/thirdparty/embree/kernels/config.h
@@ -3,27 +3,27 @@
#include "../include/embree4/rtcore_config.h"
-#cmakedefine EMBREE_RAY_MASK
-#cmakedefine EMBREE_STAT_COUNTERS
-#cmakedefine EMBREE_BACKFACE_CULLING
-#cmakedefine EMBREE_BACKFACE_CULLING_CURVES
-#cmakedefine EMBREE_BACKFACE_CULLING_SPHERES
-#cmakedefine EMBREE_FILTER_FUNCTION
-#cmakedefine EMBREE_IGNORE_INVALID_RAYS
-#cmakedefine EMBREE_GEOMETRY_TRIANGLE
-#cmakedefine EMBREE_GEOMETRY_QUAD
-#cmakedefine EMBREE_GEOMETRY_CURVE
-#cmakedefine EMBREE_GEOMETRY_SUBDIVISION
-#cmakedefine EMBREE_GEOMETRY_USER
-#cmakedefine EMBREE_GEOMETRY_INSTANCE
+// #cmakedefine EMBREE_RAY_MASK
+// #cmakedefine EMBREE_STAT_COUNTERS
+// #cmakedefine EMBREE_BACKFACE_CULLING
+// #cmakedefine EMBREE_BACKFACE_CULLING_CURVES
+// #cmakedefine EMBREE_BACKFACE_CULLING_SPHERES
+#define EMBREE_FILTER_FUNCTION
+// #cmakedefine EMBREE_IGNORE_INVALID_RAYS
+#define EMBREE_GEOMETRY_TRIANGLE
+// #cmakedefine EMBREE_GEOMETRY_QUAD
+// #cmakedefine EMBREE_GEOMETRY_CURVE
+// #cmakedefine EMBREE_GEOMETRY_SUBDIVISION
+// #cmakedefine EMBREE_GEOMETRY_USER
+// #cmakedefine EMBREE_GEOMETRY_INSTANCE
// EMBREE_GEOMETRY_INSTANCE_ARRAY is defined in rtcore_config.h
-#cmakedefine EMBREE_GEOMETRY_GRID
-#cmakedefine EMBREE_GEOMETRY_POINT
-#cmakedefine EMBREE_RAY_PACKETS
-#cmakedefine EMBREE_COMPACT_POLYS
+// #cmakedefine EMBREE_GEOMETRY_GRID
+// #cmakedefine EMBREE_GEOMETRY_POINT
+#define EMBREE_RAY_PACKETS
+// #cmakedefine EMBREE_COMPACT_POLYS
-#define EMBREE_CURVE_SELF_INTERSECTION_AVOIDANCE_FACTOR @EMBREE_CURVE_SELF_INTERSECTION_AVOIDANCE_FACTOR@
-#cmakedefine EMBREE_DISC_POINT_SELF_INTERSECTION_AVOIDANCE
+#define EMBREE_CURVE_SELF_INTERSECTION_AVOIDANCE_FACTOR 2.0
+#define EMBREE_DISC_POINT_SELF_INTERSECTION_AVOIDANCE
#if defined(EMBREE_GEOMETRY_TRIANGLE)
#define IF_ENABLED_TRIS(x) x

View File

@@ -0,0 +1,32 @@
diff --git a/thirdparty/embree/common/sys/sysinfo.cpp b/thirdparty/embree/common/sys/sysinfo.cpp
index 5f375cd95c..3c23fb1610 100644
--- a/thirdparty/embree/common/sys/sysinfo.cpp
+++ b/thirdparty/embree/common/sys/sysinfo.cpp
@@ -659,6 +659,10 @@ namespace embree
#if defined(__EMSCRIPTEN__)
#include <emscripten.h>
+
+extern "C" {
+extern int godot_js_os_hw_concurrency_get();
+}
#endif
namespace embree
@@ -672,6 +676,8 @@ namespace embree
nThreads = sysconf(_SC_NPROCESSORS_ONLN); // does not work in Linux LXC container
assert(nThreads);
#elif defined(__EMSCRIPTEN__)
+ nThreads = godot_js_os_hw_concurrency_get();
+#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({
@@ -687,6 +693,7 @@ namespace embree
return 1;
}
});
+#endif
#else
cpu_set_t set;
if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)

View File

@@ -0,0 +1,13 @@
diff --git a/thirdparty/embree/common/sys/sysinfo.cpp b/thirdparty/embree/common/sys/sysinfo.cpp
index d5b653fe5a..4583e49b1c 100644
--- a/thirdparty/embree/common/sys/sysinfo.cpp
+++ b/thirdparty/embree/common/sys/sysinfo.cpp
@@ -295,7 +295,7 @@ namespace embree
if (nIds >= 1) __cpuid (cpuid_leaf_1,0x00000001);
#if _WIN32
#if _MSC_VER && (_MSC_FULL_VER < 160040219)
-#else
+#elif defined(_MSC_VER)
if (nIds >= 7) __cpuidex(cpuid_leaf_7,0x00000007,0);
#endif
#else

View File

@@ -0,0 +1,40 @@
diff --git a/thirdparty/embree/common/simd/arm/sse2neon.h b/thirdparty/embree/common/simd/arm/sse2neon.h
index b18d41e783..5a75ccff20 100644
--- a/thirdparty/embree/common/simd/arm/sse2neon.h
+++ b/thirdparty/embree/common/simd/arm/sse2neon.h
@@ -102,7 +102,7 @@
#include <stdint.h>
#include <stdlib.h>
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__)
/* Definitions for _mm_{malloc,free} are provided by <malloc.h>
* from both MinGW-w64 and MSVC.
*/
@@ -1888,7 +1888,11 @@ FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b)
#if !defined(SSE2NEON_ALLOC_DEFINED)
FORCE_INLINE void _mm_free(void *addr)
{
+#if defined(_WIN32)
+ _aligned_free(addr);
+#else
free(addr);
+#endif
}
#endif
@@ -2080,8 +2084,14 @@ 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 *);
+#if defined(_WIN32)
+ ptr = _aligned_malloc(size, align);
+ if (ptr)
+ return ptr;
+#else
if (!posix_memalign(&ptr, align, size))
return ptr;
+#endif
return NULL;
}
#endif