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

◆ release_fence()

void MayaFlux::Portal::Graphics::ShaderFoundry::release_fence ( FenceID  fence_id)

Destroy the fence and free its associated command buffer.

Must be called once per FenceID returned by submit_async, after is_fence_signaled returns true. Failure to call this leaks a VkFence and a command buffer slot every dispatch cycle.

Safe to call with INVALID_FENCE.

Parameters
fence_idFenceID returned by submit_async.

Definition at line 1072 of file ShaderFoundry.cpp.

1073{
1074 if (fence_id == INVALID_FENCE)
1075 return;
1076
1077 auto it = m_fences.find(fence_id);
1078 if (it == m_fences.end())
1079 return;
1080
1081 if (it->second.fence) {
1082 get_device().destroyFence(it->second.fence);
1083 it->second.fence = nullptr;
1084 }
1085
1086 const CommandBufferID cmd_id = it->second.cmd_id;
1087 m_fences.erase(it);
1088
1089 if (cmd_id != INVALID_COMMAND_BUFFER) {
1090 auto cmd_it = m_command_buffers.find(cmd_id);
1091 if (cmd_it != m_command_buffers.end()) {
1092 m_backend->get_command_manager().free_command_buffer(cmd_it->second.cmd);
1093 m_command_buffers.erase(cmd_it);
1094 }
1095 }
1096}
vk::Device get_device() const
Get logical device handle.
std::unordered_map< FenceID, FenceState > m_fences
std::unordered_map< CommandBufferID, CommandBufferState > m_command_buffers
std::shared_ptr< Core::VulkanBackend > m_backend
constexpr FenceID INVALID_FENCE
constexpr CommandBufferID INVALID_COMMAND_BUFFER

References get_device(), MayaFlux::Portal::Graphics::INVALID_COMMAND_BUFFER, MayaFlux::Portal::Graphics::INVALID_FENCE, m_backend, m_command_buffers, and m_fences.

+ Here is the call graph for this function: