Clone of mesa.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

vk_ext_khr_device_swapchain.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. //
  2. // File: vk_ext_khr_device_swapchain.h
  3. //
  4. /*
  5. ** Copyright (c) 2015 The Khronos Group Inc.
  6. **
  7. ** Permission is hereby granted, free of charge, to any person obtaining a
  8. ** copy of this software and/or associated documentation files (the
  9. ** "Materials"), to deal in the Materials without restriction, including
  10. ** without limitation the rights to use, copy, modify, merge, publish,
  11. ** distribute, sublicense, and/or sell copies of the Materials, and to
  12. ** permit persons to whom the Materials are furnished to do so, subject to
  13. ** the following conditions:
  14. **
  15. ** The above copyright notice and this permission notice shall be included
  16. ** in all copies or substantial portions of the Materials.
  17. **
  18. ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  21. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  22. ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  25. */
  26. #ifndef __VK_EXT_KHR_DEVICE_SWAPCHAIN_H__
  27. #define __VK_EXT_KHR_DEVICE_SWAPCHAIN_H__
  28. #include "vulkan.h"
  29. #define VK_EXT_KHR_DEVICE_SWAPCHAIN_REVISION 53
  30. #define VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NUMBER 2
  31. #define VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NAME "VK_EXT_KHR_device_swapchain"
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif // __cplusplus
  36. // ------------------------------------------------------------------------------------------------
  37. // Objects
  38. VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR);
  39. // ------------------------------------------------------------------------------------------------
  40. // Enumeration constants
  41. #define VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id)))
  42. #define VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id)))
  43. // Extend VkStructureType enum with extension specific constants
  44. #define VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 0)
  45. #define VK_STRUCTURE_TYPE_PRESENT_INFO_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 1)
  46. // Extend VkImageLayout enum with extension specific constants
  47. #define VK_IMAGE_LAYOUT_PRESENT_SOURCE_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkImageLayout, 2)
  48. // Extend VkResult enum with extension specific constants
  49. // Return codes for successful operation execution
  50. #define VK_SUBOPTIMAL_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM_POSITIVE(VkResult, 3)
  51. // Error codes
  52. #define VK_ERROR_OUT_OF_DATE_KHR VK_EXT_KHR_DEVICE_SWAPCHAIN_ENUM(VkResult, 4)
  53. // ------------------------------------------------------------------------------------------------
  54. // Enumerations
  55. typedef enum {
  56. VK_PRESENT_MODE_IMMEDIATE_KHR = 0,
  57. VK_PRESENT_MODE_MAILBOX_KHR = 1,
  58. VK_PRESENT_MODE_FIFO_KHR = 2,
  59. VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR,
  60. VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_KHR,
  61. VK_PRESENT_MODE_NUM = (VK_PRESENT_MODE_FIFO_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
  62. VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF
  63. } VkPresentModeKHR;
  64. typedef enum {
  65. VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
  66. VK_COLORSPACE_NUM = (VK_COLORSPACE_SRGB_NONLINEAR_KHR - VK_COLORSPACE_SRGB_NONLINEAR_KHR + 1),
  67. VK_COLORSPACE_MAX_ENUM_KHR = 0x7FFFFFFF
  68. } VkColorSpaceKHR;
  69. // ------------------------------------------------------------------------------------------------
  70. // Flags
  71. // ------------------------------------------------------------------------------------------------
  72. // Structures
  73. typedef struct {
  74. uint32_t minImageCount; // Supported minimum number of images for the surface
  75. uint32_t maxImageCount; // Supported maximum number of images for the surface, 0 for unlimited
  76. VkExtent2D currentExtent; // Current image width and height for the surface, (-1, -1) if undefined
  77. VkExtent2D minImageExtent; // Supported minimum image width and height for the surface
  78. VkExtent2D maxImageExtent; // Supported maximum image width and height for the surface
  79. VkSurfaceTransformFlagsKHR supportedTransforms;// 1 or more bits representing the transforms supported
  80. VkSurfaceTransformKHR currentTransform; // The surface's current transform relative to the device's natural orientation
  81. uint32_t maxImageArraySize; // Supported maximum number of image layers for the surface
  82. VkImageUsageFlags supportedUsageFlags;// Supported image usage flags for the surface
  83. } VkSurfacePropertiesKHR;
  84. typedef struct {
  85. VkFormat format; // Supported pair of rendering format
  86. VkColorSpaceKHR colorSpace; // and colorspace for the surface
  87. } VkSurfaceFormatKHR;
  88. typedef struct {
  89. VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
  90. const void* pNext; // Pointer to next structure
  91. const VkSurfaceDescriptionKHR* pSurfaceDescription;// describes the swap chain's target surface
  92. uint32_t minImageCount; // Minimum number of presentation images the application needs
  93. VkFormat imageFormat; // Format of the presentation images
  94. VkColorSpaceKHR imageColorSpace; // Colorspace of the presentation images
  95. VkExtent2D imageExtent; // Dimensions of the presentation images
  96. VkImageUsageFlags imageUsageFlags; // Bits indicating how the presentation images will be used
  97. VkSurfaceTransformKHR preTransform; // The transform, relative to the device's natural orientation, applied to the image content prior to presentation
  98. uint32_t imageArraySize; // Determines the number of views for multiview/stereo presentation
  99. VkSharingMode sharingMode; // Sharing mode used for the presentation images
  100. uint32_t queueFamilyCount; // Number of queue families having access to the images in case of concurrent sharing mode
  101. const uint32_t* pQueueFamilyIndices; // Array of queue family indices having access to the images in case of concurrent sharing mode
  102. VkPresentModeKHR presentMode; // Which presentation mode to use for presents on this swap chain
  103. VkSwapchainKHR oldSwapchain; // Existing swap chain to replace, if any
  104. VkBool32 clipped; // Specifies whether presentable images may be affected by window clip regions
  105. } VkSwapchainCreateInfoKHR;
  106. typedef struct {
  107. VkStructureType sType; // Must be VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
  108. const void* pNext; // Pointer to next structure
  109. uint32_t swapchainCount; // Number of swap chains to present in this call
  110. const VkSwapchainKHR* swapchains; // Swap chains to present an image from
  111. const uint32_t* imageIndices; // Indices of which swapchain images to present
  112. } VkPresentInfoKHR;
  113. // ------------------------------------------------------------------------------------------------
  114. // Function types
  115. typedef VkResult (VKAPI_PTR *PFN_vkGetSurfacePropertiesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkSurfacePropertiesKHR* pSurfaceProperties);
  116. typedef VkResult (VKAPI_PTR *PFN_vkGetSurfaceFormatsKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkSurfaceFormatKHR* pSurfaceFormats);
  117. typedef VkResult (VKAPI_PTR *PFN_vkGetSurfacePresentModesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkPresentModeKHR* pPresentModes);
  118. typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, VkSwapchainKHR* pSwapchain);
  119. typedef VkResult (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain);
  120. typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pCount, VkImage* pSwapchainImages);
  121. typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, uint32_t* pImageIndex);
  122. typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, VkPresentInfoKHR* pPresentInfo);
  123. // ------------------------------------------------------------------------------------------------
  124. // Function prototypes
  125. #ifdef VK_PROTOTYPES
  126. VKAPI_ATTR VkResult VKAPI_CALL vkGetSurfacePropertiesKHR(
  127. VkDevice device,
  128. const VkSurfaceDescriptionKHR* pSurfaceDescription,
  129. VkSurfacePropertiesKHR* pSurfaceProperties);
  130. VKAPI_ATTR VkResult VKAPI_CALL vkGetSurfaceFormatsKHR(
  131. VkDevice device,
  132. const VkSurfaceDescriptionKHR* pSurfaceDescription,
  133. uint32_t* pCount,
  134. VkSurfaceFormatKHR* pSurfaceFormats);
  135. VKAPI_ATTR VkResult VKAPI_CALL vkGetSurfacePresentModesKHR(
  136. VkDevice device,
  137. const VkSurfaceDescriptionKHR* pSurfaceDescription,
  138. uint32_t* pCount,
  139. VkPresentModeKHR* pPresentModes);
  140. VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
  141. VkDevice device,
  142. const VkSwapchainCreateInfoKHR* pCreateInfo,
  143. VkSwapchainKHR* pSwapchain);
  144. VKAPI_ATTR VkResult VKAPI_CALL vkDestroySwapchainKHR(
  145. VkDevice device,
  146. VkSwapchainKHR swapchain);
  147. VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(
  148. VkDevice device,
  149. VkSwapchainKHR swapchain,
  150. uint32_t* pCount,
  151. VkImage* pSwapchainImages);
  152. VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(
  153. VkDevice device,
  154. VkSwapchainKHR swapchain,
  155. uint64_t timeout,
  156. VkSemaphore semaphore,
  157. uint32_t* pImageIndex);
  158. VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(
  159. VkQueue queue,
  160. VkPresentInfoKHR* pPresentInfo);
  161. #endif // VK_PROTOTYPES
  162. #ifdef __cplusplus
  163. } // extern "C"
  164. #endif // __cplusplus
  165. #endif // __VK_EXT_KHR_SWAPCHAIN_H__