From e6623a244b5eb2b74f61b5b9c188bcc854188fd8 Mon Sep 17 00:00:00 2001 From: Gon Solo Date: Sat, 9 Mar 2024 18:36:23 +0100 Subject: [PATCH] Upgrade to Embree 4. --- Package.swift | 4 ++-- Sources/embree3/embree3.h | 1 - Sources/embree3/module.modulemap | 5 ----- Sources/embree4/embree4.h | 1 + Sources/embree4/module.modulemap | 5 +++++ Sources/gonzales/Accelerators/Embree.swift | 11 ++++------- 6 files changed, 12 insertions(+), 15 deletions(-) delete mode 100644 Sources/embree3/embree3.h delete mode 100644 Sources/embree3/module.modulemap create mode 100644 Sources/embree4/embree4.h create mode 100644 Sources/embree4/module.modulemap diff --git a/Package.swift b/Package.swift index 6dd5bf9..e1e0422 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,7 @@ let package = Package( name: "gonzales", dependencies: [ "SWCompression", - "embree3", + "embree4", "openImageIOBridge", "cuda", "cudaBridge", @@ -35,7 +35,7 @@ let package = Package( dependencies: ["cuda"], swiftSettings: [.interoperabilityMode(.Cxx)] ), - .systemLibrary(name: "embree3"), + .systemLibrary(name: "embree4"), .systemLibrary(name: "openimageio", pkgConfig: "OpenImageIO"), .systemLibrary(name: "cuda", pkgConfig: "cuda-12.3"), .systemLibrary(name: "ptex", pkgConfig: "ptex"), diff --git a/Sources/embree3/embree3.h b/Sources/embree3/embree3.h deleted file mode 100644 index 9b57872..0000000 --- a/Sources/embree3/embree3.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/Sources/embree3/module.modulemap b/Sources/embree3/module.modulemap deleted file mode 100644 index d50df84..0000000 --- a/Sources/embree3/module.modulemap +++ /dev/null @@ -1,5 +0,0 @@ -module embree3 { - umbrella header "embree3.h" - link "embree3" -} - diff --git a/Sources/embree4/embree4.h b/Sources/embree4/embree4.h new file mode 100644 index 0000000..77c1b42 --- /dev/null +++ b/Sources/embree4/embree4.h @@ -0,0 +1 @@ +#include diff --git a/Sources/embree4/module.modulemap b/Sources/embree4/module.modulemap new file mode 100644 index 0000000..ec31280 --- /dev/null +++ b/Sources/embree4/module.modulemap @@ -0,0 +1,5 @@ +module embree4 { + umbrella header "embree4.h" + link "embree4" +} + diff --git a/Sources/gonzales/Accelerators/Embree.swift b/Sources/gonzales/Accelerators/Embree.swift index 6c395ec..6512672 100644 --- a/Sources/gonzales/Accelerators/Embree.swift +++ b/Sources/gonzales/Accelerators/Embree.swift @@ -1,5 +1,5 @@ import Foundation -import embree3 +import embree4 // swift-format-ignore: AlwaysUseLowerCamelCase @_silgen_name("_swift_stdlib_immortalize") @@ -139,14 +139,11 @@ final class EmbreeAccelerator: EmbreeBase { v: 0, primID: 0, geomID: rtcInvalidGeometryId, - instID: rtcInvalidGeometryId) + instID: rtcInvalidGeometryId, + instPrimID: 0) - //_unsafePerformance { var rayhit = RTCRayHit(ray: rtcRay, hit: rtcHit) - var context = RTCIntersectContext() - rtcInitIntersectContext(&context) - rtcIntersect1(rtcScene, &context, &rayhit) - //} + rtcIntersect1(rtcScene, &rayhit, nil) guard rayhit.hit.geomID != rtcInvalidGeometryId else { return empty(#line)