MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / loadTexture

Method loadTexture

Source/Falcor/Scene/Material/Material.cpp:202–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200 }
201
202 bool Material::loadTexture(TextureSlot slot, const std::filesystem::path& path, bool useSrgb)
203 {
204 if (!hasTextureSlot(slot))
205 {
206 logWarning("Material '{}' does not have texture slot '{}'. Ignoring call to loadTexture().", getName(), to_string(slot));
207 return false;
208 }
209
210 auto texture = Texture::createFromFile(mpDevice, path, true, useSrgb && getTextureSlotInfo(slot).srgb);
211 if (texture)
212 {
213 setTexture(slot, texture);
214 // Wait for GPU to finish to prevent the upload heap from growing too large. Doing so after
215 // every texture creation is overly conservative, and will likely lead to performance issues
216 // due to the forced CPU/GPU sync.
217 mpDevice->wait();
218 return true;
219 }
220
221 return false;
222 }
223
224 uint2 Material::getMaxTextureDimensions() const
225 {

Callers 4

readMaterialMethod · 0.45
loadMaterialTextureMethod · 0.45
FALCOR_SCRIPT_BINDINGFunction · 0.45
GPU_TESTFunction · 0.45

Calls 5

hasTextureSlotFunction · 0.85
to_stringFunction · 0.70
logWarningFunction · 0.50
getNameFunction · 0.50
waitMethod · 0.45

Tested by 1

GPU_TESTFunction · 0.36