@@ -55,8 +55,8 @@ inline core::smart_refctd_ptr<ICPUShader> nbl::asset::IShaderCompiler::compileTo
55
55
56
56
if (options.writeCache )
57
57
{
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));
60
60
}
61
61
return retVal;
62
62
}
@@ -398,7 +398,7 @@ core::smart_refctd_ptr<IShaderCompiler::CCache> IShaderCompiler::CCache::deseria
398
398
static void * SzAlloc (ISzAllocPtr p, size_t size) { p = p; return _NBL_ALIGNED_MALLOC (size, _NBL_SIMD_ALIGNMENT); }
399
399
static void SzFree (ISzAllocPtr p, void * address) { p = p; _NBL_ALIGNED_FREE (address); }
400
400
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)
402
402
{
403
403
dependencies = std::move (dependencies);
404
404
uncompressedContentHash = uncompressedSpirvBuffer->getContentHash ();
@@ -421,11 +421,12 @@ void nbl::asset::IShaderCompiler::CCache::SEntry::setContent(const asset::ICPUBu
421
421
&props, compressedSpirv.data (), &propsSize, props.writeEndMark ,
422
422
nullptr , &alloc, &alloc);
423
423
424
- assert (propsSize == LZMA_PROPS_SIZE);
425
- assert (res == SZ_OK);
424
+ if (res != SZ_OK || propsSize != LZMA_PROPS_SIZE) return false ;
426
425
427
426
spirv = core::make_smart_refctd_ptr<ICPUBuffer>(propsSize + destLen);
428
427
memcpy (spirv->getPointer (), compressedSpirv.data (), spirv->getSize ());
428
+
429
+ return true ;
429
430
}
430
431
431
432
core::smart_refctd_ptr<ICPUShader> nbl::asset::IShaderCompiler::CCache::SEntry::decompressShader () const
0 commit comments