diff --git a/BUILD.gn b/BUILD.gn index 27a14df..9950d2b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,5 +1,6 @@ # Copyright (C) 2018-2019 The ANGLE Project Authors. # Copyright (C) 2019 LunarG, Inc. +# Copyright (c) 2022 Huawei Device Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,11 +14,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build_overrides/vulkan_headers.gni") +import("//build/ohos.gni") + +is_ohos = current_os == "ohos" +is_android = current_os == "android" +is_mac = current_os == "ios" || current_os == "tvos" || current_os == "mac" +is_win = current_os == "win" || current_os == "mingw" +is_linux = current_os == "linux" +is_fuchsia = current_os == "fuchsia" config("vulkan_headers_config") { include_dirs = [ "include" ] + if (is_ohos) { + defines = [ "VK_USE_PLATFORM_OHOS" ] + } if (is_win) { defines = [ "VK_USE_PLATFORM_WIN32_KHR" ] } @@ -48,8 +59,7 @@ source_set("vulkan_headers") { "include/vulkan/vulkan.h", "include/vulkan/vulkan.hpp", "include/vulkan/vulkan_core.h", - "include/vulkan/vulkan_screen.h", + "include/vulkan/vulkan_ohos.h", ] public_configs = [ ":vulkan_headers_config" ] } - diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 3f7cdba..df4a403 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -85,6 +85,11 @@ #include "vulkan_screen.h" #endif +#ifdef VK_USE_PLATFORM_OHOS +#include +#include "vulkan_ohos.h" +#endif + #ifdef VK_ENABLE_BETA_EXTENSIONS #include "vulkan_beta.h" #endif diff --git a/include/vulkan/vulkan_ohos.h b/include/vulkan/vulkan_ohos.h new file mode 100644 index 0000000..b3a91ef --- /dev/null +++ b/include/vulkan/vulkan_ohos.h @@ -0,0 +1,47 @@ +#ifndef VULKAN_OHOS_H_ +#define VULKAN_OHOS_H_ 1 + +/* +** Copyright 2015-2021 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define VK_OHOS_openhm_surface 1 +#define VK_OHOS_OPENHM_SURFACE_SPEC_VERSION 1 +#define VK_OHOS_OPENHM_SURFACE_EXTENSION_NAME "VK_OHOS_openhm_surface" +typedef VkFlags VkOpenhmSurfaceCreateFlagsOHOS; +typedef struct VkOpenhmSurfaceCreateInfoOHOS { + VkStructureType sType; + const void* pNext; + VkOpenhmSurfaceCreateFlagsOHOS flags; + OHNativeWindow* window; +} VkOpenhmSurfaceCreateInfoOHOS; + +typedef VkResult (VKAPI_PTR *PFN_VkCreateOpenhmSurfaceOHOS)(VkInstance instance, const VkOpenhmSurfaceCreateInfoOHOS* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL VkCreateOpenhmSurfaceOHOS( + VkInstance instance, + const VkOpenhmSurfaceCreateInfoOHOS* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif + +#ifdef __cplusplus +} +#endif + +#endif