Switch to embree-aarch64
This commit is contained in:
@ -70,25 +70,19 @@ if env["builtin_embree"]:
|
||||
thirdparty_sources = [thirdparty_dir + file for file in embree_src]
|
||||
|
||||
env_raycast.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "include"])
|
||||
env_raycast.Append(
|
||||
CPPDEFINES=[
|
||||
"EMBREE_TARGET_SSE2",
|
||||
"EMBREE_LOWEST_ISA",
|
||||
"TASKING_INTERNAL",
|
||||
"NDEBUG",
|
||||
"__SSE2__",
|
||||
"__SSE__",
|
||||
]
|
||||
)
|
||||
env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE2", "EMBREE_LOWEST_ISA", "TASKING_INTERNAL", "NDEBUG"])
|
||||
|
||||
if not env.msvc:
|
||||
env_raycast.Append(CPPFLAGS=["-msse2", "-mxsave"])
|
||||
if env["arch"] in ["x86", "x86_64"]:
|
||||
env_raycast.Append(CPPFLAGS=["-msse2", "-mxsave"])
|
||||
|
||||
if env["platform"] == "windows":
|
||||
env_raycast.Append(CPPFLAGS=["-mstackrealign"])
|
||||
|
||||
if env["platform"] == "windows":
|
||||
if env.msvc:
|
||||
env.Append(LINKFLAGS=["psapi.lib"])
|
||||
env_raycast.Append(CPPDEFINES=["__SSE2__", "__SSE__"])
|
||||
else:
|
||||
env.Append(LIBS=["psapi"])
|
||||
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
def can_build(env, platform):
|
||||
# Embree requires at least SSE2 to be available, so 32-bit and ARM64 builds are
|
||||
# not supported.
|
||||
# It's also only relevant for tools build and desktop platforms,
|
||||
# as doing lightmap generation on Android or HTML5 would be a bit far-fetched.
|
||||
supported_platform = platform in ["x11", "osx", "windows", "server"]
|
||||
supported_bits = env["bits"] == "64"
|
||||
supported_arch = env["arch"] != "arm64"
|
||||
if not env["tools"]:
|
||||
return False
|
||||
|
||||
# Hack to disable on Linux arm64. This won't work well for cross-compilation (checks
|
||||
# host, not target) and would need a more thorough fix by refactoring our arch and
|
||||
# bits-handling code.
|
||||
from platform import machine
|
||||
if platform == "android":
|
||||
return env["android_arch"] in ["arm64v8", "x86", "x86_64"]
|
||||
|
||||
if platform == "x11" and machine() != "x86_64":
|
||||
supported_arch = False
|
||||
if platform in ["javascript", "server"]:
|
||||
return False
|
||||
|
||||
return env["tools"] and supported_platform and supported_bits and supported_arch
|
||||
return True
|
||||
|
||||
|
||||
def configure(env):
|
||||
|
||||
@ -74,17 +74,18 @@ cpp_files = [
|
||||
|
||||
os.chdir("../../thirdparty")
|
||||
|
||||
if os.path.exists("embree"):
|
||||
shutil.rmtree("embree")
|
||||
dir_name = "embree"
|
||||
if os.path.exists(dir_name):
|
||||
shutil.rmtree(dir_name)
|
||||
|
||||
subprocess.run(["git", "clone", "https://github.com/embree/embree.git", "embree-tmp"])
|
||||
subprocess.run(["git", "clone", "https://github.com/lighttransport/embree-aarch64.git", "embree-tmp"])
|
||||
os.chdir("embree-tmp")
|
||||
|
||||
commit_hash = str(subprocess.check_output(["git", "rev-parse", "HEAD"], universal_newlines=True)).strip()
|
||||
|
||||
dest_dir = "../embree"
|
||||
all_files = set(cpp_files)
|
||||
|
||||
dest_dir = os.path.join("..", dir_name)
|
||||
for include_dir in include_dirs:
|
||||
headers = glob.iglob(os.path.join(include_dir, "*.h"))
|
||||
all_files.update(headers)
|
||||
|
||||
@ -192,8 +192,11 @@ LightmapRaycasterEmbree::~LightmapRaycasterEmbree() {
|
||||
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF);
|
||||
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_OFF);
|
||||
|
||||
if (embree_scene != nullptr)
|
||||
if (embree_scene != nullptr) {
|
||||
rtcReleaseScene(embree_scene);
|
||||
if (embree_device != nullptr)
|
||||
}
|
||||
|
||||
if (embree_device != nullptr) {
|
||||
rtcReleaseDevice(embree_device);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user