KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::FVulkanFenceManager Class Reference

Public Member Functions

 FVulkanFenceManager (FVulkanDevice &InDevice)
 Constructor.
 ~FVulkanFenceManager ()
 Makes sure m_UsedFences are zero i.e no fences are currently in use by GPU or inflight-work.
void Denit ()
 Purpose is two-fold.
FVulkanFenceAllocateFence (bool bCreateSignaled=false)
 Allocates fence for use.
bool WaitForFence (FVulkanFence *Fence)
 Waits for the given fence to be signaled.
void ResetFence (FVulkanFence *Fence)
 Resets the given fence to the unsignaled state.
void ReleaseFence (FVulkanFence *&Fence)
 Releases the given fence back to the manager.

Protected Member Functions

void DestroyFence (FVulkanFence *InFence)
 Destroys the given fence and releases its resources.

Protected Attributes

FVulkanDevicem_Device
KarmaVector< FVulkanFence * > m_FreeFences
 Array of free fences to be used.
KarmaVector< FVulkanFence * > m_UsedFences
 Array of fences currently in use by GPU or in-flight work.

Constructor & Destructor Documentation

◆ FVulkanFenceManager()

Karma::FVulkanFenceManager::FVulkanFenceManager ( FVulkanDevice & InDevice)
inline

Constructor.

Parameters
InDeviceReference to the owning FVulkanDevice
Since
Karma 1.0.0

◆ ~FVulkanFenceManager()

Karma::FVulkanFenceManager::~FVulkanFenceManager ( )

Makes sure m_UsedFences are zero i.e no fences are currently in use by GPU or inflight-work.

Since
Karma 1.0.0

Member Function Documentation

◆ AllocateFence()

FVulkanFence * Karma::FVulkanFenceManager::AllocateFence ( bool bCreateSignaled = false)

Allocates fence for use.

Looks in m_FreeFences, if array is not empty, uses the first fence and fills m_UsedFence. If m_FreeFences is empty, creates new FVulkanFence and fills m_UsedFence.

Parameters
bCreateSignaledShould the fence be in Signaled state
See also
KarmaGuiVulkanHandler::FillWindowData
Since
Karma 1.0.0

◆ Denit()

void Karma::FVulkanFenceManager::Denit ( )

Purpose is two-fold.

  • 1. Makes sure no fences are currently in use (m_UsedFences.Num() == 0)
  • 2. Clear off m_FreeFences
Since
Karma 1.0.0

◆ DestroyFence()

void Karma::FVulkanFenceManager::DestroyFence ( FVulkanFence * InFence)
protected

Destroys the given fence and releases its resources.

Parameters
InFenceThe fence to be destroyed
Since
Karma 1.0.0

◆ ReleaseFence()

void Karma::FVulkanFenceManager::ReleaseFence ( FVulkanFence *& Fence)

Releases the given fence back to the manager.

Moves the fence from m_UsedFences to m_FreeFences for future reuse.

Note
This is kind of reverse of AllocateFence
Parameters
FenceThe fence to be released
See also
KarmaGuiVulkanHandler::DestroyFramesOnFlightData
Since
Karma 1.0.0

◆ ResetFence()

void Karma::FVulkanFenceManager::ResetFence ( FVulkanFence * Fence)

Resets the given fence to the unsignaled state.

Note
Both CPU and GPU side states are reset.
Parameters
FenceThe fence to be reset
Since
Karma 1.0.0

◆ WaitForFence()

bool Karma::FVulkanFenceManager::WaitForFence ( FVulkanFence * Fence)

Waits for the given fence to be signaled.

Makes sure the fence is in m_UsedFences before waiting.

Parameters
FenceThe fence to wait for
Since
Karma 1.0.0

Member Data Documentation

◆ m_FreeFences

KarmaVector<FVulkanFence*> Karma::FVulkanFenceManager::m_FreeFences
protected

Array of free fences to be used.

Note
This gets filled mainly by ReleaseFence and WaitAndReleaseFence once work is finished.

The documentation for this class was generated from the following files: