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

Commit 6aa30db7 authored by Chris Forbes's avatar Chris Forbes
Browse files

vulkan: Split known/intercepted extension lists

We need to do some work in the loader based on whether gpdp2 is present
and enabled, and we'd like to /not/ filter gpdp2 out of extension lists.

However, we don't need or want to generate full forwarding stubs.

All extensions in driver.KnownExtensions will have enums and matching
infrastructure generated, but only extensions in
driver.InterceptedExtensions will have g_hook_procs populated for their
entrypoints.

V3: Define driver.KnownExtensions in terms of
driver.InterceptedExtensions as always a superset.

Change-Id: If0fdabad99fa4637d7c6fc1e9a7e5e3908b53aca
Test: build
parent 1d4e5540
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ const ProcHook* GetProcHook(const char* name) {
}

ProcHook::Extension GetProcHookExtension(const char* name) {
  {{$exts := Strings (Macro "driver.InterceptedExtensions") | SplitOn "\n"}}
  {{$exts := Strings (Macro "driver.KnownExtensions") | SplitOn "\n"}}
  // clang-format off
  {{range $e := $exts}}
    if (strcmp(name, "{{$e}}") == 0) return ProcHook::{{TrimPrefix "VK_" $e}};
@@ -692,6 +692,17 @@ VK_KHR_shared_presentable_image
{{end}}


{{/*
------------------------------------------------------------------------------
  Emits a list of extensions known to vulkan::driver.
------------------------------------------------------------------------------
*/}}
{{define "driver.KnownExtensions"}}
{{Macro "driver.InterceptedExtensions"}}
VK_KHR_get_physical_device_properties2
{{end}}


{{/*
------------------------------------------------------------------------------
  Emits true if an extension is intercepted by vulkan::driver.
@@ -776,7 +787,7 @@ VK_KHR_shared_presentable_image
      };

      enum Extension {
        {{$exts := Strings (Macro "driver.InterceptedExtensions") | SplitOn "\n"}}
        {{$exts := Strings (Macro "driver.KnownExtensions") | SplitOn "\n"}}
        {{range $e := $exts}}
          {{TrimPrefix "VK_" $e}},
        {{end}}
@@ -965,7 +976,7 @@ VK_KHR_shared_presentable_image
    {{else if eq $.Name "vkDestroyImage"}}true

    {{else if eq $.Name "vkGetPhysicalDeviceProperties"}}true

    {{else if eq $.Name "vkGetPhysicalDeviceProperties2KHR"}}true
    {{end}}

    {{$ext := GetAnnotation $ "extension"}}
+1 −0
Original line number Diff line number Diff line
@@ -454,6 +454,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) {
                hook_extensions_.set(ext_bit);
                break;
            case ProcHook::EXTENSION_UNKNOWN:
            case ProcHook::KHR_get_physical_device_properties2:
                // HAL's extensions
                break;
            default:
+2 −0
Original line number Diff line number Diff line
@@ -371,6 +371,7 @@ ProcHook::Extension GetProcHookExtension(const char* name) {
    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_shared_presentable_image") == 0) return ProcHook::KHR_shared_presentable_image;
    if (strcmp(name, "VK_KHR_get_physical_device_properties2") == 0) return ProcHook::KHR_get_physical_device_properties2;
    // clang-format on
    return ProcHook::EXTENSION_UNKNOWN;
}
@@ -409,6 +410,7 @@ bool InitDriverTable(VkInstance instance,
    INIT_PROC_EXT(EXT_debug_report, true, instance, CreateDebugReportCallbackEXT);
    INIT_PROC_EXT(EXT_debug_report, true, instance, DestroyDebugReportCallbackEXT);
    INIT_PROC_EXT(EXT_debug_report, true, instance, DebugReportMessageEXT);
    INIT_PROC_EXT(KHR_get_physical_device_properties2, true, instance, GetPhysicalDeviceProperties2KHR);
    // clang-format on

    return success;
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ struct ProcHook {
        KHR_surface,
        KHR_swapchain,
        KHR_shared_presentable_image,
        KHR_get_physical_device_properties2,

        EXTENSION_CORE,  // valid bit
        EXTENSION_COUNT,
@@ -67,6 +68,7 @@ struct InstanceDriverTable {
    PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
    PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
    PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
    PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
    // clang-format on
};