From 5a12ebb2d07f04a060a5267016cbc625de94481e Mon Sep 17 00:00:00 2001 From: Mia Rolfe Date: Fri, 20 Feb 2026 18:40:50 +0000 Subject: [PATCH 1/2] Set KMP_BLOCKTIME to 0 --- build/premake5.lua | 270 +++++++++++++++++++++---------------------- lib/Core/Utility.cpp | 5 +- 2 files changed, 133 insertions(+), 142 deletions(-) diff --git a/build/premake5.lua b/build/premake5.lua index f78f563..186eb22 100644 --- a/build/premake5.lua +++ b/build/premake5.lua @@ -27,45 +27,6 @@ platforms { "x64", "ARM64" } defaultplatform "x64" -filter { "toolset:gcc or toolset:clang" } - buildoptions { - "-Werror", - "-Wredundant-decls", - "-Wcast-align", - "-Wno-sign-conversion", - "-Wdouble-promotion", - "-Wno-unused-parameter", - "-Wno-unused-function", - "-Wuninitialized", - "-pedantic", - "-fopenmp" - } - - linkoptions { - "-fopenmp" - } - -filter {} - -filter { "system:windows" } - defines { "_CRT_SECURE_NO_WARNINGS" } - -filter { "toolset:msc" } - buildoptions { - "/W4", - "/WX", - "/permissive-", - "/openmp", - "/MP", - } - - linkoptions { - "/openmp", - "/MP", - } - -filter {} - filter "configurations:Debug_*" defines { "DEBUG" } symbols "On" @@ -98,6 +59,35 @@ project(workspaceName) location "./" targetdir "../bin/%{cfg.buildcfg}" + filter { "system:windows" } + defines { "_CRT_SECURE_NO_WARNINGS" } + buildoptions { + -- "/W4", + -- "/WX", + "/permissive-", + "/openmp:llvm", + "/MP", + } + + filter { "system:linux" } + buildoptions { + "-Werror", + "-Wredundant-decls", + "-Wcast-align", + "-Wno-sign-conversion", + "-Wdouble-promotion", + "-Wno-unused-parameter", + "-Wno-unused-function", + "-Wuninitialized", + "-pedantic", + "-fopenmp" + } + linkoptions { + "-fopenmp" + } + + filter {} + files { path.getdirectory(os.getcwd()) .. "/external/stb/**.cpp", path.getdirectory(os.getcwd()) .. "/external/stb/**.h", @@ -106,110 +96,110 @@ project(workspaceName) path.getdirectory(os.getcwd()) .. "/include/**.h", } -filter { "configurations:*_GUI" } - files { - path.getdirectory(os.getcwd()) .. "/external/imgui/**.cpp", - path.getdirectory(os.getcwd()) .. "/external/imgui/**.h", - } - -filter {} + filter { "configurations:*_GUI" } + files { + path.getdirectory(os.getcwd()) .. "/external/imgui/**.cpp", + path.getdirectory(os.getcwd()) .. "/external/imgui/**.h", + } -filter { "files:**/external/**", "toolset:msc" } - disablewarnings { "4100", "4244", "4267", "4389", "4505" } + filter {} -filter { "files:**/external/**", "toolset:gcc or toolset:clang" } - buildoptions { "-w", "-Wno-error" } + filter { "files:**/external/**", "system:windows" } + disablewarnings { "4100", "4244", "4267", "4389", "4505" } -filter {} + filter { "files:**/external/**", "system:linux" } + buildoptions { "-w", "-Wno-error" } -externalincludedirs { - path.getdirectory(os.getcwd()) .. "/external", - path.getdirectory(os.getcwd()) .. "/lib", - path.getdirectory(os.getcwd()) .. "/lib/foundation", - path.getdirectory(os.getcwd()) .. "/lib/math", - path.getdirectory(os.getcwd()) .. "/lib/geometry", - path.getdirectory(os.getcwd()) .. "/lib/materials", - path.getdirectory(os.getcwd()) .. "/lib/raytracing", - path.getdirectory(os.getcwd()) .. "/lib/acceleration", - path.getdirectory(os.getcwd()) .. "/include", -} + filter {} -filter { "configurations:*_GUI" } externalincludedirs { - path.getdirectory(os.getcwd()) .. "/external/imgui/", - path.getdirectory(os.getcwd()) .. "/external/SDL3/include", - } - -filter {} - -filter { "system:windows", "platforms:x64", "configurations:*_GUI" } - libdirs { path.getdirectory(os.getcwd()) .. "/external/SDL3/lib/windows/x64" } - links { "SDL3" } - postbuildcommands { - '{COPYFILE} "%{wks.location}/external/SDL3/lib/windows/x64/SDL3.dll" "%{cfg.targetdir}"' - } - -filter { "system:windows", "platforms:ARM64", "configurations:*_GUI" } - libdirs { path.getdirectory(os.getcwd()) .. "/external/SDL3/lib/windows/arm64" } - links { "SDL3" } - postbuildcommands { - '{COPYFILE} "%{wks.location}/external/SDL3/lib/windows/arm64/SDL3.dll" "%{cfg.targetdir}"' - } - -filter { "system:linux", "configurations:*_GUI" } - links { "SDL3" } - -filter {} - -filter { "configurations:Debug_* or Release_*" } - files { - path.getdirectory(os.getcwd()) .. "/src/ART.cpp", - path.getdirectory(os.getcwd()) .. "/src/Common/**.cpp", - path.getdirectory(os.getcwd()) .. "/src/Common/**.h", - } - - externalincludedirs { - path.getdirectory(os.getcwd()) .. "/src", - path.getdirectory(os.getcwd()) .. "/src/Common", - } - -filter {} - -filter { "configurations:*_GUI" } - files { - path.getdirectory(os.getcwd()) .. "/src/GUI/**.cpp", - path.getdirectory(os.getcwd()) .. "/src/GUI/**.h", - } - - externalincludedirs { - path.getdirectory(os.getcwd()) .. "/src/GUI", - } - -filter {} - -filter { "configurations:*_Headless" } - files { - path.getdirectory(os.getcwd()) .. "/src/Headless/**.cpp", - path.getdirectory(os.getcwd()) .. "/src/Headless/**.h", - } - - externalincludedirs { - path.getdirectory(os.getcwd()) .. "/src/Headless", - } - -filter {} - -filter { "configurations:Test" } - files { - path.getdirectory(os.getcwd()) .. "/tests/**.cpp", - path.getdirectory(os.getcwd()) .. "/tests/**.h", - } - - externalincludedirs { - path.getdirectory(os.getcwd()) .. "/tests" - } - -filter {} - -cdialect "C17" -cppdialect "C++17" + path.getdirectory(os.getcwd()) .. "/external", + path.getdirectory(os.getcwd()) .. "/lib", + path.getdirectory(os.getcwd()) .. "/lib/foundation", + path.getdirectory(os.getcwd()) .. "/lib/math", + path.getdirectory(os.getcwd()) .. "/lib/geometry", + path.getdirectory(os.getcwd()) .. "/lib/materials", + path.getdirectory(os.getcwd()) .. "/lib/raytracing", + path.getdirectory(os.getcwd()) .. "/lib/acceleration", + path.getdirectory(os.getcwd()) .. "/include", + } + + filter { "configurations:*_GUI" } + externalincludedirs { + path.getdirectory(os.getcwd()) .. "/external/imgui/", + path.getdirectory(os.getcwd()) .. "/external/SDL3/include", + } + + filter {} + + filter { "system:windows", "platforms:x64", "configurations:*_GUI" } + libdirs { path.getdirectory(os.getcwd()) .. "/external/SDL3/lib/windows/x64" } + links { "SDL3" } + postbuildcommands { + '{COPYFILE} "%{wks.location}/external/SDL3/lib/windows/x64/SDL3.dll" "%{cfg.targetdir}"' + } + + filter { "system:windows", "platforms:ARM64", "configurations:*_GUI" } + libdirs { path.getdirectory(os.getcwd()) .. "/external/SDL3/lib/windows/arm64" } + links { "SDL3" } + postbuildcommands { + '{COPYFILE} "%{wks.location}/external/SDL3/lib/windows/arm64/SDL3.dll" "%{cfg.targetdir}"' + } + + filter { "system:linux", "configurations:*_GUI" } + links { "SDL3" } + + filter {} + + filter { "configurations:Debug_* or Release_*" } + files { + path.getdirectory(os.getcwd()) .. "/src/ART.cpp", + path.getdirectory(os.getcwd()) .. "/src/Common/**.cpp", + path.getdirectory(os.getcwd()) .. "/src/Common/**.h", + } + + externalincludedirs { + path.getdirectory(os.getcwd()) .. "/src", + path.getdirectory(os.getcwd()) .. "/src/Common", + } + + filter {} + + filter { "configurations:*_GUI" } + files { + path.getdirectory(os.getcwd()) .. "/src/GUI/**.cpp", + path.getdirectory(os.getcwd()) .. "/src/GUI/**.h", + } + + externalincludedirs { + path.getdirectory(os.getcwd()) .. "/src/GUI", + } + + filter {} + + filter { "configurations:*_Headless" } + files { + path.getdirectory(os.getcwd()) .. "/src/Headless/**.cpp", + path.getdirectory(os.getcwd()) .. "/src/Headless/**.h", + } + + externalincludedirs { + path.getdirectory(os.getcwd()) .. "/src/Headless", + } + + filter {} + + filter { "configurations:Test" } + files { + path.getdirectory(os.getcwd()) .. "/tests/**.cpp", + path.getdirectory(os.getcwd()) .. "/tests/**.h", + } + + externalincludedirs { + path.getdirectory(os.getcwd()) .. "/tests" + } + + filter {} + + cdialect "C17" + cppdialect "C++17" \ No newline at end of file diff --git a/lib/Core/Utility.cpp b/lib/Core/Utility.cpp index c3b48c5..d6c3af5 100644 --- a/lib/Core/Utility.cpp +++ b/lib/Core/Utility.cpp @@ -50,14 +50,15 @@ double RenderStats::TotalTimeMilliseconds() const void Init() { #if defined(_MSC_VER) + kmp_set_blocktime(0); + std::size_t num_openmp_threads = std::thread::hardware_concurrency(); + if (num_openmp_threads <= 0) { num_openmp_threads = 1; } omp_set_num_threads(static_cast(num_openmp_threads)); - - Logger::Get().LogInfo("Using " + std::to_string(num_openmp_threads) + " threads for render"); #endif // defined(_MSC_VER) } From 2ca18ba5672cf078c98418c12b160bc464509adc Mon Sep 17 00:00:00 2001 From: Mia Rolfe Date: Wed, 18 Mar 2026 18:06:55 +0000 Subject: [PATCH 2/2] Include header --- lib/Core/ArenaAllocator.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Core/ArenaAllocator.h b/lib/Core/ArenaAllocator.h index 463659b..e41f5c4 100644 --- a/lib/Core/ArenaAllocator.h +++ b/lib/Core/ArenaAllocator.h @@ -3,6 +3,7 @@ #include #include +#include #include #include