MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / LoadTextureFromMemoryAsync

Method LoadTextureFromMemoryAsync

src/engine/TextureCache.cpp:580–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromMemoryAsync(
581 const std::shared_ptr<vfs::IBlob>& data,
582 const std::string& name,
583 const std::string& mimeType,
584 bool sRGB,
585 ThreadPool& threadPool)
586{
587 std::shared_ptr<TextureData> texture = CreateTextureData();
588
589 texture->forceSRGB = sRGB;
590 texture->path = name;
591 texture->mimeType = mimeType;
592
593 threadPool.AddTask([this, texture, data, mimeType]()
594 {
595 if (FillTextureData(data, texture, "", mimeType))
596 {
597 TextureLoaded(texture);
598
599 std::lock_guard<std::mutex> guard(m_TexturesToFinalizeMutex);
600
601 m_TexturesToFinalize.push(texture);
602 }
603
604 ++m_TexturesLoaded;
605 });
606
607 return texture;
608}
609
610std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromMemory(
611 const std::shared_ptr<vfs::IBlob>& data,

Callers 1

LoadMethod · 0.80

Calls 1

AddTaskMethod · 0.80

Tested by

no test coverage detected