Class VulkanModuleFence

java.lang.Object
io.codetoil.curved_spacetime.vulkan.VulkanModuleFence

public class VulkanModuleFence extends Object
A Vulkan fence, used by the host to wait for work submitted to a queue to finish.

Fences synchronise the CPU against the GPU; use a VulkanModuleSemaphore to order GPU work against other GPU work. A fence created signalled lets the first frame proceed without a special case, since vulkanFenceWait() then returns immediately.

  • Constructor Details

    • VulkanModuleFence

      public VulkanModuleFence(VulkanModuleLogicalDevice logicalDevice, boolean signaled)
      Creates a fence on the given device.
      Parameters:
      logicalDevice - the device to create the fence on
      signaled - whether the fence starts signalled, so the first wait returns at once
      Throws:
      AssertionError - if the fence cannot be created
  • Method Details

    • cleanup

      public void cleanup()
      Destroys the fence.
    • vulkanFenceWait

      public void vulkanFenceWait()
      Blocks until the fence is signalled.

      Waits indefinitely; the caller is expected to have submitted work that will signal it.

    • getVkFence

      public long getVkFence()
      Returns the underlying Vulkan handle.
      Returns:
      the VkFence handle
    • reset

      public void reset()
      Returns the fence to the unsignalled state, ready to be waited on again.