@@ -216,7 +216,7 @@ auto IShaderCompiler::CIncludeFinder::tryIncludeGenerators(const std::string& in
216216 return {};
217217}
218218
219- core::smart_refctd_ptr<asset::ICPUShader> IShaderCompiler::CCache::find (const SEntry& mainFile, const IShaderCompiler::CIncludeFinder* finder) const
219+ SEntry IShaderCompiler::CCache::find (const SEntry& mainFile, const IShaderCompiler::CIncludeFinder* finder) const
220220{
221221 auto foundRange = m_container.equal_range (mainFile);
222222 for (auto & found = foundRange.first ; found != foundRange.second ; found++)
@@ -240,10 +240,10 @@ core::smart_refctd_ptr<asset::ICPUShader> IShaderCompiler::CCache::find(const SE
240240 }
241241 }
242242 if (allDependenciesMatch) {
243- return found-> value ;
243+ return * found;
244244 }
245245 }
246- return nullptr ;
246+ return SEntry () ;
247247}
248248
249249core::smart_refctd_ptr<ICPUBuffer> IShaderCompiler::CCache::serialize () const
@@ -263,10 +263,10 @@ core::smart_refctd_ptr<ICPUBuffer> IShaderCompiler::CCache::serialize() const
263263 // We keep a copy of the offsets and the sizes of each shader. This is so that later on, when we add the shaders to the buffer after json creation
264264 // (where the params array has been moved) we don't have to read the json to get the offsets again
265265 offsets[i] = shaderBufferSize;
266- sizes[i] = entry.value ->getContent ()->getSize ();
266+ sizes[i] = entry.cpuShader ->getContent ()->getSize ();
267267
268268 // And add the params to the shader creation parameters array
269- shaderCreationParams.emplace_back (entry.value ->getStage (), entry.value ->getContentType (), entry.value ->getFilepathHint (), sizes[i], shaderBufferSize);
269+ shaderCreationParams.emplace_back (entry.cpuShader ->getStage (), entry.cpuShader ->getContentType (), entry.cpuShader ->getFilepathHint (), sizes[i], shaderBufferSize);
270270 // Enlarge the shader buffer by the size of the current shader
271271 shaderBufferSize += sizes[i];
272272 i++;
@@ -290,7 +290,7 @@ core::smart_refctd_ptr<ICPUBuffer> IShaderCompiler::CCache::serialize() const
290290 // Loop over entries again, adding each one's shader to the buffer.
291291 i = 0u ;
292292 for (auto & entry : m_container) {
293- memcpy (retVal.data () + SHADER_BUFFER_SIZE_BYTES + offsets[i], entry.value ->getContent ()->getPointer (), sizes[i]);
293+ memcpy (retVal.data () + SHADER_BUFFER_SIZE_BYTES + offsets[i], entry.cpuShader ->getContent ()->getPointer (), sizes[i]);
294294 i++;
295295 }
296296
@@ -335,9 +335,7 @@ core::smart_refctd_ptr<IShaderCompiler::CCache> IShaderCompiler::CCache::deseria
335335 // Copy the shader bytecode into the buffer
336336 memcpy (code->getPointer (), serializedCache.data () + SHADER_BUFFER_SIZE_BYTES + shaderCreationParams[i].offset , shaderCreationParams[i].codeByteSize );
337337 // Create the ICPUShader
338- auto value = core::make_smart_refctd_ptr<ICPUShader>(std::move (code), shaderCreationParams[i].stage , shaderCreationParams[i].contentType , std::move (shaderCreationParams[i].filepathHint ));
339-
340- entries[i].value = std::move (value);
338+ entries[i].cpuShader = core::make_smart_refctd_ptr<ICPUShader>(std::move (code), shaderCreationParams[i].stage , shaderCreationParams[i].contentType , std::move (shaderCreationParams[i].filepathHint ));
341339
342340 retVal->insert (std::move (entries[i]));
343341 }
0 commit comments