From 3ead413d3f9328eb7855ea538dc559bb98665608 Mon Sep 17 00:00:00 2001 From: Ian Elliott Date: Fri, 21 Aug 2015 13:43:31 -0600 Subject: WSI: Update headers for WSI swapchain extensions (versions 47 & 15). BIG RENAME: The names change for the extensions, header files, enums, functions, etc. --- include/vk_ext_khr_device_swapchain.h | 210 +++++++++++++++++++++++++++++ include/vk_ext_khr_swapchain.h | 153 +++++++++++++++++++++ include/vk_wsi_device_swapchain.h | 242 ---------------------------------- include/vk_wsi_swapchain.h | 133 ------------------- 4 files changed, 363 insertions(+), 375 deletions(-) create mode 100644 include/vk_ext_khr_device_swapchain.h create mode 100644 include/vk_ext_khr_swapchain.h delete mode 100644 include/vk_wsi_device_swapchain.h delete mode 100644 include/vk_wsi_swapchain.h diff --git a/include/vk_ext_khr_device_swapchain.h b/include/vk_ext_khr_device_swapchain.h new file mode 100644 index 00000000..dc08e356 --- /dev/null +++ b/include/vk_ext_khr_device_swapchain.h @@ -0,0 +1,210 @@ +// +// File: vk_ext_khr_device_swapchain.h +// +/* +** Copyright (c) 2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __VK_EXT_KHR_DEVICE_SWAPCHAIN_H__ +#define __VK_EXT_KHR_DEVICE_SWAPCHAIN_H__ + +#include "vulkan.h" + +#define VK_EXT_KHR_DEVICE_SWAPCHAIN_VERSION VK_MAKE_VERSION(0, 47, 0) +#define VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NUMBER 2 +#define VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NAME "VK_EXT_KHR_device_swapchain" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// ------------------------------------------------------------------------------------------------ +// Objects + +VK_DEFINE_NONDISP_HANDLE(VkSwapchainKHR); + +// ------------------------------------------------------------------------------------------------ +// Enumeration constants + +#define VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id))) +#define VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id))) + +// Extend VkStructureType enum with extension specific constants +#define VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 0) +#define VK_STRUCTURE_TYPE_PRESENT_INFO_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 1) + +// Extend VkImageLayout enum with extension specific constants +#define VK_IMAGE_LAYOUT_PRESENT_SOURCE_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkImageLayout, 2) + +// Extend VkResult enum with extension specific constants +// Return codes for successful operation execution +#define VK_SUBOPTIMAL_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM_POSITIVE(VkResult, 3) +// Error codes +#define VK_ERROR_OUT_OF_DATE_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkResult, 4) + +// ------------------------------------------------------------------------------------------------ +// Enumerations + +typedef enum { + VK_PRESENT_MODE_IMMEDIATE_KHR = 0, + VK_PRESENT_MODE_MAILBOX_KHR = 1, + VK_PRESENT_MODE_FIFO_KHR = 2, + VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR, + VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_KHR, + VK_PRESENT_MODE_NUM = (VK_PRESENT_MODE_FIFO_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1), + VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkPresentModeKHR; + +typedef enum { + VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000, + VK_COLORSPACE_NUM = (VK_COLORSPACE_SRGB_NONLINEAR_KHR - VK_COLORSPACE_SRGB_NONLINEAR_KHR + 1), + VK_COLORSPACE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkColorSpaceKHR; + +// ------------------------------------------------------------------------------------------------ +// Flags + +// ------------------------------------------------------------------------------------------------ +// Structures + +typedef struct { + uint32_t minImageCount; // Supported minimum number of images for the surface + uint32_t maxImageCount; // Supported maximum number of images for the surface, 0 for unlimited + + VkExtent2D currentExtent; // Current image width and height for the surface, (-1, -1) if undefined + VkExtent2D minImageExtent; // Supported minimum image width and height for the surface + VkExtent2D maxImageExtent; // Supported maximum image width and height for the surface + + VkSurfaceTransformFlagsKHR supportedTransforms;// 1 or more bits representing the transforms supported + VkSurfaceTransformKHR currentTransform; // The surface's current transform relative to the device's natural orientation + + uint32_t maxImageArraySize; // Supported maximum number of image layers for the surface + + VkImageUsageFlags supportedUsageFlags;// Supported image usage flags for the surface +} VkSurfacePropertiesKHR; + +typedef struct { + VkFormat format; // Supported pair of rendering format + VkColorSpaceKHR colorSpace; // and colorspace for the surface +} VkSurfaceFormatKHR; + +typedef struct { + VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_KHR + const void* pNext; // Pointer to next structure + + const VkSurfaceDescriptionKHR* pSurfaceDescription;// describes the swap chain's target surface + + uint32_t minImageCount; // Minimum number of presentation images the application needs + VkFormat imageFormat; // Format of the presentation images + VkColorSpaceKHR imageColorSpace; // Colorspace of the presentation images + VkExtent2D imageExtent; // Dimensions of the presentation images + VkImageUsageFlags imageUsageFlags; // Bits indicating how the presentation images will be used + VkSurfaceTransformKHR preTransform; // The transform, relative to the device's natural orientation, applied to the image content prior to presentation + uint32_t imageArraySize; // Determines the number of views for multiview/stereo presentation + + VkSharingMode sharingMode; // Sharing mode used for the presentation images + uint32_t queueFamilyCount; // Number of queue families having access to the images in case of concurrent sharing mode + const uint32_t* pQueueFamilyIndices; // Array of queue family indices having access to the images in case of concurrent sharing mode + + VkPresentModeKHR presentMode; // Which presentation mode to use for presents on this swap chain + + VkSwapchainKHR oldSwapchain; // Existing swap chain to replace, if any + + VkBool32 clipped; // Specifies whether presentable images may be affected by window clip regions +} VkSwapchainCreateInfoKHR; + +typedef struct { + VkStructureType sType; // Must be VK_STRUCTURE_TYPE_PRESENT_INFO_KHR + const void* pNext; // Pointer to next structure + uint32_t swapchainCount; // Number of swap chains to present in this call + const VkSwapchainKHR* swapchains; // Swap chains to present an image from + const uint32_t* imageIndices; // Indices of which swapchain images to present +} VkPresentInfoKHR; + +// ------------------------------------------------------------------------------------------------ +// Function types + +typedef VkResult (VKAPI *PFN_vkGetSurfacePropertiesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkSurfacePropertiesKHR* pSurfaceProperties); +typedef VkResult (VKAPI *PFN_vkGetSurfaceFormatsKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkSurfaceFormatKHR* pSurfaceFormats); +typedef VkResult (VKAPI *PFN_vkGetSurfacePresentModesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkPresentModeKHR* pPresentModes); +typedef VkResult (VKAPI *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, VkSwapchainKHR* pSwapchain); +typedef VkResult (VKAPI *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain); +typedef VkResult (VKAPI *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pCount, VkImage* pSwapchainImages); +typedef VkResult (VKAPI *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, uint32_t* pImageIndex); +typedef VkResult (VKAPI *PFN_vkQueuePresentKHR)(VkQueue queue, VkPresentInfoKHR* pPresentInfo); + +// ------------------------------------------------------------------------------------------------ +// Function prototypes + +#ifdef VK_PROTOTYPES + +VkResult VKAPI vkGetSurfacePropertiesKHR( + VkDevice device, + const VkSurfaceDescriptionKHR* pSurfaceDescription, + VkSurfacePropertiesKHR* pSurfaceProperties); + +VkResult VKAPI vkGetSurfaceFormatsKHR( + VkDevice device, + const VkSurfaceDescriptionKHR* pSurfaceDescription, + uint32_t* pCount, + VkSurfaceFormatKHR* pSurfaceFormats); + +VkResult VKAPI vkGetSurfacePresentModesKHR( + VkDevice device, + const VkSurfaceDescriptionKHR* pSurfaceDescription, + uint32_t* pCount, + VkPresentModeKHR* pPresentModes); + +VkResult VKAPI vkCreateSwapchainKHR( + VkDevice device, + const VkSwapchainCreateInfoKHR* pCreateInfo, + VkSwapchainKHR* pSwapchain); + +VkResult VKAPI vkDestroySwapchainKHR( + VkDevice device, + VkSwapchainKHR swapchain); + +VkResult VKAPI vkGetSwapchainImagesKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pCount, + VkImage* pSwapchainImages); + +VkResult VKAPI vkAcquireNextImageKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint64_t timeout, + VkSemaphore semaphore, + uint32_t* pImageIndex); + +VkResult VKAPI vkQueuePresentKHR( + VkQueue queue, + VkPresentInfoKHR* pPresentInfo); + +#endif // VK_PROTOTYPES + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // __VK_EXT_KHR_SWAPCHAIN_H__ diff --git a/include/vk_ext_khr_swapchain.h b/include/vk_ext_khr_swapchain.h new file mode 100644 index 00000000..fbf4ea7d --- /dev/null +++ b/include/vk_ext_khr_swapchain.h @@ -0,0 +1,153 @@ +// +// File: vk_ext_khr_swapchain.h +// +/* +** Copyright (c) 2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __VK_EXT_KHR_SWAPCHAIN_H__ +#define __VK_EXT_KHR_SWAPCHAIN_H__ + +#include "vulkan.h" + +#define VK_EXT_KHR_SWAPCHAIN_VERSION VK_MAKE_VERSION(0, 15, 0) +#define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER 1 +#define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME "VK_EXT_KHR_swapchain" + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +// ------------------------------------------------------------------------------------------------ +// Objects + +// ------------------------------------------------------------------------------------------------ +// Enumeration constants + +#define VK_EXT_KHR_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id))) +#define VK_EXT_KHR_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id))) + +// Extend VkStructureType enum with extension specific constants +#define VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_KHR VK_EXT_KHR_SWAPCHAIN_ENUM(VkStructureType, 0) + +// ------------------------------------------------------------------------------------------------ +// Enumerations + +typedef enum { + VK_SURFACE_TRANSFORM_NONE_KHR = 0, + VK_SURFACE_TRANSFORM_ROT90_KHR = 1, + VK_SURFACE_TRANSFORM_ROT180_KHR = 2, + VK_SURFACE_TRANSFORM_ROT270_KHR = 3, + VK_SURFACE_TRANSFORM_HMIRROR_KHR = 4, + VK_SURFACE_TRANSFORM_HMIRROR_ROT90_KHR = 5, + VK_SURFACE_TRANSFORM_HMIRROR_ROT180_KHR = 6, + VK_SURFACE_TRANSFORM_HMIRROR_ROT270_KHR = 7, + VK_SURFACE_TRANSFORM_INHERIT_KHR = 8, +} VkSurfaceTransformKHR; + +typedef enum { + VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001, + VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002, + VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004, + VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008, + VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010, + VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020, + VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040, + VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080, + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, +} VkSurfaceTransformFlagBitsKHR; +typedef VkFlags VkSurfaceTransformFlagsKHR; + +typedef enum { + VK_PLATFORM_WIN32_KHR = 0, + VK_PLATFORM_X11_KHR = 1, + VK_PLATFORM_XCB_KHR = 2, + VK_PLATFORM_ANDROID_KHR = 3, + VK_PLATFORM_WAYLAND_KHR = 4, + VK_PLATFORM_MIR_KHR = 5, + VK_PLATFORM_BEGIN_RANGE_KHR = VK_PLATFORM_WIN32_KHR, + VK_PLATFORM_END_RANGE_KHR = VK_PLATFORM_MIR_KHR, + VK_PLATFORM_NUM_KHR = (VK_PLATFORM_MIR_KHR - VK_PLATFORM_WIN32_KHR + 1), + VK_PLATFORM_MAX_ENUM_KHR = 0x7FFFFFFF +} VkPlatformKHR; + +// ------------------------------------------------------------------------------------------------ +// Flags + +// ------------------------------------------------------------------------------------------------ +// Structures + +// Placeholder structure header for the different types of surface description structures +typedef struct { + VkStructureType sType; // Can be any of the VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_XXX_KHR constants + const void* pNext; // Pointer to next structure +} VkSurfaceDescriptionKHR; + +// Surface description structure for a native platform window surface +typedef struct { + VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_KHR + const void* pNext; // Pointer to next structure + VkPlatformKHR platform; // e.g. VK_PLATFORM_*_KHR + void* pPlatformHandle; + void* pPlatformWindow; +} VkSurfaceDescriptionWindowKHR; + +// pPlatformHandle points to this struct when platform is VK_PLATFORM_X11_KHR +#ifdef _X11_XLIB_H_ +typedef struct { + Display* dpy; // Display connection to an X server + Window root; // To identify the X screen +} VkPlatformHandleX11KHR; +#endif /* _X11_XLIB_H_ */ + +// pPlatformHandle points to this struct when platform is VK_PLATFORM_XCB_KHR +#ifdef __XCB_H__ +typedef struct { + xcb_connection_t* connection; // XCB connection to an X server + xcb_window_t root; // To identify the X screen +} VkPlatformHandleXcbKHR; +#endif /* __XCB_H__ */ + +// ------------------------------------------------------------------------------------------------ +// Function types + +typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkBool32* pSupported); + +// ------------------------------------------------------------------------------------------------ +// Function prototypes + +#ifdef VK_PROTOTYPES + +VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + const VkSurfaceDescriptionKHR* pSurfaceDescription, + VkBool32* pSupported); + +#endif // VK_PROTOTYPES + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // __VK_EXT_KHR_SWAPCHAIN_H__ diff --git a/include/vk_wsi_device_swapchain.h b/include/vk_wsi_device_swapchain.h deleted file mode 100644 index 6af785e0..00000000 --- a/include/vk_wsi_device_swapchain.h +++ /dev/null @@ -1,242 +0,0 @@ -// -// File: vk_wsi_device_swapchain.h -// -/* -** Copyright (c) 2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#ifndef __VK_WSI_DEVICE_SWAPCHAIN_H__ -#define __VK_WSI_DEVICE_SWAPCHAIN_H__ - -#include "vulkan.h" - -#define VK_WSI_DEVICE_SWAPCHAIN_REVISION 45 -#define VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NUMBER 2 -#define VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NAME "VK_WSI_device_swapchain" - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -// ------------------------------------------------------------------------------------------------ -// Objects - -VK_DEFINE_NONDISP_HANDLE(VkSwapChainWSI); - -// ------------------------------------------------------------------------------------------------ -// Enumeration constants - -#define VK_WSI_DEVICE_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id))) -#define VK_WSI_DEVICE_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id))) - -// Extend VkStructureType enum with extension specific constants -#define VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 0) -#define VK_STRUCTURE_TYPE_PRESENT_INFO_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 1) - -// Extend VkImageLayout enum with extension specific constants -#define VK_IMAGE_LAYOUT_PRESENT_SOURCE_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkImageLayout, 2) - -// Extend VkResult enum with extension specific constants -// Return codes for successful operation execution -#define VK_SUBOPTIMAL_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM_POSITIVE(VkResult, 3) -// Error codes -#define VK_ERROR_OUT_OF_DATE_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkResult, 4) - -// ------------------------------------------------------------------------------------------------ -// Enumerations - -typedef enum VkSurfaceTransformWSI_ -{ - VK_SURFACE_TRANSFORM_NONE_WSI = 0, - VK_SURFACE_TRANSFORM_ROT90_WSI = 1, - VK_SURFACE_TRANSFORM_ROT180_WSI = 2, - VK_SURFACE_TRANSFORM_ROT270_WSI = 3, - VK_SURFACE_TRANSFORM_HMIRROR_WSI = 4, - VK_SURFACE_TRANSFORM_HMIRROR_ROT90_WSI = 5, - VK_SURFACE_TRANSFORM_HMIRROR_ROT180_WSI = 6, - VK_SURFACE_TRANSFORM_HMIRROR_ROT270_WSI = 7, - VK_SURFACE_TRANSFORM_INHERIT_WSI = 8, -} VkSurfaceTransformWSI; - -typedef enum VkSurfaceTransformFlagBitsWSI_ -{ - VK_SURFACE_TRANSFORM_NONE_BIT_WSI = 0x00000001, - VK_SURFACE_TRANSFORM_ROT90_BIT_WSI = 0x00000002, - VK_SURFACE_TRANSFORM_ROT180_BIT_WSI = 0x00000004, - VK_SURFACE_TRANSFORM_ROT270_BIT_WSI = 0x00000008, - VK_SURFACE_TRANSFORM_HMIRROR_BIT_WSI = 0x00000010, - VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_WSI = 0x00000020, - VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_WSI = 0x00000040, - VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_WSI = 0x00000080, - VK_SURFACE_TRANSFORM_INHERIT_BIT_WSI = 0x00000100, -} VkSurfaceTransformFlagBitsWSI; -typedef VkFlags VkSurfaceTransformFlagsWSI; - -typedef enum VkPresentModeWSI_ -{ - VK_PRESENT_MODE_IMMEDIATE_WSI = 0, - VK_PRESENT_MODE_MAILBOX_WSI = 1, - VK_PRESENT_MODE_FIFO_WSI = 2, - VK_PRESENT_MODE_BEGIN_RANGE_WSI = VK_PRESENT_MODE_IMMEDIATE_WSI, - VK_PRESENT_MODE_END_RANGE_WSI = VK_PRESENT_MODE_FIFO_WSI, - VK_PRESENT_MODE_NUM = (VK_PRESENT_MODE_FIFO_WSI - VK_PRESENT_MODE_IMMEDIATE_WSI + 1), - VK_PRESENT_MODE_MAX_ENUM_WSI = 0x7FFFFFFF -} VkPresentModeWSI; - -typedef enum VkColorSpaceWSI_ -{ - VK_COLORSPACE_SRGB_NONLINEAR_WSI = 0x00000000, - VK_COLORSPACE_MAX_ENUM_WSI = 0x7FFFFFFF -} VkColorSpaceWSI; - -// ------------------------------------------------------------------------------------------------ -// Flags - -// ------------------------------------------------------------------------------------------------ -// Structures - -typedef struct VkSurfacePropertiesWSI_ -{ - uint32_t minImageCount; // Supported minimum number of images for the surface - uint32_t maxImageCount; // Supported maximum number of images for the surface, 0 for unlimited - - VkExtent2D currentExtent; // Current image width and height for the surface, (-1, -1) if undefined. - VkExtent2D minImageExtent; // Supported minimum image width and height for the surface - VkExtent2D maxImageExtent; // Supported maximum image width and height for the surface - - VkSurfaceTransformFlagsWSI supportedTransforms;// 1 or more bits representing the transforms supported - VkSurfaceTransformWSI currentTransform; // The surface's current transform relative to the device's natural orientation. - - uint32_t maxImageArraySize; // Supported maximum number of image layers for the surface - - VkImageUsageFlags supportedUsageFlags;// Supported image usage flags for the surface -} VkSurfacePropertiesWSI; - -typedef struct VkSurfaceFormatWSI_ -{ - VkFormat format; // Supported pair of rendering format - VkColorSpaceWSI colorSpace; // and colorspace for the surface -} VkSurfaceFormatWSI; - -typedef struct VkSwapChainCreateInfoWSI_ -{ - VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI - const void* pNext; // Pointer to next structure - - const VkSurfaceDescriptionWSI* pSurfaceDescription;// describes the swap chain's target surface - - uint32_t minImageCount; // Minimum number of presentation images the application needs - VkFormat imageFormat; // Format of the presentation images - VkColorSpaceWSI imageColorSpace; // Colorspace of the presentation images - VkExtent2D imageExtent; // Dimensions of the presentation images - VkImageUsageFlags imageUsageFlags; // Bits indicating how the presentation images will be used - VkSurfaceTransformWSI preTransform; // The transform, relative to the device's natural orientation, applied to the image content prior to presentation - uint32_t imageArraySize; // Determines the number of views for multiview/stereo presentation - - VkSharingMode sharingMode; // Sharing mode used for the presentation images - uint32_t queueFamilyCount; // Number of queue families having access to the images in case of concurrent sharing mode - const uint32_t* pQueueFamilyIndices; // Array of queue family indices having access to the images in case of concurrent sharing mode - - VkPresentModeWSI presentMode; // Which presentation mode to use for presents on this swap chain. - - VkSwapChainWSI oldSwapChain; // Existing swap chain to replace, if any. - - VkBool32 clipped; // Specifies whether presentable images may be affected by window clip regions. -} VkSwapChainCreateInfoWSI; - -typedef struct VkPresentInfoWSI_ -{ - VkStructureType sType; // Must be VK_STRUCTURE_TYPE_PRESENT_INFO_WSI - const void* pNext; // Pointer to next structure - uint32_t swapChainCount; // Number of swap chains to present in this call - const VkSwapChainWSI* swapChains; // Swap chains to present an image from. - const uint32_t* imageIndices; // Indices of which swapChain images to present -} VkPresentInfoWSI; - -// ------------------------------------------------------------------------------------------------ -// Function types - -typedef VkResult (VKAPI *PFN_vkGetSurfacePropertiesWSI)(VkDevice device, const VkSurfaceDescriptionWSI* pSurfaceDescription, VkSurfacePropertiesWSI* pSurfaceProperties); -typedef VkResult (VKAPI *PFN_vkGetSurfaceFormatsWSI)(VkDevice device, const VkSurfaceDescriptionWSI* pSurfaceDescription, uint32_t* pCount, VkSurfaceFormatWSI* pSurfaceFormats); -typedef VkResult (VKAPI *PFN_vkGetSurfacePresentModesWSI)(VkDevice device, const VkSurfaceDescriptionWSI* pSurfaceDescription, uint32_t* pCount, VkPresentModeWSI* pPresentModes); -typedef VkResult (VKAPI *PFN_vkCreateSwapChainWSI)(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain); -typedef VkResult (VKAPI *PFN_vkDestroySwapChainWSI)(VkDevice device, VkSwapChainWSI swapChain); -typedef VkResult (VKAPI *PFN_vkGetSwapChainImagesWSI)(VkDevice device, VkSwapChainWSI swapChain, uint32_t* pCount, VkImage* pSwapChainImages); -typedef VkResult (VKAPI *PFN_vkAcquireNextImageWSI)(VkDevice device, VkSwapChainWSI swapChain, uint64_t timeout, VkSemaphore semaphore, uint32_t* pImageIndex); -typedef VkResult (VKAPI *PFN_vkQueuePresentWSI)(VkQueue queue, VkPresentInfoWSI* pPresentInfo); - -// ------------------------------------------------------------------------------------------------ -// Function prototypes - -#ifdef VK_PROTOTYPES - -VkResult VKAPI vkGetSurfacePropertiesWSI( - VkDevice device, - const VkSurfaceDescriptionWSI* pSurfaceDescription, - VkSurfacePropertiesWSI* pSurfaceProperties); - -VkResult VKAPI vkGetSurfaceFormatsWSI( - VkDevice device, - const VkSurfaceDescriptionWSI* pSurfaceDescription, - uint32_t* pCount, - VkSurfaceFormatWSI* pSurfaceFormats); - -VkResult VKAPI vkGetSurfacePresentModesWSI( - VkDevice device, - const VkSurfaceDescriptionWSI* pSurfaceDescription, - uint32_t* pCount, - VkPresentModeWSI* pPresentModes); - -VkResult VKAPI vkCreateSwapChainWSI( - VkDevice device, - const VkSwapChainCreateInfoWSI* pCreateInfo, - VkSwapChainWSI* pSwapChain); - -VkResult VKAPI vkDestroySwapChainWSI( - VkDevice device, - VkSwapChainWSI swapChain); - -VkResult VKAPI vkGetSwapChainImagesWSI( - VkDevice device, - VkSwapChainWSI swapChain, - uint32_t* pCount, - VkImage* pSwapChainImages); - -VkResult VKAPI vkAcquireNextImageWSI( - VkDevice device, - VkSwapChainWSI swapChain, - uint64_t timeout, - VkSemaphore semaphore, - uint32_t* pImageIndex); - -VkResult VKAPI vkQueuePresentWSI( - VkQueue queue, - VkPresentInfoWSI* pPresentInfo); - -#endif // VK_PROTOTYPES - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // __VK_WSI_SWAPCHAIN_H__ diff --git a/include/vk_wsi_swapchain.h b/include/vk_wsi_swapchain.h deleted file mode 100644 index 010b285b..00000000 --- a/include/vk_wsi_swapchain.h +++ /dev/null @@ -1,133 +0,0 @@ -// -// File: vk_wsi_swapchain.h -// -/* -** Copyright (c) 2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#ifndef __VK_WSI_SWAPCHAIN_H__ -#define __VK_WSI_SWAPCHAIN_H__ - -#include "vulkan.h" - -#define VK_WSI_SWAPCHAIN_REVISION 13 -#define VK_WSI_SWAPCHAIN_EXTENSION_NUMBER 1 -#define VK_WSI_SWAPCHAIN_EXTENSION_NAME "VK_WSI_swapchain" - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -// ------------------------------------------------------------------------------------------------ -// Objects - -// ------------------------------------------------------------------------------------------------ -// Enumeration constants - -#define VK_WSI_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_WSI_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id))) -#define VK_WSI_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_WSI_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id))) - -// Extend VkStructureType enum with extension specific constants -#define VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI VK_WSI_SWAPCHAIN_ENUM(VkStructureType, 0) - -// ------------------------------------------------------------------------------------------------ -// Enumerations - -typedef enum VkPlatformWSI_ -{ - VK_PLATFORM_WIN32_WSI = 0, - VK_PLATFORM_X11_WSI = 1, - VK_PLATFORM_XCB_WSI = 2, - VK_PLATFORM_ANDROID_WSI = 3, - VK_PLATFORM_WAYLAND_WSI = 4, - VK_PLATFORM_MIR_WSI = 5, - VK_PLATFORM_BEGIN_RANGE_WSI = VK_PLATFORM_WIN32_WSI, - VK_PLATFORM_END_RANGE_WSI = VK_PLATFORM_MIR_WSI, - VK_PLATFORM_NUM_WSI = (VK_PLATFORM_MIR_WSI - VK_PLATFORM_WIN32_WSI + 1), - VK_PLATFORM_MAX_ENUM_WSI = 0x7FFFFFFF -} VkPlatformWSI; - -// ------------------------------------------------------------------------------------------------ -// Flags - -// ------------------------------------------------------------------------------------------------ -// Structures - -// pPlatformHandle points to this struct when platform is VK_PLATFORM_X11_WSI -#ifdef _X11_XLIB_H_ -typedef struct VkPlatformHandleX11WSI_ -{ - Display* dpy; // Display connection to an X server - Window root; // To identify the X screen -} VkPlatformHandleX11WSI; -#endif /* _X11_XLIB_H_ */ - -// pPlatformHandle points to this struct when platform is VK_PLATFORM_XCB_WSI -#ifdef __XCB_H__ -typedef struct VkPlatformHandleXcbWSI_ -{ - xcb_connection_t* connection; // XCB connection to an X server - xcb_window_t root; // To identify the X screen -} VkPlatformHandleXcbWSI; -#endif /* __XCB_H__ */ - -// Placeholder structure header for the different types of surface description structures -typedef struct VkSurfaceDescriptionWSI_ -{ - VkStructureType sType; // Can be any of the VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_XXX_WSI constants - const void* pNext; // Pointer to next structure -} VkSurfaceDescriptionWSI; - -// Surface description structure for a native platform window surface -typedef struct VkSurfaceDescriptionWindowWSI_ -{ - VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI - const void* pNext; // Pointer to next structure - VkPlatformWSI platform; // e.g. VK_PLATFORM_*_WSI - void* pPlatformHandle; - void* pPlatformWindow; -} VkSurfaceDescriptionWindowWSI; - -// ------------------------------------------------------------------------------------------------ -// Function types - -typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceSurfaceSupportWSI)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, const VkSurfaceDescriptionWSI* pSurfaceDescription, VkBool32* pSupported); - -// ------------------------------------------------------------------------------------------------ -// Function prototypes - -#ifdef VK_PROTOTYPES - -VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportWSI( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - const VkSurfaceDescriptionWSI* pSurfaceDescription, - VkBool32* pSupported); - -#endif // VK_PROTOTYPES - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // __VK_WSI_SWAPCHAIN_H__ -- cgit v1.2.3