MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ release()

void MayaFlux::Yantra::GpuResourceManager::release ( const std::string &  key)

Destroy the pipeline, shader, descriptor sets, and buffers for a single key, without affecting any other key.

Definition at line 292 of file GpuResourceManager.cpp.

293{
294 auto it = m_units.find(key);
295 if (it == m_units.end())
296 return;
297
298 auto& unit = *it->second;
299 if (!unit.ready) {
300 m_units.erase(it);
301 return;
302 }
303
304 auto& foundry = Portal::Graphics::get_shader_foundry();
305 auto& compute_press = Portal::Graphics::get_compute_press();
306 auto device = foundry.get_device();
307
308 if (unit.impl) {
309 for (auto& slot : unit.impl->buffers)
310 free_slot(device, slot);
311 }
312 unit.impl.reset();
313 unit.buffer_slots.clear();
314 unit.image_slots.clear();
315
316 if (unit.pipeline_id != Portal::Graphics::INVALID_COMPUTE_PIPELINE)
317 compute_press.destroy_pipeline(unit.pipeline_id);
318
319 if (unit.shader_id != Portal::Graphics::INVALID_SHADER)
320 foundry.destroy_shader(unit.shader_id);
321
322 m_units.erase(it);
323}
vk::PhysicalDevice device
Definition VKDevice.cpp:121
std::unordered_map< std::string, std::unique_ptr< PipelineUnit > > m_units
constexpr ShaderID INVALID_SHADER
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
constexpr ComputePipelineID INVALID_COMPUTE_PIPELINE
MAYAFLUX_API ComputePress & get_compute_press()

References device, MayaFlux::Portal::Graphics::get_compute_press(), MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::INVALID_COMPUTE_PIPELINE, MayaFlux::Portal::Graphics::INVALID_SHADER, and m_units.

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: