1 // Copyright (C) 2018 The Android Open Source Project
2 // Copyright (C) 2018 Google Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 #pragma once
16
17 #include <vulkan/vulkan.h>
18
19 #ifdef __cplusplus
20 #include <algorithm>
21 extern "C" {
22 #endif
23
24 #define VK_ANDROID_native_buffer 1
25 #define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER 11
26
27 /* NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 6
28 *
29 * This version of the extension transitions from gralloc0 to gralloc1 usage
30 * flags (int -> 2x uint64_t). The WSI implementation will temporarily continue
31 * to fill out deprecated fields in VkNativeBufferANDROID, and will call the
32 * deprecated vkGetSwapchainGrallocUsageANDROID if the new
33 * vkGetSwapchainGrallocUsage2ANDROID is not supported. This transitionary
34 * backwards-compatibility support is temporary, and will likely be removed in
35 * (along with all gralloc0 support) in a future release.
36 */
37 #define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 7
38 #define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer"
39
40 #define VK_ANDROID_NATIVE_BUFFER_ENUM(type,id) ((type)(1000000000 + (1000 * (VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER - 1)) + (id)))
41 #define VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 0)
42 #define VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 1)
43 #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 2)
44
45 typedef enum VkSwapchainImageUsageFlagBitsANDROID {
46 VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID = 0x00000001,
47 VK_SWAPCHAIN_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
48 } VkSwapchainImageUsageFlagBitsANDROID;
49 typedef VkFlags VkSwapchainImageUsageFlagsANDROID;
50
51 typedef struct {
52 VkStructureType sType; // must be VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID
53 const void* pNext;
54
55 // Buffer handle and stride returned from gralloc alloc()
56 const uint32_t* handle;
57 int stride;
58
59 // Gralloc format and usage requested when the buffer was allocated.
60 int format;
61 int usage; // DEPRECATED in SPEC_VERSION 6
62 // -- Added in SPEC_VERSION 6 --
63 uint64_t consumer;
64 uint64_t producer;
65 } VkNativeBufferANDROID;
66
67 typedef struct {
68 VkStructureType sType; // must be VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID
69 const void* pNext;
70
71 VkSwapchainImageUsageFlagsANDROID usage;
72 } VkSwapchainImageCreateInfoANDROID;
73
74 typedef struct {
75 VkStructureType sType; // must be VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID
76 const void* pNext;
77
78 VkBool32 sharedImage;
79 } VkPhysicalDevicePresentationPropertiesANDROID;
80
81 // -- DEPRECATED in SPEC_VERSION 6 --
82 typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageANDROID)(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
83 // -- ADDED in SPEC_VERSION 6 --
84 typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsage2ANDROID)(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, uint64_t* grallocConsumerUsage, uint64_t* grallocProducerUsage);
85 typedef VkResult (VKAPI_PTR *PFN_vkAcquireImageANDROID)(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
86 typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageANDROID)(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
87
88 #define VK_GOOGLE_address_space 1
89
90 typedef VkResult (VKAPI_PTR *PFN_vkMapMemoryIntoAddressSpaceGOOGLE)(VkDevice device, VkDeviceMemory memory, uint64_t* pAddress);
91
92 #define VK_GOOGLE_color_buffer 1
93 #define VK_GOOGLE_COLOR_BUFFER_EXTENSION_NUMBER 219
94
95 #define VK_GOOGLE_COLOR_BUFFER_ENUM(type,id) ((type)(1000000000 + (1000 * (VK_GOOGLE_COLOR_BUFFER_EXTENSION_NUMBER - 1)) + (id)))
96 #define VK_STRUCTURE_TYPE_IMPORT_COLOR_BUFFER_GOOGLE VK_GOOGLE_COLOR_BUFFER_ENUM(VkStructureType, 0)
97 #define VK_STRUCTURE_TYPE_IMPORT_PHYSICAL_ADDRESS_GOOGLE VK_GOOGLE_COLOR_BUFFER_ENUM(VkStructureType, 1)
98
99 typedef struct {
100 VkStructureType sType; // must be VK_STRUCTURE_TYPE_IMPORT_COLOR_BUFFER_GOOGLE
101 const void* pNext;
102 uint32_t colorBuffer;
103 } VkImportColorBufferGOOGLE;
104
105 typedef struct {
106 VkStructureType sType; // must be VK_STRUCTURE_TYPE_IMPORT_PHYSICAL_ADDRESS_GOOGLE
107 const void* pNext;
108 uint64_t physicalAddress;
109 VkDeviceSize size;
110 VkFormat format;
111 VkImageTiling tiling;
112 uint32_t tilingParameter;
113 } VkImportPhysicalAddressGOOGLE;
114
115 typedef VkResult (VKAPI_PTR *PFN_vkRegisterImageColorBufferGOOGLE)(VkDevice device, VkImage image, uint32_t colorBuffer);
116 typedef VkResult (VKAPI_PTR *PFN_vkRegisterBufferColorBufferGOOGLE)(VkDevice device, VkBuffer image, uint32_t colorBuffer);
117
118 #define VK_GOOGLE_address_space_info 1
119
120 typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryHostAddressInfoGOOGLE)(VkDevice device, VkDeviceMemory memory, uint64_t* pAddress, uint64_t* pSize);
121
122 #define VK_GOOGLE_free_memory_sync 1
123
124 typedef VkResult (VKAPI_PTR *PFN_vkFreeMemorySyncGOOGLE)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocationCallbacks);
125
126 #define VK_ANDROID_external_memory_android_hardware_buffer 1
127 struct AHardwareBuffer;
128 struct VkAndroidHardwareBufferPropertiesANDROID;
129 struct VkMemoryGetAndroidHardwareBufferInfoANDROID;
130
131 #ifdef __Fuchsia__
132
133 typedef struct VkAndroidHardwareBufferUsageANDROID {
134 VkStructureType sType;
135 void* pNext;
136 uint64_t androidHardwareBufferUsage;
137 } VkAndroidHardwareBufferUsageANDROID;
138
139 typedef struct VkAndroidHardwareBufferPropertiesANDROID {
140 VkStructureType sType;
141 void* pNext;
142 VkDeviceSize allocationSize;
143 uint32_t memoryTypeBits;
144 } VkAndroidHardwareBufferPropertiesANDROID;
145
146 typedef struct VkAndroidHardwareBufferFormatPropertiesANDROID {
147 VkStructureType sType;
148 void* pNext;
149 VkFormat format;
150 uint64_t externalFormat;
151 VkFormatFeatureFlags formatFeatures;
152 VkComponentMapping samplerYcbcrConversionComponents;
153 VkSamplerYcbcrModelConversion suggestedYcbcrModel;
154 VkSamplerYcbcrRange suggestedYcbcrRange;
155 VkChromaLocation suggestedXChromaOffset;
156 VkChromaLocation suggestedYChromaOffset;
157 } VkAndroidHardwareBufferFormatPropertiesANDROID;
158
159 typedef struct VkImportAndroidHardwareBufferInfoANDROID {
160 VkStructureType sType;
161 const void* pNext;
162 struct AHardwareBuffer* buffer;
163 } VkImportAndroidHardwareBufferInfoANDROID;
164
165 typedef struct VkMemoryGetAndroidHardwareBufferInfoANDROID {
166 VkStructureType sType;
167 const void* pNext;
168 VkDeviceMemory memory;
169 } VkMemoryGetAndroidHardwareBufferInfoANDROID;
170
171 typedef struct VkExternalFormatANDROID {
172 VkStructureType sType;
173 void* pNext;
174 uint64_t externalFormat;
175 } VkExternalFormatANDROID;
176
177
178 typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties);
179 typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer);
180
181 #ifndef VK_NO_PROTOTYPES
182 VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID(
183 VkDevice device,
184 const struct AHardwareBuffer* buffer,
185 VkAndroidHardwareBufferPropertiesANDROID* pProperties);
186
187 VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID(
188 VkDevice device,
189 const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo,
190 struct AHardwareBuffer** pBuffer);
191 #endif
192
193 /**
194 * Buffer pixel formats.
195 */
196 enum AHardwareBuffer_Format {
197 /**
198 * Corresponding formats:
199 * Vulkan: VK_FORMAT_R8G8B8A8_UNORM
200 * OpenGL ES: GL_RGBA8
201 */
202 AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1,
203 /**
204 * 32 bits per pixel, 8 bits per channel format where alpha values are
205 * ignored (always opaque).
206 * Corresponding formats:
207 * Vulkan: VK_FORMAT_R8G8B8A8_UNORM
208 * OpenGL ES: GL_RGB8
209 */
210 AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2,
211 /**
212 * Corresponding formats:
213 * Vulkan: VK_FORMAT_R8G8B8_UNORM
214 * OpenGL ES: GL_RGB8
215 */
216 AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM = 3,
217 /**
218 * Corresponding formats:
219 * Vulkan: VK_FORMAT_R5G6B5_UNORM_PACK16
220 * OpenGL ES: GL_RGB565
221 */
222 AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM = 4,
223 /**
224 * Corresponding formats:
225 * Vulkan: VK_FORMAT_R16G16B16A16_SFLOAT
226 * OpenGL ES: GL_RGBA16F
227 */
228 AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 0x16,
229 /**
230 * Corresponding formats:
231 * Vulkan: VK_FORMAT_A2B10G10R10_UNORM_PACK32
232 * OpenGL ES: GL_RGB10_A2
233 */
234 AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 0x2b,
235 /**
236 * Opaque binary blob format.
237 * Must have height 1 and one layer, with width equal to the buffer
238 * size in bytes. Corresponds to Vulkan buffers and OpenGL buffer
239 * objects. Can be bound to the latter using GL_EXT_external_buffer.
240 */
241 AHARDWAREBUFFER_FORMAT_BLOB = 0x21,
242 /**
243 * Corresponding formats:
244 * Vulkan: VK_FORMAT_D16_UNORM
245 * OpenGL ES: GL_DEPTH_COMPONENT16
246 */
247 AHARDWAREBUFFER_FORMAT_D16_UNORM = 0x30,
248 /**
249 * Corresponding formats:
250 * Vulkan: VK_FORMAT_X8_D24_UNORM_PACK32
251 * OpenGL ES: GL_DEPTH_COMPONENT24
252 */
253 AHARDWAREBUFFER_FORMAT_D24_UNORM = 0x31,
254 /**
255 * Corresponding formats:
256 * Vulkan: VK_FORMAT_D24_UNORM_S8_UINT
257 * OpenGL ES: GL_DEPTH24_STENCIL8
258 */
259 AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT = 0x32,
260 /**
261 * Corresponding formats:
262 * Vulkan: VK_FORMAT_D32_SFLOAT
263 * OpenGL ES: GL_DEPTH_COMPONENT32F
264 */
265 AHARDWAREBUFFER_FORMAT_D32_FLOAT = 0x33,
266 /**
267 * Corresponding formats:
268 * Vulkan: VK_FORMAT_D32_SFLOAT_S8_UINT
269 * OpenGL ES: GL_DEPTH32F_STENCIL8
270 */
271 AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT = 0x34,
272 /**
273 * Corresponding formats:
274 * Vulkan: VK_FORMAT_S8_UINT
275 * OpenGL ES: GL_STENCIL_INDEX8
276 */
277 AHARDWAREBUFFER_FORMAT_S8_UINT = 0x35,
278 };
279 /**
280 * Buffer usage flags, specifying how the buffer will be accessed.
281 */
282 enum AHardwareBuffer_UsageFlags {
283 /// The buffer will never be locked for direct CPU reads using the
284 /// AHardwareBuffer_lock() function. Note that reading the buffer
285 /// using OpenGL or Vulkan functions or memory mappings is still
286 /// allowed.
287 AHARDWAREBUFFER_USAGE_CPU_READ_NEVER = 0UL,
288 /// The buffer will sometimes be locked for direct CPU reads using
289 /// the AHardwareBuffer_lock() function. Note that reading the
290 /// buffer using OpenGL or Vulkan functions or memory mappings
291 /// does not require the presence of this flag.
292 AHARDWAREBUFFER_USAGE_CPU_READ_RARELY = 2UL,
293 /// The buffer will often be locked for direct CPU reads using
294 /// the AHardwareBuffer_lock() function. Note that reading the
295 /// buffer using OpenGL or Vulkan functions or memory mappings
296 /// does not require the presence of this flag.
297 AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN = 3UL,
298 /// CPU read value mask.
299 AHARDWAREBUFFER_USAGE_CPU_READ_MASK = 0xFUL,
300 /// The buffer will never be locked for direct CPU writes using the
301 /// AHardwareBuffer_lock() function. Note that writing the buffer
302 /// using OpenGL or Vulkan functions or memory mappings is still
303 /// allowed.
304 AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER = 0UL << 4,
305 /// The buffer will sometimes be locked for direct CPU writes using
306 /// the AHardwareBuffer_lock() function. Note that writing the
307 /// buffer using OpenGL or Vulkan functions or memory mappings
308 /// does not require the presence of this flag.
309 AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY = 2UL << 4,
310 /// The buffer will often be locked for direct CPU writes using
311 /// the AHardwareBuffer_lock() function. Note that writing the
312 /// buffer using OpenGL or Vulkan functions or memory mappings
313 /// does not require the presence of this flag.
314 AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN = 3UL << 4,
315 /// CPU write value mask.
316 AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK = 0xFUL << 4,
317 /// The buffer will be read from by the GPU as a texture.
318 AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 1UL << 8,
319 /**
320 * The buffer will be written to by the GPU as a framebuffer
321 * attachment.
322 *
323 * Note that the name of this flag is somewhat misleading: it does
324 * not imply that the buffer contains a color format. A buffer with
325 * depth or stencil format that will be used as a framebuffer
326 * attachment should also have this flag.
327 */
328 AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = 1UL << 9,
329 /**
330 * The buffer is protected from direct CPU access or being read by
331 * non-secure hardware, such as video encoders.
332 *
333 * This flag is incompatible with CPU read and write flags. It is
334 * mainly used when handling DRM video. Refer to the EGL extension
335 * EGL_EXT_protected_content and GL extension
336 * GL_EXT_protected_textures for more information on how these
337 * buffers are expected to behave.
338 */
339 AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 1UL << 14,
340 /// The buffer will be read by a hardware video encoder.
341 AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 1UL << 16,
342 /**
343 * The buffer will be used for direct writes from sensors.
344 * When this flag is present, the format must be AHARDWAREBUFFER_FORMAT_BLOB.
345 */
346 AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 1UL << 23,
347 /**
348 * The buffer will be used as a shader storage or uniform buffer object.
349 * When this flag is present, the format must be AHARDWAREBUFFER_FORMAT_BLOB.
350 */
351 AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 1UL << 24,
352 /**
353 * The buffer will be used as a cube map texture.
354 * When this flag is present, the buffer must have a layer count
355 * that is a multiple of 6. Note that buffers with this flag must be
356 * bound to OpenGL textures using the extension
357 * GL_EXT_EGL_image_storage instead of GL_KHR_EGL_image.
358 */
359 AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 1UL << 25,
360 /**
361 * The buffer contains a complete mipmap hierarchy.
362 * Note that buffers with this flag must be bound to OpenGL textures using
363 * the extension GL_EXT_EGL_image_storage instead of GL_KHR_EGL_image.
364 */
365 AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 1UL << 26,
366 AHARDWAREBUFFER_USAGE_VENDOR_0 = 1ULL << 28,
367 AHARDWAREBUFFER_USAGE_VENDOR_1 = 1ULL << 29,
368 AHARDWAREBUFFER_USAGE_VENDOR_2 = 1ULL << 30,
369 AHARDWAREBUFFER_USAGE_VENDOR_3 = 1ULL << 31,
370 AHARDWAREBUFFER_USAGE_VENDOR_4 = 1ULL << 48,
371 AHARDWAREBUFFER_USAGE_VENDOR_5 = 1ULL << 49,
372 AHARDWAREBUFFER_USAGE_VENDOR_6 = 1ULL << 50,
373 AHARDWAREBUFFER_USAGE_VENDOR_7 = 1ULL << 51,
374 AHARDWAREBUFFER_USAGE_VENDOR_8 = 1ULL << 52,
375 AHARDWAREBUFFER_USAGE_VENDOR_9 = 1ULL << 53,
376 AHARDWAREBUFFER_USAGE_VENDOR_10 = 1ULL << 54,
377 AHARDWAREBUFFER_USAGE_VENDOR_11 = 1ULL << 55,
378 AHARDWAREBUFFER_USAGE_VENDOR_12 = 1ULL << 56,
379 AHARDWAREBUFFER_USAGE_VENDOR_13 = 1ULL << 57,
380 AHARDWAREBUFFER_USAGE_VENDOR_14 = 1ULL << 58,
381 AHARDWAREBUFFER_USAGE_VENDOR_15 = 1ULL << 59,
382 AHARDWAREBUFFER_USAGE_VENDOR_16 = 1ULL << 60,
383 AHARDWAREBUFFER_USAGE_VENDOR_17 = 1ULL << 61,
384 AHARDWAREBUFFER_USAGE_VENDOR_18 = 1ULL << 62,
385 AHARDWAREBUFFER_USAGE_VENDOR_19 = 1ULL << 63,
386 };
387 /**
388 * Buffer description. Used for allocating new buffers and querying
389 * parameters of existing ones.
390 */
391 typedef struct AHardwareBuffer_Desc {
392 uint32_t width; ///< Width in pixels.
393 uint32_t height; ///< Height in pixels.
394 /**
395 * Number of images in an image array. AHardwareBuffers with one
396 * layer correspond to regular 2D textures. AHardwareBuffers with
397 * more than layer correspond to texture arrays. If the layer count
398 * is a multiple of 6 and the usage flag
399 * AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP is present, the buffer is
400 * a cube map or a cube map array.
401 */
402 uint32_t layers;
403 uint32_t format; ///< One of AHardwareBuffer_Format.
404 uint64_t usage; ///< Combination of AHardwareBuffer_UsageFlags.
405 uint32_t stride; ///< Row stride in pixels, ignored for AHardwareBuffer_allocate()
406 uint32_t rfu0; ///< Initialize to zero, reserved for future use.
407 uint64_t rfu1; ///< Initialize to zero, reserved for future use.
408 } AHardwareBuffer_Desc;
409
410 #endif // __Fuchsia__
411
412 #define VK_GOOGLE_sized_descriptor_update_template 1
413
414 typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateSizedGOOGLE)(
415 VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate,
416 uint32_t imageInfoCount,
417 uint32_t bufferInfoCount,
418 uint32_t bufferViewCount,
419 const uint32_t* pImageInfoEntryIndices,
420 const uint32_t* pBufferInfoEntryIndices,
421 const uint32_t* pBufferViewEntryIndices,
422 const VkDescriptorImageInfo* pImageInfos,
423 const VkDescriptorBufferInfo* pBufferInfos,
424 const VkBufferView* pBufferViews);
425
426 #define VK_GOOGLE_async_command_buffers 1
427
428 typedef void (VKAPI_PTR *PFN_vkBeginCommandBufferAsyncGOOGLE)(
429 VkCommandBuffer commandBuffer,
430 const VkCommandBufferBeginInfo* pBeginInfo);
431 typedef void (VKAPI_PTR *PFN_vkEndCommandBufferAsyncGOOGLE)(
432 VkCommandBuffer commandBuffer);
433 typedef void (VKAPI_PTR *PFN_vkResetCommandBufferAsyncGOOGLE)(
434 VkCommandBuffer commandBuffer,
435 VkCommandBufferResetFlags flags);
436 typedef void (VKAPI_PTR *PFN_vkCommandBufferHostSyncGOOGLE)(
437 VkCommandBuffer commandBuffer,
438 uint32_t needHostSync,
439 uint32_t sequenceNumber);
440
441 #define VK_GOOGLE_create_resources_with_requirements 1
442
443 typedef void (VKAPI_PTR *PFN_vkCreateImageWithRequirementsGOOGLE)(
444 VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage, VkMemoryRequirements* pMemoryRequirements);
445
446 #ifndef VK_FUCHSIA_buffer_collection
447 #define VK_FUCHSIA_buffer_collection 1
448 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferCollectionFUCHSIA)
449
450 #define VK_FUCHSIA_BUFFER_COLLECTION_SPEC_VERSION 1
451 #define VK_FUCHSIA_BUFFER_COLLECTION_EXTENSION_NAME "VK_FUCHSIA_buffer_collection"
452
453 typedef struct VkBufferCollectionCreateInfoFUCHSIA {
454 VkStructureType sType;
455 const void* pNext;
456 uint32_t collectionToken;
457 } VkBufferCollectionCreateInfoFUCHSIA;
458
459 typedef struct VkImportMemoryBufferCollectionFUCHSIA {
460 VkStructureType sType;
461 const void* pNext;
462 VkBufferCollectionFUCHSIA collection;
463 uint32_t index;
464 } VkImportMemoryBufferCollectionFUCHSIA;
465
466 typedef struct VkBufferCollectionImageCreateInfoFUCHSIA {
467 VkStructureType sType;
468 const void* pNext;
469 VkBufferCollectionFUCHSIA collection;
470 uint32_t index;
471 } VkBufferCollectionImageCreateInfoFUCHSIA;
472
473 typedef struct VkBufferCollectionPropertiesFUCHSIA {
474 VkStructureType sType;
475 void* pNext;
476 uint32_t memoryTypeBits;
477 uint32_t count;
478 } VkBufferCollectionPropertiesFUCHSIA;
479
480 #define VK_STRUCTURE_TYPE_IMPORT_MEMORY_BUFFER_COLLECTION_FUCHSIA \
481 ((VkStructureType)1001004004)
482 #define VK_STRUCTURE_TYPE_BUFFER_COLLECTION_IMAGE_CREATE_INFO_FUCHSIA \
483 ((VkStructureType)1001004005)
484 #endif // VK_FUCHSIA_buffer_collection
485
486 #ifndef VK_FUCHSIA_external_memory
487 #define VK_FUCHSIA_external_memory 1
488 #define VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION 1
489 #define VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME "VK_FUCHSIA_external_memory"
490
491 typedef struct VkImportMemoryZirconHandleInfoFUCHSIA {
492 VkStructureType sType;
493 const void* pNext;
494 VkExternalMemoryHandleTypeFlagBits handleType;
495 uint32_t handle;
496 } VkImportMemoryZirconHandleInfoFUCHSIA;
497
498 typedef struct VkMemoryZirconHandlePropertiesFUCHSIA {
499 VkStructureType sType;
500 void* pNext;
501 uint32_t memoryTypeBits;
502 } VkMemoryZirconHandlePropertiesFUCHSIA;
503
504 typedef struct VkMemoryGetZirconHandleInfoFUCHSIA {
505 VkStructureType sType;
506 const void* pNext;
507 VkDeviceMemory memory;
508 VkExternalMemoryHandleTypeFlagBits handleType;
509 } VkMemoryGetZirconHandleInfoFUCHSIA;
510
511 #define VK_STRUCTURE_TYPE_TEMP_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA \
512 ((VkStructureType)1001005000)
513 #define VK_STRUCTURE_TYPE_TEMP_MEMORY_ZIRCON_HANDLE_PROPERTIES_FUCHSIA \
514 ((VkStructureType)1001005001)
515 #define VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA \
516 ((VkExternalMemoryHandleTypeFlagBits)0x00100000)
517 #endif // VK_FUCHSIA_external_memory
518
519 #ifndef VK_FUCHSIA_external_semaphore
520 #define VK_FUCHSIA_external_semaphore 1
521 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION 1
522 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_FUCHSIA_external_semaphore"
523
524 typedef struct VkImportSemaphoreZirconHandleInfoFUCHSIA {
525 VkStructureType sType;
526 const void* pNext;
527 VkSemaphore semaphore;
528 VkSemaphoreImportFlags flags;
529 VkExternalSemaphoreHandleTypeFlagBits handleType;
530 uint32_t handle;
531 } VkImportSemaphoreZirconHandleInfoFUCHSIA;
532
533 typedef struct VkSemaphoreGetZirconHandleInfoFUCHSIA {
534 VkStructureType sType;
535 const void* pNext;
536 VkSemaphore semaphore;
537 VkExternalSemaphoreHandleTypeFlagBits handleType;
538 } VkSemaphoreGetZirconHandleInfoFUCHSIA;
539
540 #define VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA \
541 ((VkExternalSemaphoreHandleTypeFlagBits)0x00100000)
542 #endif // VK_FUCHSIA_external_semaphore
543
544 // VulkanStream features
545 #define VULKAN_STREAM_FEATURE_NULL_OPTIONAL_STRINGS_BIT (1 << 0)
546 #define VULKAN_STREAM_FEATURE_IGNORED_HANDLES_BIT (1 << 1)
547
548 #define VK_YCBCR_CONVERSION_DO_NOTHING ((VkSamplerYcbcrConversion)0x1111111111111111)
549
550 #ifdef __cplusplus
551 } // extern "C"
552 #endif
553
554 #ifdef __cplusplus
555
556 template<class T, typename F>
arrayany(const T * arr,uint32_t begin,uint32_t end,const F & func)557 bool arrayany(const T* arr, uint32_t begin, uint32_t end, const F& func) {
558 const T* e = arr + end;
559 return std::find_if(arr + begin, e, func) != e;
560 }
561
562 #endif
563