@@ -26,7 +26,6 @@ IShaderCompiler::IShaderCompiler(core::smart_refctd_ptr<system::ISystem>&& syste
2626core::smart_refctd_ptr<ICPUShader> nbl::asset::IShaderCompiler::compileToSPIRV (const std::string_view code, const SCompilerOptions& options) const
2727{
2828 CCache::SEntry entry;
29- std::vector<CCache::SEntry::SPreprocessingDependency> dependencies;
3029 if (options.readCache || options.writeCache )
3130 entry = CCache::SEntry (code, options);
3231
@@ -44,7 +43,7 @@ core::smart_refctd_ptr<ICPUShader> nbl::asset::IShaderCompiler::compileToSPIRV(c
4443 }
4544 }
4645
47- auto retVal = compileToSPIRV_impl (code, options, options.writeCache ? &dependencies : nullptr );
46+ auto retVal = compileToSPIRV_impl (code, options, options.writeCache ? &entry. dependencies : nullptr );
4847 // compute the SPIR-V shader content hash
4948 {
5049 auto backingBuffer = retVal->getContent ();
@@ -53,7 +52,7 @@ core::smart_refctd_ptr<ICPUShader> nbl::asset::IShaderCompiler::compileToSPIRV(c
5352
5453 if (options.writeCache )
5554 {
56- if (entry.setContent (retVal->getContent (), std::move (dependencies) ))
55+ if (entry.setContent (retVal->getContent ()))
5756 options.writeCache ->insert (std::move (entry));
5857 }
5958 return retVal;
@@ -272,19 +271,19 @@ IShaderCompiler::CCache::EntrySet::const_iterator IShaderCompiler::CCache::find_
272271 auto found = m_container.find (mainFile);
273272 // go through all dependencies
274273 if (found!=m_container.end ())
275- for (auto i = 0 ; i < found->dependencies .size (); i++)
276274 {
277- const auto & dependency = found->dependencies [i];
278-
279- IIncludeLoader::found_t header;
280- if (dependency.standardInclude )
281- header = finder->getIncludeStandard (dependency.requestingSourceDir , dependency.identifier );
282- else
283- header = finder->getIncludeRelative (dependency.requestingSourceDir , dependency.identifier );
284-
285- if (header.hash != dependency.hash )
275+ for (const auto & dependency : found->dependencies )
286276 {
287- return m_container.end ();
277+ IIncludeLoader::found_t header;
278+ if (dependency.standardInclude )
279+ header = finder->getIncludeStandard (dependency.requestingSourceDir , dependency.identifier );
280+ else
281+ header = finder->getIncludeRelative (dependency.requestingSourceDir , dependency.identifier );
282+
283+ if (header.hash != dependency.hash )
284+ {
285+ return m_container.end ();
286+ }
288287 }
289288 }
290289
@@ -393,9 +392,8 @@ core::smart_refctd_ptr<IShaderCompiler::CCache> IShaderCompiler::CCache::deseria
393392static void * SzAlloc (ISzAllocPtr p, size_t size) { p = p; return _NBL_ALIGNED_MALLOC (size, _NBL_SIMD_ALIGNMENT); }
394393static void SzFree (ISzAllocPtr p, void * address) { p = p; _NBL_ALIGNED_FREE (address); }
395394
396- bool nbl::asset::IShaderCompiler::CCache::SEntry::setContent (const asset::ICPUBuffer* uncompressedSpirvBuffer, dependency_container_t && dependencies )
395+ bool nbl::asset::IShaderCompiler::CCache::SEntry::setContent (const asset::ICPUBuffer* uncompressedSpirvBuffer)
397396{
398- dependencies = std::move (dependencies);
399397 uncompressedContentHash = uncompressedSpirvBuffer->getContentHash ();
400398 uncompressedSize = uncompressedSpirvBuffer->getSize ();
401399
0 commit comments