22// This file is part of the "Nabla Engine".
33// For conditions of distribution and use, see copyright notice in nabla.h
44#include " nbl/asset/utils/IShaderCompiler.h"
5- #include " includeResolutionCommon.h"
65#include " nbl/asset/utils/shadercUtils.h"
76
87#include < sstream>
@@ -605,49 +604,16 @@ auto IShaderCompiler::CFileSystemIncludeLoader::getInclude(const system::path& s
605604{
606605 system::path path = (searchPath / includeName).lexically_normal ();
607606
608- const auto cacheKey = path.generic_string ();
609- if (!cacheKey.empty ())
610- {
611- std::lock_guard<std::mutex> lock (m_cacheMutex);
612- const auto found = m_cache.find (cacheKey);
613- if (found != m_cache.end ())
614- {
615- if (needHash && found->second .hash == core::blake3_hash_t {})
616- {
617- core::blake3_hasher hasher;
618- hasher.update (reinterpret_cast <uint8_t *>(found->second .contents .data ()), found->second .contents .size () * (sizeof (char ) / sizeof (uint8_t )));
619- found->second .hash = static_cast <core::blake3_hash_t >(hasher);
620- }
621- return found->second ;
622- }
623- if (m_missingCache.contains (cacheKey))
624- return {};
625- }
626-
627607 core::smart_refctd_ptr<system::IFile> f;
628608 {
629609 system::ISystem::future_t <core::smart_refctd_ptr<system::IFile>> future;
630610 m_system->createFile (future, path.c_str (), system::IFile::ECF_READ);
631611 if (!future.wait ())
632- {
633- if (!cacheKey.empty ())
634- {
635- std::lock_guard<std::mutex> lock (m_cacheMutex);
636- m_missingCache.insert (cacheKey);
637- }
638612 return {};
639- }
640613 future.acquire ().move_into (f);
641614 }
642615 if (!f)
643- {
644- if (!cacheKey.empty ())
645- {
646- std::lock_guard<std::mutex> lock (m_cacheMutex);
647- m_missingCache.insert (cacheKey);
648- }
649616 return {};
650- }
651617 const size_t size = f->getSize ();
652618
653619 std::string contents (size, ' \0 ' );
@@ -664,13 +630,6 @@ auto IShaderCompiler::CFileSystemIncludeLoader::getInclude(const system::path& s
664630 retVal.hash = static_cast <core::blake3_hash_t >(hasher);
665631 }
666632
667- if (!cacheKey.empty ())
668- {
669- std::lock_guard<std::mutex> lock (m_cacheMutex);
670- m_missingCache.erase (cacheKey);
671- m_cache.insert_or_assign (cacheKey, retVal);
672- }
673-
674633 return retVal;
675634}
676635
@@ -731,22 +690,9 @@ auto IShaderCompiler::CIncludeFinder::getIncludeRelative(const system::path& req
731690{
732691 const auto lookupName = normalizeIncludeLookupName (includeName);
733692 IShaderCompiler::IIncludeLoader::found_t retVal;
734- if (asset::detail::isGloballyResolvedIncludeName (lookupName))
735- {
736- if (auto contents = tryIncludeGenerators (lookupName))
737- retVal = std::move (contents);
738- else if (auto contents = trySearchPaths (lookupName, needHash))
739- retVal = std::move (contents);
740- else retVal = m_defaultFileSystemLoader->getInclude (requestingSourceDir.string (), lookupName, needHash);
741- }
742- else
743- {
744- if (auto contents = m_defaultFileSystemLoader->getInclude (requestingSourceDir.string (), lookupName, needHash))
745- retVal = std::move (contents);
746- else if (auto contents = tryIncludeGenerators (lookupName))
747- retVal = std::move (contents);
748- else retVal = std::move (trySearchPaths (lookupName, needHash));
749- }
693+ if (auto contents = m_defaultFileSystemLoader->getInclude (requestingSourceDir.string (), lookupName, needHash))
694+ retVal = std::move (contents);
695+ else retVal = std::move (trySearchPaths (lookupName, needHash));
750696
751697 if (needHash && retVal && retVal.hash == core::blake3_hash_t {})
752698 {
0 commit comments