MCPcopy Create free account
hub / github.com/Apress/Ray-Tracing-Gems-II / LoadPIXImageFromFile

Method LoadPIXImageFromFile

Chapter_27/Core/TextureManager.cpp:314–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312
313
314const ManagedTexture* TextureManager::LoadPIXImageFromFile( const std::wstring& fileName )
315{
316 auto ManagedTex = FindOrLoadTexture(fileName);
317
318 ManagedTexture* ManTex = ManagedTex.first;
319 const bool RequestsLoad = ManagedTex.second;
320
321 if (!RequestsLoad)
322 {
323 ManTex->WaitForLoad();
324 return ManTex;
325 }
326
327 Utility::ByteArray ba = Utility::ReadFileSync( s_RootPath + fileName );
328 if (ba->size() > 0)
329 {
330 ManTex->CreatePIXImageFromMemory(ba->data(), ba->size());
331 ManTex->GetResource()->SetName(fileName.c_str());
332 }
333 else
334 ManTex->SetToInvalidTexture();
335
336 return ManTex;
337}

Callers

nothing calls this directly

Calls 8

FindOrLoadTextureFunction · 0.85
WaitForLoadMethod · 0.80
c_strMethod · 0.80
SetToInvalidTextureMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
GetResourceMethod · 0.45

Tested by

no test coverage detected