Class JCSwapchainConfiguration

java.lang.Object
com.io7m.jcoronado.utility.swapchain.JCSwapchainConfiguration
All Implemented Interfaces:
JCSwapchainConfigurationType

public final class JCSwapchainConfiguration extends Object implements JCSwapchainConfigurationType
The configuration values required to create (and re-create) swapchains.
  • Method Details

    • requestedMinimumImages

      public int requestedMinimumImages()
      Specified by:
      requestedMinimumImages in interface JCSwapchainConfigurationType
      Returns:
      The requested minimum number of swapchain images
    • framesInFlight

      public int framesInFlight()
      Specified by:
      framesInFlight in interface JCSwapchainConfigurationType
      Returns:
      The number of frames in flight (the number of frame-slot resources allocated by the manager: acquire semaphore, bounding fence, and present fence per slot)
    • device

      public VulkanLogicalDeviceType device()
      Specified by:
      device in interface JCSwapchainConfigurationType
      Returns:
      The logical device.
    • surface

      Specified by:
      surface in interface JCSwapchainConfigurationType
      Returns:
      The KHR_surface.
    • extentSupplier

      public JCSwapchainExtentSupplierType extentSupplier()
      The supplier of the extent that the surface should have. See JCSwapchainExtentSupplierType.
      Specified by:
      extentSupplier in interface JCSwapchainConfigurationType
      Returns:
      The extent supplier
    • swapChainExtension

      public VulkanExtKHRSwapChainType swapChainExtension()
      Specified by:
      swapChainExtension in interface JCSwapchainConfigurationType
      Returns:
      The KHR_swapchain extension.
    • surfaceExtension

      public VulkanExtKHRSurfaceType surfaceExtension()
      Specified by:
      surfaceExtension in interface JCSwapchainConfigurationType
      Returns:
      The KHR_surface extension.
    • graphicsQueue

      public VulkanQueueType graphicsQueue()
      Specified by:
      graphicsQueue in interface JCSwapchainConfigurationType
      Returns:
      The queue used for graphics operations
    • presentationQueue

      public VulkanQueueType presentationQueue()
      Specified by:
      presentationQueue in interface JCSwapchainConfigurationType
      Returns:
      The queue used for presentation operations
    • preferredModes

      public List<VulkanPresentModeKHR> preferredModes()
      The list of presentation modes to try in order of preference (earlier entries have higher preference).
      Specified by:
      preferredModes in interface JCSwapchainConfigurationType
      Returns:
      The list of presentation modes in preference order
    • preferredFormats

      public List<VulkanSurfaceFormatKHR> preferredFormats()
      The list of surface formats to try in order of preference (earlier entries have higher preference).
      Specified by:
      preferredFormats in interface JCSwapchainConfigurationType
      Returns:
      The list of surface formats in preference order
    • imageUsageFlags

      public Set<VulkanImageUsageFlag> imageUsageFlags()
      Specified by:
      imageUsageFlags in interface JCSwapchainConfigurationType
      Returns:
      The usage flags required to be present on images returned from the swapchain
    • surfaceAlphaFlags

      public Set<VulkanCompositeAlphaFlagKHR> surfaceAlphaFlags()
      Specified by:
      surfaceAlphaFlags in interface JCSwapchainConfigurationType
      Returns:
      The required surface alpha flags
    • acquireTimeout

      public Duration acquireTimeout()
      The overall timeout for the frame acquire operation. If the frame cannot be acquired within this duration, the acquire will fail.
      Specified by:
      acquireTimeout in interface JCSwapchainConfigurationType
      Returns:
      The overall acquire timeout (default: 5 seconds)
    • acquireImageTimeout

      public Duration acquireImageTimeout()
      The timeout for each individual vkAcquireNextImageKHR call within the acquire retry loop. This must not exceed acquireTimeout().
      Specified by:
      acquireImageTimeout in interface JCSwapchainConfigurationType
      Returns:
      The per-call image acquisition timeout (default: 1 second)
    • withRequestedMinimumImages

      public final JCSwapchainConfiguration withRequestedMinimumImages(int value)
      Copy the current immutable object by setting a value for the requestedMinimumImages attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for requestedMinimumImages
      Returns:
      A modified copy or the this object
    • withFramesInFlight

      public final JCSwapchainConfiguration withFramesInFlight(int value)
      Copy the current immutable object by setting a value for the framesInFlight attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for framesInFlight
      Returns:
      A modified copy or the this object
    • withDevice

      public final JCSwapchainConfiguration withDevice(VulkanLogicalDeviceType value)
      Copy the current immutable object by setting a value for the device attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for device
      Returns:
      A modified copy or the this object
    • withSurface

      Copy the current immutable object by setting a value for the surface attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for surface
      Returns:
      A modified copy or the this object
    • withExtentSupplier

      public final JCSwapchainConfiguration withExtentSupplier(JCSwapchainExtentSupplierType value)
      Copy the current immutable object by setting a value for the extentSupplier attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for extentSupplier
      Returns:
      A modified copy or the this object
    • withSwapChainExtension

      public final JCSwapchainConfiguration withSwapChainExtension(VulkanExtKHRSwapChainType value)
      Copy the current immutable object by setting a value for the swapChainExtension attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for swapChainExtension
      Returns:
      A modified copy or the this object
    • withSurfaceExtension

      public final JCSwapchainConfiguration withSurfaceExtension(VulkanExtKHRSurfaceType value)
      Copy the current immutable object by setting a value for the surfaceExtension attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for surfaceExtension
      Returns:
      A modified copy or the this object
    • withGraphicsQueue

      public final JCSwapchainConfiguration withGraphicsQueue(VulkanQueueType value)
      Copy the current immutable object by setting a value for the graphicsQueue attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for graphicsQueue
      Returns:
      A modified copy or the this object
    • withPresentationQueue

      public final JCSwapchainConfiguration withPresentationQueue(VulkanQueueType value)
      Copy the current immutable object by setting a value for the presentationQueue attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for presentationQueue
      Returns:
      A modified copy or the this object
    • withPreferredModes

      public final JCSwapchainConfiguration withPreferredModes(VulkanPresentModeKHR... elements)
      Copy the current immutable object with elements that replace the content of preferredModes.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withPreferredModes

      public final JCSwapchainConfiguration withPreferredModes(Iterable<? extends VulkanPresentModeKHR> elements)
      Copy the current immutable object with elements that replace the content of preferredModes. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of preferredModes elements to set
      Returns:
      A modified copy or this if not changed
    • withPreferredFormats

      public final JCSwapchainConfiguration withPreferredFormats(VulkanSurfaceFormatKHR... elements)
      Copy the current immutable object with elements that replace the content of preferredFormats.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withPreferredFormats

      public final JCSwapchainConfiguration withPreferredFormats(Iterable<? extends VulkanSurfaceFormatKHR> elements)
      Copy the current immutable object with elements that replace the content of preferredFormats. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of preferredFormats elements to set
      Returns:
      A modified copy or this if not changed
    • withImageUsageFlags

      public final JCSwapchainConfiguration withImageUsageFlags(VulkanImageUsageFlag... elements)
      Copy the current immutable object with elements that replace the content of imageUsageFlags.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withImageUsageFlags

      public final JCSwapchainConfiguration withImageUsageFlags(Iterable<VulkanImageUsageFlag> elements)
      Copy the current immutable object with elements that replace the content of imageUsageFlags. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of imageUsageFlags elements to set
      Returns:
      A modified copy or this if not changed
    • withSurfaceAlphaFlags

      public final JCSwapchainConfiguration withSurfaceAlphaFlags(VulkanCompositeAlphaFlagKHR... elements)
      Copy the current immutable object with elements that replace the content of surfaceAlphaFlags.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withSurfaceAlphaFlags

      public final JCSwapchainConfiguration withSurfaceAlphaFlags(Iterable<VulkanCompositeAlphaFlagKHR> elements)
      Copy the current immutable object with elements that replace the content of surfaceAlphaFlags. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of surfaceAlphaFlags elements to set
      Returns:
      A modified copy or this if not changed
    • withAcquireTimeout

      public final JCSwapchainConfiguration withAcquireTimeout(Duration value)
      Copy the current immutable object by setting a value for the acquireTimeout attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for acquireTimeout
      Returns:
      A modified copy or the this object
    • withAcquireImageTimeout

      public final JCSwapchainConfiguration withAcquireImageTimeout(Duration value)
      Copy the current immutable object by setting a value for the acquireImageTimeout attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for acquireImageTimeout
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of JCSwapchainConfiguration that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: requestedMinimumImages, framesInFlight, device, surface, extentSupplier, swapChainExtension, surfaceExtension, graphicsQueue, presentationQueue, preferredModes, preferredFormats, imageUsageFlags, surfaceAlphaFlags, acquireTimeout, acquireImageTimeout.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value JCSwapchainConfiguration with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static JCSwapchainConfiguration copyOf(JCSwapchainConfigurationType instance)
      Creates an immutable copy of a JCSwapchainConfigurationType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable JCSwapchainConfiguration instance
    • builder

      public static JCSwapchainConfiguration.Builder builder()
      Creates a builder for JCSwapchainConfiguration.
      JCSwapchainConfiguration.builder()
         .setRequestedMinimumImages(int) // optional requestedMinimumImages
         .setFramesInFlight(int) // optional framesInFlight
         .setDevice(com.io7m.jcoronado.api.VulkanLogicalDeviceType) // required device
         .setSurface(com.io7m.jcoronado.extensions.khr_surface.api.VulkanExtKHRSurfaceType.VulkanKHRSurfaceType) // required surface
         .setExtentSupplier(com.io7m.jcoronado.utility.swapchain.JCSwapchainExtentSupplierType) // required extentSupplier
         .setSwapChainExtension(com.io7m.jcoronado.extensions.khr_swapchain.api.VulkanExtKHRSwapChainType) // required swapChainExtension
         .setSurfaceExtension(com.io7m.jcoronado.extensions.khr_surface.api.VulkanExtKHRSurfaceType) // required surfaceExtension
         .setGraphicsQueue(com.io7m.jcoronado.api.VulkanQueueType) // required graphicsQueue
         .setPresentationQueue(com.io7m.jcoronado.api.VulkanQueueType) // required presentationQueue
         .addPreferredModes|addAllPreferredModes(com.io7m.jcoronado.extensions.khr_swapchain.api.VulkanPresentModeKHR) // preferredModes elements
         .addPreferredFormats|addAllPreferredFormats(com.io7m.jcoronado.extensions.khr_surface.api.VulkanSurfaceFormatKHR) // preferredFormats elements
         .addImageUsageFlags|addAllImageUsageFlags(com.io7m.jcoronado.api.VulkanImageUsageFlag) // imageUsageFlags elements
         .addSurfaceAlphaFlags|addAllSurfaceAlphaFlags(com.io7m.jcoronado.extensions.khr_swapchain.api.VulkanCompositeAlphaFlagKHR) // surfaceAlphaFlags elements
         .setAcquireTimeout(java.time.Duration) // optional acquireTimeout
         .setAcquireImageTimeout(java.time.Duration) // optional acquireImageTimeout
         .build();
      
      Returns:
      A new JCSwapchainConfiguration builder