diff --git a/README_OpenHarmony.md b/README_OpenHarmony.md index 8997b2c1d2a391822dc402ce89f003ec201f3649..18f094851d51c46bf9b10b54841c8375658e996d 100644 --- a/README_OpenHarmony.md +++ b/README_OpenHarmony.md @@ -81,18 +81,18 @@ Vulkan Layer属于增强Vulkan开发环境的扩展功能,可以由开发人 { "file_format_version" : "1.0.0", "layer" : { - "name": "VK_LAYER_OpenHarmony_OHOS_surface", + "name": "VK_LAYER_OHOS_surface", "type": "GLOBAL", "library_path": "libvulkan_swapchain.so", "api_version": "1.3.231", "implementation_version": "1", "description": "Vulkan Swapchain", "disable_environment": { - "DISABLE_OPENHARMONY_SWAPCHAIN_LAYER": "1" + "DISABLE_OHOS_SWAPCHAIN_LAYER": "1" }, "instance_extensions": [ { "name": "VK_KHR_surface", "spec_version": "25" }, - { "name": "VK_OpenHarmony_OHOS_surface", "spec_version": "1" } + { "name": "VK_OHOS_surface", "spec_version": "1" } ], "device_extensions": [ { "name": "VK_KHR_swapchain", "spec_version": "70" } diff --git a/loader/generated/vk_dispatch_table_helper.h b/loader/generated/vk_dispatch_table_helper.h index 018bace18fe54ee0a7be58f2e2a789478f3a4c34..35ef23d2dcb141b274d5a69c761c29a1f2551269 100644 --- a/loader/generated/vk_dispatch_table_helper.h +++ b/loader/generated/vk_dispatch_table_helper.h @@ -379,6 +379,27 @@ static VKAPI_ATTR VkResult VKAPI_CALL StubBindOpticalFlowSessionImageNV(VkDevice static VKAPI_ATTR void VKAPI_CALL StubCmdOpticalFlowExecuteNV(VkCommandBuffer commandBuffer, VkOpticalFlowSessionNV session, const VkOpticalFlowExecuteInfoNV* pExecuteInfo) { } static VKAPI_ATTR VkResult VKAPI_CALL StubGetFramebufferTilePropertiesQCOM(VkDevice device, VkFramebuffer framebuffer, uint32_t* pPropertiesCount, VkTilePropertiesQCOM* pProperties) { return VK_SUCCESS; } static VKAPI_ATTR VkResult VKAPI_CALL StubGetDynamicRenderingTilePropertiesQCOM(VkDevice device, const VkRenderingInfo* pRenderingInfo, VkTilePropertiesQCOM* pProperties) { return VK_SUCCESS; } +#ifdef VK_USE_PLATFORM_OHOS +static VKAPI_ATTR VkResult VKAPI_CALL StubSetNativeFenceFdOpenHarmony(VkDevice device, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence) { return VK_SUCCESS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +static VKAPI_ATTR VkResult VKAPI_CALL StubGetNativeFenceFdOpenHarmony(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd) { return VK_SUCCESS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +static VKAPI_ATTR VkResult VKAPI_CALL StubGetSwapchainGrallocUsageOHOS(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t* grallocUsage) { return VK_SUCCESS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +static VKAPI_ATTR VkResult VKAPI_CALL StubAcquireImageOHOS(VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence) { return VK_SUCCESS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +static VKAPI_ATTR VkResult VKAPI_CALL StubQueueSignalReleaseImageOHOS(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd) { return VK_SUCCESS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +static VKAPI_ATTR VkResult VKAPI_CALL StubGetNativeBufferPropertiesOHOS(VkDevice device, const struct OH_NativeBuffer* buffer, VkNativeBufferPropertiesOHOS* pProperties) { return VK_SUCCESS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryNativeBufferOHOS(VkDevice device, const VkMemoryGetNativeBufferInfoOHOS* pInfo, struct OH_NativeBuffer** pBuffer) { return VK_SUCCESS; } +#endif // VK_USE_PLATFORM_OHOS static VKAPI_ATTR VkResult VKAPI_CALL StubCreateAccelerationStructureKHR(VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureKHR* pAccelerationStructure) { return VK_SUCCESS; } static VKAPI_ATTR void VKAPI_CALL StubDestroyAccelerationStructureKHR(VkDevice device, VkAccelerationStructureKHR accelerationStructure, const VkAllocationCallbacks* pAllocator) { } static VKAPI_ATTR void VKAPI_CALL StubCmdBuildAccelerationStructuresKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos) { } @@ -404,21 +425,7 @@ static VKAPI_ATTR void VKAPI_CALL StubCmdSetRayTracingPipelineStackSizeKHR(VkCom static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksEXT(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) { } static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksIndirectEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { } static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksIndirectCountEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { } -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -static VKAPI_ATTR VkResult VKAPI_CALL StubGetSwapchainGrallocUsageOpenHarmony(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t* grallocUsage) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -static VKAPI_ATTR VkResult VKAPI_CALL StubSetNativeFenceFdOpenHarmony(VkDevice device, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -static VKAPI_ATTR VkResult VKAPI_CALL StubGetNativeFenceFdOpenHarmony( VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -static VKAPI_ATTR VkResult VKAPI_CALL StubGetOHOSNativeBufferPropertiesOpenHarmony( VkDevice device, const struct OH_NativeBuffer* buffer, VkOHOSNativeBufferPropertiesOpenHarmony* pProperties) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -static VKAPI_ATTR VkResult VKAPI_CALL StubGetMemoryOHOSNativeBufferOpenHarmony( VkDevice device, const VkMemoryGetOHOSNativeBufferInfoOpenHarmony* pInfo, struct OH_NativeBuffer** pBuffer) { return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY + static inline void layer_init_device_dispatch_table(VkDevice device, VkLayerDispatchTable *table, PFN_vkGetDeviceProcAddr gpa) { @@ -1252,6 +1259,34 @@ static inline void layer_init_device_dispatch_table(VkDevice device, VkLayerDisp if (table->GetFramebufferTilePropertiesQCOM == nullptr) { table->GetFramebufferTilePropertiesQCOM = (PFN_vkGetFramebufferTilePropertiesQCOM)StubGetFramebufferTilePropertiesQCOM; } table->GetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM) gpa(device, "vkGetDynamicRenderingTilePropertiesQCOM"); if (table->GetDynamicRenderingTilePropertiesQCOM == nullptr) { table->GetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM)StubGetDynamicRenderingTilePropertiesQCOM; } +#ifdef VK_USE_PLATFORM_OHOS + table->SetNativeFenceFdOpenHarmony = (PFN_vkSetNativeFenceFdOpenHarmony) gpa(device, "vkSetNativeFenceFdOpenHarmony"); + if (table->SetNativeFenceFdOpenHarmony == nullptr) { table->SetNativeFenceFdOpenHarmony = (PFN_vkSetNativeFenceFdOpenHarmony)StubSetNativeFenceFdOpenHarmony; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->GetNativeFenceFdOpenHarmony = (PFN_vkGetNativeFenceFdOpenHarmony) gpa(device, "vkGetNativeFenceFdOpenHarmony"); + if (table->GetNativeFenceFdOpenHarmony == nullptr) { table->GetNativeFenceFdOpenHarmony = (PFN_vkGetNativeFenceFdOpenHarmony)StubGetNativeFenceFdOpenHarmony; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->GetSwapchainGrallocUsageOHOS = (PFN_vkGetSwapchainGrallocUsageOHOS) gpa(device, "vkGetSwapchainGrallocUsageOHOS"); + if (table->GetSwapchainGrallocUsageOHOS == nullptr) { table->GetSwapchainGrallocUsageOHOS = (PFN_vkGetSwapchainGrallocUsageOHOS)StubGetSwapchainGrallocUsageOHOS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->AcquireImageOHOS = (PFN_vkAcquireImageOHOS) gpa(device, "vkAcquireImageOHOS"); + if (table->AcquireImageOHOS == nullptr) { table->AcquireImageOHOS = (PFN_vkAcquireImageOHOS)StubAcquireImageOHOS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->QueueSignalReleaseImageOHOS = (PFN_vkQueueSignalReleaseImageOHOS) gpa(device, "vkQueueSignalReleaseImageOHOS"); + if (table->QueueSignalReleaseImageOHOS == nullptr) { table->QueueSignalReleaseImageOHOS = (PFN_vkQueueSignalReleaseImageOHOS)StubQueueSignalReleaseImageOHOS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->GetNativeBufferPropertiesOHOS = (PFN_vkGetNativeBufferPropertiesOHOS) gpa(device, "vkGetNativeBufferPropertiesOHOS"); + if (table->GetNativeBufferPropertiesOHOS == nullptr) { table->GetNativeBufferPropertiesOHOS = (PFN_vkGetNativeBufferPropertiesOHOS)StubGetNativeBufferPropertiesOHOS; } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->GetMemoryNativeBufferOHOS = (PFN_vkGetMemoryNativeBufferOHOS) gpa(device, "vkGetMemoryNativeBufferOHOS"); + if (table->GetMemoryNativeBufferOHOS == nullptr) { table->GetMemoryNativeBufferOHOS = (PFN_vkGetMemoryNativeBufferOHOS)StubGetMemoryNativeBufferOHOS; } +#endif // VK_USE_PLATFORM_OHOS table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR) gpa(device, "vkCreateAccelerationStructureKHR"); if (table->CreateAccelerationStructureKHR == nullptr) { table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)StubCreateAccelerationStructureKHR; } table->DestroyAccelerationStructureKHR = (PFN_vkDestroyAccelerationStructureKHR) gpa(device, "vkDestroyAccelerationStructureKHR"); @@ -1302,26 +1337,6 @@ static inline void layer_init_device_dispatch_table(VkDevice device, VkLayerDisp if (table->CmdDrawMeshTasksIndirectEXT == nullptr) { table->CmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)StubCmdDrawMeshTasksIndirectEXT; } table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT) gpa(device, "vkCmdDrawMeshTasksIndirectCountEXT"); if (table->CmdDrawMeshTasksIndirectCountEXT == nullptr) { table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)StubCmdDrawMeshTasksIndirectCountEXT; } -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetSwapchainGrallocUsageOpenHarmony = (PFN_vkGetSwapchainGrallocUsageOpenHarmony) gpa(device, "vkGetSwapchainGrallocUsageOpenHarmony"); - if (table->GetSwapchainGrallocUsageOpenHarmony == nullptr) { table->GetSwapchainGrallocUsageOpenHarmony = (PFN_vkGetSwapchainGrallocUsageOpenHarmony)StubGetSwapchainGrallocUsageOpenHarmony; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->SetNativeFenceFdOpenHarmony = (PFN_vkSetNativeFenceFdOpenHarmony) gpa(device, "vkSetNativeFenceFdOpenHarmony"); - if (table->SetNativeFenceFdOpenHarmony == nullptr) { table->SetNativeFenceFdOpenHarmony = (PFN_vkSetNativeFenceFdOpenHarmony)StubSetNativeFenceFdOpenHarmony; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetNativeFenceFdOpenHarmony = (PFN_vkGetNativeFenceFdOpenHarmony) gpa(device, "vkGetNativeFenceFdOpenHarmony"); - if (table->GetNativeFenceFdOpenHarmony == nullptr) { table->GetNativeFenceFdOpenHarmony = (PFN_vkGetNativeFenceFdOpenHarmony)StubGetNativeFenceFdOpenHarmony; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetOHOSNativeBufferPropertiesOpenHarmony = (PFN_vkGetOHOSNativeBufferPropertiesOpenHarmony) gpa(device, "vkGetOHOSNativeBufferPropertiesOpenHarmony"); - if (table->GetOHOSNativeBufferPropertiesOpenHarmony == nullptr) { table->GetOHOSNativeBufferPropertiesOpenHarmony = (PFN_vkGetOHOSNativeBufferPropertiesOpenHarmony)StubGetOHOSNativeBufferPropertiesOpenHarmony; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetMemoryOHOSNativeBufferOpenHarmony = (PFN_vkGetMemoryOHOSNativeBufferOpenHarmony) gpa(device, "vkGetMemoryOHOSNativeBufferOpenHarmony"); - if (table->GetMemoryOHOSNativeBufferOpenHarmony == nullptr) { table->GetMemoryOHOSNativeBufferOpenHarmony = (PFN_vkGetMemoryOHOSNativeBufferOpenHarmony)StubGetMemoryOHOSNativeBufferOpenHarmony; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY } @@ -1482,7 +1497,7 @@ static inline void layer_init_instance_dispatch_table(VkInstance instance, VkLay table->GetPhysicalDeviceScreenPresentationSupportQNX = (PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX) gpa(instance, "vkGetPhysicalDeviceScreenPresentationSupportQNX"); #endif // VK_USE_PLATFORM_SCREEN_QNX table->GetPhysicalDeviceOpticalFlowImageFormatsNV = (PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV) gpa(instance, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->CreateOHOSSurfaceOpenHarmony = (PFN_vkCreateOHOSSurfaceOpenHarmony) gpa(instance, "vkCreateOHOSSurfaceOpenHarmony"); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY +#ifdef VK_USE_PLATFORM_OHOS + table->CreateSurfaceOHOS = (PFN_vkCreateSurfaceOHOS) gpa(instance, "vkCreateSurfaceOHOS"); +#endif // VK_USE_PLATFORM_OHOS } diff --git a/loader/generated/vk_layer_dispatch_table.h b/loader/generated/vk_layer_dispatch_table.h index d6a88830d79cb5ca0989eba7ba9927dd955b29ce..5fb0c84edc4c20a73d9cca439ce4562d33d375eb 100644 --- a/loader/generated/vk_layer_dispatch_table.h +++ b/loader/generated/vk_layer_dispatch_table.h @@ -113,6 +113,7 @@ typedef struct VkLayerInstanceDispatchTable_ { #ifdef VK_USE_PLATFORM_ANDROID_KHR PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR; #endif // VK_USE_PLATFORM_ANDROID_KHR + // ---- VK_KHR_win32_surface extension commands #ifdef VK_USE_PLATFORM_WIN32_KHR PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR; @@ -277,10 +278,11 @@ typedef struct VkLayerInstanceDispatchTable_ { // ---- VK_NV_optical_flow extension commands PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV GetPhysicalDeviceOpticalFlowImageFormatsNV; - // ---- VK_OpenHarmony_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - PFN_vkCreateOHOSSurfaceOpenHarmony CreateOHOSSurfaceOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY + + // ---- VK_OHOS_surface extension commands +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkCreateSurfaceOHOS CreateSurfaceOHOS; +#endif // VK_USE_PLATFORM_OHOS } VkLayerInstanceDispatchTable; // Device function pointer dispatch table @@ -1022,6 +1024,31 @@ typedef struct VkLayerDispatchTable_ { PFN_vkGetFramebufferTilePropertiesQCOM GetFramebufferTilePropertiesQCOM; PFN_vkGetDynamicRenderingTilePropertiesQCOM GetDynamicRenderingTilePropertiesQCOM; + // ---- VK_OHOS_native_buffer extension commands +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkSetNativeFenceFdOpenHarmony SetNativeFenceFdOpenHarmony; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkGetNativeFenceFdOpenHarmony GetNativeFenceFdOpenHarmony; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkGetSwapchainGrallocUsageOHOS GetSwapchainGrallocUsageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkAcquireImageOHOS AcquireImageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkQueueSignalReleaseImageOHOS QueueSignalReleaseImageOHOS; +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkGetNativeBufferPropertiesOHOS GetNativeBufferPropertiesOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkGetMemoryNativeBufferOHOS GetMemoryNativeBufferOHOS; +#endif // VK_USE_PLATFORM_OHOS + // ---- VK_KHR_acceleration_structure extension commands PFN_vkCreateAccelerationStructureKHR CreateAccelerationStructureKHR; PFN_vkDestroyAccelerationStructureKHR DestroyAccelerationStructureKHR; @@ -1052,26 +1079,6 @@ typedef struct VkLayerDispatchTable_ { PFN_vkCmdDrawMeshTasksEXT CmdDrawMeshTasksEXT; PFN_vkCmdDrawMeshTasksIndirectEXT CmdDrawMeshTasksIndirectEXT; PFN_vkCmdDrawMeshTasksIndirectCountEXT CmdDrawMeshTasksIndirectCountEXT; - - // ---- VK_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - PFN_vkGetSwapchainGrallocUsageOpenHarmony GetSwapchainGrallocUsageOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - PFN_vkSetNativeFenceFdOpenHarmony SetNativeFenceFdOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - PFN_vkGetNativeFenceFdOpenHarmony GetNativeFenceFdOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - - // ---- VK_OpenHarmony_external_memory_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - PFN_vkGetOHOSNativeBufferPropertiesOpenHarmony GetOHOSNativeBufferPropertiesOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - PFN_vkGetMemoryOHOSNativeBufferOpenHarmony GetMemoryOHOSNativeBufferOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - } VkLayerDispatchTable; diff --git a/loader/generated/vk_loader_extensions.c b/loader/generated/vk_loader_extensions.c index f9373352926aa9b9b825d18cee4c88a243525796..ff5d8ec1b545eb52cfc55401c0b9460ba4837679 100644 --- a/loader/generated/vk_loader_extensions.c +++ b/loader/generated/vk_loader_extensions.c @@ -266,10 +266,6 @@ VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_t #ifdef VK_USE_PLATFORM_FUCHSIA LOOKUP_GIPA(CreateImagePipeSurfaceFUCHSIA, false); #endif // VK_USE_PLATFORM_FUCHSIA - // ---- VK_OpenHarmony_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - LOOKUP_GIPA(CreateOHOSSurfaceOpenHarmony, false); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY // ---- VK_EXT_metal_surface extension commands #ifdef VK_USE_PLATFORM_METAL_EXT @@ -327,6 +323,11 @@ VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_t // ---- VK_NV_optical_flow extension commands LOOKUP_GIPA(GetPhysicalDeviceOpticalFlowImageFormatsNV, false); + // ---- VK_OHOS_surface extension commands +#ifdef VK_USE_PLATFORM_OHOS + LOOKUP_GIPA(CreateSurfaceOHOS, false); +#endif // VK_USE_PLATFORM_OHOS + #undef LOOKUP_GIPA return true; @@ -1083,6 +1084,31 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->GetFramebufferTilePropertiesQCOM = (PFN_vkGetFramebufferTilePropertiesQCOM)gdpa(dev, "vkGetFramebufferTilePropertiesQCOM"); table->GetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM)gdpa(dev, "vkGetDynamicRenderingTilePropertiesQCOM"); + // ---- VK_OHOS_native_buffer extension commands +#ifdef VK_USE_PLATFORM_OHOS + table->SetNativeFenceFdOpenHarmony = (PFN_vkSetNativeFenceFdOpenHarmony)gdpa(dev, "vkSetNativeFenceFdOpenHarmony"); +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->GetNativeFenceFdOpenHarmony = (PFN_vkGetNativeFenceFdOpenHarmony)gdpa(dev, "vkGetNativeFenceFdOpenHarmony"); +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->GetSwapchainGrallocUsageOHOS = (PFN_vkGetSwapchainGrallocUsageOHOS)gdpa(dev, "vkGetSwapchainGrallocUsageOHOS"); +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->AcquireImageOHOS = (PFN_vkAcquireImageOHOS)gdpa(dev, "vkAcquireImageOHOS"); +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->QueueSignalReleaseImageOHOS = (PFN_vkQueueSignalReleaseImageOHOS)gdpa(dev, "vkQueueSignalReleaseImageOHOS"); +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#ifdef VK_USE_PLATFORM_OHOS + table->GetNativeBufferPropertiesOHOS = (PFN_vkGetNativeBufferPropertiesOHOS)gdpa(dev, "vkGetNativeBufferPropertiesOHOS"); +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + table->GetMemoryNativeBufferOHOS = (PFN_vkGetMemoryNativeBufferOHOS)gdpa(dev, "vkGetMemoryNativeBufferOHOS"); +#endif // VK_USE_PLATFORM_OHOS + // ---- VK_KHR_acceleration_structure extension commands table->CreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)gdpa(dev, "vkCreateAccelerationStructureKHR"); table->DestroyAccelerationStructureKHR = (PFN_vkDestroyAccelerationStructureKHR)gdpa(dev, "vkDestroyAccelerationStructureKHR"); @@ -1113,24 +1139,6 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->CmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT)gdpa(dev, "vkCmdDrawMeshTasksEXT"); table->CmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)gdpa(dev, "vkCmdDrawMeshTasksIndirectEXT"); table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)gdpa(dev, "vkCmdDrawMeshTasksIndirectCountEXT"); - // ---- VK_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetSwapchainGrallocUsageOpenHarmony = (PFN_vkGetSwapchainGrallocUsageOpenHarmony)gdpa(dev, "vkGetSwapchainGrallocUsageOpenHarmony"); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->SetNativeFenceFdOpenHarmony = (PFN_vkSetNativeFenceFdOpenHarmony)gdpa(dev, "vkSetNativeFenceFdOpenHarmony"); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetNativeFenceFdOpenHarmony = (PFN_vkGetNativeFenceFdOpenHarmony)gdpa(dev, "vkGetNativeFenceFdOpenHarmony"); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - - // ---- VK_OpenHarmony_external_memory_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetOHOSNativeBufferPropertiesOpenHarmony = (PFN_vkGetOHOSNativeBufferPropertiesOpenHarmony)gdpa(dev, "vkGetOHOSNativeBufferPropertiesOpenHarmony"); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->GetMemoryOHOSNativeBufferOpenHarmony = (PFN_vkGetMemoryOHOSNativeBufferOpenHarmony)gdpa(dev, "vkGetMemoryOHOSNativeBufferOpenHarmony"); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY } // Init Instance function pointer dispatch table with core commands @@ -1332,11 +1340,6 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer table->CreateImagePipeSurfaceFUCHSIA = (PFN_vkCreateImagePipeSurfaceFUCHSIA)gpa(inst, "vkCreateImagePipeSurfaceFUCHSIA"); #endif // VK_USE_PLATFORM_FUCHSIA - // ---- VK_OpenHarmony_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - table->CreateOHOSSurfaceOpenHarmony = (PFN_vkCreateOHOSSurfaceOpenHarmony)gpa(inst, "vkCreateOHOSSurfaceOpenHarmony"); -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - // ---- VK_EXT_metal_surface extension commands #ifdef VK_USE_PLATFORM_METAL_EXT table->CreateMetalSurfaceEXT = (PFN_vkCreateMetalSurfaceEXT)gpa(inst, "vkCreateMetalSurfaceEXT"); @@ -1389,6 +1392,11 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer // ---- VK_NV_optical_flow extension commands table->GetPhysicalDeviceOpticalFlowImageFormatsNV = (PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)gpa(inst, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); + + // ---- VK_OHOS_surface extension commands +#ifdef VK_USE_PLATFORM_OHOS + table->CreateSurfaceOHOS = (PFN_vkCreateSurfaceOHOS)gpa(inst, "vkCreateSurfaceOHOS"); +#endif // VK_USE_PLATFORM_OHOS } // Device command lookup function @@ -2131,6 +2139,31 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "GetFramebufferTilePropertiesQCOM")) return (void *)table->GetFramebufferTilePropertiesQCOM; if (!strcmp(name, "GetDynamicRenderingTilePropertiesQCOM")) return (void *)table->GetDynamicRenderingTilePropertiesQCOM; + // ---- VK_OHOS_native_buffer extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "SetNativeFenceFdOpenHarmony")) return (void *)table->SetNativeFenceFdOpenHarmony; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "GetNativeFenceFdOpenHarmony")) return (void *)table->GetNativeFenceFdOpenHarmony; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "GetSwapchainGrallocUsageOHOS")) return (void *)table->GetSwapchainGrallocUsageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "AcquireImageOHOS")) return (void *)table->AcquireImageOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "QueueSignalReleaseImageOHOS")) return (void *)table->QueueSignalReleaseImageOHOS; +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "GetNativeBufferPropertiesOHOS")) return (void *)table->GetNativeBufferPropertiesOHOS; +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "GetMemoryNativeBufferOHOS")) return (void *)table->GetMemoryNativeBufferOHOS; +#endif // VK_USE_PLATFORM_OHOS + // ---- VK_KHR_acceleration_structure extension commands if (!strcmp(name, "CreateAccelerationStructureKHR")) return (void *)table->CreateAccelerationStructureKHR; if (!strcmp(name, "DestroyAccelerationStructureKHR")) return (void *)table->DestroyAccelerationStructureKHR; @@ -2366,11 +2399,6 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI if (!strcmp(name, "CreateImagePipeSurfaceFUCHSIA")) return (void *)table->CreateImagePipeSurfaceFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA - // ---- VK_OpenHarmony_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - if (!strcmp(name, "CreateOHOSSurfaceOpenHarmony")) return (void *)table->CreateOHOSSurfaceOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - // ---- VK_EXT_metal_surface extension commands #ifdef VK_USE_PLATFORM_METAL_EXT if (!strcmp(name, "CreateMetalSurfaceEXT")) return (void *)table->CreateMetalSurfaceEXT; @@ -2424,6 +2452,11 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI // ---- VK_NV_optical_flow extension commands if (!strcmp(name, "GetPhysicalDeviceOpticalFlowImageFormatsNV")) return (void *)table->GetPhysicalDeviceOpticalFlowImageFormatsNV; + // ---- VK_OHOS_surface extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp(name, "CreateSurfaceOHOS")) return (void *)table->CreateSurfaceOHOS; +#endif // VK_USE_PLATFORM_OHOS + *found_name = false; return NULL; } @@ -7414,6 +7447,132 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM( } +// ---- VK_OHOS_native_buffer extension trampoline/terminators + +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL SetNativeFenceFdOpenHarmony( + VkDevice device, + int32_t nativeFenceFd, + VkSemaphore semaphore, + VkFence fence) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkSetNativeFenceFdOpenHarmony: Invalid device " + "[VUID-vkSetNativeFenceFdOpenHarmony-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->SetNativeFenceFdOpenHarmony(device, nativeFenceFd, semaphore, fence); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL GetNativeFenceFdOpenHarmony( + VkQueue queue, + uint32_t waitSemaphoreCount, + const VkSemaphore* pWaitSemaphores, + VkImage image, + int32_t* pNativeFenceFd) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetNativeFenceFdOpenHarmony: Invalid queue " + "[VUID-vkGetNativeFenceFdOpenHarmony-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetNativeFenceFdOpenHarmony(queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainGrallocUsageOHOS( + VkDevice device, + VkFormat format, + VkImageUsageFlags imageUsage, + uint64_t* grallocUsage) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetSwapchainGrallocUsageOHOS: Invalid device " + "[VUID-vkGetSwapchainGrallocUsageOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetSwapchainGrallocUsageOHOS(device, format, imageUsage, grallocUsage); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL AcquireImageOHOS( + VkDevice device, + VkImage image, + int32_t nativeFenceFd, + VkSemaphore semaphore, + VkFence fence) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkAcquireImageOHOS: Invalid device " + "[VUID-vkAcquireImageOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->AcquireImageOHOS(device, image, nativeFenceFd, semaphore, fence); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL QueueSignalReleaseImageOHOS( + VkQueue queue, + uint32_t waitSemaphoreCount, + const VkSemaphore* pWaitSemaphores, + VkImage image, + int32_t* pNativeFenceFd) { + const VkLayerDispatchTable *disp = loader_get_dispatch(queue); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkQueueSignalReleaseImageOHOS: Invalid queue " + "[VUID-vkQueueSignalReleaseImageOHOS-queue-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->QueueSignalReleaseImageOHOS(queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd); +} + +#endif // VK_USE_PLATFORM_OHOS + +// ---- VK_OHOS_external_memory extension trampoline/terminators + +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS( + VkDevice device, + const struct OH_NativeBuffer* buffer, + VkNativeBufferPropertiesOHOS* pProperties) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetNativeBufferPropertiesOHOS: Invalid device " + "[VUID-vkGetNativeBufferPropertiesOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetNativeBufferPropertiesOHOS(device, buffer, pProperties); +} + +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS( + VkDevice device, + const VkMemoryGetNativeBufferInfoOHOS* pInfo, + struct OH_NativeBuffer** pBuffer) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetMemoryNativeBufferOHOS: Invalid device " + "[VUID-vkGetMemoryNativeBufferOHOS-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetMemoryNativeBufferOHOS(device, pInfo, pBuffer); +} + +#endif // VK_USE_PLATFORM_OHOS + // ---- VK_KHR_acceleration_structure extension trampoline/terminators VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR( @@ -7806,94 +7965,6 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectCountEXT( disp->CmdDrawMeshTasksIndirectCountEXT(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); } -// ---- VK_OHOS_native_buffer extension trampoline/terminators - -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -VKAPI_ATTR VkResult GetSwapchainGrallocUsageOpenHarmony( - VkDevice device, - VkFormat format, - VkImageUsageFlags imageUsage, - uint64_t* grallocUsage) { - const VkLayerDispatchTable *disp = loader_get_dispatch(device); - if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetSwapchainGrallocUsageOpenHarmony: Invalid device " - "[VUID-vkGetSwapchainGrallocUsageOpenHarmony-device-parameter]"); - abort(); /* Intentionally fail so user can correct issue. */ - } - return disp->GetSwapchainGrallocUsageOpenHarmony(device, format, imageUsage, grallocUsage); -} -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -VKAPI_ATTR VkResult SetNativeFenceFdOpenHarmony( - VkDevice device, - int32_t nativeFenceFd, - VkSemaphore semaphore, - VkFence fence) { - const VkLayerDispatchTable *disp = loader_get_dispatch(device); - if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkSetNativeFenceFdOpenHarmony: Invalid device " - "[VUID-vkSetNativeFenceFdOpenHarmony-device-parameter]"); - abort(); /* Intentionally fail so user can correct issue. */ - } - return disp->SetNativeFenceFdOpenHarmony(device, nativeFenceFd, semaphore, fence); -} -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -VKAPI_ATTR VkResult GetNativeFenceFdOpenHarmony( - VkQueue queue, - uint32_t waitSemaphoreCount, - const VkSemaphore* pWaitSemaphores, - VkImage image, - int32_t* pNativeFenceFd) { - const VkLayerDispatchTable *disp = loader_get_dispatch(queue); - if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetNativeFenceFdOpenHarmony: Invalid queue " - "[VUID-vkGetNativeFenceFdOpenHarmony-device-parameter]"); - abort(); /* Intentionally fail so user can correct issue. */ - } - return disp->GetNativeFenceFdOpenHarmony(queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd); -} -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - -// ---- VK_OpenHarmony_external_memory_OHOS_native_buffer extension trampoline/terminators - -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -VKAPI_ATTR VkResult GetOHOSNativeBufferPropertiesOpenHarmony( - VkDevice device, - const struct OH_NativeBuffer* buffer, - VkOHOSNativeBufferPropertiesOpenHarmony* pProperties) { - const VkLayerDispatchTable *disp = loader_get_dispatch(device); - if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetOHOSNativeBufferPropertiesOpenHarmony: Invalid device " - "[VUID-vkGetOHOSNativeBufferPropertiesOpenHarmony-device-parameter]"); - abort(); /* Intentionally fail so user can correct issue. */ - } - return disp->GetOHOSNativeBufferPropertiesOpenHarmony(device, buffer, pProperties); -} -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -VKAPI_ATTR VkResult GetMemoryOHOSNativeBufferOpenHarmony( - VkDevice device, - const VkMemoryGetOHOSNativeBufferInfoOpenHarmony* pInfo, - struct OH_NativeBuffer** pBuffer) { - const VkLayerDispatchTable *disp = loader_get_dispatch(device); - if (NULL == disp) { - loader_log(NULL, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, - "vkGetMemoryOHOSNativeBufferOpenHarmony: Invalid device " - "[VUID-vkGetMemoryOHOSNativeBufferOpenHarmony-device-parameter]"); - abort(); /* Intentionally fail so user can correct issue. */ - } - return disp->GetMemoryOHOSNativeBufferOpenHarmony(device, pInfo, pBuffer); -} -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - // GPA helpers for extensions bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { *addr = NULL; @@ -9491,6 +9562,52 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_OHOS_native_buffer extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkSetNativeFenceFdOpenHarmony", name)) { + *addr = (void *)SetNativeFenceFdOpenHarmony; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkGetNativeFenceFdOpenHarmony", name)) { + *addr = (void *)GetNativeFenceFdOpenHarmony; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkGetSwapchainGrallocUsageOHOS", name)) { + *addr = (void *)GetSwapchainGrallocUsageOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkAcquireImageOHOS", name)) { + *addr = (void *)AcquireImageOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkQueueSignalReleaseImageOHOS", name)) { + *addr = (void *)QueueSignalReleaseImageOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS + + // ---- VK_OHOS_external_memory extension commands +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkGetNativeBufferPropertiesOHOS", name)) { + *addr = (void *)vkGetNativeBufferPropertiesOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS +#ifdef VK_USE_PLATFORM_OHOS + if (!strcmp("vkGetMemoryNativeBufferOHOS", name)) { + *addr = (void *)vkGetMemoryNativeBufferOHOS; + return true; + } +#endif // VK_USE_PLATFORM_OHOS + // ---- VK_KHR_acceleration_structure extension commands if (!strcmp("vkCreateAccelerationStructureKHR", name)) { *addr = (void *)CreateAccelerationStructureKHR; @@ -9596,40 +9713,6 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na *addr = (void *)CmdDrawMeshTasksIndirectCountEXT; return true; } - - // ---- VK_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - if (!strcmp("vkGetSwapchainGrallocUsageOpenHarmony", name)) { - *addr = (void *)GetSwapchainGrallocUsageOpenHarmony; - return true; - } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - if (!strcmp("vkSetNativeFenceFdOpenHarmony", name)) { - *addr = (void *)SetNativeFenceFdOpenHarmony; - return true; - } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - if (!strcmp("vkGetNativeFenceFdOpenHarmony", name)) { - *addr = (void *)GetNativeFenceFdOpenHarmony; - return true; - } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - - // ---- VK_OpenHarmony_external_memory_OHOS_native_buffer extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - if (!strcmp("vkGetOHOSNativeBufferPropertiesOpenHarmony", name)) { - *addr = (void *)GetOHOSNativeBufferPropertiesOpenHarmony; - return true; - } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - if (!strcmp("vkGetMemoryOHOSNativeBufferOpenHarmony", name)) { - *addr = (void *)GetMemoryOHOSNativeBufferOpenHarmony; - return true; - } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY return false; } @@ -9944,11 +10027,6 @@ const VkLayerInstanceDispatchTable instance_disp = { .CreateImagePipeSurfaceFUCHSIA = terminator_CreateImagePipeSurfaceFUCHSIA, #endif // VK_USE_PLATFORM_FUCHSIA - // ---- VK_OpenHarmony_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - .CreateOHOSSurfaceOpenHarmony = terminator_CreateOHOSSurfaceOpenHarmony, -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - // ---- VK_EXT_metal_surface extension commands #ifdef VK_USE_PLATFORM_METAL_EXT .CreateMetalSurfaceEXT = terminator_CreateMetalSurfaceEXT, @@ -10001,6 +10079,11 @@ const VkLayerInstanceDispatchTable instance_disp = { // ---- VK_NV_optical_flow extension commands .GetPhysicalDeviceOpticalFlowImageFormatsNV = terminator_GetPhysicalDeviceOpticalFlowImageFormatsNV, + + // ---- VK_OHOS_surface extension commands +#ifdef VK_USE_PLATFORM_OHOS + .CreateSurfaceOHOS = terminator_CreateSurfaceOHOS, +#endif // VK_USE_PLATFORM_OHOS }; // A null-terminated list of all of the instance extensions supported by the loader. @@ -10056,9 +10139,6 @@ const char *const LOADER_INSTANCE_EXTENSIONS[] = { #ifdef VK_USE_PLATFORM_FUCHSIA VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_FUCHSIA -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - VK_OPENHARMONY_OHOS_SURFACE_EXTENSION_NAME, -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY #ifdef VK_USE_PLATFORM_METAL_EXT VK_EXT_METAL_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_METAL_EXT @@ -10072,5 +10152,8 @@ const char *const LOADER_INSTANCE_EXTENSIONS[] = { VK_QNX_SCREEN_SURFACE_EXTENSION_NAME, #endif // VK_USE_PLATFORM_SCREEN_QNX VK_GOOGLE_SURFACELESS_QUERY_EXTENSION_NAME, +#ifdef VK_USE_PLATFORM_OHOS + VK_OHOS_SURFACE_EXTENSION_NAME, +#endif // VK_USE_PLATFORM_OHOS NULL }; diff --git a/loader/generated/vk_loader_extensions.h b/loader/generated/vk_loader_extensions.h index cd3012fb7d595796b6d585588f01cde9ebeced65..51b894c56790c13e137a1ef6f3825f3e4326dcfa 100644 --- a/loader/generated/vk_loader_extensions.h +++ b/loader/generated/vk_loader_extensions.h @@ -419,11 +419,6 @@ struct loader_icd_term_dispatch { PFN_vkCreateImagePipeSurfaceFUCHSIA CreateImagePipeSurfaceFUCHSIA; #endif // VK_USE_PLATFORM_FUCHSIA - // ---- VK_OpenHarmony_OHOS_surface extension commands -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - PFN_vkCreateOHOSSurfaceOpenHarmony CreateOHOSSurfaceOpenHarmony; -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY - // ---- VK_EXT_metal_surface extension commands #ifdef VK_USE_PLATFORM_METAL_EXT PFN_vkCreateMetalSurfaceEXT CreateMetalSurfaceEXT; @@ -479,6 +474,11 @@ struct loader_icd_term_dispatch { // ---- VK_NV_optical_flow extension commands PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV GetPhysicalDeviceOpticalFlowImageFormatsNV; + + // ---- VK_OHOS_surface extension commands +#ifdef VK_USE_PLATFORM_OHOS + PFN_vkCreateSurfaceOHOS CreateSurfaceOHOS; +#endif // VK_USE_PLATFORM_OHOS }; struct loader_instance_extension_enables { diff --git a/loader/loader.c b/loader/loader.c index 373c2b4561d4957fb02eb6ea5cd0156e602416e5..a53ac8c36bc3d6fa684e064489b906ef17b57884 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -5266,6 +5266,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI #ifdef VK_USE_PLATFORM_ANDROID_KHR NULL != icd_term->dispatch.CreateAndroidSurfaceKHR || #endif // VK_USE_PLATFORM_ANDROID_KHR +#ifdef VK_USE_PLATFORM_OHOS + NULL != icd_term->dispatch.CreateSurfaceOHOS || +#endif // VK_USE_PLATFORM_OHOS #ifdef VK_USE_PLATFORM_WIN32_KHR NULL != icd_term->dispatch.CreateWin32SurfaceKHR || #endif // VK_USE_PLATFORM_WIN32_KHR diff --git a/loader/loader_common.h b/loader/loader_common.h index af09c86bd38bb0c70f4a88161aad0e036ac3dfac..8d934dc13e5afc1c22242571bd1a318feac0c670 100644 --- a/loader/loader_common.h +++ b/loader/loader_common.h @@ -322,8 +322,8 @@ struct loader_instance { #ifdef VK_USE_PLATFORM_ANDROID_KHR bool wsi_android_surface_enabled; #endif -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - bool wsi_openharmony_surface_enabled; +#ifdef VK_USE_PLATFORM_OHOS + bool wsi_ohos_surface_enabled; #endif #ifdef VK_USE_PLATFORM_MACOS_MVK bool wsi_macos_surface_enabled; diff --git a/loader/log.c b/loader/log.c index 2e13857ea1a43502ff8a163e2f9fe080b0b26e05..2ccacb5d737f226c9a5f3fcff91e22aa357b7734 100644 --- a/loader/log.c +++ b/loader/log.c @@ -33,7 +33,7 @@ #include "debug_utils.h" #include "get_environment.h" -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY +#ifdef VK_USE_PLATFORM_OHOS #include "loader_hilog.h" #endif @@ -224,7 +224,7 @@ void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t ms OutputDebugString("\n"); #endif -#if defined(VK_USE_PLATFORM_OHOS_OPENHARMONY) +#if defined(VK_USE_PLATFORM_OHOS) OpenHarmonyLog(msg_type, cmd_line_msg); #endif diff --git a/loader/wsi.c b/loader/wsi.c index 73b2a9bc12e3b072b405e477636081c758477ab4..e208f04167594318e1f773fd12f21808e857561b 100644 --- a/loader/wsi.c +++ b/loader/wsi.c @@ -80,12 +80,12 @@ void wsi_create_instance(struct loader_instance *loader_inst, const VkInstanceCr continue; } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_OPENHARMONY_OHOS_SURFACE_EXTENSION_NAME) == 0) { - loader_inst->wsi_openharmony_surface_enabled = true; +#ifdef VK_USE_PLATFORM_OHOS + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_OHOS_SURFACE_EXTENSION_NAME) == 0) { + loader_inst->wsi_ohos_surface_enabled = true; continue; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY +#endif // VK_USE_PLATFORM_OHOS #ifdef VK_USE_PLATFORM_MACOS_MVK if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_MVK_MACOS_SURFACE_EXTENSION_NAME) == 0) { loader_inst->wsi_macos_surface_enabled = true; @@ -1217,47 +1217,47 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance ins #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY +#ifdef VK_USE_PLATFORM_OHOS -// Functions for the VK_OpenHarmony_OHOS_surface extension: +// Functions for the VK_OHOS_surface extension: -// This is the trampoline entrypoint for CreateOHOSSurfaceOpenHarmony +// This is the trampoline entrypoint for CreateSurfaceOHOS -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateOHOSSurfaceOpenHarmony(VkInstance instance, - const VkOHOSSurfaceCreateInfoOpenHarmony *pCreateInfo, +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS(VkInstance instance, + const VkSurfaceCreateInfoOHOS *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; if (NULL == loader_get_instance(instance)) { loader_log(NULL, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VkOHOSSurfaceCreateInfoOpenHarmony: Invalid instance [VUID-VkOHOSSurfaceCreateInfoOpenHarmony-instance-parameter]"); + "vkCreateSurfaceOHOS: Invalid instance [VUID-vkCreateSurfaceOHOS-instance-parameter]"); abort(); /* Intentionally fail so user can correct issue. */ } disp = loader_get_instance_layer_dispatch(instance); - return disp->CreateOHOSSurfaceOpenHarmony(instance, pCreateInfo, pAllocator, pSurface); + return disp->CreateSurfaceOHOS(instance, pCreateInfo, pAllocator, pSurface); } -// This is the instance chain terminator function for CreateOHOSSurfaceOpenHarmony -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateOHOSSurfaceOpenHarmony(VkInstance instance, - const VkOHOSSurfaceCreateInfoOpenHarmony *pCreateInfo, +// This is the instance chain terminator function for CreateSurfaceOHOS +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSurfaceOHOS(VkInstance instance, + const VkSurfaceCreateInfoOHOS *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { // First, check to ensure the appropriate extension was enabled: struct loader_instance *loader_inst = loader_get_instance(instance); if (!loader_inst->wsi_display_enabled) { loader_log(loader_inst, VULKAN_LOADER_ERROR_BIT, 0, - "VK_KHR_display extension not enabled. vkCreateOHOSSurfaceOpenHarmony not executed!\n"); + "VK_KHR_display extension not enabled. vkCreateSurfaceOHOS not executed!\n"); return VK_ERROR_EXTENSION_NOT_PRESENT; } // Next, if so, proceed with the implementation of this function: - VkIcdSurfaceOpenHarmony *pIcdSurface = - loader_instance_heap_alloc(loader_inst, sizeof(VkIcdSurfaceOpenHarmony), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + VkIcdSurfaceOHOS *pIcdSurface = + loader_instance_heap_alloc(loader_inst, sizeof(VkIcdSurfaceOHOS), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (pIcdSurface == NULL) { return VK_ERROR_OUT_OF_HOST_MEMORY; } - pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_OPENHARMONY; + pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_OHOS; pIcdSurface->window = pCreateInfo->window; *pSurface = (VkSurfaceKHR)pIcdSurface; @@ -1265,7 +1265,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateOHOSSurfaceOpenHarmony(VkInstanc return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY +#endif // VK_USE_PLATFORM_OHOS // Functions for the VK_EXT_headless_surface extension: @@ -2913,14 +2913,14 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *loader_inst, const char return true; } #endif // VK_USE_PLATFORM_ANDROID_KHR -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY +#ifdef VK_USE_PLATFORM_OHOS - // Functions for the VK_OpenHarmony_OHOS_surface extension: - if (!strcmp("vkCreateOHOSSurfaceOpenHarmony", name)) { - *addr = loader_inst->wsi_openharmony_surface_enabled ? (void *)vkCreateOHOSSurfaceOpenHarmony : NULL; + // Functions for the VK_OHOS_surface extension: + if (!strcmp("vkCreateSurfaceOHOS", name)) { + *addr = loader_inst->wsi_ohos_surface_enabled ? (void *)vkCreateSurfaceOHOS : NULL; return true; } -#endif // VK_USE_PLATFORM_OHOS_OPENHARMONY +#endif // VK_USE_PLATFORM_OHOS #ifdef VK_USE_PLATFORM_MACOS_MVK diff --git a/loader/wsi.h b/loader/wsi.h index b02b8b81f7a515207fe6b5abb1a3c9369b3facd9..9895da3d99a28493f971c5262de30ebe1fc569e9 100644 --- a/loader/wsi.h +++ b/loader/wsi.h @@ -229,9 +229,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance ins const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); #endif -#ifdef VK_USE_PLATFORM_OHOS_OPENHARMONY -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateOHOSSurfaceOpenHarmony(VkInstance instance, - const VkOHOSSurfaceCreateInfoOpenHarmony* pCreateInfo, +#ifdef VK_USE_PLATFORM_OHOS +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSurfaceOHOS(VkInstance instance, + const VkSurfaceCreateInfoOHOS* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); #endif diff --git a/openharmony/BUILD.gn b/openharmony/BUILD.gn index e8fa1a644427783ebb996305ac5581bcbea5eaf0..83cdc80fb730505c2e6c36700af70f4d994be76e 100644 --- a/openharmony/BUILD.gn +++ b/openharmony/BUILD.gn @@ -38,7 +38,7 @@ config("vulkan_internal_config") { "SYSCONFDIR=\"/system/etc\"", "FALLBACK_CONFIG_DIRS=\"/vendor/etc\"", "FALLBACK_DATA_DIRS=\"/data\"", - "VK_USE_PLATFORM_OHOS_OPENHARMONY", + "VK_USE_PLATFORM_OHOS", ] } diff --git a/scripts/common_codegen.py b/scripts/common_codegen.py index ab07fc10000c8154dd3bbae0bb2ef7c058f1a1b6..0805981cb6165a6734a677ffb3bc62fd0e350b02 100644 --- a/scripts/common_codegen.py +++ b/scripts/common_codegen.py @@ -60,7 +60,7 @@ platform_dict = { 'xlib_xrandr' : 'VK_USE_PLATFORM_XLIB_XRANDR_EXT', 'provisional' : 'VK_ENABLE_BETA_EXTENSIONS', 'screen' : 'VK_USE_PLATFORM_SCREEN_QNX', - 'openharmony' : 'VK_USE_PLATFORM_OHOS_OPENHARMONY', + 'ohos' : 'VK_USE_PLATFORM_OHOS', } # diff --git a/scripts/loader_extension_generator.py b/scripts/loader_extension_generator.py index a54b05ea4cbff56dcf29927586120875ae9d2f9b..623133048017da9bae7b765a16b265c2e4a518e2 100644 --- a/scripts/loader_extension_generator.py +++ b/scripts/loader_extension_generator.py @@ -47,7 +47,7 @@ WSI_EXT_NAMES = ['VK_KHR_surface', 'VK_KHR_get_surface_capabilities2', 'VK_QNX_screen_surface', 'VK_NN_vi_surface', - 'VK_OpenHarmony_OHOS_surface'] + 'VK_OHOS_surface'] ADD_INST_CMDS = ['vkCreateInstance', 'vkEnumerateInstanceExtensionProperties',