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

Callers 1

LoadMethod · 0.80

Calls 1

AddTaskMethod · 0.80

Tested by

no test coverage detected