standardize OH extension api

Signed-off-by: shegangbin <shegangbin1@huawei.com>
Change-Id: I854a1a67f1337482279c300dcc37f6637c638f7e
This commit is contained in:
shegangbin 2023-05-30 02:59:08 +00:00
parent 934ba98366
commit 4603b3a932
13 changed files with 295 additions and 266 deletions

View File

@ -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" }

View File

@ -379,6 +379,21 @@ 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 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 +419,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 +1253,26 @@ 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->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 +1323,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 +1483,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
}

View File

@ -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,25 @@ typedef struct VkLayerDispatchTable_ {
PFN_vkGetFramebufferTilePropertiesQCOM GetFramebufferTilePropertiesQCOM;
PFN_vkGetDynamicRenderingTilePropertiesQCOM GetDynamicRenderingTilePropertiesQCOM;
// ---- VK_OHOS_native_buffer extension commands
#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 +1073,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;

View File

@ -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,25 @@ 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->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 +1133,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 +1334,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 +1386,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 +2133,25 @@ 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, "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 +2387,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 +2440,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 +7435,97 @@ VKAPI_ATTR VkResult VKAPI_CALL GetDynamicRenderingTilePropertiesQCOM(
}
// ---- VK_OHOS_native_buffer extension trampoline/terminators
#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 GetNativeBufferPropertiesOHOS(
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 GetMemoryNativeBufferOHOS(
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 +7918,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 +9515,40 @@ 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("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 *)GetNativeBufferPropertiesOHOS;
return true;
}
#endif // VK_USE_PLATFORM_OHOS
#ifdef VK_USE_PLATFORM_OHOS
if (!strcmp("vkGetMemoryNativeBufferOHOS", name)) {
*addr = (void *)GetMemoryNativeBufferOHOS;
return true;
}
#endif // VK_USE_PLATFORM_OHOS
// ---- VK_KHR_acceleration_structure extension commands
if (!strcmp("vkCreateAccelerationStructureKHR", name)) {
*addr = (void *)CreateAccelerationStructureKHR;
@ -9596,40 +9654,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 +9968,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 +10020,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 +10080,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 +10093,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 };

View File

@ -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 {

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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",
]
}

View File

@ -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',
}
#

View File

@ -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',