From c4f1b0da565caaaab1cf095b97e885adbc68f76f Mon Sep 17 00:00:00 2001 From: Jacco Bikker Date: Fri, 15 Nov 2024 17:28:48 +0100 Subject: [PATCH] Small bugfix. --- tiny_bvh.h | 1 - tiny_bvh_speedtest.cpp | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tiny_bvh.h b/tiny_bvh.h index 7926eae..18eb9b4 100644 --- a/tiny_bvh.h +++ b/tiny_bvh.h @@ -1527,7 +1527,6 @@ void BVH::Convert( BVHLayout from, BVHLayout to, const bool deleteOriginal ) // For now all other conversions are invalid. assert( false ); } - rebuildable = false; // hard to guarantee safe rebuilds after a layout conversion. } int BVH::NodeCount( BVHLayout layout ) const diff --git a/tiny_bvh_speedtest.cpp b/tiny_bvh_speedtest.cpp index e94235d..eb2afd2 100644 --- a/tiny_bvh_speedtest.cpp +++ b/tiny_bvh_speedtest.cpp @@ -382,19 +382,15 @@ int main() // trace all rays three times to estimate average performance // - single core version, alternative bvh layout printf( "Optimizing BVH, regular... " ); - if (bvh.refittable) + t.reset(); + if (!bvh.refittable) { - printf( "Currently can't optimize SBVH.\n" ); + bvh.Optimize( 1000000 ); // optimize the raw SBVH } else { - t.reset(); - bvh.Optimize( 1000000 ); - printf( "done (%.2fs). New: %i nodes, SAH=%.2f\n", t.elapsed(), bvh.NodeCount( BVH::WALD_32BYTE ), bvh.SAHCost() ); - printf( "Optimizing BVH, fullsplit... " ); - t.reset(); bvh.buildFlag = BVH::FULLSPLIT; - bvh.Build( triangles, verts / 3 ); + bvh.Build( triangles, verts / 3 ); // rebuild with full splitting. bvh.Optimize( 1000000 ); bvh.MergeLeafs(); printf( "done (%.2fs). New: %i nodes, SAH=%.2f\n", t.elapsed(), bvh.NodeCount( BVH::WALD_32BYTE ), bvh.SAHCost() );