From 3db0f4abb81023f90040a49ce71f49148d4adf19 Mon Sep 17 00:00:00 2001 From: Fletterio Date: Tue, 14 Apr 2026 17:32:34 -0300 Subject: [PATCH 1/7] dd the option to run opt passes at the end of default pass --- include/nbl/asset/utils/IShaderCompiler.h | 1 + include/nbl/video/ILogicalDevice.h | 1 + src/nbl/asset/utils/CHLSLCompiler.cpp | 4 ++-- src/nbl/video/ILogicalDevice.cpp | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/nbl/asset/utils/IShaderCompiler.h b/include/nbl/asset/utils/IShaderCompiler.h index 05116b8d52..3ab6feafc2 100644 --- a/include/nbl/asset/utils/IShaderCompiler.h +++ b/include/nbl/asset/utils/IShaderCompiler.h @@ -261,6 +261,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted SPreprocessorOptions preprocessorOptions = {}; CCache* readCache = nullptr; CCache* writeCache = nullptr; + bool optimizerIsExtraPasses = false; // Instead of disabling the default opt passes, run the provided optimization passes at the end }; class CCache final : public IReferenceCounted diff --git a/include/nbl/video/ILogicalDevice.h b/include/nbl/video/ILogicalDevice.h index 756b417c79..234f5575f3 100644 --- a/include/nbl/video/ILogicalDevice.h +++ b/include/nbl/video/ILogicalDevice.h @@ -833,6 +833,7 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe std::span extraDefines = {}; hlsl::ShaderStage stage = hlsl::ShaderStage::ESS_ALL_OR_LIBRARY; core::bitflag debugInfoFlags = asset::IShaderCompiler::E_DEBUG_INFO_FLAGS::EDIF_NONE; + bool optimizerIsExtraPasses = false; // Instead of disabling the default opt passes, run the provided optimization passes at the end }; core::smart_refctd_ptr compileShader(const SShaderCreationParameters& creationParams); diff --git a/src/nbl/asset/utils/CHLSLCompiler.cpp b/src/nbl/asset/utils/CHLSLCompiler.cpp index 6fec81c8cc..dd506afc54 100644 --- a/src/nbl/asset/utils/CHLSLCompiler.cpp +++ b/src/nbl/asset/utils/CHLSLCompiler.cpp @@ -584,13 +584,13 @@ core::smart_refctd_ptr CHLSLCompiler::compileToSPIRV_impl(const std::st // TODO: add entry point to `CHLSLCompiler::SOptions` and handle it properly in `dxc_compile_flags.empty()` arguments.push_back(L"main"); } - // If a custom SPIR-V optimizer is specified, use that instead of DXC's spirv-opt. + // If a custom SPIR-V optimizer is specified and set to replace default optimization passes, use that instead of DXC's spirv-opt. // This is how we can get more optimizer options. // // Optimization is also delegated to SPIRV-Tools. Right now there are no difference between // optimization levels greater than zero; they will all invoke the same optimization recipe. // https://github.com/Microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#optimization - if (hlslOptions.spirvOptimizer) + if (hlslOptions.spirvOptimizer && !hlslOptions.optimizerIsExtraPasses) arguments.push_back(L"-O0"); } // diff --git a/src/nbl/video/ILogicalDevice.cpp b/src/nbl/video/ILogicalDevice.cpp index 1752717879..466a0b300f 100644 --- a/src/nbl/video/ILogicalDevice.cpp +++ b/src/nbl/video/ILogicalDevice.cpp @@ -362,6 +362,7 @@ core::smart_refctd_ptr ILogicalDevice::compileShader(const SShad commonCompileOptions.stage = creationParams.stage; commonCompileOptions.debugInfoFlags = creationParams.debugInfoFlags; commonCompileOptions.spirvOptimizer = creationParams.optimizer; + commonCompileOptions.optimizerIsExtraPasses = creationParams.optimizerIsExtraPasses; commonCompileOptions.preprocessorOptions.targetSpirvVersion = m_physicalDevice->getLimits().spirvVersion; commonCompileOptions.readCache = creationParams.readCache; From 4065f210509eb1c6ff19be83ed3d29c92b6c9659 Mon Sep 17 00:00:00 2001 From: Fletterio Date: Tue, 14 Apr 2026 20:29:40 -0300 Subject: [PATCH 2/7] Give the compiler choices to spit out preprocessed and spv files, useful for debug --- include/nbl/asset/utils/IShaderCompiler.h | 2 + include/nbl/video/ILogicalDevice.h | 2 + src/nbl/asset/utils/CHLSLCompiler.cpp | 48 +++++++++++++++++++++++ src/nbl/video/ILogicalDevice.cpp | 3 ++ 4 files changed, 55 insertions(+) diff --git a/include/nbl/asset/utils/IShaderCompiler.h b/include/nbl/asset/utils/IShaderCompiler.h index 3ab6feafc2..526a9dd80e 100644 --- a/include/nbl/asset/utils/IShaderCompiler.h +++ b/include/nbl/asset/utils/IShaderCompiler.h @@ -262,6 +262,8 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted CCache* readCache = nullptr; CCache* writeCache = nullptr; bool optimizerIsExtraPasses = false; // Instead of disabling the default opt passes, run the provided optimization passes at the end + std::string preprocessedOutputPath = ""; + std::string spvOutputPath = ""; }; class CCache final : public IReferenceCounted diff --git a/include/nbl/video/ILogicalDevice.h b/include/nbl/video/ILogicalDevice.h index 234f5575f3..742cb506c6 100644 --- a/include/nbl/video/ILogicalDevice.h +++ b/include/nbl/video/ILogicalDevice.h @@ -834,6 +834,8 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe hlsl::ShaderStage stage = hlsl::ShaderStage::ESS_ALL_OR_LIBRARY; core::bitflag debugInfoFlags = asset::IShaderCompiler::E_DEBUG_INFO_FLAGS::EDIF_NONE; bool optimizerIsExtraPasses = false; // Instead of disabling the default opt passes, run the provided optimization passes at the end + std::string preprocessedOutputPath = ""; + std::string spvOutputPath = ""; }; core::smart_refctd_ptr compileShader(const SShaderCreationParameters& creationParams); diff --git a/src/nbl/asset/utils/CHLSLCompiler.cpp b/src/nbl/asset/utils/CHLSLCompiler.cpp index dd506afc54..661edd18b8 100644 --- a/src/nbl/asset/utils/CHLSLCompiler.cpp +++ b/src/nbl/asset/utils/CHLSLCompiler.cpp @@ -546,6 +546,30 @@ core::smart_refctd_ptr CHLSLCompiler::compileToSPIRV_impl(const std::st auto newCode = preprocessShader(std::string(code), stage, hlslOptions.preprocessorOptions, dxc_compile_flags, dependencies); if (newCode.empty()) return nullptr; + if (!options.preprocessedOutputPath.empty()) + { + core::smart_refctd_ptr preprocessedFile; + + system::ISystem::future_t> future; + m_system->deleteFile(options.preprocessedOutputPath); + m_system->createFile(future, options.preprocessedOutputPath, system::IFile::ECF_WRITE); + if (future.wait()) + { + future.acquire().move_into(preprocessedFile); + if (preprocessedFile) + { + system::IFile::success_t succ; + preprocessedFile->write(succ, newCode.data(), 0, newCode.size()); + if (!succ) + logger.log("Failed Writing To Preprocessed Output File.", nbl::system::ILogger::ELL_ERROR); + } + else + logger.log("Failed Creating Preprocessed Output File.", nbl::system::ILogger::ELL_ERROR); + } + else + logger.log("Failed Creating Preprocessed Output File.", nbl::system::ILogger::ELL_ERROR); + } + // Suffix is the shader model version std::wstring targetProfile(SHADER_MODEL_PROFILE); @@ -651,6 +675,30 @@ core::smart_refctd_ptr CHLSLCompiler::compileToSPIRV_impl(const std::st if (hlslOptions.spirvOptimizer) outSpirv = hlslOptions.spirvOptimizer->optimize(outSpirv.get(), logger); + if (!options.spvOutputPath.empty()) + { + core::smart_refctd_ptr spvFile; + + system::ISystem::future_t> future; + m_system->deleteFile(options.spvOutputPath); + m_system->createFile(future, options.spvOutputPath, system::IFile::ECF_WRITE); + if (future.wait()) + { + future.acquire().move_into(spvFile); + if (spvFile) + { + system::IFile::success_t succ; + spvFile->write(succ, outSpirv->getPointer(), 0, outSpirv->getSize()); + if (!succ) + logger.log("Failed Writing To SPIR-V Output File.", nbl::system::ILogger::ELL_ERROR); + } + else + logger.log("Failed Creating SPIR-V Output File.", nbl::system::ILogger::ELL_ERROR); + } + else + logger.log("Failed Creating SPIR-V Output File.", nbl::system::ILogger::ELL_ERROR); + } + return core::make_smart_refctd_ptr(std::move(outSpirv), IShader::E_CONTENT_TYPE::ECT_SPIRV, hlslOptions.preprocessorOptions.sourceIdentifier.data()); } diff --git a/src/nbl/video/ILogicalDevice.cpp b/src/nbl/video/ILogicalDevice.cpp index 466a0b300f..bee6381f7a 100644 --- a/src/nbl/video/ILogicalDevice.cpp +++ b/src/nbl/video/ILogicalDevice.cpp @@ -368,6 +368,9 @@ core::smart_refctd_ptr ILogicalDevice::compileShader(const SShad commonCompileOptions.readCache = creationParams.readCache; commonCompileOptions.writeCache = creationParams.writeCache; + commonCompileOptions.preprocessedOutputPath = creationParams.preprocessedOutputPath; + commonCompileOptions.spvOutputPath = creationParams.spvOutputPath; + if (sourceContent==asset::IShader::E_CONTENT_TYPE::ECT_HLSL) { // TODO: add specific HLSLCompiler::SOption params From ba922ed2a8b53508554fe1ab9fcc549eb8c33ab9 Mon Sep 17 00:00:00 2001 From: Fletterio Date: Wed, 15 Apr 2026 15:02:06 -0300 Subject: [PATCH 3/7] ex pointer update for merge --- examples_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples_tests b/examples_tests index 1345dae922..21133becb3 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit 1345dae9220598734e73ed425225b49dc3c3cfe6 +Subproject commit 21133becb3e24e9c60dc329ca96d5be07adc89d4 From c86736526d1efb13260b3c907d2318ccf272b234 Mon Sep 17 00:00:00 2001 From: Fletterio Date: Thu, 16 Apr 2026 21:32:30 -0300 Subject: [PATCH 4/7] Clean up optimizer improvement and preprocessed/spirv shader storage, add new compiler option to shader cache entries --- include/nbl/asset/utils/IShaderCompiler.h | 10 +++- src/nbl/asset/utils/CHLSLCompiler.cpp | 64 ++++++++++------------- src/nbl/asset/utils/IShaderCompiler.cpp | 54 +++++++++++++++++++ src/nbl/system/ISystem.cpp | 2 +- 4 files changed, 93 insertions(+), 37 deletions(-) diff --git a/include/nbl/asset/utils/IShaderCompiler.h b/include/nbl/asset/utils/IShaderCompiler.h index 526a9dd80e..f90aec8fdd 100644 --- a/include/nbl/asset/utils/IShaderCompiler.h +++ b/include/nbl/asset/utils/IShaderCompiler.h @@ -245,6 +245,9 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted @includeFinder Optional parameter; if not nullptr, it will resolve the includes in the code @maxSelfInclusionCount used only when includeFinder is not nullptr @extraDefines adds extra defines to the shader before compilation + @optimizerIsExtraPasses Instead of entirely replacing the default optimization passes, run the provided passes after the default ones + @preprocessedOutputPath If not empty, the preprocessed shader will be saved to this path + @spvOutputPath If not empty, the compiled SPIR-V binary will be saved to this path */ struct SCompilerOptions { @@ -364,7 +367,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted public: inline bool operator==(const SCompilerArgs& other) const { bool retVal = true; - if (stage != other.stage || targetSpirvVersion != other.targetSpirvVersion || debugInfoFlags != other.debugInfoFlags || preprocessorArgs != other.preprocessorArgs) retVal = false; + if (stage != other.stage || targetSpirvVersion != other.targetSpirvVersion || debugInfoFlags != other.debugInfoFlags || preprocessorArgs != other.preprocessorArgs || optimizerIsExtraPasses != other.optimizerIsExtraPasses) retVal = false; if (optimizerPasses.size() != other.optimizerPasses.size()) retVal = false; for (auto passesIt = optimizerPasses.begin(), otherPassesIt = other.optimizerPasses.begin(); passesIt != optimizerPasses.end(); passesIt++, otherPassesIt++) { if (*passesIt != *otherPassesIt) { @@ -392,6 +395,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted // Only SEntry should instantiate this struct SCompilerArgs(const SCompilerOptions& options) : stage(options.stage), targetSpirvVersion(options.preprocessorOptions.targetSpirvVersion), debugInfoFlags(options.debugInfoFlags), preprocessorArgs(options.preprocessorOptions) + , optimizerIsExtraPasses(options.optimizerIsExtraPasses) { if (options.spirvOptimizer) { for (auto pass : options.spirvOptimizer->getPasses()) @@ -402,6 +406,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted IShader::E_SHADER_STAGE stage; E_SPIRV_VERSION targetSpirvVersion; std::vector optimizerPasses; + bool optimizerIsExtraPasses; core::bitflag debugInfoFlags; SPreprocessorArgs preprocessorArgs; }; @@ -461,6 +466,9 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted bool setContent(const asset::ICPUBuffer* uncompressedSpirvBuffer); + IShader::E_SHADER_STAGE getShaderStage() const { return compilerArgs.stage; } + SPreprocessorArgs getPreprocessorArgs() const { return compilerArgs.preprocessorArgs; } + core::smart_refctd_ptr decompressShader() const; // TODO: make some of these private diff --git a/src/nbl/asset/utils/CHLSLCompiler.cpp b/src/nbl/asset/utils/CHLSLCompiler.cpp index 661edd18b8..e0798d5340 100644 --- a/src/nbl/asset/utils/CHLSLCompiler.cpp +++ b/src/nbl/asset/utils/CHLSLCompiler.cpp @@ -546,29 +546,44 @@ core::smart_refctd_ptr CHLSLCompiler::compileToSPIRV_impl(const std::st auto newCode = preprocessShader(std::string(code), stage, hlslOptions.preprocessorOptions, dxc_compile_flags, dependencies); if (newCode.empty()) return nullptr; - if (!options.preprocessedOutputPath.empty()) + auto saveToFile = [&](const std::string& filePath, const void* buffer, size_t size, const char* loggerName) { - core::smart_refctd_ptr preprocessedFile; - + core::smart_refctd_ptr saveFile; + system::ISystem::future_t> future; - m_system->deleteFile(options.preprocessedOutputPath); - m_system->createFile(future, options.preprocessedOutputPath, system::IFile::ECF_WRITE); + // Ensure it doesn't exist + m_system->deleteFile(filePath + "_temp"); + m_system->createFile(future, filePath + "_temp", system::IFile::ECF_WRITE); if (future.wait()) { - future.acquire().move_into(preprocessedFile); - if (preprocessedFile) + future.acquire().move_into(saveFile); + if (saveFile) { system::IFile::success_t succ; - preprocessedFile->write(succ, newCode.data(), 0, newCode.size()); + saveFile->write(succ, buffer, 0, size); if (!succ) - logger.log("Failed Writing To Preprocessed Output File.", nbl::system::ILogger::ELL_ERROR); + { + logger.log(std::string("Failed Writing To Temp ") + loggerName + " File.", nbl::system::ILogger::ELL_ERROR); + return; + } + m_system->deleteFile(filePath); + auto renameResult = m_system->moveFileOrDirectory(filePath + "_temp", filePath); + if (renameResult) + { + logger.log(std::string("Failed Saving ") + loggerName + " File. Check it's not open.", nbl::system::ILogger::ELL_ERROR); + // Clean up + m_system->deleteFile(filePath + "_temp"); + } } else - logger.log("Failed Creating Preprocessed Output File.", nbl::system::ILogger::ELL_ERROR); + logger.log(std::string("Failed Creating ") + loggerName + " File.", nbl::system::ILogger::ELL_ERROR); } else - logger.log("Failed Creating Preprocessed Output File.", nbl::system::ILogger::ELL_ERROR); - } + logger.log(std::string("Failed Creating ") + loggerName + " File.", nbl::system::ILogger::ELL_ERROR); + }; + + if (!options.preprocessedOutputPath.empty()) + saveToFile(options.preprocessedOutputPath, newCode.data(), newCode.size(), "Preprocessed Output"); // Suffix is the shader model version std::wstring targetProfile(SHADER_MODEL_PROFILE); @@ -675,29 +690,8 @@ core::smart_refctd_ptr CHLSLCompiler::compileToSPIRV_impl(const std::st if (hlslOptions.spirvOptimizer) outSpirv = hlslOptions.spirvOptimizer->optimize(outSpirv.get(), logger); - if (!options.spvOutputPath.empty()) - { - core::smart_refctd_ptr spvFile; - - system::ISystem::future_t> future; - m_system->deleteFile(options.spvOutputPath); - m_system->createFile(future, options.spvOutputPath, system::IFile::ECF_WRITE); - if (future.wait()) - { - future.acquire().move_into(spvFile); - if (spvFile) - { - system::IFile::success_t succ; - spvFile->write(succ, outSpirv->getPointer(), 0, outSpirv->getSize()); - if (!succ) - logger.log("Failed Writing To SPIR-V Output File.", nbl::system::ILogger::ELL_ERROR); - } - else - logger.log("Failed Creating SPIR-V Output File.", nbl::system::ILogger::ELL_ERROR); - } - else - logger.log("Failed Creating SPIR-V Output File.", nbl::system::ILogger::ELL_ERROR); - } + if (outSpirv && !options.spvOutputPath.empty()) + saveToFile(options.spvOutputPath, outSpirv->getPointer(), outSpirv->getSize(), "SPIR-V Output"); return core::make_smart_refctd_ptr(std::move(outSpirv), IShader::E_CONTENT_TYPE::ECT_SPIRV, hlslOptions.preprocessorOptions.sourceIdentifier.data()); } diff --git a/src/nbl/asset/utils/IShaderCompiler.cpp b/src/nbl/asset/utils/IShaderCompiler.cpp index d180d83a5c..d1dbb0fd1f 100644 --- a/src/nbl/asset/utils/IShaderCompiler.cpp +++ b/src/nbl/asset/utils/IShaderCompiler.cpp @@ -111,6 +111,7 @@ namespace nbl::system::json { { "shaderStage", shaderStage }, { "spirvVersion", spirvVersion }, { "optimizerPasses", p.optimizerPasses }, + { "optimizerIsExtraPasses", p.optimizerIsExtraPasses }, { "debugFlags", debugFlags }, { "preprocessorArgs", p.preprocessorArgs }, }; @@ -122,6 +123,7 @@ namespace nbl::system::json { j.at("shaderStage").get_to(shaderStage); j.at("spirvVersion").get_to(spirvVersion); j.at("optimizerPasses").get_to(p.optimizerPasses); + j.at("optimizerIsExtraPasses").get_to(p.optimizerIsExtraPasses); j.at("debugFlags").get_to(debugFlags); j.at("preprocessorArgs").get_to(p.preprocessorArgs); p.stage = static_cast(shaderStage); @@ -502,6 +504,42 @@ core::smart_refctd_ptr nbl::asset::IShaderCompiler::compileToSPIRV(cons return IShaderCompiler::writeDepfile(params, dependencies, options.preprocessorOptions.includeFinder, options.preprocessorOptions.logger); }; + auto saveToFile = [&](const std::string& filePath, const void* buffer, size_t size, const char* loggerName) + { + core::smart_refctd_ptr saveFile; + + system::ISystem::future_t> future; + // Ensure it doesn't exist + m_system->deleteFile(filePath + "_temp"); + m_system->createFile(future, filePath + "_temp", system::IFile::ECF_WRITE); + if (future.wait()) + { + future.acquire().move_into(saveFile); + if (saveFile) + { + system::IFile::success_t succ; + saveFile->write(succ, buffer, 0, size); + if (!succ) + { + options.preprocessorOptions.logger.log(std::string("Failed Writing To Temp ") + loggerName + " File.", nbl::system::ILogger::ELL_ERROR); + return; + } + m_system->deleteFile(filePath); + auto renameResult = m_system->moveFileOrDirectory(filePath + "_temp", filePath); + if (renameResult) + { + options.preprocessorOptions.logger.log(std::string("Failed Saving ") + loggerName + " File. Check it's not open.", nbl::system::ILogger::ELL_ERROR); + // Clean up + m_system->deleteFile(filePath + "_temp"); + } + } + else + options.preprocessorOptions.logger.log(std::string("Failed Creating ") + loggerName + " File.", nbl::system::ILogger::ELL_ERROR); + } + else + options.preprocessorOptions.logger.log(std::string("Failed Creating ") + loggerName + " File.", nbl::system::ILogger::ELL_ERROR); + }; + CCache::SEntry entry; if (options.readCache || options.writeCache) entry = CCache::SEntry(code, options); @@ -519,6 +557,22 @@ core::smart_refctd_ptr nbl::asset::IShaderCompiler::compileToSPIRV(cons auto shader = found->decompressShader(); if (depfileEnabled && !writeDepfileFromDependencies(found->dependencies)) return nullptr; + if (!options.spvOutputPath.empty()) + saveToFile(options.spvOutputPath, shader->getContent()->getPointer(), shader->getContent()->getSize(), "SPIR-V"); + // Entry doesn't store preprocessed shader, so preprocess it + if (!options.preprocessedOutputPath.empty()) + { + // copy shader contents + std::string shaderContents = found->mainFileContents; + auto stage = options.stage; + // Create a copy, cache hit means dependencies haven't changed but there is no function that takes a const pointer. This is meant for debug anyway. + auto deps = found->dependencies; + auto preprocessedShader = preprocessShader(std::move(shaderContents), stage, options.preprocessorOptions, &deps); + if (preprocessedShader.empty()) + options.preprocessorOptions.logger.log("Failed to preprocess shader for output.", nbl::system::ILogger::ELL_ERROR); + else + saveToFile(options.preprocessedOutputPath, preprocessedShader.data(), preprocessedShader.size(), "Preprocessed Shader"); + } return shader; } } diff --git a/src/nbl/system/ISystem.cpp b/src/nbl/system/ISystem.cpp index 079a861bfd..d9c939be1a 100644 --- a/src/nbl/system/ISystem.cpp +++ b/src/nbl/system/ISystem.cpp @@ -125,7 +125,7 @@ bool ISystem::deleteDirectory(const system::path& p) bool nbl::system::ISystem::deleteFile(const system::path& p) { if (std::filesystem::exists(p) && !std::filesystem::is_directory(p)) - return std::filesystem::remove(p); + return std::filesystem::remove(p); else return false; } From cb3df7b12cddb695bc2da2edc231689bc42a774b Mon Sep 17 00:00:00 2001 From: Fletterio Date: Thu, 16 Apr 2026 21:32:54 -0300 Subject: [PATCH 5/7] Update shader cache version --- include/nbl/asset/utils/IShaderCompiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nbl/asset/utils/IShaderCompiler.h b/include/nbl/asset/utils/IShaderCompiler.h index f90aec8fdd..1c369cf9b0 100644 --- a/include/nbl/asset/utils/IShaderCompiler.h +++ b/include/nbl/asset/utils/IShaderCompiler.h @@ -275,7 +275,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted public: // Used to check compatibility of Caches before reading - constexpr static inline std::string_view VERSION = "1.1.0"; + constexpr static inline std::string_view VERSION = "1.1.1"; static auto const SHADER_BUFFER_SIZE_BYTES = sizeof(uint64_t) / sizeof(uint8_t); // It's obviously 8 From cae12e26c7345cc3d1bbc20946c53f790f74bff9 Mon Sep 17 00:00:00 2001 From: Fletterio Date: Mon, 20 Apr 2026 11:20:31 -0300 Subject: [PATCH 6/7] Drop temp file handle before rename --- src/nbl/asset/utils/CHLSLCompiler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nbl/asset/utils/CHLSLCompiler.cpp b/src/nbl/asset/utils/CHLSLCompiler.cpp index e0798d5340..c378048180 100644 --- a/src/nbl/asset/utils/CHLSLCompiler.cpp +++ b/src/nbl/asset/utils/CHLSLCompiler.cpp @@ -566,7 +566,8 @@ core::smart_refctd_ptr CHLSLCompiler::compileToSPIRV_impl(const std::st logger.log(std::string("Failed Writing To Temp ") + loggerName + " File.", nbl::system::ILogger::ELL_ERROR); return; } - m_system->deleteFile(filePath); + saveFile = nullptr; // drop handle first + m_system->deleteFile(filePath); // safe to delete + rename auto renameResult = m_system->moveFileOrDirectory(filePath + "_temp", filePath); if (renameResult) { From ff8aff37f44ffebf0a90b1c4a4dd094077702bdd Mon Sep 17 00:00:00 2001 From: Fletterio Date: Mon, 20 Apr 2026 11:21:09 -0300 Subject: [PATCH 7/7] Change examples pointer --- examples_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples_tests b/examples_tests index 21133becb3..a3b41ac8dc 160000 --- a/examples_tests +++ b/examples_tests @@ -1 +1 @@ -Subproject commit 21133becb3e24e9c60dc329ca96d5be07adc89d4 +Subproject commit a3b41ac8dc2b37bb86dff574d783a90e0cdb3009