Class KHRSurface
- java.lang.Object
-
- org.lwjgl.vulkan.KHRSurface
-
public class KHRSurface extends java.lang.Object
TheVK_KHR_surface
extension is an instance extension. It introducesVkSurfaceKHR
objects, which abstract native platform surface or window objects for use with Vulkan. It also provides a way to determine whether a queue family in a physical device supports presenting to particular surface.Separate extensions for each each platform provide the mechanisms for creating
VkSurfaceKHRs
, but once created they may be used in this and other platform-independent extensions, in particular theVK_KHR_swapchain
extension.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
The presentation engine supports the sRGB colorspace.static int
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
The way in which the presentation engine treats the alpha channel in the images is unknown to the Vulkan API.static int
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
The alpha channel, if it exists, of the images is ignored in the compositing process.static int
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHRThe alpha channel, if it exists, of the images is respected in the compositing process.static int
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR
The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API.static int
VK_ERROR_SURFACE_LOST_KHR
A surface is no longer available.static java.lang.String
VK_KHR_SURFACE_EXTENSION_NAME
The extension name.static int
VK_KHR_SURFACE_SPEC_VERSION
The extension specification version.static int
VK_PRESENT_MODE_FIFO_KHR
VK_PRESENT_MODE_FIFO_RELAXED_KHRThe presentation engine waits for the next vertical blanking period to update the current image.static int
VK_PRESENT_MODE_IMMEDIATE_KHR
The presentation engine does not wait for a vertical blanking period to update the current image, meaning this mode may result in visible tearing.static int
VK_PRESENT_MODE_MAILBOX_KHR
The presentation engine waits for the next vertical blanking period to update the current image.static int
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR
The image content is mirrored horizontally.static int
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR
The image content is mirrored horizontally, then rotated 180 degrees clockwise.static int
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR
The image content is mirrored horizontally, then rotated 270 degrees clockwise.static int
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR
The image content is mirrored horizontally, then rotated 90 degrees clockwise.static int
VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
The image content is presented without being transformed.static int
VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR
The presentation transform is not specified, and is instead determined by platform-specific considerations and mechanisms outside Vulkan.static int
VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR
The image content is rotated 180 degrees clockwise.static int
VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR
The image content is rotated 270 degrees clockwise.static int
VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR
The image content is rotated 90 degrees clockwise.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static void
vkDestroySurfaceKHR(VkInstance instance, long surface, VkAllocationCallbacks pAllocator)
Destroys aVkSurfaceKHR
object.static int
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, long surface, VkSurfaceCapabilitiesKHR pSurfaceCapabilities)
Queries the basic capabilities of a surface, needed in order to create a swapchain.static int
vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, long surface, int[] pSurfaceFormatCount, VkSurfaceFormatKHR.Buffer pSurfaceFormats)
Array version of:GetPhysicalDeviceSurfaceFormatsKHR
static int
vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, long surface, java.nio.IntBuffer pSurfaceFormatCount, VkSurfaceFormatKHR.Buffer pSurfaceFormats)
Queries the supported swapchain format-colorspace pairs for a surface.static int
vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, long surface, int[] pPresentModeCount, int[] pPresentModes)
Array version of:GetPhysicalDeviceSurfacePresentModesKHR
static int
vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, long surface, java.nio.IntBuffer pPresentModeCount, java.nio.IntBuffer pPresentModes)
Queries the supported presentation modes for a surface.static int
vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, int queueFamilyIndex, long surface, int[] pSupported)
Array version of:GetPhysicalDeviceSurfaceSupportKHR
static int
vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, int queueFamilyIndex, long surface, java.nio.IntBuffer pSupported)
Determines whether a queue family of a physical device supports presentation to a given surface.
-
-
-
Field Detail
-
VK_KHR_SURFACE_SPEC_VERSION
public static final int VK_KHR_SURFACE_SPEC_VERSION
The extension specification version.- See Also:
- Constant Field Values
-
VK_KHR_SURFACE_EXTENSION_NAME
public static final java.lang.String VK_KHR_SURFACE_EXTENSION_NAME
The extension name.- See Also:
- Constant Field Values
-
VK_ERROR_SURFACE_LOST_KHR
public static final int VK_ERROR_SURFACE_LOST_KHR
A surface is no longer available.- See Also:
- Constant Field Values
-
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR
public static final int VK_ERROR_NATIVE_WINDOW_IN_USE_KHR
The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API.- See Also:
- Constant Field Values
-
VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
public static final int VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
The presentation engine supports the sRGB colorspace.- See Also:
- Constant Field Values
-
VK_PRESENT_MODE_IMMEDIATE_KHR
public static final int VK_PRESENT_MODE_IMMEDIATE_KHR
The presentation engine does not wait for a vertical blanking period to update the current image, meaning this mode may result in visible tearing. No internal queuing of presentation requests is needed, as the requests are applied immediately.- See Also:
- Constant Field Values
-
VK_PRESENT_MODE_MAILBOX_KHR
public static final int VK_PRESENT_MODE_MAILBOX_KHR
The presentation engine waits for the next vertical blanking period to update the current image. Tearing cannot be observed. An internal single-entry queue is used to hold pending presentation requests. If the queue is full when a new presentation request is received, the new request replaces the existing entry, and any images associated with the prior entry become available for re-use by the application. One request is removed from the queue and processed during each vertical blanking period in which the queue is non-empty.- See Also:
- Constant Field Values
-
VK_PRESENT_MODE_FIFO_KHR
public static final int VK_PRESENT_MODE_FIFO_KHR
The presentation engine waits for the next vertical blanking period to update the current image. Tearing cannot be observed. An internal queue containing(numSwapchainImages - 1)
entries, wherenumSwapchainImages
is the number of presentable images in the swapchain, is used to hold pending presentation requests. New requests are appended to the end of the queue, and one request is removed from the beginning of the queue and processed during each vertical blanking period in which the queue is non-empty. This is the only value ofpresentMode
that is required to be supported.- See Also:
- Constant Field Values
-
VK_PRESENT_MODE_FIFO_RELAXED_KHR
public static final int VK_PRESENT_MODE_FIFO_RELAXED_KHR
The presentation engine waits for the next vertical blanking period to update the current image. If a vertical blanking period has already passed since the last update of the current image then the presentation engine does not wait for another vertical blanking period for the update, meaning this mode may result in visible tearing in this case. An internal queue containingnumSwapchainImages − 1
entries, wherenumSwapchainImages
is the number of presentable images in the swapchain, is used to hold pending presentation requests. New requests are appended to the end of the queue, and one request is removed from the beginning of the queue and processed during or after each vertical blanking period in which the queue is non-empty.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
The image content is presented without being transformed.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR
The image content is rotated 90 degrees clockwise.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR
The image content is rotated 180 degrees clockwise.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR
The image content is rotated 270 degrees clockwise.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR
The image content is mirrored horizontally.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR
The image content is mirrored horizontally, then rotated 90 degrees clockwise.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR
The image content is mirrored horizontally, then rotated 180 degrees clockwise.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR
The image content is mirrored horizontally, then rotated 270 degrees clockwise.- See Also:
- Constant Field Values
-
VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR
public static final int VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR
The presentation transform is not specified, and is instead determined by platform-specific considerations and mechanisms outside Vulkan.- See Also:
- Constant Field Values
-
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
public static final int VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
The alpha channel, if it exists, of the images is ignored in the compositing process. Instead, the image is treated as if it has a constant alpha of 1.0.- See Also:
- Constant Field Values
-
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR
public static final int VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR
The alpha channel, if it exists, of the images is respected in the compositing process. The non-alpha channels of the image are expected to already be multiplied by the alpha channel by the application.- See Also:
- Constant Field Values
-
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR
public static final int VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR
The alpha channel, if it exists, of the images is respected in the compositing process. The non-alpha channels of the image are not expected to already be multiplied by the alpha channel by the application; instead, the compositor will multiply the non-alpha channels of the image by the alpha channel during compositing.- See Also:
- Constant Field Values
-
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
public static final int VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
The way in which the presentation engine treats the alpha channel in the images is unknown to the Vulkan API. Instead, the application is responsible for setting the composite alpha blending mode using native window system commands. If the application does not set the blending mode using native window system commands, then a platform-specific default will be used.- See Also:
- Constant Field Values
-
-
Method Detail
-
vkDestroySurfaceKHR
public static void vkDestroySurfaceKHR(VkInstance instance, long surface, VkAllocationCallbacks pAllocator)
Destroys aVkSurfaceKHR
object.Several WSI functions return
ERROR_SURFACE_LOST_KHR
if the surface becomes no longer available. After such an error, the surface (and any child swapchain, if one exists) should be destroyed, as there is no way to restore them to a not-lost state. Applications may attempt to create a newVkSurfaceKHR
using the same native platform window object, but whether such re-creation will succeed is platform-dependent and may depend on the reason the surface became unavailable. A lost surface does not otherwise cause devices to be lost.Destroying a
VkSurfaceKHR
merely severs the connection between Vulkan and the native surface, and doesn’t imply destroying the native surface, closing a window, or similar behavior.Valid Usage
instance
must be a validVkInstance
handle- If
surface
is notNULL_HANDLE
,surface
must be a validVkSurfaceKHR
handle - If
pAllocator
is notNULL
,pAllocator
must be a pointer to a validVkAllocationCallbacks
structure - If
surface
is a valid handle, it must have been created, allocated or retrieved frominstance
- All
VkSwapchainKHR
objects created forsurface
must have been destroyed prior to destroyingsurface
- If
VkAllocationCallbacks
were provided whensurface
was created, a compatible set of callbacks must be provided here - If no
VkAllocationCallbacks
were provided whensurface
was created,pAllocator
must beNULL
Host Synchronization
- Host access to
surface
must be externally synchronized
- Parameters:
instance
- the instance used to create the surfacesurface
- the surface to destroypAllocator
- controls host memory allocation
-
vkGetPhysicalDeviceSurfaceSupportKHR
public static int vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, int queueFamilyIndex, long surface, java.nio.IntBuffer pSupported)
Determines whether a queue family of a physical device supports presentation to a given surface.Valid Usage
physicalDevice
must be a validVkPhysicalDevice
handlesurface
must be a validVkSurfaceKHR
handlepSupported
must be a pointer to aVkBool32
value- Each of
physicalDevice
andsurface
must have been created, allocated or retrieved from the sameVkInstance
queueFamilyIndex
must be less thanpQueueFamilyPropertyCount
returned byGetPhysicalDeviceQueueFamilyProperties
for the givenphysicalDevice
-
vkGetPhysicalDeviceSurfaceCapabilitiesKHR
public static int vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, long surface, VkSurfaceCapabilitiesKHR pSurfaceCapabilities)
Queries the basic capabilities of a surface, needed in order to create a swapchain.Valid Usage
physicalDevice
must be a validVkPhysicalDevice
handlesurface
must be a validVkSurfaceKHR
handlepSurfaceCapabilities
must be a pointer to aVkSurfaceCapabilitiesKHR
structure- Each of
physicalDevice
andsurface
must have been created, allocated or retrieved from the sameVkInstance
- Parameters:
physicalDevice
- the physical device that will be associated with the swapchain to be createdsurface
- the surface that will be associated with the swapchainpSurfaceCapabilities
- a pointer to an instance of theVkSurfaceCapabilitiesKHR
structure that will be filled with information
-
vkGetPhysicalDeviceSurfaceFormatsKHR
public static int vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, long surface, java.nio.IntBuffer pSurfaceFormatCount, VkSurfaceFormatKHR.Buffer pSurfaceFormats)
Queries the supported swapchain format-colorspace pairs for a surface.If
pSurfaceFormats
isNULL
, then the number of format pairs supported for the given surface is returned inpSurfaceFormatCount
. Otherwise,pSurfaceFormatCount
must point to a variable set by the user to the number of elements in thepSurfaceFormats
array, and on return the variable is overwritten with the number of structures actually written topSurfaceFormats
. If the value ofpSurfaceFormatCount
is less than the number of queue families supported, at mostpSurfaceFormatCount
structures will be written. IfpSurfaceFormatCount
is smaller than the number of format pairs supported for the givensurface
,INCOMPLETE
will be returned instead ofSUCCESS
to indicate that not all the available values were returned.Valid Usage
physicalDevice
must be a validVkPhysicalDevice
handlesurface
must be a validVkSurfaceKHR
handlepSurfaceFormatCount
must be a pointer to auint32_t
value- If the value referenced by
pSurfaceFormatCount
is not 0, andpSurfaceFormats
is notNULL
,pSurfaceFormats
must be a pointer to an array ofpSurfaceFormatCount
VkSurfaceFormatKHR
structures - Each of
physicalDevice
andsurface
must have been created, allocated or retrieved from the sameVkInstance
- Parameters:
physicalDevice
- the physical device that will be associated with the swapchain to be createdsurface
- the surface that will be associated with the swapchainpSurfaceFormatCount
- a pointer to an integer related to the number of format pairs available or queriedpSurfaceFormats
- eitherNULL
or a pointer to an array ofVkSurfaceFormatKHR
structures
-
vkGetPhysicalDeviceSurfacePresentModesKHR
public static int vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, long surface, java.nio.IntBuffer pPresentModeCount, java.nio.IntBuffer pPresentModes)
Queries the supported presentation modes for a surface.If
pPresentModes
isNULL
, then the number of presentation modes supported for the given surface is returned inpPresentModeCount
. Otherwise,pPresentModeCount
must point to a variable set by the user to the number of elements in thepPresentModes
array, and on return the variable is overwritten with the number of structures actually written topPresentModes
. If the value ofpPresentModeCount
is less than the number of presentation modes supported, at mostpPresentModeCount
structures will be written. IfpPresentModeCount
is smaller than the number of presentation modes supported for the givensurfac
e,INCOMPLETE
will be returned instead ofSUCCESS
to indicate that not all the available values were returned.Valid Usage
physicalDevice
must be a validVkPhysicalDevice
handlesurface
must be a validVkSurfaceKHR
handlepPresentModeCount
must be a pointer to auint32_t
value- If the value referenced by
pPresentModeCount
is not 0, andpPresentModes
is notNULL
,pPresentModes
must be a pointer to an array ofpPresentModeCount
VkPresentModeKHR
values - Each of
physicalDevice
andsurface
must have been created, allocated or retrieved from the sameVkInstance
- Parameters:
physicalDevice
- the physical device that will be associated with the swapchain to be createdsurface
- the surface that will be associated with the swapchainpPresentModeCount
- a pointer to an integer related to the number of format pairs available or queriedpPresentModes
- eitherNULL
or a pointer to an array ofVkPresentModeKHR
values
-
vkGetPhysicalDeviceSurfaceSupportKHR
public static int vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, int queueFamilyIndex, long surface, int[] pSupported)
Array version of:GetPhysicalDeviceSurfaceSupportKHR
-
vkGetPhysicalDeviceSurfaceFormatsKHR
public static int vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, long surface, int[] pSurfaceFormatCount, VkSurfaceFormatKHR.Buffer pSurfaceFormats)
Array version of:GetPhysicalDeviceSurfaceFormatsKHR
-
vkGetPhysicalDeviceSurfacePresentModesKHR
public static int vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, long surface, int[] pPresentModeCount, int[] pPresentModes)
Array version of:GetPhysicalDeviceSurfacePresentModesKHR
-
-