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

Commit a1d53fa7 authored by Chia-I Wu's avatar Chia-I Wu Committed by Android (Google) Code Review
Browse files

Merge "vulkan: fix vkGetDeviceProcAddr for intercepted commands" into nyc-dev

parents a50117e5 c56603e0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -272,11 +272,14 @@ VKAPI_ATTR PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice device, const char* p
        std::binary_search(
            known_non_device_names, known_non_device_names + count, pName,
            [](const char* a, const char* b) { return (strcmp(a, b) < 0); })) {
        ALOGE("vkGetDeviceProcAddr called with %s", pName);
        ALOGE("vkGetDeviceProcAddr called with %s", (pName) ? pName : "(null)");
        return nullptr;
    }
    // clang-format off

    if (strcmp(pName, "vkGetDeviceProcAddr") == 0) return reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceProcAddr);
    if (strcmp(pName, "vkDestroyDevice") == 0) return reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::DestroyDevice);

    return vulkan::api::GetData(device).dispatch.GetDeviceProcAddr(device, pName);
}

+15 −1
Original line number Diff line number Diff line
@@ -529,11 +529,25 @@ bool InitDriverTable(VkDevice dev, PFN_vkGetDeviceProcAddr get_proc)
      std::binary_search(
        known_non_device_names, known_non_device_names + count, pName,
        [](const char* a, const char* b) { return (strcmp(a, b) < 0); })) {
    ALOGE("vkGetDeviceProcAddr called with %s", pName);
    ALOGE("vkGetDeviceProcAddr called with %s", (pName) ? pName : "(null)");
    return nullptr;
  }
  // clang-format off

  {{range $f := AllCommands $}}
    {{if (Macro "IsDeviceDispatched" $f)}}
      {{     if (Macro "api.IsIntercepted" $f)}}
        if (strcmp(pName, "{{$f.Name}}") == 0) return §
          reinterpret_cast<PFN_vkVoidFunction>(§
            vulkan::api::{{Macro "BaseName" $f}});
      {{else if eq $f.Name "vkGetDeviceProcAddr"}}
        if (strcmp(pName, "{{$f.Name}}") == 0) return §
          reinterpret_cast<PFN_vkVoidFunction>(§
            {{$f.Name}});
      {{end}}
    {{end}}
  {{end}}

{{end}}