From 96dd7384be927e0c7f7fb67480d28407aaa43d8e Mon Sep 17 00:00:00 2001 From: Eddy Jansson Date: Sat, 2 Nov 2024 21:49:39 +0100 Subject: [PATCH 1/4] Remove explicit casts. They generate type-punning warnings on GCC 14.2 Rename second `N` which is shadowed. --- tiny_bvh_fenster.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tiny_bvh_fenster.cpp b/tiny_bvh_fenster.cpp index 7cd69c1..b6a36bb 100644 --- a/tiny_bvh_fenster.cpp +++ b/tiny_bvh_fenster.cpp @@ -69,13 +69,13 @@ void Tick( uint32_t* buf ) for (int s = 0; s < 16; s++, i++) if (rays[i].hit.t < 1000) { int primIdx = rays[i].hit.prim; - bvhvec3 v0 = *(bvhvec3*)&triangles[primIdx * 3 + 0]; - bvhvec3 v1 = *(bvhvec3*)&triangles[primIdx * 3 + 1]; - bvhvec3 v2 = *(bvhvec3*)&triangles[primIdx * 3 + 2]; - bvhvec3 N = normalize( cross( v1 - v0, v2 - v0 ) ); - avg += fabs( dot( N, normalize( bvhvec3( 1, 2, 3 ) ) ) ); + bvhvec3 v0 = triangles[primIdx * 3 + 0]; + bvhvec3 v1 = triangles[primIdx * 3 + 1]; + bvhvec3 v2 = triangles[primIdx * 3 + 2]; + bvhvec3 UN = normalize( cross( v1 - v0, v2 - v0 ) ); + avg += fabs( dot( UN, normalize( bvhvec3( 1, 2, 3 ) ) ) ); } int c = (int)(15.9f * avg); buf[x + y * SCRWIDTH] = c + (c << 8) + (c << 16); } -} \ No newline at end of file +} From bed24c015de31fd08aec1af380773681c6c68ccf Mon Sep 17 00:00:00 2001 From: Linghui Zeng Date: Sun, 3 Nov 2024 20:26:22 +0800 Subject: [PATCH 2/4] Add compilation command for macOS --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e0c0f57..f8fe4a6 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ The cross-platform fenster-based single-source bitmap renderer can be compiled w ````g++ -std=c++20 -mavx -mwindows -O3 tiny_bvh_fenster.cpp -o tiny_bvh_fenster```` (on windows) +```g++ -std=c++20 -mavx -O3 -framework Cocoa tiny_bvh_fenster.cpp -o tiny_bvh_fenster``` (on macOS) + # Version The current version of the library is a 'prototype'; please expect changes to the interface. Once the interface has settled, more functionality will follow. Plans: * Spatial Splits (SBVH) From a697b6706568c99f11381d8a4984879e82ea60de Mon Sep 17 00:00:00 2001 From: Jacco Bikker Date: Sun, 3 Nov 2024 19:56:30 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index f8fe4a6..ff50108 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ The cross-platform fenster-based single-source bitmap renderer can be compiled w ```g++ -std=c++20 -mavx -O3 -framework Cocoa tiny_bvh_fenster.cpp -o tiny_bvh_fenster``` (on macOS) +The performance measurements use OpenMP and can be compiled with: + +````g++ -std=c++20 -mavx -Wall -fopenmp tiny_bvh_speedtest.cpp -o tiny_bvh_speedtest```` + # Version The current version of the library is a 'prototype'; please expect changes to the interface. Once the interface has settled, more functionality will follow. Plans: * Spatial Splits (SBVH) From b7e7967c50462c635ff79eee96b9efdcbb228ef2 Mon Sep 17 00:00:00 2001 From: Jacco Bikker Date: Sun, 3 Nov 2024 19:56:44 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff50108..ae63269 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The cross-platform fenster-based single-source bitmap renderer can be compiled w The performance measurements use OpenMP and can be compiled with: -````g++ -std=c++20 -mavx -Wall -fopenmp tiny_bvh_speedtest.cpp -o tiny_bvh_speedtest```` +````g++ -std=c++20 -mavx -fopenmp tiny_bvh_speedtest.cpp -o tiny_bvh_speedtest```` # Version The current version of the library is a 'prototype'; please expect changes to the interface. Once the interface has settled, more functionality will follow. Plans: