Class VulkanRenderModuleSurface
java.lang.Object
io.codetoil.curved_spacetime.render.vulkan.VulkanRenderModuleSurface
- Direct Known Subclasses:
VulkanGLFWRenderModuleRenderModuleSurface
A Vulkan surface: the bridge between a platform window and Vulkan's presentation machinery.
Creating one is inherently platform-specific, so this class holds only what is common — querying capabilities and negotiating a format — and leaves the actual creation to a subclass that knows the windowing library.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA pixel format paired with the colour space it is interpreted in. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LoggerThe logger this surface writes its diagnostics to.protected final VulkanModulePhysicalDeviceThe physical device the surface's capabilities are queried against. -
Constructor Summary
ConstructorsConstructorDescriptionVulkanRenderModuleSurface(VulkanModulePhysicalDevice vulkanModulePhysicalDevice, Logger logger) Creates a surface bound to the given physical device. -
Method Summary
Modifier and TypeMethodDescriptionprotected VulkanRenderModuleSurface.SurfaceFormatPicks a format from those the surface advertises.abstract voidcleanup()Destroys the surface and releases the platform resources behind it.abstract org.lwjgl.vulkan.VkSurfaceCapabilitiesKHRReturns what this surface supports: image count bounds, extent bounds, and transforms.Returns the pixel format and colour space chosen for this surface.abstract longReturns the underlying Vulkan handle.
-
Field Details
-
vulkanModulePhysicalDevice
The physical device the surface's capabilities are queried against. -
logger
The logger this surface writes its diagnostics to.
-
-
Constructor Details
-
VulkanRenderModuleSurface
public VulkanRenderModuleSurface(VulkanModulePhysicalDevice vulkanModulePhysicalDevice, Logger logger) Creates a surface bound to the given physical device.- Parameters:
vulkanModulePhysicalDevice- the device to query surface support againstlogger- the logger to write surface diagnostics to
-
-
Method Details
-
cleanup
public abstract void cleanup()Destroys the surface and releases the platform resources behind it. -
getSurfaceCaps
public abstract org.lwjgl.vulkan.VkSurfaceCapabilitiesKHR getSurfaceCaps()Returns what this surface supports: image count bounds, extent bounds, and transforms.A swap chain must be built within these limits.
- Returns:
- the surface capabilities
-
getSurfaceFormat
Returns the pixel format and colour space chosen for this surface.- Returns:
- the negotiated surface format
-
calcSurfaceFormat
Picks a format from those the surface advertises.Prefers 32-bit BGRA in the sRGB non-linear colour space, which is what a display expects, and otherwise falls back to whatever the surface offers first.
- Returns:
- the chosen format and colour space
- Throws:
RuntimeException- if the surface advertises no formats at all
-
getVkSurface
public abstract long getVkSurface()Returns the underlying Vulkan handle.- Returns:
- the
VkSurfaceKHRhandle
-