• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Vulkan Module
2
3
4## Overview
5
6The **Vulkan** module provides Vulkan capabilities extended by OpenHarmony. It provides extended APIs for creating a Vulkan surface using **OHNativeWindow** and obtaining **OH_NativeBuffer **and **OH_NativeBuffer** properties.
7
8\@syscap SystemCapability.Graphic.Vulkan
9
10**Since**
11
1210
13
14
15## Summary
16
17
18### Files
19
20| Name| Description|
21| -------- | -------- |
22| [vulkan_ohos.h](vulkan__ohos_8h.md) | Declares the Vulkan interfaces extended by OpenHarmony.<br>File to include: &lt;vulkan/vulkan.h&gt;<br>Library: libvulkan.so |
23
24
25### Structs
26
27| Name| Description|
28| -------- | -------- |
29| [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) | Defines the parameters required for creating a Vulkan surface.|
30| [VkNativeBufferUsageOHOS](_vk_native_buffer_usage_o_h_o_s.md) | Defines the usage of a **NativeBuffer**.|
31| [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) | Defines the properties of a **NativeBuffer**.|
32| [VkNativeBufferFormatPropertiesOHOS](_vk_native_buffer_format_properties_o_h_o_s.md) | Defines the format properties of a **NativeBuffer**.|
33| [VkImportNativeBufferInfoOHOS](_vk_import_native_buffer_info_o_h_o_s.md) | Defines the pointer to an **OH_NativeBuffer** struct.|
34| [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) | Defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.|
35| [VkExternalFormatOHOS](_vk_external_format_o_h_o_s.md) | Defines an externally defined format.|
36
37
38### Macros
39
40| Name| Description|
41| -------- | -------- |
42| [VK_OHOS_surface](#vk_ohos_surface)   1 | Surface extension macro definition of OpenHarmony.|
43| [VK_OHOS_SURFACE_SPEC_VERSION](#vk_ohos_surface_spec_version)   1 | Surface extension version of OpenHarmony.|
44| [VK_OHOS_SURFACE_EXTENSION_NAME](#vk_ohos_surface_extension_name)   "VK_OHOS_surface" | Surface extension name of OpenHarmony.|
45| [VK_OHOS_external_memory](#vk_ohos_external_memory)   1 | External memory extension macro definition of OpenHarmony.|
46| [VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION](#vk_ohos_external_memory_spec_version)   1 | External memory extension version of OpenHarmony.|
47| [VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME](#vk_ohos_external_memory_extension_name)   "VK_OHOS_external_memory" | External memory extension name of OpenHarmony.|
48
49
50### Types
51
52| Name| Description|
53| -------- | -------- |
54| [OHNativeWindow](#ohnativewindow) | Defines an **OHNativeWindow**.|
55| [VkSurfaceCreateFlagsOHOS](#vksurfacecreateflagsohos) | Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface. It is a reserved flag type.|
56| [VkSurfaceCreateInfoOHOS](#vksurfacecreateinfoohos) | Defines the parameters required for creating a Vulkan surface.|
57| VkResult ([VKAPI_PTR *PFN_vkCreateSurfaceOHOS](#pfn_vkcreatesurfaceohos)) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Defines the function pointer for creating a Vulkan surface.|
58| [VkNativeBufferUsageOHOS](#vknativebufferusageohos) | Defines the usage of a **NativeBuffer**.|
59| [VkNativeBufferPropertiesOHOS](#vknativebufferpropertiesohos) | Defines the properties of a **NativeBuffer**.|
60| [VkNativeBufferFormatPropertiesOHOS](#vknativebufferformatpropertiesohos) | Defines the format properties of a **NativeBuffer**.|
61| [VkImportNativeBufferInfoOHOS](#vkimportnativebufferinfoohos) | Defines the pointer to an **OH_NativeBuffer** struct.|
62| [VkMemoryGetNativeBufferInfoOHOS](#vkmemorygetnativebufferinfoohos) | Defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.|
63| [VkExternalFormatOHOS](#vkexternalformatohos) | Defines an externally defined format.|
64| VkResult ([VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS](#pfn_vkgetnativebufferpropertiesohos)) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Defines a function pointer used to obtain **OH_NativeBuffer** properties.|
65| VkResult ([VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS](#pfn_vkgetmemorynativebufferohos)) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Defines a function pointer used to obtain an **OH_NativeBuffer** instance.|
66
67
68### Functions
69
70| Name| Description|
71| -------- | -------- |
72| VKAPI_ATTR VkResult VKAPI_CALL [vkCreateSurfaceOHOS](#vkcreatesurfaceohos) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Creates a Vulkan surface.|
73| VKAPI_ATTR VkResult VKAPI_CALL [vkGetNativeBufferPropertiesOHOS](#vkgetnativebufferpropertiesohos) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Obtains the properties of an **OH_NativeBuffer** instance.|
74| VKAPI_ATTR VkResult VKAPI_CALL [vkGetMemoryNativeBufferOHOS](#vkgetmemorynativebufferohos) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Obtains an **OH_NativeBuffer** instance.|
75| VKAPI_ATTR VkResult VKAPI_CALL [vkGetSwapchainGrallocUsageOHOS](#vkgetswapchaingrallocusageohos) (VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t \*grallocUsage) | Returns the appropriate gralloc usage flag based on the given Vulkan device, image format, and image usage flag.|
76| VKAPI_ATTR VkResult VKAPI_CALL [vkAcquireImageOHOS](#vkacquireimageohos) (VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence) | Obtains the ownership of the swap chain image and imports the fence of the external signal to the VkSemaphore and VkFence objects.|
77| VKAPI_ATTR VkResult VKAPI_CALL [vkQueueSignalReleaseImageOHOS](#vkqueuesignalreleaseimageohos) (VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore \*pWaitSemaphores, VkImage image, int32_t \*pNativeFenceFd) | Sends a signal to the system hardware buffer to release an image once it is no longer needed so that other components can access it.|
78
79
80### Variables
81
82| Name| Description|
83| -------- | -------- |
84| [VkSurfaceCreateInfoOHOS::sType](#stype-17) | Struct type.|
85| [VkSurfaceCreateInfoOHOS::pNext](#pnext-17) | Pointer to the next-level struct.|
86| [VkSurfaceCreateInfoOHOS::flags](#flags) | Reserved flag type.|
87| [VkSurfaceCreateInfoOHOS::window](#window) | Pointer to an **OHNativeWindow** instance.|
88| [VkNativeBufferUsageOHOS::sType](#stype-27) | Struct type.|
89| [VkNativeBufferUsageOHOS::pNext](#pnext-27) | Pointer to the next-level struct.|
90| [VkNativeBufferUsageOHOS::OHOSNativeBufferUsage](#ohosnativebufferusage) | Usage of a **NativeBuffer**.|
91| [VkNativeBufferPropertiesOHOS::sType](#stype-37) | Struct type.|
92| [VkNativeBufferPropertiesOHOS::pNext](#pnext-37) | Pointer to the next-level struct.|
93| [VkNativeBufferPropertiesOHOS::allocationSize](#allocationsize) | Size of the occupied memory.|
94| [VkNativeBufferPropertiesOHOS::memoryTypeBits](#memorytypebits) | Memory type.|
95| [VkNativeBufferFormatPropertiesOHOS::sType](#stype-47) | Struct type.|
96| [VkNativeBufferFormatPropertiesOHOS::pNext](#pnext-47) | Pointer to the next-level struct.|
97| [VkNativeBufferFormatPropertiesOHOS::format](#format) | Format properties.|
98| [VkNativeBufferFormatPropertiesOHOS::externalFormat](#externalformat-12) | Externally defined format.|
99| [VkNativeBufferFormatPropertiesOHOS::formatFeatures](#formatfeatures) | Features of the externally defined format.|
100| [VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponents](#samplerycbcrconversioncomponents) | A group of VkComponentSwizzles.|
101| [VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrModel](#suggestedycbcrmodel) | Color model.|
102| [VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrRange](#suggestedycbcrrange) | Color value range.|
103| [VkNativeBufferFormatPropertiesOHOS::suggestedXChromaOffset](#suggestedxchromaoffset) | X chrominance offset.|
104| [VkNativeBufferFormatPropertiesOHOS::suggestedYChromaOffset](#suggestedychromaoffset) | Y chrominance offset.|
105| [VkImportNativeBufferInfoOHOS::sType](#stype-57) | Struct type.|
106| [VkImportNativeBufferInfoOHOS::pNext](#pnext-57) | Pointer to the next-level struct.|
107| [VkImportNativeBufferInfoOHOS::buffer](#buffer) | Pointer to an **OH_NativeBuffer** struct.|
108| [VkMemoryGetNativeBufferInfoOHOS::sType](#stype-67) | Struct type.|
109| [VkMemoryGetNativeBufferInfoOHOS::pNext](#pnext-67) | Pointer to the next-level struct.|
110| [VkMemoryGetNativeBufferInfoOHOS::memory](#memory) | **VkDeviceMemory** instance.|
111| [VkExternalFormatOHOS::sType](#stype-77) | Struct type.|
112| [VkExternalFormatOHOS::pNext](#pnext-77) | Pointer to the next-level struct.|
113| [VkExternalFormatOHOS::externalFormat](#externalformat-22) | Externally defined format.|
114
115
116## Macro Description
117
118
119### VK_OHOS_external_memory
120
121
122```
123#define VK_OHOS_external_memory   1
124```
125
126**Description**
127
128External memory extension macro definition of OpenHarmony.
129
130
131### VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME
132
133
134```
135#define VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME   "VK_OHOS_external_memory"
136```
137
138**Description**
139
140External memory extension name of OpenHarmony.
141
142
143### VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION
144
145
146```
147#define VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION   1
148```
149
150**Description**
151
152External memory extension version of OpenHarmony.
153
154
155### VK_OHOS_surface
156
157
158```
159#define VK_OHOS_surface   1
160```
161
162**Description**
163
164Surface extension macro definition of OpenHarmony.
165
166
167### VK_OHOS_SURFACE_EXTENSION_NAME
168
169
170```
171#define VK_OHOS_SURFACE_EXTENSION_NAME   "VK_OHOS_surface"
172```
173
174**Description**
175
176Surface extension name of OpenHarmony.
177
178
179### VK_OHOS_SURFACE_SPEC_VERSION
180
181
182```
183#define VK_OHOS_SURFACE_SPEC_VERSION   1
184```
185
186**Description**
187
188Surface extension version of OpenHarmony.
189
190
191## Type Description
192
193
194### OHNativeWindow
195
196
197```
198typedef struct NativeWindow OHNativeWindow
199```
200
201**Description**
202
203Defines an **OHNativeWindow**.
204
205
206### PFN_vkCreateSurfaceOHOS
207
208
209```
210typedef VkResult(VKAPI_PTR * PFN_vkCreateSurfaceOHOS) (VkInstance instance, const VkSurfaceCreateInfoOHOS *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
211```
212
213**Description**
214
215Defines the function pointer for creating a Vulkan surface.
216
217\@syscap SystemCapability.Graphic.Vulkan
218
219**Parameters**
220
221| Name| Description|
222| -------- | -------- |
223| instance | **Vulkan** instance.|
224| pCreateInfo | Pointer to the **VkSurfaceCreateInfoOHOS** struct, including the parameters required for creating a Vulkan surface.|
225| pAllocator | Pointer to a callback function for custom memory allocation. If custom memory allocation is not required, pass in **NULL**, and the default memory allocation function is used.|
226| pSurface | Pointer to the Vulkan surface created. The type is **VkSurfaceKHR**.|
227
228**Returns**
229
230Returns **VK_SUCCESS** if the execution is successful; returns an error code of the VkResult type otherwise.
231
232
233### PFN_vkGetMemoryNativeBufferOHOS
234
235
236```
237typedef VkResult(VKAPI_PTR * PFN_vkGetMemoryNativeBufferOHOS) (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS *pInfo, struct OH_NativeBuffer **pBuffer)
238```
239
240**Description**
241
242Defines a function pointer used to obtain an **OH_NativeBuffer** instance.
243
244\@syscap SystemCapability.Graphic.Vulkan
245
246**Parameters**
247
248| Name| Description|
249| -------- | -------- |
250| device | **VkDevice** instance.|
251| pInfo | Pointer to a **VkMemoryGetNativeBufferInfoOHOS** struct.|
252| pBuffer | Pointer to the **OH_NativeBuffer** obtained.|
253
254**Returns**
255
256Returns **VK_SUCCESS** if the execution is successful; returns an error code of the VkResult type otherwise.
257
258
259### PFN_vkGetNativeBufferPropertiesOHOS
260
261
262```
263typedef VkResult(VKAPI_PTR * PFN_vkGetNativeBufferPropertiesOHOS) (VkDevice device, const struct OH_NativeBuffer *buffer, VkNativeBufferPropertiesOHOS *pProperties)
264```
265
266**Description**
267
268Defines a function pointer used to obtain **OH_NativeBuffer** properties.
269
270\@syscap SystemCapability.Graphic.Vulkan
271
272**Parameters**
273
274| Name| Description|
275| -------- | -------- |
276| device | **VkDevice** instance.|
277| buffer | Pointer to an **OH_NativeBuffer** struct.|
278| pProperties | Pointer to the struct holding the properties of **OH_NativeBuffer**.|
279
280**Returns**
281
282Returns **VK_SUCCESS** if the execution is successful; returns an error code of the VkResult type otherwise.
283
284
285### VkExternalFormatOHOS
286
287
288```
289typedef struct VkExternalFormatOHOS VkExternalFormatOHOS
290```
291
292**Description**
293
294Defines an externally defined format.
295
296
297### VkImportNativeBufferInfoOHOS
298
299
300```
301typedef struct VkImportNativeBufferInfoOHOS VkImportNativeBufferInfoOHOS
302```
303
304**Description**
305
306Defines the pointer to an **OH_NativeBuffer** struct.
307
308
309### VkMemoryGetNativeBufferInfoOHOS
310
311
312```
313typedef struct VkMemoryGetNativeBufferInfoOHOS VkMemoryGetNativeBufferInfoOHOS
314```
315
316**Description**
317
318Defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.
319
320
321### VkNativeBufferFormatPropertiesOHOS
322
323
324```
325typedef struct VkNativeBufferFormatPropertiesOHOS VkNativeBufferFormatPropertiesOHOS
326```
327
328**Description**
329
330Defines the format properties of a **NativeBuffer**.
331
332
333### VkNativeBufferPropertiesOHOS
334
335
336```
337typedef struct VkNativeBufferPropertiesOHOS VkNativeBufferPropertiesOHOS
338```
339
340**Description**
341
342Defines the properties of a **NativeBuffer**.
343
344
345### VkNativeBufferUsageOHOS
346
347
348```
349typedef struct VkNativeBufferUsageOHOS VkNativeBufferUsageOHOS
350```
351
352**Description**
353
354Defines the usage of a **NativeBuffer**.
355
356
357### VkSurfaceCreateFlagsOHOS
358
359
360```
361typedef VkFlags VkSurfaceCreateFlagsOHOS
362```
363
364**Description**
365
366Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface. It is a reserved flag type.
367
368
369### VkSurfaceCreateInfoOHOS
370
371
372```
373typedef struct VkSurfaceCreateInfoOHOS VkSurfaceCreateInfoOHOS
374```
375
376**Description**
377
378Defines the parameters required for creating a Vulkan surface.
379
380
381## Function Description
382
383
384### vkAcquireImageOHOS()
385
386```
387VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageOHOS (VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence )
388```
389
390**Description**
391
392Obtains the ownership of the swap chain image and imports the fence of the external signal to the VkSemaphore and VkFence objects.
393
394**System capability**: SystemCapability.Graphic.Vulkan
395
396**Since**: 10
397
398**Parameters**
399
400| Name| Description|
401| -------- | -------- |
402| device | **VkDevice** instance.|
403| image | Vulkan image to obtain.|
404| nativeFenceFd | File descriptor of the native fence.|
405| semaphore | Vulkan semaphore indicating that the image is available.|
406| fence | Vulkan fence used for synchronization when the image acquisition is complete.|
407
408**Returns**
409
410Returns an error code of the VkResult type.
411- Returns **VK_SUCCESS** if the operation is successful.
412- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the host memory is insufficient.
413### vkCreateSurfaceOHOS()
414
415
416```
417VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS (VkInstance instance, const VkSurfaceCreateInfoOHOS * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSurfaceKHR * pSurface )
418```
419
420**Description**
421
422Creates a Vulkan surface.
423
424\@syscap SystemCapability.Graphic.Vulkan
425
426**Parameters**
427
428| Name| Description|
429| -------- | -------- |
430| instance | **Vulkan** instance.|
431| pCreateInfo | Pointer to the **VkSurfaceCreateInfoOHOS** struct, including the parameters required for creating a Vulkan surface.|
432| pAllocator | Pointer to a callback function for custom memory allocation. If custom memory allocation is not required, pass in **NULL**, and the default memory allocation function is used.|
433| pSurface | Pointer to the Vulkan surface created. The type is **VkSurfaceKHR**.|
434
435**Returns**
436
437Returns an error code of the VkResult type.
438- Returns **VK_SUCCESS** if the operation is successful.
439- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the VkSurfaceKHR memory fails to be allocated.
440- Returns **VK_ERROR_SURFACE_LOST_KHR** if the NativeWindow operation fails.
441
442
443### vkGetMemoryNativeBufferOHOS()
444
445
446```
447VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS * pInfo, struct OH_NativeBuffer ** pBuffer )
448```
449
450**Description**
451
452Obtains an **OH_NativeBuffer** instance.
453
454\@syscap SystemCapability.Graphic.Vulkan
455
456**Parameters**
457
458| Name| Description|
459| -------- | -------- |
460| device | **VkDevice** instance.|
461| pInfo | Pointer to a **VkMemoryGetNativeBufferInfoOHOS** struct.|
462| pBuffer | Pointer to the **OH_NativeBuffer** obtained.|
463
464**Returns**
465
466Returns an error code of the VkResult type.
467- Returns **VK_SUCCESS** if the operation is successful.
468- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the input parameter **pInfo** is abnormal or the obtained **pBuffer** is abnormal.
469
470### vkGetNativeBufferPropertiesOHOS()
471
472
473```
474VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS (VkDevice device, const struct OH_NativeBuffer * buffer, VkNativeBufferPropertiesOHOS * pProperties )
475```
476
477**Description**
478
479Obtains the properties of an **OH_NativeBuffer** instance.
480
481\@syscap SystemCapability.Graphic.Vulkan
482
483**Parameters**
484
485| Name| Description|
486| -------- | -------- |
487| device | **VkDevice** instance.|
488| buffer | Pointer to an **OH_NativeBuffer** struct.|
489| pProperties | Pointer to the struct holding the properties of **OH_NativeBuffer**.|
490
491**Returns**
492
493Returns an error code of the VkResult type.
494- Returns **VK_SUCCESS** if the operation is successful.
495- Returns **VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR** if an input parameter is abnormal.
496- Returns **VK_ERROR_OUT_OF_DEVICE_MEMORY** if the device memory is insufficient.
497
498
499### vkGetSwapchainGrallocUsageOHOS()
500
501```
502VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageOHOS (VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t* grallocUsage )
503```
504
505**Description**
506
507Returns the appropriate gralloc usage flag based on the given Vulkan device, image format, and image usage flag.
508
509**System capability**: SystemCapability.Graphic.Vulkan
510
511**Since**: 10
512
513**Parameters**
514
515| Name| Description|
516| -------- | -------- |
517| device | **VkDevice** instance.|
518| format | Image format.|
519| imageUsage | Image use flag.|
520| grallocUsage | Pointer to the gralloc usage flag.|
521
522**Returns**
523
524Returns an error code of the VkResult type.
525- Returns **VK_SUCCESS** if the operation is successful.
526- Returns **VK_ERROR_INITIALIZATION_FAILED** if an input parameter is abnormal.
527
528### vkQueueSignalReleaseImageOHOS()
529
530```
531VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageOHOS (VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd )
532```
533
534**Description**
535
536Sends a signal to the system hardware buffer to release an image once it is no longer needed so that other components can access it.
537
538**System capability**: SystemCapability.Graphic.Vulkan
539
540**Since**: 10
541
542**Parameters**
543
544| Name| Description|
545| -------- | -------- |
546| queue | Handle to the Vulkan queue.|
547| waitSemaphoreCount | Number of semaphores to wait on.|
548| pWaitSemaphores | Pointer to the array of semaphores to wait on.|
549| images | Handle to the Vulkan image to be released.|
550| pNativeFenceFd | Pointer to the file descriptor of the fence.|
551
552**Returns**
553
554Returns an error code of the VkResult type.
555- Returns **VK_SUCCESS** if the operation is successful.
556- Returns **VK_ERROR_DEVICE_LOST** if the Vulkan device link is lost.
557- Returns **VK_ERROR_OUT_OF_HOST_MEMORY** if the host memory is insufficient.
558
559## Variable Description
560
561
562### allocationSize
563
564
565```
566VkDeviceSize VkNativeBufferPropertiesOHOS::allocationSize
567```
568
569**Description**
570
571Size of the occupied memory.
572
573
574### buffer
575
576
577```
578struct OH_NativeBuffer* VkImportNativeBufferInfoOHOS::buffer
579```
580
581**Description**
582
583Pointer to an **OH_NativeBuffer** struct.
584
585
586### externalFormat [1/2]
587
588
589```
590uint64_t VkNativeBufferFormatPropertiesOHOS::externalFormat
591```
592
593**Description**
594
595Externally defined format.
596
597
598### externalFormat [2/2]
599
600
601```
602uint64_t VkExternalFormatOHOS::externalFormat
603```
604
605**Description**
606
607Externally defined format.
608
609
610### flags
611
612
613```
614VkSurfaceCreateFlagsOHOS VkSurfaceCreateInfoOHOS::flags
615```
616
617**Description**
618
619Reserved flag type.
620
621
622### format
623
624
625```
626VkFormat VkNativeBufferFormatPropertiesOHOS::format
627```
628
629**Description**
630
631Format properties.
632
633
634### formatFeatures
635
636
637```
638VkFormatFeatureFlags VkNativeBufferFormatPropertiesOHOS::formatFeatures
639```
640
641**Description**
642
643Features of the externally defined format.
644
645
646### memory
647
648
649```
650VkDeviceMemory VkMemoryGetNativeBufferInfoOHOS::memory
651```
652
653**Description**
654
655**VkDeviceMemory** instance.
656
657
658### memoryTypeBits
659
660
661```
662uint32_t VkNativeBufferPropertiesOHOS::memoryTypeBits
663```
664
665**Description**
666
667Memory type.
668
669
670### OHOSNativeBufferUsage
671
672
673```
674uint64_t VkNativeBufferUsageOHOS::OHOSNativeBufferUsage
675```
676
677**Description**
678
679Usage of a **NativeBuffer**.
680
681
682### pNext [1/7]
683
684
685```
686const void* VkSurfaceCreateInfoOHOS::pNext
687```
688
689**Description**
690
691Pointer to the next-level struct.
692
693
694### pNext [2/7]
695
696
697```
698void* VkNativeBufferUsageOHOS::pNext
699```
700
701**Description**
702
703Pointer to the next-level struct.
704
705
706### pNext [3/7]
707
708
709```
710void* VkNativeBufferPropertiesOHOS::pNext
711```
712
713**Description**
714
715Pointer to the next-level struct.
716
717
718### pNext [4/7]
719
720
721```
722void* VkNativeBufferFormatPropertiesOHOS::pNext
723```
724
725**Description**
726
727Pointer to the next-level struct.
728
729
730### pNext [5/7]
731
732
733```
734const void* VkImportNativeBufferInfoOHOS::pNext
735```
736
737**Description**
738
739Pointer to the next-level struct.
740
741
742### pNext [6/7]
743
744
745```
746const void* VkMemoryGetNativeBufferInfoOHOS::pNext
747```
748
749**Description**
750
751Pointer to the next-level struct.
752
753
754### pNext [7/7]
755
756
757```
758void* VkExternalFormatOHOS::pNext
759```
760
761**Description**
762
763Pointer to the next-level struct.
764
765
766### samplerYcbcrConversionComponents
767
768
769```
770VkComponentMapping VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponents
771```
772
773**Description**
774
775A group of VkComponentSwizzles.
776
777
778### sType [1/7]
779
780
781```
782VkStructureType VkSurfaceCreateInfoOHOS::sType
783```
784
785**Description**
786
787Struct type.
788
789
790### sType [2/7]
791
792
793```
794VkStructureType VkNativeBufferUsageOHOS::sType
795```
796
797**Description**
798
799Struct type.
800
801
802### sType [3/7]
803
804
805```
806VkStructureType VkNativeBufferPropertiesOHOS::sType
807```
808
809**Description**
810
811Struct type.
812
813
814### sType [4/7]
815
816
817```
818VkStructureType VkNativeBufferFormatPropertiesOHOS::sType
819```
820
821**Description**
822
823Struct type.
824
825
826### sType [5/7]
827
828
829```
830VkStructureType VkImportNativeBufferInfoOHOS::sType
831```
832
833**Description**
834
835Struct type.
836
837
838### sType [6/7]
839
840
841```
842VkStructureType VkMemoryGetNativeBufferInfoOHOS::sType
843```
844
845**Description**
846
847Struct type.
848
849
850### sType [7/7]
851
852
853```
854VkStructureType VkExternalFormatOHOS::sType
855```
856
857**Description**
858
859Struct type.
860
861
862### suggestedXChromaOffset
863
864
865```
866VkChromaLocation VkNativeBufferFormatPropertiesOHOS::suggestedXChromaOffset
867```
868
869**Description**
870
871X chrominance offset.
872
873
874### suggestedYcbcrModel
875
876
877```
878VkSamplerYcbcrModelConversion VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrModel
879```
880
881**Description**
882
883Color model.
884
885
886### suggestedYcbcrRange
887
888
889```
890VkSamplerYcbcrRange VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrRange
891```
892
893**Description**
894
895Color value range.
896
897
898### suggestedYChromaOffset
899
900
901```
902VkChromaLocation VkNativeBufferFormatPropertiesOHOS::suggestedYChromaOffset
903```
904
905**Description**
906
907Y chrominance offset.
908
909
910### window
911
912
913```
914OHNativeWindow* VkSurfaceCreateInfoOHOS::window
915```
916
917**Description**
918
919Pointer to an **OHNativeWindow** instance.
920