From 83f76e4b6e6e1694e6127afdcdbf8e4701ab927e Mon Sep 17 00:00:00 2001 From: zhanghong <329177372@qq.com> Date: Thu, 11 Apr 2024 17:10:55 +0800 Subject: [PATCH] modify vulkan_ohos.h --- src/video/khronos/vulkan/vulkan_ohos.h | 27 +++++++++++++++++--------- src/video/ohos/SDL_ohosvulkan.c | 4 ++-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/video/khronos/vulkan/vulkan_ohos.h b/src/video/khronos/vulkan/vulkan_ohos.h index 026185556..f5211d587 100644 --- a/src/video/khronos/vulkan/vulkan_ohos.h +++ b/src/video/khronos/vulkan/vulkan_ohos.h @@ -13,19 +13,22 @@ * limitations under the License. */ +#ifndef SDL_OHOS_VULKAN_H +#define SDL_OHOS_VULKAN_H + #include -#ifndef VULKAN_OHOS_H_ -#define VULKAN_OHOS_H_ 1 +#ifndef VULKAN_OHOS_H +#define VULKAN_OHOS_H 1 #ifdef __cplusplus extern "C" { #endif -#define VK_KHR_ohos_surface 1 +#define VK_KHR_OHOS_XCOMPONENT 1 struct ONativeWindow; -#define VK_KHR_OHOS_SURFACE_SPEC_VERSION 6 -#define VK_KHR_OHOS_SURFACE_EXTENSION_NAME "VK_OHOS_surface" +#define VK_KHR_OHOS_XCOMPONENT_SPEC_VERSION 6 +#define VK_KHR_OHOS_XCOMPONENT_EXTENSION_NAME "VK_OHOS_surface" typedef VkFlags VkOHOSSurfaceCreateFlagsKHR; @@ -36,7 +39,9 @@ typedef struct VkOHOSSurfaceCreateInfoKHR { struct OHNativeWindow* window; } VkOHOSSurfaceCreateInfoKHR; -typedef VkResult (VKAPI_PTR *PFN_vkCreateOHOSSurfaceKHR)(VkInstance instance, const VkOHOSSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkResult (VKAPI_PTR *PFN_vkCreateOHOSSurfaceKHR)(VkInstance instance, + const VkOHOSSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); #ifndef VK_NO_PROTOTYPES VKAPI_ATTR VkResult VKAPI_CALL vkCreateOHOSSurfaceKHR( @@ -46,7 +51,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateOHOSSurfaceKHR( VkSurfaceKHR* pSurface); #endif -#define VK_OHOS_external_memory_ohos_hardware_buffer 1 +#define VK_OHOS_EXTERNAL_MEMORY_OHOS_HARDWARE_BUFFER 1 struct OHardwareBuffer; #define VK_OHOS_EXTERNAL_MEMORY_OHOS_HARDWARE_BUFFER_SPEC_VERSION 3 @@ -97,8 +102,10 @@ typedef struct VkExternalFormatOHOS { } VkExternalFormatOHOS; -typedef VkResult (VKAPI_PTR *PFN_vkGetOHOSHardwareBufferPropertiesOHOS)(VkDevice device, const struct OHardwareBuffer* buffer, VkOHOSHardwareBufferPropertiesOHOS* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryOHOSHardwareBufferOHOS)(VkDevice device, const VkMemoryGetOHOSHardwareBufferInfoOHOS* pInfo, struct OHardwareBuffer** pBuffer); +typedef VkResult (VKAPI_PTR *PFN_vkGetOHOSHardwareBufferPropertiesOHOS)(VkDevice device, + const struct OHardwareBuffer* buffer, VkOHOSHardwareBufferPropertiesOHOS* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryOHOSHardwareBufferOHOS)(VkDevice device, + const VkMemoryGetOHOSHardwareBufferInfoOHOS* pInfo, struct OHardwareBuffer** pBuffer); #ifndef VK_NO_PROTOTYPES VKAPI_ATTR VkResult VKAPI_CALL vkGetOHOSHardwareBufferPropertiesOHOS( @@ -117,3 +124,5 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryOHOSHardwareBufferOHOS( #endif #endif + +#endif diff --git a/src/video/ohos/SDL_ohosvulkan.c b/src/video/ohos/SDL_ohosvulkan.c index 523ee3b89..2141f728d 100644 --- a/src/video/ohos/SDL_ohosvulkan.c +++ b/src/video/ohos/SDL_ohosvulkan.c @@ -81,7 +81,7 @@ SDL_bool OHOS_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, const char **names) { static const char *const extensionsForOHOS[] = { - VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_OHOS_SURFACE_EXTENSION_NAME + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_OHOS_XCOMPONENT_EXTENSION_NAME }; if (!_this->vulkan_config.loader_handle) { SDL_SetError("Vulkan is not loaded"); @@ -113,7 +113,7 @@ SDL_bool OHOS_Vulkan_CreateSurface(SDL_VideoDevice *_this, } if (!vkCreateOHOSSurfaceKHR) { - SDL_SetError(VK_KHR_OHOS_SURFACE_EXTENSION_NAME + SDL_SetError(VK_KHR_OHOS_XCOMPONENT_EXTENSION_NAME " extension is not enabled in the Vulkan instance."); return SDL_FALSE; } -- Gitee