Class VulkanModuleVulkanInstance

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

public class VulkanModuleVulkanInstance extends Object
The Vulkan instance: the application's connection to the Vulkan loader, and the object every physical device is enumerated from.

When validation is enabled in configuration, this also installs a debug messenger that routes the validation layers' output into the module's logger, so driver complaints appear alongside the program's own diagnostics. Validation degrades gracefully: the preferred Khronos layer is used if present, then a LunarG fallback, then a set of individual Google and LunarG layers, and if none are available validation is switched off with a warning rather than failing.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The prefix every message forwarded from the validation layers carries.
    protected org.lwjgl.vulkan.VkDebugUtilsMessengerCreateInfoEXT
    The debug messenger's creation info, retained so it can be freed, or null when validation is disabled.
    protected final Logger
    The logger this instance, and the validation layers, write to.
    static final int
    Which severities the debug messenger reports: errors and warnings only.
    static final int
    Which message kinds the debug messenger reports: general, validation, and performance.
    static final String
    The extension that lets non-conformant implementations, such as MoltenVK, be enumerated.
    static final String
    The preferred validation layer.
    static final String
    The validation layer to try when VALIDATION_DEFAULT is unavailable.
    static final Set<String>
    The individual layers to fall back on when neither combined validation layer is available.
    protected long
    The debug messenger handle, or VK_NULL_HANDLE when validation is disabled.
    protected org.lwjgl.vulkan.VkInstance
    The underlying Vulkan instance.
  • Constructor Summary

    Constructors
    Constructor
    Description
    VulkanModuleVulkanInstance(VulkanModuleEntrypoint vulkanModuleEntrypoint, Logger logger)
    Creates the Vulkan instance, enabling validation if configuration asks for it and the layers are available.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Destroys the debug messenger, if any, and then the instance.
    org.lwjgl.vulkan.VkInstance
    Returns the underlying Vulkan instance.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MESSAGE_SEVERITY_BITMASK

      public static final int MESSAGE_SEVERITY_BITMASK
      Which severities the debug messenger reports: errors and warnings only.
      See Also:
    • MESSAGE_TYPE_BITMASK

      public static final int MESSAGE_TYPE_BITMASK
      Which message kinds the debug messenger reports: general, validation, and performance.
      See Also:
    • VALIDATION_DEFAULT

      public static final String VALIDATION_DEFAULT
      The preferred validation layer.
      See Also:
    • VALIDATION_FALLBACK1

      public static final String VALIDATION_FALLBACK1
      The validation layer to try when VALIDATION_DEFAULT is unavailable.
      See Also:
    • VALIDATION_FALLBACK2

      public static final Set<String> VALIDATION_FALLBACK2
      The individual layers to fall back on when neither combined validation layer is available.
    • PORTABILITY_EXTENSION

      public static final String PORTABILITY_EXTENSION
      The extension that lets non-conformant implementations, such as MoltenVK, be enumerated.
      See Also:
    • DBG_CALLBACK_PREF

      public static final String DBG_CALLBACK_PREF
      The prefix every message forwarded from the validation layers carries.
      See Also:
    • logger

      protected final Logger logger
      The logger this instance, and the validation layers, write to.
    • vkInstance

      protected org.lwjgl.vulkan.VkInstance vkInstance
      The underlying Vulkan instance.
    • debugUtils

      protected org.lwjgl.vulkan.VkDebugUtilsMessengerCreateInfoEXT debugUtils
      The debug messenger's creation info, retained so it can be freed, or null when validation is disabled.
    • vkDebugHandle

      protected long vkDebugHandle
      The debug messenger handle, or VK_NULL_HANDLE when validation is disabled.
  • Constructor Details

    • VulkanModuleVulkanInstance

      public VulkanModuleVulkanInstance(VulkanModuleEntrypoint vulkanModuleEntrypoint, Logger logger)
      Creates the Vulkan instance, enabling validation if configuration asks for it and the layers are available.
      Parameters:
      vulkanModuleEntrypoint - the entrypoint supplying the Vulkan module's configuration
      logger - the logger to write instance and validation output to
      Throws:
      AssertionError - if the instance or the debug messenger cannot be created
  • Method Details

    • cleanup

      public void cleanup()
      Destroys the debug messenger, if any, and then the instance.
    • getVkInstance

      public org.lwjgl.vulkan.VkInstance getVkInstance()
      Returns the underlying Vulkan instance.
      Returns:
      the VkInstance