MCPcopy Create free account
hub / github.com/OGRECave/ogre / saveMicrocodeCache

Method saveMicrocodeCache

OgreMain/src/OgreGpuProgramManager.cpp:341–374  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

339 }
340 //---------------------------------------------------------------------
341 void GpuProgramManager::saveMicrocodeCache( const DataStreamPtr& stream ) const
342 {
343 if (!mCacheDirty)
344 return;
345
346 if (!stream->isWriteable())
347 {
348 OGRE_EXCEPT(Exception::ERR_CANNOT_WRITE_TO_FILE,
349 "Unable to write to stream " + stream->getName(),
350 "GpuProgramManager::saveMicrocodeCache");
351 }
352
353 StreamSerialiser serialiser(stream);
354 serialiser.writeChunkBegin(CACHE_CHUNK_ID, 3);
355
356 // write the size of the array
357 uint32 sizeOfArray = static_cast<uint32>(mMicrocodeCache.size());
358 serialiser.write(&sizeOfArray);
359
360 // loop the array and save it
361 for ( const auto& entry : mMicrocodeCache )
362 {
363 // saves the id of the shader
364 serialiser.write(&entry.first);
365
366 // saves the microcode
367 const Microcode & microcodeOfShader = entry.second;
368 uint32 microcodeLength = static_cast<uint32>(microcodeOfShader->size());
369 serialiser.write(&microcodeLength);
370 serialiser.writeData(microcodeOfShader->getPtr(), 1, microcodeLength);
371 }
372
373 serialiser.writeChunkEnd(CACHE_CHUNK_ID);
374 }
375 //---------------------------------------------------------------------
376 void GpuProgramManager::loadMicrocodeCache( const DataStreamPtr& stream )
377 {

Callers 1

shutdownMethod · 0.80

Calls 6

writeChunkBeginMethod · 0.80
writeChunkEndMethod · 0.80
getNameMethod · 0.45
sizeMethod · 0.45
writeMethod · 0.45
writeDataMethod · 0.45

Tested by

no test coverage detected