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

Method LoadTextureFromFileAsync

src/engine/TextureCache.cpp:546–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

544}
545
546std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromFileAsync(
547 const std::filesystem::path& path,
548 bool sRGB,
549 ThreadPool& threadPool)
550{
551 std::shared_ptr<TextureData> texture;
552
553 if (FindTextureInCache(path, texture))
554 return texture;
555
556 texture->forceSRGB = sRGB;
557 texture->path = path.generic_string();
558
559 threadPool.AddTask([this, texture, path]()
560 {
561 auto fileData = ReadTextureFile(path);
562 if (fileData)
563 {
564 if (FillTextureData(fileData, texture, path.extension().generic_string(), ""))
565 {
566 TextureLoaded(texture);
567
568 std::lock_guard<std::mutex> guard(m_TexturesToFinalizeMutex);
569
570 m_TexturesToFinalize.push(texture);
571 }
572 }
573
574 ++m_TexturesLoaded;
575 });
576
577 return texture;
578}
579
580std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromMemoryAsync(
581 const std::shared_ptr<vfs::IBlob>& data,

Callers 1

LoadMethod · 0.80

Calls 1

AddTaskMethod · 0.80

Tested by

no test coverage detected