Browse Source

bvh: update to 2025.02.03 (#7402)

* bvh: update to 2025.02.03

* try fix narrowing
Saikari 2 months ago
parent
commit
84f98defb2
2 changed files with 44 additions and 2 deletions
  1. 40 0
      packages/b/bvh/patches/2025.02.03/fix-narrow.diff
  2. 4 2
      packages/b/bvh/xmake.lua

+ 40 - 0
packages/b/bvh/patches/2025.02.03/fix-narrow.diff

@@ -0,0 +1,40 @@
+diff --git a/src/bvh/v2/index.h b/src/bvh/v2/index.h
+index 7120031..2fe40cc 100644
+--- a/src/bvh/v2/index.h
++++ b/src/bvh/v2/index.h
+@@ -54,30 +54,21 @@ struct Index {
+     BVH_ALWAYS_INLINE bool is_inner() const { return !is_leaf(); }
+ 
+     BVH_ALWAYS_INLINE void set_first_id(size_t first_id) {
+-        *this = Index { first_id, prim_count() };
++        *this = make_leaf(first_id, prim_count());
+     }
+ 
+     BVH_ALWAYS_INLINE void set_prim_count(size_t prim_count) {
+-        *this = Index { first_id(), prim_count };
++        *this = make_leaf(first_id(), prim_count);
+     }
+ 
+     static BVH_ALWAYS_INLINE Index make_leaf(size_t first_prim, size_t prim_count) {
+         assert(prim_count != 0);
+-        return Index { first_prim, prim_count };
++        return Index { (static_cast<Type>(first_prim) << prim_count_bits) |
++                        (static_cast<Type>(prim_count) & max_prim_count) };
+     }
+ 
+     static BVH_ALWAYS_INLINE Index make_inner(size_t first_child) {
+-        return Index { first_child, 0 };
+-    }
+-
+-private:
+-    explicit Index(size_t first_id, size_t prim_count)
+-        : Index(
+-            (static_cast<Type>(first_id) << prim_count_bits) |
+-            (static_cast<Type>(prim_count) & max_prim_count))
+-    {
+-        assert(first_id   <= static_cast<size_t>(max_first_id));
+-        assert(prim_count <= static_cast<size_t>(max_prim_count));
++        return Index { static_cast<Type>(first_child) << prim_count_bits };
+     }
+ };
+ 

+ 4 - 2
packages/b/bvh/xmake.lua

@@ -1,5 +1,4 @@
 package("bvh")
 package("bvh")
-
     set_homepage("https://github.com/madmann91/bvh")
     set_homepage("https://github.com/madmann91/bvh")
     set_description("A modern C++ BVH construction and traversal library")
     set_description("A modern C++ BVH construction and traversal library")
     set_license("MIT")
     set_license("MIT")
@@ -7,13 +6,16 @@ package("bvh")
     add_urls("https://github.com/madmann91/bvh.git")
     add_urls("https://github.com/madmann91/bvh.git")
     add_versions("2023.6.30", "578b1e8035743d0a97fcac802de81622c54f28e3")
     add_versions("2023.6.30", "578b1e8035743d0a97fcac802de81622c54f28e3")
     add_versions("2024.7.8", "77a08cac234bae46abbb5e78c73e8f3c158051d0")
     add_versions("2024.7.8", "77a08cac234bae46abbb5e78c73e8f3c158051d0")
+    add_versions("2025.02.03", "fbdc59615112d471409515cd2ab826fcc3100fd7")
+    add_patches("2025.02.03", "patches/2025.02.03/fix-narrow.diff", "5df510bb0ac8b23b29e68fb69ad190b3cfae4d441d44a4f2ad5d63e7e0752a22")
 
 
     add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
     add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
     add_configs("c_api",  {description = "Builds the C API library wrapper", default = true, type = "boolean"})
     add_configs("c_api",  {description = "Builds the C API library wrapper", default = true, type = "boolean"})
 
 
-    if is_plat("bsd") then
+    if is_plat("linux", "bsd") then
         add_syslinks("pthread")
         add_syslinks("pthread")
     end
     end
+
     on_load(function (package)
     on_load(function (package)
         if not package:config("c_api") then
         if not package:config("c_api") then
             package:set("kind", "library", {headeronly = true})
             package:set("kind", "library", {headeronly = true})