Class VulkanModuleVulkan
java.lang.Object
io.codetoil.curved_spacetime.MainCallback
io.codetoil.curved_spacetime.vulkan.VulkanModuleVulkan
Owns the Vulkan objects that outlive any one window: the instance, the physical device, and the
logical device.
Registered as a MainCallback so that its lifetime is tied to the engine rather than to a
scene. Everything scene- or surface-specific — swap chains, render passes, framebuffers — is
built on top of these by the render modules, which reach them through the getters here.
Creation order matters and is not negotiable: the instance must exist before a physical device
can be selected, and a physical device before a logical one can be created. clean()
unwinds in the reverse order, after waiting for the device to go idle.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected VulkanModuleLogicalDeviceThe logical device created against the selected physical device.protected VulkanModulePhysicalDeviceThe selected physical device.protected VulkanModuleVulkanInstanceThe Vulkan instance, created first duringinit().Fields inherited from class MainCallback
initialized, mainModuleEngine -
Constructor Summary
ConstructorsConstructorDescriptionVulkanModuleVulkan(MainModuleEngine mainModuleEngine, VulkanModuleEntrypoint entrypoint) Creates the Vulkan callback. -
Method Summary
Modifier and TypeMethodDescriptionvoidclean()Releases whatever this callback acquired inMainCallback.init().Returns the logical device.Returns the selected physical device.Returns the Vulkan instance.voidinit()Creates the instance, selects a physical device, and creates the logical device.voidloop()Advances this callback by one frame.Methods inherited from class MainCallback
isInitialized
-
Field Details
-
vulkanModuleVulkanInstance
The Vulkan instance, created first duringinit(). -
vulkanModulePhysicalDevice
The selected physical device. -
vulkanModuleLogicalDevice
The logical device created against the selected physical device.
-
-
Constructor Details
-
VulkanModuleVulkan
Creates the Vulkan callback.No Vulkan object is created until
init()runs on the engine's callback thread.- Parameters:
mainModuleEngine- the engine this callback belongs toentrypoint- the Vulkan module's entrypoint, supplying configuration and logger
-
-
Method Details
-
init
public void init()Creates the instance, selects a physical device, and creates the logical device.- Specified by:
initin classMainCallback- Throws:
RuntimeException- if no suitable physical device is available, or if any Vulkan call fails
-
loop
public void loop()Description copied from class:MainCallbackAdvances this callback by one frame.Called repeatedly at the frame rate the engine's configuration specifies.
- Specified by:
loopin classMainCallback
-
clean
public void clean()Description copied from class:MainCallbackReleases whatever this callback acquired inMainCallback.init().- Specified by:
cleanin classMainCallback
-
getVulkanModuleVulkanInstance
Returns the Vulkan instance.- Returns:
- the instance, or
nullbeforeinit()
-
getVulkanModulePhysicalDevice
Returns the selected physical device.- Returns:
- the physical device, or
nullbeforeinit()
-
getVulkanModuleLogicalDevice
Returns the logical device.- Returns:
- the logical device, or
nullbeforeinit()
-