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

Method LoadTextureFromFileDeferred

src/engine/TextureCache.cpp:516–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514}
515
516std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromFileDeferred(
517 const std::filesystem::path& path,
518 bool sRGB)
519{
520 std::shared_ptr<TextureData> texture;
521
522 if (FindTextureInCache(path, texture))
523 return texture;
524
525 texture->forceSRGB = sRGB;
526 texture->path = path.generic_string();
527
528 auto fileData = ReadTextureFile(path);
529 if (fileData)
530 {
531 if (FillTextureData(fileData, texture, path.extension().generic_string(), ""))
532 {
533 TextureLoaded(texture);
534
535 std::lock_guard<std::mutex> guard(m_TexturesToFinalizeMutex);
536
537 m_TexturesToFinalize.push(texture);
538 }
539 }
540
541 ++m_TexturesLoaded;
542
543 return texture;
544}
545
546std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromFileAsync(
547 const std::filesystem::path& path,

Callers 1

LoadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected