mirror of
https://gitee.com/openharmony/third_party_vulkan-headers
synced 2024-11-23 07:49:47 +00:00
add native buffer ext
Signed-off-by: andrew0229 <zhangzhao62@huawei.com> Change-Id: I98eede17582e855949034223e7c885e1ca89a179
This commit is contained in:
parent
66d2670a32
commit
ee3e87373f
53
README_OpenHarmony.md
Normal file
53
README_OpenHarmony.md
Normal file
@ -0,0 +1,53 @@
|
||||
# Vulkan API Headers
|
||||
|
||||
仓库包含Vulkan API 和 API 注册表。Vulkan 是一个适用于高性能 3D 图形设备的低开销、跨平台 API。与 OpenGL ES (GLES) 一样,Vulkan 提供用于在应用中创建高品质实时图形的工具。与OpenGL ES相比使用 Vulkan 的优势明显,Vulkan可以大大降低 CPU 开销,另外Vulkan支持 SPIR-V 二进制Shader语言。
|
||||
|
||||
OpenHarmony引入后,在框架层新增加载程序(Vulkan-Loader),负责加GPU驱动实现、加载OpenHarmony平台的Vulkan WSI(Window System Integration, 窗口系统集成)实现,并对外开放Vulkan API。请参考[Vulkan-Loader](https://gitee.com/openharmony/third_party_vulkan-loader/blob/master/README_OpenHarmony.md)
|
||||
|
||||
|
||||
## 南向开发和OpenHarmony发行版
|
||||
|
||||
设备成功运行Vulkan必需的条件:
|
||||
1. Vulkan-Loader,由OpenHarmony提供
|
||||
2. 实现了Vulkan API 的 VulKan 驱动程序,由 SoC 提供。
|
||||
|
||||
### Vulkan Loader
|
||||
|
||||
`third_party/vulkan-loader`中实现的Vulkan加载程序是Vulkan应用与Vulkan驱动之前的Wrapper层。安装在`/system/lib[64]/libvulkan.so`中。
|
||||
Vulkan Loader 会提供标准 Vulkan API 函数符号、OpenHarmony WSI扩展的函数符号,以及许多其他可选扩展。
|
||||
|
||||
|
||||
### Vulkan 驱动程序
|
||||
|
||||
Vulkan-Loader成功加载Vulkan驱动程序的必要条件
|
||||
1.要参考[LoaderDriverInterface](https://gitee.com/openharmony/third_party_vulkan-loader/blob/master/docs/LoaderDriverInterface.md)实现对应的接口;
|
||||
2.提供驱动程序描述json文件,参考[加载GPU驱动](https://gitee.com/openharmony/third_party_vulkan-loader/blob/master/README_OpenHarmony.md#%E5%8A%A0%E8%BD%BDgpu%E9%A9%B1%E5%8A%A8);
|
||||
3.实现OpenHarmony平台的扩展包括`VK_OHOS_native_buffer`和`VK_OpenHarmony_external_memory_OHOS_native_buffer`扩展。
|
||||
|
||||
|
||||
## 北向应用开发者
|
||||
|
||||
### VK_OpenHarmony_OHOS_surface 扩展
|
||||
|
||||
接口:vkCreateOHOSSurfaceOpenHarmony
|
||||
VkResult vkCreateOHOSSurfaceOpenHarmony(
|
||||
VkInstance instance,
|
||||
const VkOHOSSurfaceCreateInfoOpenHarmony pCreateInfo,
|
||||
const VkAllocationCallbacks pAllocator,
|
||||
VkSurfaceKHR pSurface)
|
||||
|
||||
参数:
|
||||
instance是要关联Surface的实例。
|
||||
pCreateInfo是一个指向结构的指针,该VkOHOSSurfaceCreateInfoOpenHarmony 结构包含影响表面对象创建的参数。
|
||||
pAllocator是用于在没有更多特定内存分配器可用时做为Surface对象分配的分配器。
|
||||
pSurface是一个指向VkSurfaceKHR句柄的指针,在该句柄中返回创建的Surface对象。
|
||||
|
||||
|
||||
## Vulkan使用文档
|
||||
|
||||
API官方文档 https://registry.khronos.org/vulkan/
|
||||
|
||||
|
||||
## License
|
||||
|
||||
见 [LICENSE](LICENSE).
|
49
README_zh.md
49
README_zh.md
@ -1,49 +0,0 @@
|
||||
# Vulkan API Headers
|
||||
|
||||
仓库包含Vulkan API 和 API 注册表。Vulkan 是一个适用于高性能 3D 图形设备的低开销、跨平台 API。与 OpenGL ES (GLES) 一样,Vulkan 提供用于在应用中创建高品质实时图形的工具。与OpenGL ES相比使用 Vulkan 的优势明显,Vulkan可以大大降低 CPU 开销,另外Vulkan支持 SPIR-V 二进制Shader语言。
|
||||
|
||||
OpenHarmony引入后,在框架层新增Vulkan Wrapper,负责实现Vulkan WSI(Window System Integration, 窗口系统集成) 与本地窗口(NativeWindow)对接,另外提供Vulkan加载程序。目前仅支持native层调用Vulkan。
|
||||
|
||||
|
||||
## 一、北向开发和OpenHarmony发行版
|
||||
### 1.实现 Vulkan
|
||||
|
||||
设备成功运行Vulkan必需的条件:
|
||||
1. 加载程序,由OpenHarmony提供
|
||||
2. 实现了Vulkan API 的 VulKan 驱动程序,有 SoC 提供。
|
||||
|
||||
### 2. Vulkan Wrapper
|
||||
|
||||
`foundation/graphic/graphic_2d/frameworks/vulkan_wrapper`中实现的Vulkan加载程序是Vulkan应用与Vulkan驱动之前的Wrapper层。Vulkan Wrapper安装在`/system/lib[64]/libvulkan.so`中。Vulkan Wrapper 会提供标准 Vulkan API 函数符号、OpenHarmony WSI扩展的函数符号,以及许多其他可选扩展。
|
||||
|
||||
|
||||
### 3. Vulkan 驱动程序
|
||||
|
||||
Vulkan驱动程序需要对外暴露的函数符号请参考`hdi_vulkan.h`中的定义。
|
||||
|
||||
## 二、南向应用开发者
|
||||
|
||||
### VK_OpenHarmony_OHOS_surface 扩展
|
||||
|
||||
接口:vkCreateOHOSSurfaceOpenHarmony
|
||||
VkResult vkCreateOHOSSurfaceOpenHarmony(
|
||||
VkInstance instance,
|
||||
const VkOHOSSurfaceCreateInfoOpenHarmony pCreateInfo,
|
||||
const VkAllocationCallbacks pAllocator,
|
||||
VkSurfaceKHR pSurface)
|
||||
|
||||
参数:
|
||||
instance是要关联Surface的实例。
|
||||
pCreateInfo是一个指向结构的指针,该VkOHOSSurfaceCreateInfoOpenHarmony 结构包含影响表面对象创建的参数。
|
||||
pAllocator是用于在没有更多特定内存分配器可用时做为Surface对象分配的分配器。
|
||||
pSurface是一个指向VkSurfaceKHR句柄的指针,在该句柄中返回创建的Surface对象。
|
||||
|
||||
|
||||
## 三、Vulkan使用文档
|
||||
|
||||
API官方文档 https://registry.khronos.org/vulkan/
|
||||
|
||||
|
||||
## 四、License
|
||||
|
||||
见 [LICENSE](LICENSE).
|
@ -85,6 +85,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY
|
||||
#include "buffer_handle.h"
|
||||
#include "vulkan_ohos.h"
|
||||
#endif
|
||||
|
||||
|
@ -40,6 +40,80 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateOHOSSurfaceOpenHarmony(
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#define VK_OHOS_native_buffer 1
|
||||
|
||||
#define VK_OHOS_NATIVE_BUFFER_SPEC_VERSION 1
|
||||
#define VK_OHOS_NATIVE_BUFFER_EXTENSION_NAME "VK_OHOS_native_buffer"
|
||||
|
||||
typedef VkFlags VkSwapchainImageUsageFlagsOpenHarmony;
|
||||
typedef enum VkSwapchainImageUsageFlagBitsOpenHarmony {
|
||||
VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_OPENHARMONY = 0x00000001,
|
||||
VK_SWAPCHAIN_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VkSwapchainImageUsageFlagBitsOpenHarmony;
|
||||
|
||||
typedef struct {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
BufferHandle* handle;
|
||||
} VkNativeBufferOpenHarmony;
|
||||
|
||||
typedef struct {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSwapchainImageUsageFlagsOpenHarmony usage;
|
||||
} VkSwapchainImageCreateInfoOpenHarmony;
|
||||
|
||||
typedef struct {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkBool32 sharedImage;
|
||||
} VkPhysicalDevicePresentationPropertiesOpenHarmony;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageOpenHarmony)(
|
||||
VkDevice device,
|
||||
VkFormat format,
|
||||
VkImageUsageFlags imageUsage,
|
||||
uint64_t* grallocUsage);
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkSetNativeFenceFdOpenHarmony)(
|
||||
VkDevice device,
|
||||
int32_t nativeFenceFd,
|
||||
VkSemaphore semaphore,
|
||||
VkFence fence);
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetNativeFenceFdOpenHarmony)(
|
||||
VkQueue queue,
|
||||
uint32_t waitSemaphoreCount,
|
||||
const VkSemaphore* pWaitSemaphores,
|
||||
VkImage image,
|
||||
int32_t* pNativeFenceFd);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageOpenHarmony(
|
||||
VkDevice device,
|
||||
VkFormat format,
|
||||
VkImageUsageFlags imageUsage,
|
||||
uint64_t* grallocUsage
|
||||
);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkSetNativeFenceFdOpenHarmony(
|
||||
VkDevice device,
|
||||
int32_t nativeFenceFd,
|
||||
VkSemaphore semaphore,
|
||||
VkFence fence
|
||||
);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeFenceFdOpenHarmony(
|
||||
VkQueue queue,
|
||||
uint32_t waitSemaphoreCount,
|
||||
const VkSemaphore* pWaitSemaphores,
|
||||
VkImage image,
|
||||
int32_t* pNativeFenceFd
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#define VK_OpenHarmony_external_memory_OHOS_native_buffer 1
|
||||
struct OH_NativeBuffer;
|
||||
#define VK_OPENHARMONY_EXTERNAL_MEMORY_OHOS_NATIVE_BUFFER_SPEC_VERSION 1
|
||||
|
@ -20548,8 +20548,8 @@ typedef void* <name>MTLSharedEvent_id</name>;
|
||||
</extension>
|
||||
<extension name="VK_OpenHarmony_OHOS_surface" number="500" type="instance" requires="VK_KHR_surface" platform="OHOS" author="OpenHarmony" contact="Xindong Shi @stonehwsxd" supported="vulkan">
|
||||
<require>
|
||||
<enum value="1" name="VK_OpenHarmony_OHOS_SURFACE_SPEC_VERSION"/>
|
||||
<enum value=""VK_OpenHarmony_OHOS_surface"" name="VK_OpenHarmony_OHOS_SURFACE_EXTENSION_NAME"/>
|
||||
<enum value="1" name="VK_OPENHARMONY_OHOS_SURFACE_SPEC_VERSION"/>
|
||||
<enum value=""VK_OpenHarmony_OHOS_surface"" name="VK_OPENHARMONY_OHOS_SURFACE_EXTENSION_NAME"/>
|
||||
<enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_OHOS_SURFACE_CREATE_INFO_OPENHARMONY"/>
|
||||
<type name="VkOHOSSurfaceCreateFlagsOpenHarmony"/>
|
||||
<type name="VkOHOSSurfaceCreateInfoOpenHarmony"/>
|
||||
|
Loading…
Reference in New Issue
Block a user