@@ -55,8 +55,8 @@ inline core::smart_refctd_ptr<ICPUShader> nbl::asset::IShaderCompiler::compileTo
5555
5656 if (options.writeCache )
5757 {
58- entry.setContent (retVal->getContent (), std::move (dependencies));
59- options.writeCache ->insert (std::move (entry));
58+ if ( entry.setContent (retVal->getContent (), std::move (dependencies)))
59+ options.writeCache ->insert (std::move (entry));
6060 }
6161 return retVal;
6262}
@@ -398,7 +398,7 @@ core::smart_refctd_ptr<IShaderCompiler::CCache> IShaderCompiler::CCache::deseria
398398static void * SzAlloc (ISzAllocPtr p, size_t size) { p = p; return _NBL_ALIGNED_MALLOC (size, _NBL_SIMD_ALIGNMENT); }
399399static void SzFree (ISzAllocPtr p, void * address) { p = p; _NBL_ALIGNED_FREE (address); }
400400
401- void nbl::asset::IShaderCompiler::CCache::SEntry::setContent (const asset::ICPUBuffer* uncompressedSpirvBuffer, dependency_container_t && dependencies)
401+ bool nbl::asset::IShaderCompiler::CCache::SEntry::setContent (const asset::ICPUBuffer* uncompressedSpirvBuffer, dependency_container_t && dependencies)
402402{
403403 dependencies = std::move (dependencies);
404404 uncompressedContentHash = uncompressedSpirvBuffer->getContentHash ();
@@ -421,11 +421,12 @@ void nbl::asset::IShaderCompiler::CCache::SEntry::setContent(const asset::ICPUBu
421421 &props, compressedSpirv.data (), &propsSize, props.writeEndMark ,
422422 nullptr , &alloc, &alloc);
423423
424- assert (propsSize == LZMA_PROPS_SIZE);
425- assert (res == SZ_OK);
424+ if (res != SZ_OK || propsSize != LZMA_PROPS_SIZE) return false ;
426425
427426 spirv = core::make_smart_refctd_ptr<ICPUBuffer>(propsSize + destLen);
428427 memcpy (spirv->getPointer (), compressedSpirv.data (), spirv->getSize ());
428+
429+ return true ;
429430}
430431
431432core::smart_refctd_ptr<ICPUShader> nbl::asset::IShaderCompiler::CCache::SEntry::decompressShader () const
0 commit comments