Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc792f55 authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

Vulkan: remove redundant function definitions in null_driver

When deprecating the old gen scripts, there's some duplicate entries get added,
which is fixed by this change.

This change also reorders the extension constants in the gen scripts so that
future modification is less likely to put duplicate entries.

Bug: 134185757
Test: ./scripts/code_generator.py && build
Change-Id: I6c8356b01e8a9c042293804eb628ed0a72da4a5c
parent 10d01dba
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -480,14 +480,14 @@ ProcHook::Extension GetProcHookExtension(const char* name) {
    if (strcmp(name, "VK_EXT_swapchain_colorspace") == 0) return ProcHook::EXT_swapchain_colorspace;
    if (strcmp(name, "VK_GOOGLE_display_timing") == 0) return ProcHook::GOOGLE_display_timing;
    if (strcmp(name, "VK_KHR_android_surface") == 0) return ProcHook::KHR_android_surface;
    if (strcmp(name, "VK_KHR_get_surface_capabilities2") == 0) return ProcHook::KHR_get_surface_capabilities2;
    if (strcmp(name, "VK_KHR_incremental_present") == 0) return ProcHook::KHR_incremental_present;
    if (strcmp(name, "VK_KHR_shared_presentable_image") == 0) return ProcHook::KHR_shared_presentable_image;
    if (strcmp(name, "VK_KHR_surface") == 0) return ProcHook::KHR_surface;
    if (strcmp(name, "VK_KHR_swapchain") == 0) return ProcHook::KHR_swapchain;
    if (strcmp(name, "VK_KHR_get_surface_capabilities2") == 0) return ProcHook::KHR_get_surface_capabilities2;
    if (strcmp(name, "VK_KHR_get_physical_device_properties2") == 0) return ProcHook::KHR_get_physical_device_properties2;
    if (strcmp(name, "VK_ANDROID_external_memory_android_hardware_buffer") == 0) return ProcHook::ANDROID_external_memory_android_hardware_buffer;
    if (strcmp(name, "VK_KHR_bind_memory2") == 0) return ProcHook::KHR_bind_memory2;
    if (strcmp(name, "VK_KHR_get_physical_device_properties2") == 0) return ProcHook::KHR_get_physical_device_properties2;
    // clang-format on
    return ProcHook::EXTENSION_UNKNOWN;
}
+2 −2
Original line number Diff line number Diff line
@@ -40,14 +40,14 @@ struct ProcHook {
        EXT_swapchain_colorspace,
        GOOGLE_display_timing,
        KHR_android_surface,
        KHR_get_surface_capabilities2,
        KHR_incremental_present,
        KHR_shared_presentable_image,
        KHR_surface,
        KHR_swapchain,
        KHR_get_surface_capabilities2,
        KHR_get_physical_device_properties2,
        ANDROID_external_memory_android_hardware_buffer,
        KHR_bind_memory2,
        KHR_get_physical_device_properties2,

        EXTENSION_CORE,  // valid bit
        EXTENSION_COUNT,
+0 −3
Original line number Diff line number Diff line
@@ -207,9 +207,6 @@ VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat fo
VKAPI_ATTR VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, uint64_t* grallocConsumerUsage, uint64_t* grallocProducerUsage);
VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
// clang-format on

}  // namespace null_driver
+3 −3
Original line number Diff line number Diff line
@@ -27,17 +27,17 @@ interceptedExtensions = [
  'VK_EXT_swapchain_colorspace',
  'VK_GOOGLE_display_timing',
  'VK_KHR_android_surface',
  'VK_KHR_get_surface_capabilities2',
  'VK_KHR_incremental_present',
  'VK_KHR_shared_presentable_image',
  'VK_KHR_surface',
  'VK_KHR_swapchain',
  'VK_KHR_get_surface_capabilities2'
]

knownExtensions = interceptedExtensions + [
  'VK_KHR_get_physical_device_properties2',
  'VK_ANDROID_external_memory_android_hardware_buffer',
  'VK_KHR_bind_memory2'
  'VK_KHR_bind_memory2',
  'VK_KHR_get_physical_device_properties2',
]

def defineProcHookType(f):
+26 −21
Original line number Diff line number Diff line
@@ -40,41 +40,46 @@ copyright = """/*
warning = '// WARNING: This file is generated. See ../README.md for instructions.\n\n'

blacklistedExtensions = [
    'VK_EXT_acquire_xlib_display',
    'VK_EXT_direct_mode_display',
    'VK_EXT_display_control',
    'VK_EXT_display_surface_counter',
    'VK_EXT_full_screen_exclusive',
    'VK_EXT_headless_surface',
    'VK_EXT_metal_surface',
    'VK_FUCHSIA_imagepipe_surface',
    'VK_GGP_stream_descriptor_surface',
    'VK_KHR_display',
    'VK_KHR_display_swapchain',
    'VK_KHR_external_fence_win32',
    'VK_KHR_external_memory_win32',
    'VK_KHR_external_semaphore_win32',
    'VK_KHR_mir_surface',
    'VK_KHR_xcb_surface',
    'VK_KHR_xlib_surface',
    'VK_KHR_wayland_surface',
    'VK_KHR_win32_surface',
    'VK_KHR_external_memory_win32',
    'VK_KHR_win32_keyed_mutex',
    'VK_KHR_external_semaphore_win32',
    'VK_KHR_external_fence_win32',
    'VK_EXT_acquire_xlib_display',
    'VK_EXT_direct_mode_display',
    'VK_EXT_display_surface_counter',
    'VK_EXT_display_control',
    'VK_FUCHSIA_imagepipe_surface',
    'VK_KHR_win32_surface',
    'VK_KHR_xcb_surface',
    'VK_KHR_xlib_surface',
    'VK_MVK_ios_surface',
    'VK_MVK_macos_surface',
    'VK_NN_vi_surface',
    'VK_NV_cooperative_matrix',
    'VK_NV_coverage_reduction_mode',
    'VK_NV_external_memory_win32',
    'VK_NV_win32_keyed_mutex',
    'VK_EXT_metal_surface', #not present in vulkan.api
    'VK_NVX_image_view_handle', #not present in vulkan.api
    'VK_NV_cooperative_matrix', #not present in vulkan.api
    'VK_EXT_headless_surface', #not present in vulkan.api
    'VK_GGP_stream_descriptor_surface', #not present in vulkan.api
    'VK_NV_coverage_reduction_mode', #not present in vulkan.api
    'VK_EXT_full_screen_exclusive' #not present in vulkan.api
    'VK_NVX_image_view_handle',
]

exportedExtensions = [
    'VK_ANDROID_external_memory_android_hardware_buffer',
    'VK_KHR_android_surface',
    'VK_KHR_surface',
    'VK_KHR_swapchain',
    'VK_KHR_android_surface',
    'VK_ANDROID_external_memory_android_hardware_buffer'
]

optionalCommands = [
    'vkGetSwapchainGrallocUsageANDROID',
    'vkGetSwapchainGrallocUsage2ANDROID',
]

def runClangFormat(args):
@@ -241,7 +246,7 @@ def initProc(name, f):

  if name in versionDict and versionDict[name] == 'VK_VERSION_1_1':
    f.write('false, ')
  elif name == 'vkGetSwapchainGrallocUsageANDROID' or name == 'vkGetSwapchainGrallocUsage2ANDROID': # optional in vulkan.api
  elif name in optionalCommands:
    f.write('false, ')
  else:
    f.write('true, ')
Loading