MayaFlux 0.5.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 256 of file GpuResourceManager.cpp.

257{
258 auto it = m_units.find(key);
259 if (it == m_units.end())
260 return;
261
262 auto& unit = *it->second;
263 if (!unit.ready) {
264 m_units.erase(it);
265 return;
266 }
267
268 auto& foundry = Portal::Graphics::get_shader_foundry();
269 auto& compute_press = Portal::Graphics::get_compute_press();
270 auto device = foundry.get_device();
271
272 if (unit.impl) {
273 for (auto& slot : unit.impl->buffers)
274 free_slot(device, slot);
275 }
276 unit.impl.reset();
277 unit.buffer_slots.clear();
278 unit.image_slots.clear();
279
280 if (unit.pipeline_id != Portal::Graphics::INVALID_COMPUTE_PIPELINE)
281 compute_press.destroy_pipeline(unit.pipeline_id);
282
283 if (unit.shader_id != Portal::Graphics::INVALID_SHADER)
284 foundry.destroy_shader(unit.shader_id);
285
286 m_units.erase(it);
287}
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 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: