{{define "Vtbl"}}
{{AssertType $ "Function"}}
- {{range $i, $p := $.CallParameters}}
- {{if not $i}}{{Node "Vtbl" $p}}{{end}}
+ {{if gt (len $.CallParameters) 0}}
+ {{Node "Vtbl" (index $.CallParameters 0)}}
+ {{else}}Global
{{end}}
{{end}}
system/core/libsync/include
LOCAL_SRC_FILES := \
- entry.cpp \
- get_proc_addr.cpp \
+ dispatch_gen.cpp \
loader.cpp \
swapchain.cpp \
vulkan_loader_data.cpp
--- /dev/null
+{{/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */}}
+
+{{Include "../api/templates/vulkan_common.tmpl"}}
+{{Global "clang-format" (Strings "clang-format" "-style=file")}}
+{{Macro "DefineGlobals" $}}
+{{$ | Macro "dispatch_gen.h" | Format (Global "clang-format") | Write "dispatch_gen.h" }}
+{{$ | Macro "dispatch_gen.cpp" | Format (Global "clang-format") | Write "dispatch_gen.cpp"}}
+
+{{/*
+-------------------------------------------------------------------------------
+ dispatch_gen.h
+-------------------------------------------------------------------------------
+*/}}
+{{define "dispatch_gen.h"}}
+/*
+•* Copyright 2015 The Android Open Source Project
+•*
+•* Licensed under the Apache License, Version 2.0 (the "License");
+•* you may not use this file except in compliance with the License.
+•* You may obtain a copy of the License at
+•*
+•* http://www.apache.org/licenses/LICENSE-2.0
+•*
+•* Unless required by applicable law or agreed to in writing, software
+•* distributed under the License is distributed on an "AS IS" BASIS,
+•* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+•* See the License for the specific language governing permissions and
+•* limitations under the License.
+•*/
+¶
+#define VK_PROTOTYPES
+#define VK_USE_PLATFORM_ANDROID_KHR
+#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vulkan.h>
+¶
+namespace vulkan {
+¶
+struct InstanceDispatchTable {«
+ // clang-format off
+ {{range $f := AllCommands $}}
+ {{if (Macro "IsInstanceDispatched" $f)}}
+ {{Macro "FunctionPtrName" $f}} {{Macro "BaseName" $f}};
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+struct DeviceDispatchTable {«
+ // clang-format off
+ {{range $f := AllCommands $}}
+ {{if (Macro "IsDeviceDispatched" $f)}}
+ {{Macro "FunctionPtrName" $f}} {{Macro "BaseName" $f}};
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+struct DriverDispatchTable {«
+ // clang-format off
+ {{range $f := AllCommands $}}
+ {{if (Macro "IsInstanceDispatched" $f)}}
+ {{if not (Macro "IsLoaderFunction" $f)}}
+ {{Macro "FunctionPtrName" $f}} {{Macro "BaseName" $f}};
+ {{end}}
+ {{end}}
+ {{end}}
+
+ PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
+
+ {{/* TODO(jessehall): Needed by swapchain code. Figure out a better way of
+ handling this that avoids the special case. Probably should rework
+ things so the driver dispatch table has all driver functions. Probably
+ need separate instance- and device-level copies, fill in all device-
+ dispatched functions in the device-level copies only, and change
+ GetDeviceProcAddr_Bottom to look in the already-loaded driver
+ dispatch table rather than forwarding to the driver's
+ vkGetDeviceProcAddr. */}}
+ PFN_vkCreateImage CreateImage;
+ PFN_vkDestroyImage DestroyImage;
+
+ PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
+ PFN_vkAcquireImageANDROID AcquireImageANDROID;
+ PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
+ // clang-format on
+»};
+¶
+} // namespace vulkan
+¶{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ dispatch_gen.cpp
+-------------------------------------------------------------------------------
+*/}}
+{{define "dispatch_gen.cpp"}}
+/*
+•* Copyright 2015 The Android Open Source Project
+•*
+•* Licensed under the Apache License, Version 2.0 (the "License");
+•* you may not use this file except in compliance with the License.
+•* You may obtain a copy of the License at
+•*
+•* http://www.apache.org/licenses/LICENSE-2.0
+•*
+•* Unless required by applicable law or agreed to in writing, software
+•* distributed under the License is distributed on an "AS IS" BASIS,
+•* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+•* See the License for the specific language governing permissions and
+•* limitations under the License.
+•*/
+¶
+#include <log/log.h>
+#include <algorithm>
+#include "loader.h"
+¶
+#define UNLIKELY(expr) __builtin_expect((expr), 0)
+¶
+using namespace vulkan;
+¶
+namespace {
+¶
+struct NameProc {
+ const char* name;
+ PFN_vkVoidFunction proc;
+};
+¶
+PFN_vkVoidFunction Lookup(const char* name, const NameProc* begin, const NameProc* end) {
+ const auto& entry = std::lower_bound(
+ begin, end, name,
+ [](const NameProc& e, const char* n) { return strcmp(e.name, n) < 0; });
+ if (entry == end || strcmp(entry->name, name) != 0)
+ return nullptr;
+ return entry->proc;
+}
+¶
+template <size_t N>
+PFN_vkVoidFunction Lookup(const char* name, const NameProc (&procs)[N]) {
+ return Lookup(name, procs, procs + N);
+}
+¶
+const NameProc kLoaderExportProcs[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if (Macro "IsFunctionSupported" $f)}}
+ {"{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>({{$f.Name}})},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+const NameProc kLoaderGlobalProcs[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if and (Macro "HasLoaderTopImpl" $f) (eq (Macro "Vtbl" $f) "Global")}}
+ {"{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>(§
+ static_cast<{{Macro "FunctionPtrName" $f}}>(§
+ {{Macro "BaseName" $f}}_Top))},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+const NameProc kLoaderTopProcs[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if (Macro "HasLoaderTopImpl" $f)}}
+ {"{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>(§
+ static_cast<{{Macro "FunctionPtrName" $f}}>(§
+ {{Macro "BaseName" $f}}_Top))},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+const NameProc kLoaderBottomProcs[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if (Macro "HasLoaderBottomImpl" $f)}}
+ {"{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>(§
+ static_cast<{{Macro "FunctionPtrName" $f}}>(§
+ {{Macro "BaseName" $f}}_Bottom))},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+struct NameOffset {
+ const char* name;
+ size_t offset;
+};
+¶
+ssize_t Lookup(const char* name,
+ const NameOffset* begin,
+ const NameOffset* end) {
+ const auto& entry = std::lower_bound(
+ begin, end, name, [](const NameOffset& e, const char* n) {
+ return strcmp(e.name, n) < 0;
+ });
+ if (entry == end || strcmp(entry->name, name) != 0)
+ return -1;
+ return static_cast<ssize_t>(entry->offset);
+}
+¶
+template <size_t N, class Table>
+PFN_vkVoidFunction Lookup(const char* name,
+ const NameOffset (&offsets)[N],
+ const Table& table) {
+ ssize_t offset = Lookup(name, offsets, offsets + N);
+ if (offset < 0)
+ return nullptr;
+ uintptr_t base = reinterpret_cast<uintptr_t>(&table);
+ return *reinterpret_cast<PFN_vkVoidFunction*>(base +
+ static_cast<size_t>(offset));
+}
+¶
+const NameOffset kInstanceDispatchOffsets[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if (Macro "IsInstanceDispatched" $f)}}
+ {"{{$f.Name}}", offsetof(InstanceDispatchTable, {{Macro "BaseName" $f}})},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+const NameOffset kDeviceDispatchOffsets[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if (Macro "IsDeviceDispatched" $f)}}
+ {"{{$f.Name}}", offsetof(DeviceDispatchTable, {{Macro "BaseName" $f}})},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+} // anonymous namespace
+¶
+namespace vulkan {
+¶
+PFN_vkVoidFunction GetLoaderExportProcAddr(const char* name) {
+ return Lookup(name, kLoaderExportProcs);
+}
+¶
+PFN_vkVoidFunction GetLoaderGlobalProcAddr(const char* name) {
+ return Lookup(name, kLoaderGlobalProcs);
+}
+¶
+PFN_vkVoidFunction GetLoaderTopProcAddr(const char* name) {
+ return Lookup(name, kLoaderTopProcs);
+}
+¶
+PFN_vkVoidFunction GetLoaderBottomProcAddr(const char* name) {
+ return Lookup(name, kLoaderBottomProcs);
+}
+¶
+PFN_vkVoidFunction GetDispatchProcAddr(const InstanceDispatchTable& dispatch,
+ const char* name) {
+ return Lookup(name, kInstanceDispatchOffsets, dispatch);
+}
+¶
+PFN_vkVoidFunction GetDispatchProcAddr(const DeviceDispatchTable& dispatch,
+ const char* name) {
+ return Lookup(name, kDeviceDispatchOffsets, dispatch);
+}
+¶
+bool LoadInstanceDispatchTable(VkInstance instance,
+ PFN_vkGetInstanceProcAddr get_proc_addr,
+ InstanceDispatchTable& dispatch) {«
+ bool success = true;
+ // clang-format off
+ {{range $f := AllCommands $}}
+ {{if (Macro "IsInstanceDispatched" $f)}}
+ dispatch.{{Macro "BaseName" $f}} = §
+ reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
+ get_proc_addr(instance, "{{$f.Name}}"));
+ if (UNLIKELY(!dispatch.{{Macro "BaseName" $f}})) {
+ ALOGE("missing instance proc: %s", "{{$f.Name}}");
+ success = false;
+ }
+ {{end}}
+ {{end}}
+ // clang-format on
+ return success;
+»}
+¶
+bool LoadDeviceDispatchTable(VkDevice device,
+ PFN_vkGetDeviceProcAddr get_proc_addr,
+ DeviceDispatchTable& dispatch) {«
+ bool success = true;
+ // clang-format off
+ {{range $f := AllCommands $}}
+ {{if (Macro "IsDeviceDispatched" $f)}}
+ dispatch.{{Macro "BaseName" $f}} = §
+ reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
+ get_proc_addr(device, "{{$f.Name}}"));
+ if (UNLIKELY(!dispatch.{{Macro "BaseName" $f}})) {
+ ALOGE("missing device proc: %s", "{{$f.Name}}");
+ success = false;
+ }
+ {{end}}
+ {{end}}
+ // clang-format on
+ return success;
+»}
+¶
+bool LoadDriverDispatchTable(VkInstance instance,
+ PFN_vkGetInstanceProcAddr get_proc_addr,
+ DriverDispatchTable& dispatch) {«
+ bool success = true;
+ // clang-format off
+ {{range $f := AllCommands $}}
+ {{if (Macro "IsInstanceDispatched" $f)}}
+ {{if not (Macro "IsLoaderFunction" $f)}}
+ dispatch.{{Macro "BaseName" $f}} = §
+ reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
+ get_proc_addr(instance, "{{$f.Name}}"));
+ if (UNLIKELY(!dispatch.{{Macro "BaseName" $f}})) {
+ ALOGE("missing driver proc: %s", "{{$f.Name}}");
+ success = false;
+ }
+ {{end}}
+ {{end}}
+ {{end}}
+ dispatch.GetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(get_proc_addr(instance, "vkGetDeviceProcAddr"));
+ if (UNLIKELY(!dispatch.GetDeviceProcAddr)) {
+ ALOGE("missing driver proc: %s", "vkGetDeviceProcAddr");
+ success = false;
+ }
+ dispatch.CreateImage = reinterpret_cast<PFN_vkCreateImage>(get_proc_addr(instance, "vkCreateImage"));
+ if (UNLIKELY(!dispatch.CreateImage)) {
+ ALOGE("missing driver proc: %s", "vkCreateImage");
+ success = false;
+ }
+ dispatch.DestroyImage = reinterpret_cast<PFN_vkDestroyImage>(get_proc_addr(instance, "vkDestroyImage"));
+ if (UNLIKELY(!dispatch.DestroyImage)) {
+ ALOGE("missing driver proc: %s", "vkDestroyImage");
+ success = false;
+ }
+ dispatch.AcquireImageANDROID = reinterpret_cast<PFN_vkAcquireImageANDROID>(get_proc_addr(instance, "vkAcquireImageANDROID"));
+ if (UNLIKELY(!dispatch.AcquireImageANDROID)) {
+ ALOGE("missing driver proc: %s", "vkAcquireImageANDROID");
+ success = false;
+ }
+ dispatch.QueueSignalReleaseImageANDROID = reinterpret_cast<PFN_vkQueueSignalReleaseImageANDROID>(get_proc_addr(instance, "vkQueueSignalReleaseImageANDROID"));
+ if (UNLIKELY(!dispatch.QueueSignalReleaseImageANDROID)) {
+ ALOGE("missing driver proc: %s", "vkQueueSignalReleaseImageANDROID");
+ success = false;
+ }
+ // clang-format on
+ return success;
+»}
+¶
+} // namespace vulkan
+¶
+// clang-format off
+¶
+{{range $f := AllCommands $}}
+ {{if and (not (GetAnnotation $f "pfn")) (Macro "IsExported" $f)}}
+ __attribute__((visibility("default")))
+ VKAPI_ATTR {{Node "Type" $f.Return}} {{$f.Name}}({{Macro "Parameters" $f}}) {
+ {{if not (IsVoid $f.Return.Type)}}return §{{end}}
+ {{Macro "Dispatch" $f}}({{Macro "Arguments" $f}});
+ }
+ ¶
+ {{end}}
+{{end}}
+¶
+// clang-format on
+¶{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ Emit the dispatch lookup for a function based on its first parameter.
+-------------------------------------------------------------------------------
+*/}}
+{{define "Dispatch"}}
+ {{AssertType $ "Function"}}
+
+ {{if (Macro "HasLoaderTopImpl" $)}}
+ {{Macro "BaseName" $}}_Top§
+ {{else}}
+ {{$p0 := index $.CallParameters 0}}
+ GetDispatchTable({{$p0.Name}}).{{Macro "BaseName" $}}§
+ {{end}}
+{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ Emits a function name without the "vk" prefix.
+-------------------------------------------------------------------------------
+*/}}
+{{define "BaseName"}}
+ {{AssertType $ "Function"}}
+ {{TrimPrefix "vk" $.Name}}
+{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ Emits a comma-separated list of C parameter names for the given command.
+-------------------------------------------------------------------------------
+*/}}
+{{define "Arguments"}}
+ {{AssertType $ "Function"}}
+
+ {{ForEach $.CallParameters "ParameterName" | JoinWith ", "}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Emit "true" for supported functions that undergo table dispatch. Only global
+ functions and functions handled in the loader top without calling into
+ lower layers are not dispatched.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsInstanceDispatched"}}
+ {{AssertType $ "Function"}}
+ {{if and (Macro "IsFunctionSupported" $) (eq (Macro "Vtbl" $) "Instance")}}
+ {{if (ne $.Name "vkGetInstanceProcAddr")}}true{{end}}
+ {{end}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Emit "true" for supported functions that can have device-specific dispatch.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsDeviceDispatched"}}
+ {{AssertType $ "Function"}}
+ {{if (Macro "IsFunctionSupported" $)}}
+ {{if eq (Macro "Vtbl" $) "Device"}}
+ {{if ne $.Name "vkGetDeviceProcAddr"}}
+ true
+ {{end}}
+ {{end}}
+ {{end}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Emit "true" if a function is core or from a supportable extension.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsFunctionSupported"}}
+ {{AssertType $ "Function"}}
+ {{if not (GetAnnotation $ "pfn")}}
+ {{$ext := GetAnnotation $ "extension"}}
+ {{if not $ext}}true
+ {{else if not (Macro "IsExtensionBlacklisted" $ext)}}true
+ {{end}}
+ {{end}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Decides whether a function should be exported from the Android Vulkan
+ library. Functions in the core API and in loader extensions are exported.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsExported"}}
+ {{AssertType $ "Function"}}
+
+ {{$ext := GetAnnotation $ "extension"}}
+ {{if $ext}}
+ {{Macro "IsLoaderExtension" $ext}}
+ {{else}}
+ true
+ {{end}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Reports whether an extension function is implemented entirely by the loader,
+ and not implemented by drivers.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsLoaderFunction"}}
+ {{AssertType $ "Function"}}
+
+ {{$ext := GetAnnotation $ "extension"}}
+ {{if $ext}}
+ {{Macro "IsLoaderExtension" $ext}}
+ {{end}}
+{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ Emit "true" if the loader has a top-level implementation for the function
+ that should be called directly rather than dispatching to the first layer.
+-------------------------------------------------------------------------------
+*/}}
+{{define "HasLoaderTopImpl"}}
+ {{AssertType $ "Function"}}
+
+ {{/* Global functions can't be dispatched */}}
+ {{ if and (not (GetAnnotation $ "pfn")) (eq (Macro "Vtbl" $) "Global")}}true
+
+ {{/* G*PA are implemented by reading the dispatch table, not by dispatching
+ through it. */}}
+ {{else if eq $.Name "vkGetInstanceProcAddr"}}true
+ {{else if eq $.Name "vkGetDeviceProcAddr"}}true
+
+ {{/* Loader top needs to initialize dispatch for device-level dispatchable
+ objects */}}
+ {{else if eq $.Name "vkGetDeviceQueue"}}true
+ {{else if eq $.Name "vkAllocateCommandBuffers"}}true
+
+ {{/* vkDestroy for dispatchable objects needs to handle VK_NULL_HANDLE;
+ trying to dispatch through that would crash. */}}
+ {{else if eq $.Name "vkDestroyInstance"}}true
+ {{else if eq $.Name "vkDestroyDevice"}}true
+
+ {{end}}
+{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ Emit "true" if the loader has a bottom-level implementation for the function
+ which terminates the dispatch chain.
+-------------------------------------------------------------------------------
+*/}}
+{{define "HasLoaderBottomImpl"}}
+ {{AssertType $ "Function"}}
+
+ {{if (Macro "IsFunctionSupported" $)}}
+ {{ if (eq (Macro "Vtbl" $) "Instance")}}true
+ {{else if (Macro "IsLoaderFunction" $)}}true
+ {{else if (eq $.Name "vkCreateInstance")}}true
+ {{else if (eq $.Name "vkGetDeviceProcAddr")}}true
+ {{end}}
+ {{end}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Emit "true" if an extension is unsupportable on Android.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsExtensionBlacklisted"}}
+ {{$ext := index $.Arguments 0}}
+ {{ if eq $ext "VK_KHR_display"}}true
+ {{else if eq $ext "VK_KHR_display_swapchain"}}true
+ {{else if eq $ext "VK_KHR_xlib_surface"}}true
+ {{else if eq $ext "VK_KHR_xcb_surface"}}true
+ {{else if eq $ext "VK_KHR_wayland_surface"}}true
+ {{else if eq $ext "VK_KHR_mir_surface"}}true
+ {{else if eq $ext "VK_KHR_win32_surface"}}true
+ {{end}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Reports whether an extension is implemented entirely by the loader,
+ so drivers should not enumerate it.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsLoaderExtension"}}
+ {{$ext := index $.Arguments 0}}
+ {{ if eq $ext "VK_KHR_surface"}}true
+ {{else if eq $ext "VK_KHR_swapchain"}}true
+ {{else if eq $ext "VK_KHR_android_surface"}}true
+ {{end}}
+{{end}}
--- /dev/null
+/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <log/log.h>
+#include <algorithm>
+#include "loader.h"
+
+#define UNLIKELY(expr) __builtin_expect((expr), 0)
+
+using namespace vulkan;
+
+namespace {
+
+struct NameProc {
+ const char* name;
+ PFN_vkVoidFunction proc;
+};
+
+PFN_vkVoidFunction Lookup(const char* name,
+ const NameProc* begin,
+ const NameProc* end) {
+ const auto& entry = std::lower_bound(
+ begin, end, name,
+ [](const NameProc& e, const char* n) { return strcmp(e.name, n) < 0; });
+ if (entry == end || strcmp(entry->name, name) != 0)
+ return nullptr;
+ return entry->proc;
+}
+
+template <size_t N>
+PFN_vkVoidFunction Lookup(const char* name, const NameProc (&procs)[N]) {
+ return Lookup(name, procs, procs + N);
+}
+
+const NameProc kLoaderExportProcs[] = {
+ // clang-format off
+ {"vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(vkAcquireNextImageKHR)},
+ {"vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateCommandBuffers)},
+ {"vkAllocateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateDescriptorSets)},
+ {"vkAllocateMemory", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateMemory)},
+ {"vkBeginCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkBeginCommandBuffer)},
+ {"vkBindBufferMemory", reinterpret_cast<PFN_vkVoidFunction>(vkBindBufferMemory)},
+ {"vkBindImageMemory", reinterpret_cast<PFN_vkVoidFunction>(vkBindImageMemory)},
+ {"vkCmdBeginQuery", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBeginQuery)},
+ {"vkCmdBeginRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBeginRenderPass)},
+ {"vkCmdBindDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindDescriptorSets)},
+ {"vkCmdBindIndexBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindIndexBuffer)},
+ {"vkCmdBindPipeline", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindPipeline)},
+ {"vkCmdBindVertexBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindVertexBuffers)},
+ {"vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBlitImage)},
+ {"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearAttachments)},
+ {"vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearColorImage)},
+ {"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearDepthStencilImage)},
+ {"vkCmdCopyBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyBuffer)},
+ {"vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyBufferToImage)},
+ {"vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyImage)},
+ {"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyImageToBuffer)},
+ {"vkCmdCopyQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyQueryPoolResults)},
+ {"vkCmdDispatch", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDispatch)},
+ {"vkCmdDispatchIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDispatchIndirect)},
+ {"vkCmdDraw", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDraw)},
+ {"vkCmdDrawIndexed", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndexed)},
+ {"vkCmdDrawIndexedIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndexedIndirect)},
+ {"vkCmdDrawIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndirect)},
+ {"vkCmdEndQuery", reinterpret_cast<PFN_vkVoidFunction>(vkCmdEndQuery)},
+ {"vkCmdEndRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdEndRenderPass)},
+ {"vkCmdExecuteCommands", reinterpret_cast<PFN_vkVoidFunction>(vkCmdExecuteCommands)},
+ {"vkCmdFillBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdFillBuffer)},
+ {"vkCmdNextSubpass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdNextSubpass)},
+ {"vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(vkCmdPipelineBarrier)},
+ {"vkCmdPushConstants", reinterpret_cast<PFN_vkVoidFunction>(vkCmdPushConstants)},
+ {"vkCmdResetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResetEvent)},
+ {"vkCmdResetQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResetQueryPool)},
+ {"vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResolveImage)},
+ {"vkCmdSetBlendConstants", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetBlendConstants)},
+ {"vkCmdSetDepthBias", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetDepthBias)},
+ {"vkCmdSetDepthBounds", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetDepthBounds)},
+ {"vkCmdSetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetEvent)},
+ {"vkCmdSetLineWidth", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetLineWidth)},
+ {"vkCmdSetScissor", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetScissor)},
+ {"vkCmdSetStencilCompareMask", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilCompareMask)},
+ {"vkCmdSetStencilReference", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilReference)},
+ {"vkCmdSetStencilWriteMask", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilWriteMask)},
+ {"vkCmdSetViewport", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetViewport)},
+ {"vkCmdUpdateBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdUpdateBuffer)},
+ {"vkCmdWaitEvents", reinterpret_cast<PFN_vkVoidFunction>(vkCmdWaitEvents)},
+ {"vkCmdWriteTimestamp", reinterpret_cast<PFN_vkVoidFunction>(vkCmdWriteTimestamp)},
+ {"vkCreateAndroidSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(vkCreateAndroidSurfaceKHR)},
+ {"vkCreateBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCreateBuffer)},
+ {"vkCreateBufferView", reinterpret_cast<PFN_vkVoidFunction>(vkCreateBufferView)},
+ {"vkCreateCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateCommandPool)},
+ {"vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(vkCreateComputePipelines)},
+ {"vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDescriptorPool)},
+ {"vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDescriptorSetLayout)},
+ {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDevice)},
+ {"vkCreateEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCreateEvent)},
+ {"vkCreateFence", reinterpret_cast<PFN_vkVoidFunction>(vkCreateFence)},
+ {"vkCreateFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCreateFramebuffer)},
+ {"vkCreateGraphicsPipelines", reinterpret_cast<PFN_vkVoidFunction>(vkCreateGraphicsPipelines)},
+ {"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(vkCreateImage)},
+ {"vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(vkCreateImageView)},
+ {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(vkCreateInstance)},
+ {"vkCreatePipelineCache", reinterpret_cast<PFN_vkVoidFunction>(vkCreatePipelineCache)},
+ {"vkCreatePipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(vkCreatePipelineLayout)},
+ {"vkCreateQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateQueryPool)},
+ {"vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCreateRenderPass)},
+ {"vkCreateSampler", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSampler)},
+ {"vkCreateSemaphore", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSemaphore)},
+ {"vkCreateShaderModule", reinterpret_cast<PFN_vkVoidFunction>(vkCreateShaderModule)},
+ {"vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSwapchainKHR)},
+ {"vkDestroyBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyBuffer)},
+ {"vkDestroyBufferView", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyBufferView)},
+ {"vkDestroyCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyCommandPool)},
+ {"vkDestroyDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDescriptorPool)},
+ {"vkDestroyDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDescriptorSetLayout)},
+ {"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDevice)},
+ {"vkDestroyEvent", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyEvent)},
+ {"vkDestroyFence", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyFence)},
+ {"vkDestroyFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyFramebuffer)},
+ {"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyImage)},
+ {"vkDestroyImageView", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyImageView)},
+ {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyInstance)},
+ {"vkDestroyPipeline", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipeline)},
+ {"vkDestroyPipelineCache", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipelineCache)},
+ {"vkDestroyPipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipelineLayout)},
+ {"vkDestroyQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyQueryPool)},
+ {"vkDestroyRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyRenderPass)},
+ {"vkDestroySampler", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySampler)},
+ {"vkDestroySemaphore", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySemaphore)},
+ {"vkDestroyShaderModule", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyShaderModule)},
+ {"vkDestroySurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySurfaceKHR)},
+ {"vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySwapchainKHR)},
+ {"vkDeviceWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(vkDeviceWaitIdle)},
+ {"vkEndCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkEndCommandBuffer)},
+ {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateDeviceExtensionProperties)},
+ {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateDeviceLayerProperties)},
+ {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceExtensionProperties)},
+ {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceLayerProperties)},
+ {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(vkEnumeratePhysicalDevices)},
+ {"vkFlushMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(vkFlushMappedMemoryRanges)},
+ {"vkFreeCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkFreeCommandBuffers)},
+ {"vkFreeDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkFreeDescriptorSets)},
+ {"vkFreeMemory", reinterpret_cast<PFN_vkVoidFunction>(vkFreeMemory)},
+ {"vkGetBufferMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetBufferMemoryRequirements)},
+ {"vkGetDeviceMemoryCommitment", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceMemoryCommitment)},
+ {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceProcAddr)},
+ {"vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceQueue)},
+ {"vkGetEventStatus", reinterpret_cast<PFN_vkVoidFunction>(vkGetEventStatus)},
+ {"vkGetFenceStatus", reinterpret_cast<PFN_vkVoidFunction>(vkGetFenceStatus)},
+ {"vkGetImageMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageMemoryRequirements)},
+ {"vkGetImageSparseMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageSparseMemoryRequirements)},
+ {"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageSubresourceLayout)},
+ {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(vkGetInstanceProcAddr)},
+ {"vkGetPhysicalDeviceFeatures", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceFeatures)},
+ {"vkGetPhysicalDeviceFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceFormatProperties)},
+ {"vkGetPhysicalDeviceImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceImageFormatProperties)},
+ {"vkGetPhysicalDeviceMemoryProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceMemoryProperties)},
+ {"vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceProperties)},
+ {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceQueueFamilyProperties)},
+ {"vkGetPhysicalDeviceSparseImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSparseImageFormatProperties)},
+ {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceCapabilitiesKHR)},
+ {"vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceFormatsKHR)},
+ {"vkGetPhysicalDeviceSurfacePresentModesKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfacePresentModesKHR)},
+ {"vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceSupportKHR)},
+ {"vkGetPipelineCacheData", reinterpret_cast<PFN_vkVoidFunction>(vkGetPipelineCacheData)},
+ {"vkGetQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(vkGetQueryPoolResults)},
+ {"vkGetRenderAreaGranularity", reinterpret_cast<PFN_vkVoidFunction>(vkGetRenderAreaGranularity)},
+ {"vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetSwapchainImagesKHR)},
+ {"vkInvalidateMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(vkInvalidateMappedMemoryRanges)},
+ {"vkMapMemory", reinterpret_cast<PFN_vkVoidFunction>(vkMapMemory)},
+ {"vkMergePipelineCaches", reinterpret_cast<PFN_vkVoidFunction>(vkMergePipelineCaches)},
+ {"vkQueueBindSparse", reinterpret_cast<PFN_vkVoidFunction>(vkQueueBindSparse)},
+ {"vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(vkQueuePresentKHR)},
+ {"vkQueueSubmit", reinterpret_cast<PFN_vkVoidFunction>(vkQueueSubmit)},
+ {"vkQueueWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(vkQueueWaitIdle)},
+ {"vkResetCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkResetCommandBuffer)},
+ {"vkResetCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkResetCommandPool)},
+ {"vkResetDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkResetDescriptorPool)},
+ {"vkResetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkResetEvent)},
+ {"vkResetFences", reinterpret_cast<PFN_vkVoidFunction>(vkResetFences)},
+ {"vkSetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkSetEvent)},
+ {"vkUnmapMemory", reinterpret_cast<PFN_vkVoidFunction>(vkUnmapMemory)},
+ {"vkUpdateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkUpdateDescriptorSets)},
+ {"vkWaitForFences", reinterpret_cast<PFN_vkVoidFunction>(vkWaitForFences)},
+ // clang-format on
+};
+
+const NameProc kLoaderGlobalProcs[] = {
+ // clang-format off
+ {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateInstance>(CreateInstance_Top))},
+ {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceExtensionProperties>(EnumerateInstanceExtensionProperties_Top))},
+ {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceLayerProperties>(EnumerateInstanceLayerProperties_Top))},
+ // clang-format on
+};
+
+const NameProc kLoaderTopProcs[] = {
+ // clang-format off
+ {"vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkAllocateCommandBuffers>(AllocateCommandBuffers_Top))},
+ {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateInstance>(CreateInstance_Top))},
+ {"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyDevice>(DestroyDevice_Top))},
+ {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyInstance>(DestroyInstance_Top))},
+ {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceExtensionProperties>(EnumerateInstanceExtensionProperties_Top))},
+ {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceLayerProperties>(EnumerateInstanceLayerProperties_Top))},
+ {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetDeviceProcAddr>(GetDeviceProcAddr_Top))},
+ {"vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetDeviceQueue>(GetDeviceQueue_Top))},
+ {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetInstanceProcAddr>(GetInstanceProcAddr_Top))},
+ // clang-format on
+};
+
+const NameProc kLoaderBottomProcs[] = {
+ // clang-format off
+ {"vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkAcquireNextImageKHR>(AcquireNextImageKHR_Bottom))},
+ {"vkCreateAndroidSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateAndroidSurfaceKHR>(CreateAndroidSurfaceKHR_Bottom))},
+ {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDevice>(CreateDevice_Bottom))},
+ {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateInstance>(CreateInstance_Bottom))},
+ {"vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateSwapchainKHR>(CreateSwapchainKHR_Bottom))},
+ {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyInstance>(DestroyInstance_Bottom))},
+ {"vkDestroySurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroySurfaceKHR>(DestroySurfaceKHR_Bottom))},
+ {"vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroySwapchainKHR>(DestroySwapchainKHR_Bottom))},
+ {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateDeviceExtensionProperties>(EnumerateDeviceExtensionProperties_Bottom))},
+ {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateDeviceLayerProperties>(EnumerateDeviceLayerProperties_Bottom))},
+ {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumeratePhysicalDevices>(EnumeratePhysicalDevices_Bottom))},
+ {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetDeviceProcAddr>(GetDeviceProcAddr_Bottom))},
+ {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetInstanceProcAddr>(GetInstanceProcAddr_Bottom))},
+ {"vkGetPhysicalDeviceFeatures", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceFeatures>(GetPhysicalDeviceFeatures_Bottom))},
+ {"vkGetPhysicalDeviceFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceFormatProperties>(GetPhysicalDeviceFormatProperties_Bottom))},
+ {"vkGetPhysicalDeviceImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceImageFormatProperties>(GetPhysicalDeviceImageFormatProperties_Bottom))},
+ {"vkGetPhysicalDeviceMemoryProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(GetPhysicalDeviceMemoryProperties_Bottom))},
+ {"vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceProperties>(GetPhysicalDeviceProperties_Bottom))},
+ {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceQueueFamilyProperties>(GetPhysicalDeviceQueueFamilyProperties_Bottom))},
+ {"vkGetPhysicalDeviceSparseImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(GetPhysicalDeviceSparseImageFormatProperties_Bottom))},
+ {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(GetPhysicalDeviceSurfaceCapabilitiesKHR_Bottom))},
+ {"vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(GetPhysicalDeviceSurfaceFormatsKHR_Bottom))},
+ {"vkGetPhysicalDeviceSurfacePresentModesKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(GetPhysicalDeviceSurfacePresentModesKHR_Bottom))},
+ {"vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(GetPhysicalDeviceSurfaceSupportKHR_Bottom))},
+ {"vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetSwapchainImagesKHR>(GetSwapchainImagesKHR_Bottom))},
+ {"vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkQueuePresentKHR>(QueuePresentKHR_Bottom))},
+ // clang-format on
+};
+
+struct NameOffset {
+ const char* name;
+ size_t offset;
+};
+
+ssize_t Lookup(const char* name,
+ const NameOffset* begin,
+ const NameOffset* end) {
+ const auto& entry = std::lower_bound(
+ begin, end, name, [](const NameOffset& e, const char* n) {
+ return strcmp(e.name, n) < 0;
+ });
+ if (entry == end || strcmp(entry->name, name) != 0)
+ return -1;
+ return static_cast<ssize_t>(entry->offset);
+}
+
+template <size_t N, class Table>
+PFN_vkVoidFunction Lookup(const char* name,
+ const NameOffset (&offsets)[N],
+ const Table& table) {
+ ssize_t offset = Lookup(name, offsets, offsets + N);
+ if (offset < 0)
+ return nullptr;
+ uintptr_t base = reinterpret_cast<uintptr_t>(&table);
+ return *reinterpret_cast<PFN_vkVoidFunction*>(base +
+ static_cast<size_t>(offset));
+}
+
+const NameOffset kInstanceDispatchOffsets[] = {
+ // clang-format off
+ {"vkCreateAndroidSurfaceKHR", offsetof(InstanceDispatchTable, CreateAndroidSurfaceKHR)},
+ {"vkCreateDevice", offsetof(InstanceDispatchTable, CreateDevice)},
+ {"vkDestroyInstance", offsetof(InstanceDispatchTable, DestroyInstance)},
+ {"vkDestroySurfaceKHR", offsetof(InstanceDispatchTable, DestroySurfaceKHR)},
+ {"vkEnumerateDeviceExtensionProperties", offsetof(InstanceDispatchTable, EnumerateDeviceExtensionProperties)},
+ {"vkEnumerateDeviceLayerProperties", offsetof(InstanceDispatchTable, EnumerateDeviceLayerProperties)},
+ {"vkEnumeratePhysicalDevices", offsetof(InstanceDispatchTable, EnumeratePhysicalDevices)},
+ {"vkGetPhysicalDeviceFeatures", offsetof(InstanceDispatchTable, GetPhysicalDeviceFeatures)},
+ {"vkGetPhysicalDeviceFormatProperties", offsetof(InstanceDispatchTable, GetPhysicalDeviceFormatProperties)},
+ {"vkGetPhysicalDeviceImageFormatProperties", offsetof(InstanceDispatchTable, GetPhysicalDeviceImageFormatProperties)},
+ {"vkGetPhysicalDeviceMemoryProperties", offsetof(InstanceDispatchTable, GetPhysicalDeviceMemoryProperties)},
+ {"vkGetPhysicalDeviceProperties", offsetof(InstanceDispatchTable, GetPhysicalDeviceProperties)},
+ {"vkGetPhysicalDeviceQueueFamilyProperties", offsetof(InstanceDispatchTable, GetPhysicalDeviceQueueFamilyProperties)},
+ {"vkGetPhysicalDeviceSparseImageFormatProperties", offsetof(InstanceDispatchTable, GetPhysicalDeviceSparseImageFormatProperties)},
+ {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", offsetof(InstanceDispatchTable, GetPhysicalDeviceSurfaceCapabilitiesKHR)},
+ {"vkGetPhysicalDeviceSurfaceFormatsKHR", offsetof(InstanceDispatchTable, GetPhysicalDeviceSurfaceFormatsKHR)},
+ {"vkGetPhysicalDeviceSurfacePresentModesKHR", offsetof(InstanceDispatchTable, GetPhysicalDeviceSurfacePresentModesKHR)},
+ {"vkGetPhysicalDeviceSurfaceSupportKHR", offsetof(InstanceDispatchTable, GetPhysicalDeviceSurfaceSupportKHR)},
+ // clang-format on
+};
+
+const NameOffset kDeviceDispatchOffsets[] = {
+ // clang-format off
+ {"vkAcquireNextImageKHR", offsetof(DeviceDispatchTable, AcquireNextImageKHR)},
+ {"vkAllocateCommandBuffers", offsetof(DeviceDispatchTable, AllocateCommandBuffers)},
+ {"vkAllocateDescriptorSets", offsetof(DeviceDispatchTable, AllocateDescriptorSets)},
+ {"vkAllocateMemory", offsetof(DeviceDispatchTable, AllocateMemory)},
+ {"vkBeginCommandBuffer", offsetof(DeviceDispatchTable, BeginCommandBuffer)},
+ {"vkBindBufferMemory", offsetof(DeviceDispatchTable, BindBufferMemory)},
+ {"vkBindImageMemory", offsetof(DeviceDispatchTable, BindImageMemory)},
+ {"vkCmdBeginQuery", offsetof(DeviceDispatchTable, CmdBeginQuery)},
+ {"vkCmdBeginRenderPass", offsetof(DeviceDispatchTable, CmdBeginRenderPass)},
+ {"vkCmdBindDescriptorSets", offsetof(DeviceDispatchTable, CmdBindDescriptorSets)},
+ {"vkCmdBindIndexBuffer", offsetof(DeviceDispatchTable, CmdBindIndexBuffer)},
+ {"vkCmdBindPipeline", offsetof(DeviceDispatchTable, CmdBindPipeline)},
+ {"vkCmdBindVertexBuffers", offsetof(DeviceDispatchTable, CmdBindVertexBuffers)},
+ {"vkCmdBlitImage", offsetof(DeviceDispatchTable, CmdBlitImage)},
+ {"vkCmdClearAttachments", offsetof(DeviceDispatchTable, CmdClearAttachments)},
+ {"vkCmdClearColorImage", offsetof(DeviceDispatchTable, CmdClearColorImage)},
+ {"vkCmdClearDepthStencilImage", offsetof(DeviceDispatchTable, CmdClearDepthStencilImage)},
+ {"vkCmdCopyBuffer", offsetof(DeviceDispatchTable, CmdCopyBuffer)},
+ {"vkCmdCopyBufferToImage", offsetof(DeviceDispatchTable, CmdCopyBufferToImage)},
+ {"vkCmdCopyImage", offsetof(DeviceDispatchTable, CmdCopyImage)},
+ {"vkCmdCopyImageToBuffer", offsetof(DeviceDispatchTable, CmdCopyImageToBuffer)},
+ {"vkCmdCopyQueryPoolResults", offsetof(DeviceDispatchTable, CmdCopyQueryPoolResults)},
+ {"vkCmdDispatch", offsetof(DeviceDispatchTable, CmdDispatch)},
+ {"vkCmdDispatchIndirect", offsetof(DeviceDispatchTable, CmdDispatchIndirect)},
+ {"vkCmdDraw", offsetof(DeviceDispatchTable, CmdDraw)},
+ {"vkCmdDrawIndexed", offsetof(DeviceDispatchTable, CmdDrawIndexed)},
+ {"vkCmdDrawIndexedIndirect", offsetof(DeviceDispatchTable, CmdDrawIndexedIndirect)},
+ {"vkCmdDrawIndirect", offsetof(DeviceDispatchTable, CmdDrawIndirect)},
+ {"vkCmdEndQuery", offsetof(DeviceDispatchTable, CmdEndQuery)},
+ {"vkCmdEndRenderPass", offsetof(DeviceDispatchTable, CmdEndRenderPass)},
+ {"vkCmdExecuteCommands", offsetof(DeviceDispatchTable, CmdExecuteCommands)},
+ {"vkCmdFillBuffer", offsetof(DeviceDispatchTable, CmdFillBuffer)},
+ {"vkCmdNextSubpass", offsetof(DeviceDispatchTable, CmdNextSubpass)},
+ {"vkCmdPipelineBarrier", offsetof(DeviceDispatchTable, CmdPipelineBarrier)},
+ {"vkCmdPushConstants", offsetof(DeviceDispatchTable, CmdPushConstants)},
+ {"vkCmdResetEvent", offsetof(DeviceDispatchTable, CmdResetEvent)},
+ {"vkCmdResetQueryPool", offsetof(DeviceDispatchTable, CmdResetQueryPool)},
+ {"vkCmdResolveImage", offsetof(DeviceDispatchTable, CmdResolveImage)},
+ {"vkCmdSetBlendConstants", offsetof(DeviceDispatchTable, CmdSetBlendConstants)},
+ {"vkCmdSetDepthBias", offsetof(DeviceDispatchTable, CmdSetDepthBias)},
+ {"vkCmdSetDepthBounds", offsetof(DeviceDispatchTable, CmdSetDepthBounds)},
+ {"vkCmdSetEvent", offsetof(DeviceDispatchTable, CmdSetEvent)},
+ {"vkCmdSetLineWidth", offsetof(DeviceDispatchTable, CmdSetLineWidth)},
+ {"vkCmdSetScissor", offsetof(DeviceDispatchTable, CmdSetScissor)},
+ {"vkCmdSetStencilCompareMask", offsetof(DeviceDispatchTable, CmdSetStencilCompareMask)},
+ {"vkCmdSetStencilReference", offsetof(DeviceDispatchTable, CmdSetStencilReference)},
+ {"vkCmdSetStencilWriteMask", offsetof(DeviceDispatchTable, CmdSetStencilWriteMask)},
+ {"vkCmdSetViewport", offsetof(DeviceDispatchTable, CmdSetViewport)},
+ {"vkCmdUpdateBuffer", offsetof(DeviceDispatchTable, CmdUpdateBuffer)},
+ {"vkCmdWaitEvents", offsetof(DeviceDispatchTable, CmdWaitEvents)},
+ {"vkCmdWriteTimestamp", offsetof(DeviceDispatchTable, CmdWriteTimestamp)},
+ {"vkCreateBuffer", offsetof(DeviceDispatchTable, CreateBuffer)},
+ {"vkCreateBufferView", offsetof(DeviceDispatchTable, CreateBufferView)},
+ {"vkCreateCommandPool", offsetof(DeviceDispatchTable, CreateCommandPool)},
+ {"vkCreateComputePipelines", offsetof(DeviceDispatchTable, CreateComputePipelines)},
+ {"vkCreateDescriptorPool", offsetof(DeviceDispatchTable, CreateDescriptorPool)},
+ {"vkCreateDescriptorSetLayout", offsetof(DeviceDispatchTable, CreateDescriptorSetLayout)},
+ {"vkCreateEvent", offsetof(DeviceDispatchTable, CreateEvent)},
+ {"vkCreateFence", offsetof(DeviceDispatchTable, CreateFence)},
+ {"vkCreateFramebuffer", offsetof(DeviceDispatchTable, CreateFramebuffer)},
+ {"vkCreateGraphicsPipelines", offsetof(DeviceDispatchTable, CreateGraphicsPipelines)},
+ {"vkCreateImage", offsetof(DeviceDispatchTable, CreateImage)},
+ {"vkCreateImageView", offsetof(DeviceDispatchTable, CreateImageView)},
+ {"vkCreatePipelineCache", offsetof(DeviceDispatchTable, CreatePipelineCache)},
+ {"vkCreatePipelineLayout", offsetof(DeviceDispatchTable, CreatePipelineLayout)},
+ {"vkCreateQueryPool", offsetof(DeviceDispatchTable, CreateQueryPool)},
+ {"vkCreateRenderPass", offsetof(DeviceDispatchTable, CreateRenderPass)},
+ {"vkCreateSampler", offsetof(DeviceDispatchTable, CreateSampler)},
+ {"vkCreateSemaphore", offsetof(DeviceDispatchTable, CreateSemaphore)},
+ {"vkCreateShaderModule", offsetof(DeviceDispatchTable, CreateShaderModule)},
+ {"vkCreateSwapchainKHR", offsetof(DeviceDispatchTable, CreateSwapchainKHR)},
+ {"vkDestroyBuffer", offsetof(DeviceDispatchTable, DestroyBuffer)},
+ {"vkDestroyBufferView", offsetof(DeviceDispatchTable, DestroyBufferView)},
+ {"vkDestroyCommandPool", offsetof(DeviceDispatchTable, DestroyCommandPool)},
+ {"vkDestroyDescriptorPool", offsetof(DeviceDispatchTable, DestroyDescriptorPool)},
+ {"vkDestroyDescriptorSetLayout", offsetof(DeviceDispatchTable, DestroyDescriptorSetLayout)},
+ {"vkDestroyDevice", offsetof(DeviceDispatchTable, DestroyDevice)},
+ {"vkDestroyEvent", offsetof(DeviceDispatchTable, DestroyEvent)},
+ {"vkDestroyFence", offsetof(DeviceDispatchTable, DestroyFence)},
+ {"vkDestroyFramebuffer", offsetof(DeviceDispatchTable, DestroyFramebuffer)},
+ {"vkDestroyImage", offsetof(DeviceDispatchTable, DestroyImage)},
+ {"vkDestroyImageView", offsetof(DeviceDispatchTable, DestroyImageView)},
+ {"vkDestroyPipeline", offsetof(DeviceDispatchTable, DestroyPipeline)},
+ {"vkDestroyPipelineCache", offsetof(DeviceDispatchTable, DestroyPipelineCache)},
+ {"vkDestroyPipelineLayout", offsetof(DeviceDispatchTable, DestroyPipelineLayout)},
+ {"vkDestroyQueryPool", offsetof(DeviceDispatchTable, DestroyQueryPool)},
+ {"vkDestroyRenderPass", offsetof(DeviceDispatchTable, DestroyRenderPass)},
+ {"vkDestroySampler", offsetof(DeviceDispatchTable, DestroySampler)},
+ {"vkDestroySemaphore", offsetof(DeviceDispatchTable, DestroySemaphore)},
+ {"vkDestroyShaderModule", offsetof(DeviceDispatchTable, DestroyShaderModule)},
+ {"vkDestroySwapchainKHR", offsetof(DeviceDispatchTable, DestroySwapchainKHR)},
+ {"vkDeviceWaitIdle", offsetof(DeviceDispatchTable, DeviceWaitIdle)},
+ {"vkEndCommandBuffer", offsetof(DeviceDispatchTable, EndCommandBuffer)},
+ {"vkFlushMappedMemoryRanges", offsetof(DeviceDispatchTable, FlushMappedMemoryRanges)},
+ {"vkFreeCommandBuffers", offsetof(DeviceDispatchTable, FreeCommandBuffers)},
+ {"vkFreeDescriptorSets", offsetof(DeviceDispatchTable, FreeDescriptorSets)},
+ {"vkFreeMemory", offsetof(DeviceDispatchTable, FreeMemory)},
+ {"vkGetBufferMemoryRequirements", offsetof(DeviceDispatchTable, GetBufferMemoryRequirements)},
+ {"vkGetDeviceMemoryCommitment", offsetof(DeviceDispatchTable, GetDeviceMemoryCommitment)},
+ {"vkGetDeviceQueue", offsetof(DeviceDispatchTable, GetDeviceQueue)},
+ {"vkGetEventStatus", offsetof(DeviceDispatchTable, GetEventStatus)},
+ {"vkGetFenceStatus", offsetof(DeviceDispatchTable, GetFenceStatus)},
+ {"vkGetImageMemoryRequirements", offsetof(DeviceDispatchTable, GetImageMemoryRequirements)},
+ {"vkGetImageSparseMemoryRequirements", offsetof(DeviceDispatchTable, GetImageSparseMemoryRequirements)},
+ {"vkGetImageSubresourceLayout", offsetof(DeviceDispatchTable, GetImageSubresourceLayout)},
+ {"vkGetPipelineCacheData", offsetof(DeviceDispatchTable, GetPipelineCacheData)},
+ {"vkGetQueryPoolResults", offsetof(DeviceDispatchTable, GetQueryPoolResults)},
+ {"vkGetRenderAreaGranularity", offsetof(DeviceDispatchTable, GetRenderAreaGranularity)},
+ {"vkGetSwapchainImagesKHR", offsetof(DeviceDispatchTable, GetSwapchainImagesKHR)},
+ {"vkInvalidateMappedMemoryRanges", offsetof(DeviceDispatchTable, InvalidateMappedMemoryRanges)},
+ {"vkMapMemory", offsetof(DeviceDispatchTable, MapMemory)},
+ {"vkMergePipelineCaches", offsetof(DeviceDispatchTable, MergePipelineCaches)},
+ {"vkQueueBindSparse", offsetof(DeviceDispatchTable, QueueBindSparse)},
+ {"vkQueuePresentKHR", offsetof(DeviceDispatchTable, QueuePresentKHR)},
+ {"vkQueueSubmit", offsetof(DeviceDispatchTable, QueueSubmit)},
+ {"vkQueueWaitIdle", offsetof(DeviceDispatchTable, QueueWaitIdle)},
+ {"vkResetCommandBuffer", offsetof(DeviceDispatchTable, ResetCommandBuffer)},
+ {"vkResetCommandPool", offsetof(DeviceDispatchTable, ResetCommandPool)},
+ {"vkResetDescriptorPool", offsetof(DeviceDispatchTable, ResetDescriptorPool)},
+ {"vkResetEvent", offsetof(DeviceDispatchTable, ResetEvent)},
+ {"vkResetFences", offsetof(DeviceDispatchTable, ResetFences)},
+ {"vkSetEvent", offsetof(DeviceDispatchTable, SetEvent)},
+ {"vkUnmapMemory", offsetof(DeviceDispatchTable, UnmapMemory)},
+ {"vkUpdateDescriptorSets", offsetof(DeviceDispatchTable, UpdateDescriptorSets)},
+ {"vkWaitForFences", offsetof(DeviceDispatchTable, WaitForFences)},
+ // clang-format on
+};
+
+} // anonymous namespace
+
+namespace vulkan {
+
+PFN_vkVoidFunction GetLoaderExportProcAddr(const char* name) {
+ return Lookup(name, kLoaderExportProcs);
+}
+
+PFN_vkVoidFunction GetLoaderGlobalProcAddr(const char* name) {
+ return Lookup(name, kLoaderGlobalProcs);
+}
+
+PFN_vkVoidFunction GetLoaderTopProcAddr(const char* name) {
+ return Lookup(name, kLoaderTopProcs);
+}
+
+PFN_vkVoidFunction GetLoaderBottomProcAddr(const char* name) {
+ return Lookup(name, kLoaderBottomProcs);
+}
+
+PFN_vkVoidFunction GetDispatchProcAddr(const InstanceDispatchTable& dispatch,
+ const char* name) {
+ return Lookup(name, kInstanceDispatchOffsets, dispatch);
+}
+
+PFN_vkVoidFunction GetDispatchProcAddr(const DeviceDispatchTable& dispatch,
+ const char* name) {
+ return Lookup(name, kDeviceDispatchOffsets, dispatch);
+}
+
+bool LoadInstanceDispatchTable(VkInstance instance,
+ PFN_vkGetInstanceProcAddr get_proc_addr,
+ InstanceDispatchTable& dispatch) {
+ bool success = true;
+ // clang-format off
+ dispatch.DestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(get_proc_addr(instance, "vkDestroyInstance"));
+ if (UNLIKELY(!dispatch.DestroyInstance)) {
+ ALOGE("missing instance proc: %s", "vkDestroyInstance");
+ success = false;
+ }
+ dispatch.EnumeratePhysicalDevices = reinterpret_cast<PFN_vkEnumeratePhysicalDevices>(get_proc_addr(instance, "vkEnumeratePhysicalDevices"));
+ if (UNLIKELY(!dispatch.EnumeratePhysicalDevices)) {
+ ALOGE("missing instance proc: %s", "vkEnumeratePhysicalDevices");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceProperties)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceQueueFamilyProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceQueueFamilyProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceQueueFamilyProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceQueueFamilyProperties)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceQueueFamilyProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceMemoryProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceMemoryProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceMemoryProperties)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceMemoryProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceFeatures = reinterpret_cast<PFN_vkGetPhysicalDeviceFeatures>(get_proc_addr(instance, "vkGetPhysicalDeviceFeatures"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceFeatures)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceFeatures");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceFormatProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceFormatProperties)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceFormatProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceImageFormatProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceImageFormatProperties)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceImageFormatProperties");
+ success = false;
+ }
+ dispatch.CreateDevice = reinterpret_cast<PFN_vkCreateDevice>(get_proc_addr(instance, "vkCreateDevice"));
+ if (UNLIKELY(!dispatch.CreateDevice)) {
+ ALOGE("missing instance proc: %s", "vkCreateDevice");
+ success = false;
+ }
+ dispatch.EnumerateDeviceLayerProperties = reinterpret_cast<PFN_vkEnumerateDeviceLayerProperties>(get_proc_addr(instance, "vkEnumerateDeviceLayerProperties"));
+ if (UNLIKELY(!dispatch.EnumerateDeviceLayerProperties)) {
+ ALOGE("missing instance proc: %s", "vkEnumerateDeviceLayerProperties");
+ success = false;
+ }
+ dispatch.EnumerateDeviceExtensionProperties = reinterpret_cast<PFN_vkEnumerateDeviceExtensionProperties>(get_proc_addr(instance, "vkEnumerateDeviceExtensionProperties"));
+ if (UNLIKELY(!dispatch.EnumerateDeviceExtensionProperties)) {
+ ALOGE("missing instance proc: %s", "vkEnumerateDeviceExtensionProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceSparseImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceSparseImageFormatProperties)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceSparseImageFormatProperties");
+ success = false;
+ }
+ dispatch.DestroySurfaceKHR = reinterpret_cast<PFN_vkDestroySurfaceKHR>(get_proc_addr(instance, "vkDestroySurfaceKHR"));
+ if (UNLIKELY(!dispatch.DestroySurfaceKHR)) {
+ ALOGE("missing instance proc: %s", "vkDestroySurfaceKHR");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceSurfaceSupportKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfaceSupportKHR"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceSurfaceSupportKHR)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceSurfaceSupportKHR");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceSurfaceFormatsKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceSurfaceFormatsKHR)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceSurfaceFormatsKHR");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceSurfacePresentModesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceSurfacePresentModesKHR)) {
+ ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceSurfacePresentModesKHR");
+ success = false;
+ }
+ dispatch.CreateAndroidSurfaceKHR = reinterpret_cast<PFN_vkCreateAndroidSurfaceKHR>(get_proc_addr(instance, "vkCreateAndroidSurfaceKHR"));
+ if (UNLIKELY(!dispatch.CreateAndroidSurfaceKHR)) {
+ ALOGE("missing instance proc: %s", "vkCreateAndroidSurfaceKHR");
+ success = false;
+ }
+ // clang-format on
+ return success;
+}
+
+bool LoadDeviceDispatchTable(VkDevice device,
+ PFN_vkGetDeviceProcAddr get_proc_addr,
+ DeviceDispatchTable& dispatch) {
+ bool success = true;
+ // clang-format off
+ dispatch.DestroyDevice = reinterpret_cast<PFN_vkDestroyDevice>(get_proc_addr(device, "vkDestroyDevice"));
+ if (UNLIKELY(!dispatch.DestroyDevice)) {
+ ALOGE("missing device proc: %s", "vkDestroyDevice");
+ success = false;
+ }
+ dispatch.GetDeviceQueue = reinterpret_cast<PFN_vkGetDeviceQueue>(get_proc_addr(device, "vkGetDeviceQueue"));
+ if (UNLIKELY(!dispatch.GetDeviceQueue)) {
+ ALOGE("missing device proc: %s", "vkGetDeviceQueue");
+ success = false;
+ }
+ dispatch.QueueSubmit = reinterpret_cast<PFN_vkQueueSubmit>(get_proc_addr(device, "vkQueueSubmit"));
+ if (UNLIKELY(!dispatch.QueueSubmit)) {
+ ALOGE("missing device proc: %s", "vkQueueSubmit");
+ success = false;
+ }
+ dispatch.QueueWaitIdle = reinterpret_cast<PFN_vkQueueWaitIdle>(get_proc_addr(device, "vkQueueWaitIdle"));
+ if (UNLIKELY(!dispatch.QueueWaitIdle)) {
+ ALOGE("missing device proc: %s", "vkQueueWaitIdle");
+ success = false;
+ }
+ dispatch.DeviceWaitIdle = reinterpret_cast<PFN_vkDeviceWaitIdle>(get_proc_addr(device, "vkDeviceWaitIdle"));
+ if (UNLIKELY(!dispatch.DeviceWaitIdle)) {
+ ALOGE("missing device proc: %s", "vkDeviceWaitIdle");
+ success = false;
+ }
+ dispatch.AllocateMemory = reinterpret_cast<PFN_vkAllocateMemory>(get_proc_addr(device, "vkAllocateMemory"));
+ if (UNLIKELY(!dispatch.AllocateMemory)) {
+ ALOGE("missing device proc: %s", "vkAllocateMemory");
+ success = false;
+ }
+ dispatch.FreeMemory = reinterpret_cast<PFN_vkFreeMemory>(get_proc_addr(device, "vkFreeMemory"));
+ if (UNLIKELY(!dispatch.FreeMemory)) {
+ ALOGE("missing device proc: %s", "vkFreeMemory");
+ success = false;
+ }
+ dispatch.MapMemory = reinterpret_cast<PFN_vkMapMemory>(get_proc_addr(device, "vkMapMemory"));
+ if (UNLIKELY(!dispatch.MapMemory)) {
+ ALOGE("missing device proc: %s", "vkMapMemory");
+ success = false;
+ }
+ dispatch.UnmapMemory = reinterpret_cast<PFN_vkUnmapMemory>(get_proc_addr(device, "vkUnmapMemory"));
+ if (UNLIKELY(!dispatch.UnmapMemory)) {
+ ALOGE("missing device proc: %s", "vkUnmapMemory");
+ success = false;
+ }
+ dispatch.FlushMappedMemoryRanges = reinterpret_cast<PFN_vkFlushMappedMemoryRanges>(get_proc_addr(device, "vkFlushMappedMemoryRanges"));
+ if (UNLIKELY(!dispatch.FlushMappedMemoryRanges)) {
+ ALOGE("missing device proc: %s", "vkFlushMappedMemoryRanges");
+ success = false;
+ }
+ dispatch.InvalidateMappedMemoryRanges = reinterpret_cast<PFN_vkInvalidateMappedMemoryRanges>(get_proc_addr(device, "vkInvalidateMappedMemoryRanges"));
+ if (UNLIKELY(!dispatch.InvalidateMappedMemoryRanges)) {
+ ALOGE("missing device proc: %s", "vkInvalidateMappedMemoryRanges");
+ success = false;
+ }
+ dispatch.GetDeviceMemoryCommitment = reinterpret_cast<PFN_vkGetDeviceMemoryCommitment>(get_proc_addr(device, "vkGetDeviceMemoryCommitment"));
+ if (UNLIKELY(!dispatch.GetDeviceMemoryCommitment)) {
+ ALOGE("missing device proc: %s", "vkGetDeviceMemoryCommitment");
+ success = false;
+ }
+ dispatch.GetBufferMemoryRequirements = reinterpret_cast<PFN_vkGetBufferMemoryRequirements>(get_proc_addr(device, "vkGetBufferMemoryRequirements"));
+ if (UNLIKELY(!dispatch.GetBufferMemoryRequirements)) {
+ ALOGE("missing device proc: %s", "vkGetBufferMemoryRequirements");
+ success = false;
+ }
+ dispatch.BindBufferMemory = reinterpret_cast<PFN_vkBindBufferMemory>(get_proc_addr(device, "vkBindBufferMemory"));
+ if (UNLIKELY(!dispatch.BindBufferMemory)) {
+ ALOGE("missing device proc: %s", "vkBindBufferMemory");
+ success = false;
+ }
+ dispatch.GetImageMemoryRequirements = reinterpret_cast<PFN_vkGetImageMemoryRequirements>(get_proc_addr(device, "vkGetImageMemoryRequirements"));
+ if (UNLIKELY(!dispatch.GetImageMemoryRequirements)) {
+ ALOGE("missing device proc: %s", "vkGetImageMemoryRequirements");
+ success = false;
+ }
+ dispatch.BindImageMemory = reinterpret_cast<PFN_vkBindImageMemory>(get_proc_addr(device, "vkBindImageMemory"));
+ if (UNLIKELY(!dispatch.BindImageMemory)) {
+ ALOGE("missing device proc: %s", "vkBindImageMemory");
+ success = false;
+ }
+ dispatch.GetImageSparseMemoryRequirements = reinterpret_cast<PFN_vkGetImageSparseMemoryRequirements>(get_proc_addr(device, "vkGetImageSparseMemoryRequirements"));
+ if (UNLIKELY(!dispatch.GetImageSparseMemoryRequirements)) {
+ ALOGE("missing device proc: %s", "vkGetImageSparseMemoryRequirements");
+ success = false;
+ }
+ dispatch.QueueBindSparse = reinterpret_cast<PFN_vkQueueBindSparse>(get_proc_addr(device, "vkQueueBindSparse"));
+ if (UNLIKELY(!dispatch.QueueBindSparse)) {
+ ALOGE("missing device proc: %s", "vkQueueBindSparse");
+ success = false;
+ }
+ dispatch.CreateFence = reinterpret_cast<PFN_vkCreateFence>(get_proc_addr(device, "vkCreateFence"));
+ if (UNLIKELY(!dispatch.CreateFence)) {
+ ALOGE("missing device proc: %s", "vkCreateFence");
+ success = false;
+ }
+ dispatch.DestroyFence = reinterpret_cast<PFN_vkDestroyFence>(get_proc_addr(device, "vkDestroyFence"));
+ if (UNLIKELY(!dispatch.DestroyFence)) {
+ ALOGE("missing device proc: %s", "vkDestroyFence");
+ success = false;
+ }
+ dispatch.ResetFences = reinterpret_cast<PFN_vkResetFences>(get_proc_addr(device, "vkResetFences"));
+ if (UNLIKELY(!dispatch.ResetFences)) {
+ ALOGE("missing device proc: %s", "vkResetFences");
+ success = false;
+ }
+ dispatch.GetFenceStatus = reinterpret_cast<PFN_vkGetFenceStatus>(get_proc_addr(device, "vkGetFenceStatus"));
+ if (UNLIKELY(!dispatch.GetFenceStatus)) {
+ ALOGE("missing device proc: %s", "vkGetFenceStatus");
+ success = false;
+ }
+ dispatch.WaitForFences = reinterpret_cast<PFN_vkWaitForFences>(get_proc_addr(device, "vkWaitForFences"));
+ if (UNLIKELY(!dispatch.WaitForFences)) {
+ ALOGE("missing device proc: %s", "vkWaitForFences");
+ success = false;
+ }
+ dispatch.CreateSemaphore = reinterpret_cast<PFN_vkCreateSemaphore>(get_proc_addr(device, "vkCreateSemaphore"));
+ if (UNLIKELY(!dispatch.CreateSemaphore)) {
+ ALOGE("missing device proc: %s", "vkCreateSemaphore");
+ success = false;
+ }
+ dispatch.DestroySemaphore = reinterpret_cast<PFN_vkDestroySemaphore>(get_proc_addr(device, "vkDestroySemaphore"));
+ if (UNLIKELY(!dispatch.DestroySemaphore)) {
+ ALOGE("missing device proc: %s", "vkDestroySemaphore");
+ success = false;
+ }
+ dispatch.CreateEvent = reinterpret_cast<PFN_vkCreateEvent>(get_proc_addr(device, "vkCreateEvent"));
+ if (UNLIKELY(!dispatch.CreateEvent)) {
+ ALOGE("missing device proc: %s", "vkCreateEvent");
+ success = false;
+ }
+ dispatch.DestroyEvent = reinterpret_cast<PFN_vkDestroyEvent>(get_proc_addr(device, "vkDestroyEvent"));
+ if (UNLIKELY(!dispatch.DestroyEvent)) {
+ ALOGE("missing device proc: %s", "vkDestroyEvent");
+ success = false;
+ }
+ dispatch.GetEventStatus = reinterpret_cast<PFN_vkGetEventStatus>(get_proc_addr(device, "vkGetEventStatus"));
+ if (UNLIKELY(!dispatch.GetEventStatus)) {
+ ALOGE("missing device proc: %s", "vkGetEventStatus");
+ success = false;
+ }
+ dispatch.SetEvent = reinterpret_cast<PFN_vkSetEvent>(get_proc_addr(device, "vkSetEvent"));
+ if (UNLIKELY(!dispatch.SetEvent)) {
+ ALOGE("missing device proc: %s", "vkSetEvent");
+ success = false;
+ }
+ dispatch.ResetEvent = reinterpret_cast<PFN_vkResetEvent>(get_proc_addr(device, "vkResetEvent"));
+ if (UNLIKELY(!dispatch.ResetEvent)) {
+ ALOGE("missing device proc: %s", "vkResetEvent");
+ success = false;
+ }
+ dispatch.CreateQueryPool = reinterpret_cast<PFN_vkCreateQueryPool>(get_proc_addr(device, "vkCreateQueryPool"));
+ if (UNLIKELY(!dispatch.CreateQueryPool)) {
+ ALOGE("missing device proc: %s", "vkCreateQueryPool");
+ success = false;
+ }
+ dispatch.DestroyQueryPool = reinterpret_cast<PFN_vkDestroyQueryPool>(get_proc_addr(device, "vkDestroyQueryPool"));
+ if (UNLIKELY(!dispatch.DestroyQueryPool)) {
+ ALOGE("missing device proc: %s", "vkDestroyQueryPool");
+ success = false;
+ }
+ dispatch.GetQueryPoolResults = reinterpret_cast<PFN_vkGetQueryPoolResults>(get_proc_addr(device, "vkGetQueryPoolResults"));
+ if (UNLIKELY(!dispatch.GetQueryPoolResults)) {
+ ALOGE("missing device proc: %s", "vkGetQueryPoolResults");
+ success = false;
+ }
+ dispatch.CreateBuffer = reinterpret_cast<PFN_vkCreateBuffer>(get_proc_addr(device, "vkCreateBuffer"));
+ if (UNLIKELY(!dispatch.CreateBuffer)) {
+ ALOGE("missing device proc: %s", "vkCreateBuffer");
+ success = false;
+ }
+ dispatch.DestroyBuffer = reinterpret_cast<PFN_vkDestroyBuffer>(get_proc_addr(device, "vkDestroyBuffer"));
+ if (UNLIKELY(!dispatch.DestroyBuffer)) {
+ ALOGE("missing device proc: %s", "vkDestroyBuffer");
+ success = false;
+ }
+ dispatch.CreateBufferView = reinterpret_cast<PFN_vkCreateBufferView>(get_proc_addr(device, "vkCreateBufferView"));
+ if (UNLIKELY(!dispatch.CreateBufferView)) {
+ ALOGE("missing device proc: %s", "vkCreateBufferView");
+ success = false;
+ }
+ dispatch.DestroyBufferView = reinterpret_cast<PFN_vkDestroyBufferView>(get_proc_addr(device, "vkDestroyBufferView"));
+ if (UNLIKELY(!dispatch.DestroyBufferView)) {
+ ALOGE("missing device proc: %s", "vkDestroyBufferView");
+ success = false;
+ }
+ dispatch.CreateImage = reinterpret_cast<PFN_vkCreateImage>(get_proc_addr(device, "vkCreateImage"));
+ if (UNLIKELY(!dispatch.CreateImage)) {
+ ALOGE("missing device proc: %s", "vkCreateImage");
+ success = false;
+ }
+ dispatch.DestroyImage = reinterpret_cast<PFN_vkDestroyImage>(get_proc_addr(device, "vkDestroyImage"));
+ if (UNLIKELY(!dispatch.DestroyImage)) {
+ ALOGE("missing device proc: %s", "vkDestroyImage");
+ success = false;
+ }
+ dispatch.GetImageSubresourceLayout = reinterpret_cast<PFN_vkGetImageSubresourceLayout>(get_proc_addr(device, "vkGetImageSubresourceLayout"));
+ if (UNLIKELY(!dispatch.GetImageSubresourceLayout)) {
+ ALOGE("missing device proc: %s", "vkGetImageSubresourceLayout");
+ success = false;
+ }
+ dispatch.CreateImageView = reinterpret_cast<PFN_vkCreateImageView>(get_proc_addr(device, "vkCreateImageView"));
+ if (UNLIKELY(!dispatch.CreateImageView)) {
+ ALOGE("missing device proc: %s", "vkCreateImageView");
+ success = false;
+ }
+ dispatch.DestroyImageView = reinterpret_cast<PFN_vkDestroyImageView>(get_proc_addr(device, "vkDestroyImageView"));
+ if (UNLIKELY(!dispatch.DestroyImageView)) {
+ ALOGE("missing device proc: %s", "vkDestroyImageView");
+ success = false;
+ }
+ dispatch.CreateShaderModule = reinterpret_cast<PFN_vkCreateShaderModule>(get_proc_addr(device, "vkCreateShaderModule"));
+ if (UNLIKELY(!dispatch.CreateShaderModule)) {
+ ALOGE("missing device proc: %s", "vkCreateShaderModule");
+ success = false;
+ }
+ dispatch.DestroyShaderModule = reinterpret_cast<PFN_vkDestroyShaderModule>(get_proc_addr(device, "vkDestroyShaderModule"));
+ if (UNLIKELY(!dispatch.DestroyShaderModule)) {
+ ALOGE("missing device proc: %s", "vkDestroyShaderModule");
+ success = false;
+ }
+ dispatch.CreatePipelineCache = reinterpret_cast<PFN_vkCreatePipelineCache>(get_proc_addr(device, "vkCreatePipelineCache"));
+ if (UNLIKELY(!dispatch.CreatePipelineCache)) {
+ ALOGE("missing device proc: %s", "vkCreatePipelineCache");
+ success = false;
+ }
+ dispatch.DestroyPipelineCache = reinterpret_cast<PFN_vkDestroyPipelineCache>(get_proc_addr(device, "vkDestroyPipelineCache"));
+ if (UNLIKELY(!dispatch.DestroyPipelineCache)) {
+ ALOGE("missing device proc: %s", "vkDestroyPipelineCache");
+ success = false;
+ }
+ dispatch.GetPipelineCacheData = reinterpret_cast<PFN_vkGetPipelineCacheData>(get_proc_addr(device, "vkGetPipelineCacheData"));
+ if (UNLIKELY(!dispatch.GetPipelineCacheData)) {
+ ALOGE("missing device proc: %s", "vkGetPipelineCacheData");
+ success = false;
+ }
+ dispatch.MergePipelineCaches = reinterpret_cast<PFN_vkMergePipelineCaches>(get_proc_addr(device, "vkMergePipelineCaches"));
+ if (UNLIKELY(!dispatch.MergePipelineCaches)) {
+ ALOGE("missing device proc: %s", "vkMergePipelineCaches");
+ success = false;
+ }
+ dispatch.CreateGraphicsPipelines = reinterpret_cast<PFN_vkCreateGraphicsPipelines>(get_proc_addr(device, "vkCreateGraphicsPipelines"));
+ if (UNLIKELY(!dispatch.CreateGraphicsPipelines)) {
+ ALOGE("missing device proc: %s", "vkCreateGraphicsPipelines");
+ success = false;
+ }
+ dispatch.CreateComputePipelines = reinterpret_cast<PFN_vkCreateComputePipelines>(get_proc_addr(device, "vkCreateComputePipelines"));
+ if (UNLIKELY(!dispatch.CreateComputePipelines)) {
+ ALOGE("missing device proc: %s", "vkCreateComputePipelines");
+ success = false;
+ }
+ dispatch.DestroyPipeline = reinterpret_cast<PFN_vkDestroyPipeline>(get_proc_addr(device, "vkDestroyPipeline"));
+ if (UNLIKELY(!dispatch.DestroyPipeline)) {
+ ALOGE("missing device proc: %s", "vkDestroyPipeline");
+ success = false;
+ }
+ dispatch.CreatePipelineLayout = reinterpret_cast<PFN_vkCreatePipelineLayout>(get_proc_addr(device, "vkCreatePipelineLayout"));
+ if (UNLIKELY(!dispatch.CreatePipelineLayout)) {
+ ALOGE("missing device proc: %s", "vkCreatePipelineLayout");
+ success = false;
+ }
+ dispatch.DestroyPipelineLayout = reinterpret_cast<PFN_vkDestroyPipelineLayout>(get_proc_addr(device, "vkDestroyPipelineLayout"));
+ if (UNLIKELY(!dispatch.DestroyPipelineLayout)) {
+ ALOGE("missing device proc: %s", "vkDestroyPipelineLayout");
+ success = false;
+ }
+ dispatch.CreateSampler = reinterpret_cast<PFN_vkCreateSampler>(get_proc_addr(device, "vkCreateSampler"));
+ if (UNLIKELY(!dispatch.CreateSampler)) {
+ ALOGE("missing device proc: %s", "vkCreateSampler");
+ success = false;
+ }
+ dispatch.DestroySampler = reinterpret_cast<PFN_vkDestroySampler>(get_proc_addr(device, "vkDestroySampler"));
+ if (UNLIKELY(!dispatch.DestroySampler)) {
+ ALOGE("missing device proc: %s", "vkDestroySampler");
+ success = false;
+ }
+ dispatch.CreateDescriptorSetLayout = reinterpret_cast<PFN_vkCreateDescriptorSetLayout>(get_proc_addr(device, "vkCreateDescriptorSetLayout"));
+ if (UNLIKELY(!dispatch.CreateDescriptorSetLayout)) {
+ ALOGE("missing device proc: %s", "vkCreateDescriptorSetLayout");
+ success = false;
+ }
+ dispatch.DestroyDescriptorSetLayout = reinterpret_cast<PFN_vkDestroyDescriptorSetLayout>(get_proc_addr(device, "vkDestroyDescriptorSetLayout"));
+ if (UNLIKELY(!dispatch.DestroyDescriptorSetLayout)) {
+ ALOGE("missing device proc: %s", "vkDestroyDescriptorSetLayout");
+ success = false;
+ }
+ dispatch.CreateDescriptorPool = reinterpret_cast<PFN_vkCreateDescriptorPool>(get_proc_addr(device, "vkCreateDescriptorPool"));
+ if (UNLIKELY(!dispatch.CreateDescriptorPool)) {
+ ALOGE("missing device proc: %s", "vkCreateDescriptorPool");
+ success = false;
+ }
+ dispatch.DestroyDescriptorPool = reinterpret_cast<PFN_vkDestroyDescriptorPool>(get_proc_addr(device, "vkDestroyDescriptorPool"));
+ if (UNLIKELY(!dispatch.DestroyDescriptorPool)) {
+ ALOGE("missing device proc: %s", "vkDestroyDescriptorPool");
+ success = false;
+ }
+ dispatch.ResetDescriptorPool = reinterpret_cast<PFN_vkResetDescriptorPool>(get_proc_addr(device, "vkResetDescriptorPool"));
+ if (UNLIKELY(!dispatch.ResetDescriptorPool)) {
+ ALOGE("missing device proc: %s", "vkResetDescriptorPool");
+ success = false;
+ }
+ dispatch.AllocateDescriptorSets = reinterpret_cast<PFN_vkAllocateDescriptorSets>(get_proc_addr(device, "vkAllocateDescriptorSets"));
+ if (UNLIKELY(!dispatch.AllocateDescriptorSets)) {
+ ALOGE("missing device proc: %s", "vkAllocateDescriptorSets");
+ success = false;
+ }
+ dispatch.FreeDescriptorSets = reinterpret_cast<PFN_vkFreeDescriptorSets>(get_proc_addr(device, "vkFreeDescriptorSets"));
+ if (UNLIKELY(!dispatch.FreeDescriptorSets)) {
+ ALOGE("missing device proc: %s", "vkFreeDescriptorSets");
+ success = false;
+ }
+ dispatch.UpdateDescriptorSets = reinterpret_cast<PFN_vkUpdateDescriptorSets>(get_proc_addr(device, "vkUpdateDescriptorSets"));
+ if (UNLIKELY(!dispatch.UpdateDescriptorSets)) {
+ ALOGE("missing device proc: %s", "vkUpdateDescriptorSets");
+ success = false;
+ }
+ dispatch.CreateFramebuffer = reinterpret_cast<PFN_vkCreateFramebuffer>(get_proc_addr(device, "vkCreateFramebuffer"));
+ if (UNLIKELY(!dispatch.CreateFramebuffer)) {
+ ALOGE("missing device proc: %s", "vkCreateFramebuffer");
+ success = false;
+ }
+ dispatch.DestroyFramebuffer = reinterpret_cast<PFN_vkDestroyFramebuffer>(get_proc_addr(device, "vkDestroyFramebuffer"));
+ if (UNLIKELY(!dispatch.DestroyFramebuffer)) {
+ ALOGE("missing device proc: %s", "vkDestroyFramebuffer");
+ success = false;
+ }
+ dispatch.CreateRenderPass = reinterpret_cast<PFN_vkCreateRenderPass>(get_proc_addr(device, "vkCreateRenderPass"));
+ if (UNLIKELY(!dispatch.CreateRenderPass)) {
+ ALOGE("missing device proc: %s", "vkCreateRenderPass");
+ success = false;
+ }
+ dispatch.DestroyRenderPass = reinterpret_cast<PFN_vkDestroyRenderPass>(get_proc_addr(device, "vkDestroyRenderPass"));
+ if (UNLIKELY(!dispatch.DestroyRenderPass)) {
+ ALOGE("missing device proc: %s", "vkDestroyRenderPass");
+ success = false;
+ }
+ dispatch.GetRenderAreaGranularity = reinterpret_cast<PFN_vkGetRenderAreaGranularity>(get_proc_addr(device, "vkGetRenderAreaGranularity"));
+ if (UNLIKELY(!dispatch.GetRenderAreaGranularity)) {
+ ALOGE("missing device proc: %s", "vkGetRenderAreaGranularity");
+ success = false;
+ }
+ dispatch.CreateCommandPool = reinterpret_cast<PFN_vkCreateCommandPool>(get_proc_addr(device, "vkCreateCommandPool"));
+ if (UNLIKELY(!dispatch.CreateCommandPool)) {
+ ALOGE("missing device proc: %s", "vkCreateCommandPool");
+ success = false;
+ }
+ dispatch.DestroyCommandPool = reinterpret_cast<PFN_vkDestroyCommandPool>(get_proc_addr(device, "vkDestroyCommandPool"));
+ if (UNLIKELY(!dispatch.DestroyCommandPool)) {
+ ALOGE("missing device proc: %s", "vkDestroyCommandPool");
+ success = false;
+ }
+ dispatch.ResetCommandPool = reinterpret_cast<PFN_vkResetCommandPool>(get_proc_addr(device, "vkResetCommandPool"));
+ if (UNLIKELY(!dispatch.ResetCommandPool)) {
+ ALOGE("missing device proc: %s", "vkResetCommandPool");
+ success = false;
+ }
+ dispatch.AllocateCommandBuffers = reinterpret_cast<PFN_vkAllocateCommandBuffers>(get_proc_addr(device, "vkAllocateCommandBuffers"));
+ if (UNLIKELY(!dispatch.AllocateCommandBuffers)) {
+ ALOGE("missing device proc: %s", "vkAllocateCommandBuffers");
+ success = false;
+ }
+ dispatch.FreeCommandBuffers = reinterpret_cast<PFN_vkFreeCommandBuffers>(get_proc_addr(device, "vkFreeCommandBuffers"));
+ if (UNLIKELY(!dispatch.FreeCommandBuffers)) {
+ ALOGE("missing device proc: %s", "vkFreeCommandBuffers");
+ success = false;
+ }
+ dispatch.BeginCommandBuffer = reinterpret_cast<PFN_vkBeginCommandBuffer>(get_proc_addr(device, "vkBeginCommandBuffer"));
+ if (UNLIKELY(!dispatch.BeginCommandBuffer)) {
+ ALOGE("missing device proc: %s", "vkBeginCommandBuffer");
+ success = false;
+ }
+ dispatch.EndCommandBuffer = reinterpret_cast<PFN_vkEndCommandBuffer>(get_proc_addr(device, "vkEndCommandBuffer"));
+ if (UNLIKELY(!dispatch.EndCommandBuffer)) {
+ ALOGE("missing device proc: %s", "vkEndCommandBuffer");
+ success = false;
+ }
+ dispatch.ResetCommandBuffer = reinterpret_cast<PFN_vkResetCommandBuffer>(get_proc_addr(device, "vkResetCommandBuffer"));
+ if (UNLIKELY(!dispatch.ResetCommandBuffer)) {
+ ALOGE("missing device proc: %s", "vkResetCommandBuffer");
+ success = false;
+ }
+ dispatch.CmdBindPipeline = reinterpret_cast<PFN_vkCmdBindPipeline>(get_proc_addr(device, "vkCmdBindPipeline"));
+ if (UNLIKELY(!dispatch.CmdBindPipeline)) {
+ ALOGE("missing device proc: %s", "vkCmdBindPipeline");
+ success = false;
+ }
+ dispatch.CmdSetViewport = reinterpret_cast<PFN_vkCmdSetViewport>(get_proc_addr(device, "vkCmdSetViewport"));
+ if (UNLIKELY(!dispatch.CmdSetViewport)) {
+ ALOGE("missing device proc: %s", "vkCmdSetViewport");
+ success = false;
+ }
+ dispatch.CmdSetScissor = reinterpret_cast<PFN_vkCmdSetScissor>(get_proc_addr(device, "vkCmdSetScissor"));
+ if (UNLIKELY(!dispatch.CmdSetScissor)) {
+ ALOGE("missing device proc: %s", "vkCmdSetScissor");
+ success = false;
+ }
+ dispatch.CmdSetLineWidth = reinterpret_cast<PFN_vkCmdSetLineWidth>(get_proc_addr(device, "vkCmdSetLineWidth"));
+ if (UNLIKELY(!dispatch.CmdSetLineWidth)) {
+ ALOGE("missing device proc: %s", "vkCmdSetLineWidth");
+ success = false;
+ }
+ dispatch.CmdSetDepthBias = reinterpret_cast<PFN_vkCmdSetDepthBias>(get_proc_addr(device, "vkCmdSetDepthBias"));
+ if (UNLIKELY(!dispatch.CmdSetDepthBias)) {
+ ALOGE("missing device proc: %s", "vkCmdSetDepthBias");
+ success = false;
+ }
+ dispatch.CmdSetBlendConstants = reinterpret_cast<PFN_vkCmdSetBlendConstants>(get_proc_addr(device, "vkCmdSetBlendConstants"));
+ if (UNLIKELY(!dispatch.CmdSetBlendConstants)) {
+ ALOGE("missing device proc: %s", "vkCmdSetBlendConstants");
+ success = false;
+ }
+ dispatch.CmdSetDepthBounds = reinterpret_cast<PFN_vkCmdSetDepthBounds>(get_proc_addr(device, "vkCmdSetDepthBounds"));
+ if (UNLIKELY(!dispatch.CmdSetDepthBounds)) {
+ ALOGE("missing device proc: %s", "vkCmdSetDepthBounds");
+ success = false;
+ }
+ dispatch.CmdSetStencilCompareMask = reinterpret_cast<PFN_vkCmdSetStencilCompareMask>(get_proc_addr(device, "vkCmdSetStencilCompareMask"));
+ if (UNLIKELY(!dispatch.CmdSetStencilCompareMask)) {
+ ALOGE("missing device proc: %s", "vkCmdSetStencilCompareMask");
+ success = false;
+ }
+ dispatch.CmdSetStencilWriteMask = reinterpret_cast<PFN_vkCmdSetStencilWriteMask>(get_proc_addr(device, "vkCmdSetStencilWriteMask"));
+ if (UNLIKELY(!dispatch.CmdSetStencilWriteMask)) {
+ ALOGE("missing device proc: %s", "vkCmdSetStencilWriteMask");
+ success = false;
+ }
+ dispatch.CmdSetStencilReference = reinterpret_cast<PFN_vkCmdSetStencilReference>(get_proc_addr(device, "vkCmdSetStencilReference"));
+ if (UNLIKELY(!dispatch.CmdSetStencilReference)) {
+ ALOGE("missing device proc: %s", "vkCmdSetStencilReference");
+ success = false;
+ }
+ dispatch.CmdBindDescriptorSets = reinterpret_cast<PFN_vkCmdBindDescriptorSets>(get_proc_addr(device, "vkCmdBindDescriptorSets"));
+ if (UNLIKELY(!dispatch.CmdBindDescriptorSets)) {
+ ALOGE("missing device proc: %s", "vkCmdBindDescriptorSets");
+ success = false;
+ }
+ dispatch.CmdBindIndexBuffer = reinterpret_cast<PFN_vkCmdBindIndexBuffer>(get_proc_addr(device, "vkCmdBindIndexBuffer"));
+ if (UNLIKELY(!dispatch.CmdBindIndexBuffer)) {
+ ALOGE("missing device proc: %s", "vkCmdBindIndexBuffer");
+ success = false;
+ }
+ dispatch.CmdBindVertexBuffers = reinterpret_cast<PFN_vkCmdBindVertexBuffers>(get_proc_addr(device, "vkCmdBindVertexBuffers"));
+ if (UNLIKELY(!dispatch.CmdBindVertexBuffers)) {
+ ALOGE("missing device proc: %s", "vkCmdBindVertexBuffers");
+ success = false;
+ }
+ dispatch.CmdDraw = reinterpret_cast<PFN_vkCmdDraw>(get_proc_addr(device, "vkCmdDraw"));
+ if (UNLIKELY(!dispatch.CmdDraw)) {
+ ALOGE("missing device proc: %s", "vkCmdDraw");
+ success = false;
+ }
+ dispatch.CmdDrawIndexed = reinterpret_cast<PFN_vkCmdDrawIndexed>(get_proc_addr(device, "vkCmdDrawIndexed"));
+ if (UNLIKELY(!dispatch.CmdDrawIndexed)) {
+ ALOGE("missing device proc: %s", "vkCmdDrawIndexed");
+ success = false;
+ }
+ dispatch.CmdDrawIndirect = reinterpret_cast<PFN_vkCmdDrawIndirect>(get_proc_addr(device, "vkCmdDrawIndirect"));
+ if (UNLIKELY(!dispatch.CmdDrawIndirect)) {
+ ALOGE("missing device proc: %s", "vkCmdDrawIndirect");
+ success = false;
+ }
+ dispatch.CmdDrawIndexedIndirect = reinterpret_cast<PFN_vkCmdDrawIndexedIndirect>(get_proc_addr(device, "vkCmdDrawIndexedIndirect"));
+ if (UNLIKELY(!dispatch.CmdDrawIndexedIndirect)) {
+ ALOGE("missing device proc: %s", "vkCmdDrawIndexedIndirect");
+ success = false;
+ }
+ dispatch.CmdDispatch = reinterpret_cast<PFN_vkCmdDispatch>(get_proc_addr(device, "vkCmdDispatch"));
+ if (UNLIKELY(!dispatch.CmdDispatch)) {
+ ALOGE("missing device proc: %s", "vkCmdDispatch");
+ success = false;
+ }
+ dispatch.CmdDispatchIndirect = reinterpret_cast<PFN_vkCmdDispatchIndirect>(get_proc_addr(device, "vkCmdDispatchIndirect"));
+ if (UNLIKELY(!dispatch.CmdDispatchIndirect)) {
+ ALOGE("missing device proc: %s", "vkCmdDispatchIndirect");
+ success = false;
+ }
+ dispatch.CmdCopyBuffer = reinterpret_cast<PFN_vkCmdCopyBuffer>(get_proc_addr(device, "vkCmdCopyBuffer"));
+ if (UNLIKELY(!dispatch.CmdCopyBuffer)) {
+ ALOGE("missing device proc: %s", "vkCmdCopyBuffer");
+ success = false;
+ }
+ dispatch.CmdCopyImage = reinterpret_cast<PFN_vkCmdCopyImage>(get_proc_addr(device, "vkCmdCopyImage"));
+ if (UNLIKELY(!dispatch.CmdCopyImage)) {
+ ALOGE("missing device proc: %s", "vkCmdCopyImage");
+ success = false;
+ }
+ dispatch.CmdBlitImage = reinterpret_cast<PFN_vkCmdBlitImage>(get_proc_addr(device, "vkCmdBlitImage"));
+ if (UNLIKELY(!dispatch.CmdBlitImage)) {
+ ALOGE("missing device proc: %s", "vkCmdBlitImage");
+ success = false;
+ }
+ dispatch.CmdCopyBufferToImage = reinterpret_cast<PFN_vkCmdCopyBufferToImage>(get_proc_addr(device, "vkCmdCopyBufferToImage"));
+ if (UNLIKELY(!dispatch.CmdCopyBufferToImage)) {
+ ALOGE("missing device proc: %s", "vkCmdCopyBufferToImage");
+ success = false;
+ }
+ dispatch.CmdCopyImageToBuffer = reinterpret_cast<PFN_vkCmdCopyImageToBuffer>(get_proc_addr(device, "vkCmdCopyImageToBuffer"));
+ if (UNLIKELY(!dispatch.CmdCopyImageToBuffer)) {
+ ALOGE("missing device proc: %s", "vkCmdCopyImageToBuffer");
+ success = false;
+ }
+ dispatch.CmdUpdateBuffer = reinterpret_cast<PFN_vkCmdUpdateBuffer>(get_proc_addr(device, "vkCmdUpdateBuffer"));
+ if (UNLIKELY(!dispatch.CmdUpdateBuffer)) {
+ ALOGE("missing device proc: %s", "vkCmdUpdateBuffer");
+ success = false;
+ }
+ dispatch.CmdFillBuffer = reinterpret_cast<PFN_vkCmdFillBuffer>(get_proc_addr(device, "vkCmdFillBuffer"));
+ if (UNLIKELY(!dispatch.CmdFillBuffer)) {
+ ALOGE("missing device proc: %s", "vkCmdFillBuffer");
+ success = false;
+ }
+ dispatch.CmdClearColorImage = reinterpret_cast<PFN_vkCmdClearColorImage>(get_proc_addr(device, "vkCmdClearColorImage"));
+ if (UNLIKELY(!dispatch.CmdClearColorImage)) {
+ ALOGE("missing device proc: %s", "vkCmdClearColorImage");
+ success = false;
+ }
+ dispatch.CmdClearDepthStencilImage = reinterpret_cast<PFN_vkCmdClearDepthStencilImage>(get_proc_addr(device, "vkCmdClearDepthStencilImage"));
+ if (UNLIKELY(!dispatch.CmdClearDepthStencilImage)) {
+ ALOGE("missing device proc: %s", "vkCmdClearDepthStencilImage");
+ success = false;
+ }
+ dispatch.CmdClearAttachments = reinterpret_cast<PFN_vkCmdClearAttachments>(get_proc_addr(device, "vkCmdClearAttachments"));
+ if (UNLIKELY(!dispatch.CmdClearAttachments)) {
+ ALOGE("missing device proc: %s", "vkCmdClearAttachments");
+ success = false;
+ }
+ dispatch.CmdResolveImage = reinterpret_cast<PFN_vkCmdResolveImage>(get_proc_addr(device, "vkCmdResolveImage"));
+ if (UNLIKELY(!dispatch.CmdResolveImage)) {
+ ALOGE("missing device proc: %s", "vkCmdResolveImage");
+ success = false;
+ }
+ dispatch.CmdSetEvent = reinterpret_cast<PFN_vkCmdSetEvent>(get_proc_addr(device, "vkCmdSetEvent"));
+ if (UNLIKELY(!dispatch.CmdSetEvent)) {
+ ALOGE("missing device proc: %s", "vkCmdSetEvent");
+ success = false;
+ }
+ dispatch.CmdResetEvent = reinterpret_cast<PFN_vkCmdResetEvent>(get_proc_addr(device, "vkCmdResetEvent"));
+ if (UNLIKELY(!dispatch.CmdResetEvent)) {
+ ALOGE("missing device proc: %s", "vkCmdResetEvent");
+ success = false;
+ }
+ dispatch.CmdWaitEvents = reinterpret_cast<PFN_vkCmdWaitEvents>(get_proc_addr(device, "vkCmdWaitEvents"));
+ if (UNLIKELY(!dispatch.CmdWaitEvents)) {
+ ALOGE("missing device proc: %s", "vkCmdWaitEvents");
+ success = false;
+ }
+ dispatch.CmdPipelineBarrier = reinterpret_cast<PFN_vkCmdPipelineBarrier>(get_proc_addr(device, "vkCmdPipelineBarrier"));
+ if (UNLIKELY(!dispatch.CmdPipelineBarrier)) {
+ ALOGE("missing device proc: %s", "vkCmdPipelineBarrier");
+ success = false;
+ }
+ dispatch.CmdBeginQuery = reinterpret_cast<PFN_vkCmdBeginQuery>(get_proc_addr(device, "vkCmdBeginQuery"));
+ if (UNLIKELY(!dispatch.CmdBeginQuery)) {
+ ALOGE("missing device proc: %s", "vkCmdBeginQuery");
+ success = false;
+ }
+ dispatch.CmdEndQuery = reinterpret_cast<PFN_vkCmdEndQuery>(get_proc_addr(device, "vkCmdEndQuery"));
+ if (UNLIKELY(!dispatch.CmdEndQuery)) {
+ ALOGE("missing device proc: %s", "vkCmdEndQuery");
+ success = false;
+ }
+ dispatch.CmdResetQueryPool = reinterpret_cast<PFN_vkCmdResetQueryPool>(get_proc_addr(device, "vkCmdResetQueryPool"));
+ if (UNLIKELY(!dispatch.CmdResetQueryPool)) {
+ ALOGE("missing device proc: %s", "vkCmdResetQueryPool");
+ success = false;
+ }
+ dispatch.CmdWriteTimestamp = reinterpret_cast<PFN_vkCmdWriteTimestamp>(get_proc_addr(device, "vkCmdWriteTimestamp"));
+ if (UNLIKELY(!dispatch.CmdWriteTimestamp)) {
+ ALOGE("missing device proc: %s", "vkCmdWriteTimestamp");
+ success = false;
+ }
+ dispatch.CmdCopyQueryPoolResults = reinterpret_cast<PFN_vkCmdCopyQueryPoolResults>(get_proc_addr(device, "vkCmdCopyQueryPoolResults"));
+ if (UNLIKELY(!dispatch.CmdCopyQueryPoolResults)) {
+ ALOGE("missing device proc: %s", "vkCmdCopyQueryPoolResults");
+ success = false;
+ }
+ dispatch.CmdPushConstants = reinterpret_cast<PFN_vkCmdPushConstants>(get_proc_addr(device, "vkCmdPushConstants"));
+ if (UNLIKELY(!dispatch.CmdPushConstants)) {
+ ALOGE("missing device proc: %s", "vkCmdPushConstants");
+ success = false;
+ }
+ dispatch.CmdBeginRenderPass = reinterpret_cast<PFN_vkCmdBeginRenderPass>(get_proc_addr(device, "vkCmdBeginRenderPass"));
+ if (UNLIKELY(!dispatch.CmdBeginRenderPass)) {
+ ALOGE("missing device proc: %s", "vkCmdBeginRenderPass");
+ success = false;
+ }
+ dispatch.CmdNextSubpass = reinterpret_cast<PFN_vkCmdNextSubpass>(get_proc_addr(device, "vkCmdNextSubpass"));
+ if (UNLIKELY(!dispatch.CmdNextSubpass)) {
+ ALOGE("missing device proc: %s", "vkCmdNextSubpass");
+ success = false;
+ }
+ dispatch.CmdEndRenderPass = reinterpret_cast<PFN_vkCmdEndRenderPass>(get_proc_addr(device, "vkCmdEndRenderPass"));
+ if (UNLIKELY(!dispatch.CmdEndRenderPass)) {
+ ALOGE("missing device proc: %s", "vkCmdEndRenderPass");
+ success = false;
+ }
+ dispatch.CmdExecuteCommands = reinterpret_cast<PFN_vkCmdExecuteCommands>(get_proc_addr(device, "vkCmdExecuteCommands"));
+ if (UNLIKELY(!dispatch.CmdExecuteCommands)) {
+ ALOGE("missing device proc: %s", "vkCmdExecuteCommands");
+ success = false;
+ }
+ dispatch.CreateSwapchainKHR = reinterpret_cast<PFN_vkCreateSwapchainKHR>(get_proc_addr(device, "vkCreateSwapchainKHR"));
+ if (UNLIKELY(!dispatch.CreateSwapchainKHR)) {
+ ALOGE("missing device proc: %s", "vkCreateSwapchainKHR");
+ success = false;
+ }
+ dispatch.DestroySwapchainKHR = reinterpret_cast<PFN_vkDestroySwapchainKHR>(get_proc_addr(device, "vkDestroySwapchainKHR"));
+ if (UNLIKELY(!dispatch.DestroySwapchainKHR)) {
+ ALOGE("missing device proc: %s", "vkDestroySwapchainKHR");
+ success = false;
+ }
+ dispatch.GetSwapchainImagesKHR = reinterpret_cast<PFN_vkGetSwapchainImagesKHR>(get_proc_addr(device, "vkGetSwapchainImagesKHR"));
+ if (UNLIKELY(!dispatch.GetSwapchainImagesKHR)) {
+ ALOGE("missing device proc: %s", "vkGetSwapchainImagesKHR");
+ success = false;
+ }
+ dispatch.AcquireNextImageKHR = reinterpret_cast<PFN_vkAcquireNextImageKHR>(get_proc_addr(device, "vkAcquireNextImageKHR"));
+ if (UNLIKELY(!dispatch.AcquireNextImageKHR)) {
+ ALOGE("missing device proc: %s", "vkAcquireNextImageKHR");
+ success = false;
+ }
+ dispatch.QueuePresentKHR = reinterpret_cast<PFN_vkQueuePresentKHR>(get_proc_addr(device, "vkQueuePresentKHR"));
+ if (UNLIKELY(!dispatch.QueuePresentKHR)) {
+ ALOGE("missing device proc: %s", "vkQueuePresentKHR");
+ success = false;
+ }
+ // clang-format on
+ return success;
+}
+
+bool LoadDriverDispatchTable(VkInstance instance,
+ PFN_vkGetInstanceProcAddr get_proc_addr,
+ DriverDispatchTable& dispatch) {
+ bool success = true;
+ // clang-format off
+ dispatch.DestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(get_proc_addr(instance, "vkDestroyInstance"));
+ if (UNLIKELY(!dispatch.DestroyInstance)) {
+ ALOGE("missing driver proc: %s", "vkDestroyInstance");
+ success = false;
+ }
+ dispatch.EnumeratePhysicalDevices = reinterpret_cast<PFN_vkEnumeratePhysicalDevices>(get_proc_addr(instance, "vkEnumeratePhysicalDevices"));
+ if (UNLIKELY(!dispatch.EnumeratePhysicalDevices)) {
+ ALOGE("missing driver proc: %s", "vkEnumeratePhysicalDevices");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceProperties)) {
+ ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceQueueFamilyProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceQueueFamilyProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceQueueFamilyProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceQueueFamilyProperties)) {
+ ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceQueueFamilyProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceMemoryProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceMemoryProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceMemoryProperties)) {
+ ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceMemoryProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceFeatures = reinterpret_cast<PFN_vkGetPhysicalDeviceFeatures>(get_proc_addr(instance, "vkGetPhysicalDeviceFeatures"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceFeatures)) {
+ ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceFeatures");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceFormatProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceFormatProperties)) {
+ ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceFormatProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceImageFormatProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceImageFormatProperties)) {
+ ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceImageFormatProperties");
+ success = false;
+ }
+ dispatch.CreateDevice = reinterpret_cast<PFN_vkCreateDevice>(get_proc_addr(instance, "vkCreateDevice"));
+ if (UNLIKELY(!dispatch.CreateDevice)) {
+ ALOGE("missing driver proc: %s", "vkCreateDevice");
+ success = false;
+ }
+ dispatch.EnumerateDeviceLayerProperties = reinterpret_cast<PFN_vkEnumerateDeviceLayerProperties>(get_proc_addr(instance, "vkEnumerateDeviceLayerProperties"));
+ if (UNLIKELY(!dispatch.EnumerateDeviceLayerProperties)) {
+ ALOGE("missing driver proc: %s", "vkEnumerateDeviceLayerProperties");
+ success = false;
+ }
+ dispatch.EnumerateDeviceExtensionProperties = reinterpret_cast<PFN_vkEnumerateDeviceExtensionProperties>(get_proc_addr(instance, "vkEnumerateDeviceExtensionProperties"));
+ if (UNLIKELY(!dispatch.EnumerateDeviceExtensionProperties)) {
+ ALOGE("missing driver proc: %s", "vkEnumerateDeviceExtensionProperties");
+ success = false;
+ }
+ dispatch.GetPhysicalDeviceSparseImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties"));
+ if (UNLIKELY(!dispatch.GetPhysicalDeviceSparseImageFormatProperties)) {
+ ALOGE("missing driver proc: %s", "vkGetPhysicalDeviceSparseImageFormatProperties");
+ success = false;
+ }
+ dispatch.GetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(get_proc_addr(instance, "vkGetDeviceProcAddr"));
+ if (UNLIKELY(!dispatch.GetDeviceProcAddr)) {
+ ALOGE("missing driver proc: %s", "vkGetDeviceProcAddr");
+ success = false;
+ }
+ dispatch.CreateImage = reinterpret_cast<PFN_vkCreateImage>(get_proc_addr(instance, "vkCreateImage"));
+ if (UNLIKELY(!dispatch.CreateImage)) {
+ ALOGE("missing driver proc: %s", "vkCreateImage");
+ success = false;
+ }
+ dispatch.DestroyImage = reinterpret_cast<PFN_vkDestroyImage>(get_proc_addr(instance, "vkDestroyImage"));
+ if (UNLIKELY(!dispatch.DestroyImage)) {
+ ALOGE("missing driver proc: %s", "vkDestroyImage");
+ success = false;
+ }
+ dispatch.AcquireImageANDROID = reinterpret_cast<PFN_vkAcquireImageANDROID>(get_proc_addr(instance, "vkAcquireImageANDROID"));
+ if (UNLIKELY(!dispatch.AcquireImageANDROID)) {
+ ALOGE("missing driver proc: %s", "vkAcquireImageANDROID");
+ success = false;
+ }
+ dispatch.QueueSignalReleaseImageANDROID = reinterpret_cast<PFN_vkQueueSignalReleaseImageANDROID>(get_proc_addr(instance, "vkQueueSignalReleaseImageANDROID"));
+ if (UNLIKELY(!dispatch.QueueSignalReleaseImageANDROID)) {
+ ALOGE("missing driver proc: %s", "vkQueueSignalReleaseImageANDROID");
+ success = false;
+ }
+ // clang-format on
+ return success;
+}
+
+} // namespace vulkan
+
+// clang-format off
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) {
+ return CreateInstance_Top(pCreateInfo, pAllocator, pInstance);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) {
+ DestroyInstance_Top(instance, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) {
+ return GetDispatchTable(instance).EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice device, const char* pName) {
+ return GetDeviceProcAddr_Top(device, pName);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* pName) {
+ return GetInstanceProcAddr_Top(instance, pName);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties) {
+ GetDispatchTable(physicalDevice).GetPhysicalDeviceProperties(physicalDevice, pProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties) {
+ GetDispatchTable(physicalDevice).GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
+ GetDispatchTable(physicalDevice).GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
+ GetDispatchTable(physicalDevice).GetPhysicalDeviceFeatures(physicalDevice, pFeatures);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
+ GetDispatchTable(physicalDevice).GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
+ return GetDispatchTable(physicalDevice).GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) {
+ return GetDispatchTable(physicalDevice).CreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) {
+ DestroyDevice_Top(device, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties) {
+ return EnumerateInstanceLayerProperties_Top(pPropertyCount, pProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) {
+ return EnumerateInstanceExtensionProperties_Top(pLayerName, pPropertyCount, pProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties) {
+ return GetDispatchTable(physicalDevice).EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount, pProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) {
+ return GetDispatchTable(physicalDevice).EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) {
+ GetDeviceQueue_Top(device, queueFamilyIndex, queueIndex, pQueue);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) {
+ return GetDispatchTable(queue).QueueSubmit(queue, submitCount, pSubmits, fence);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkQueueWaitIdle(VkQueue queue) {
+ return GetDispatchTable(queue).QueueWaitIdle(queue);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkDeviceWaitIdle(VkDevice device) {
+ return GetDispatchTable(device).DeviceWaitIdle(device);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) {
+ return GetDispatchTable(device).AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).FreeMemory(device, memory, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData) {
+ return GetDispatchTable(device).MapMemory(device, memory, offset, size, flags, ppData);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkUnmapMemory(VkDevice device, VkDeviceMemory memory) {
+ GetDispatchTable(device).UnmapMemory(device, memory);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
+ return GetDispatchTable(device).FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
+ return GetDispatchTable(device).InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
+ GetDispatchTable(device).GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements) {
+ GetDispatchTable(device).GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
+ return GetDispatchTable(device).BindBufferMemory(device, buffer, memory, memoryOffset);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements) {
+ GetDispatchTable(device).GetImageMemoryRequirements(device, image, pMemoryRequirements);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
+ return GetDispatchTable(device).BindImageMemory(device, image, memory, memoryOffset);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
+ GetDispatchTable(device).GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) {
+ GetDispatchTable(physicalDevice).GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
+ return GetDispatchTable(queue).QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) {
+ return GetDispatchTable(device).CreateFence(device, pCreateInfo, pAllocator, pFence);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyFence(device, fence, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
+ return GetDispatchTable(device).ResetFences(device, fenceCount, pFences);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetFenceStatus(VkDevice device, VkFence fence) {
+ return GetDispatchTable(device).GetFenceStatus(device, fence);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
+ return GetDispatchTable(device).WaitForFences(device, fenceCount, pFences, waitAll, timeout);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) {
+ return GetDispatchTable(device).CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroySemaphore(device, semaphore, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent) {
+ return GetDispatchTable(device).CreateEvent(device, pCreateInfo, pAllocator, pEvent);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyEvent(device, event, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetEventStatus(VkDevice device, VkEvent event) {
+ return GetDispatchTable(device).GetEventStatus(device, event);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkSetEvent(VkDevice device, VkEvent event) {
+ return GetDispatchTable(device).SetEvent(device, event);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkResetEvent(VkDevice device, VkEvent event) {
+ return GetDispatchTable(device).ResetEvent(device, event);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool) {
+ return GetDispatchTable(device).CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyQueryPool(device, queryPool, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) {
+ return GetDispatchTable(device).GetQueryPoolResults(device, queryPool, startQuery, queryCount, dataSize, pData, stride, flags);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer) {
+ return GetDispatchTable(device).CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyBuffer(device, buffer, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView) {
+ return GetDispatchTable(device).CreateBufferView(device, pCreateInfo, pAllocator, pView);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyBufferView(device, bufferView, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage) {
+ return GetDispatchTable(device).CreateImage(device, pCreateInfo, pAllocator, pImage);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyImage(device, image, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
+ GetDispatchTable(device).GetImageSubresourceLayout(device, image, pSubresource, pLayout);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView) {
+ return GetDispatchTable(device).CreateImageView(device, pCreateInfo, pAllocator, pView);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyImageView(device, imageView, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule) {
+ return GetDispatchTable(device).CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyShaderModule(device, shaderModule, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache) {
+ return GetDispatchTable(device).CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyPipelineCache(device, pipelineCache, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
+ return GetDispatchTable(device).GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
+ return GetDispatchTable(device).MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
+ return GetDispatchTable(device).CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
+ return GetDispatchTable(device).CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyPipeline(device, pipeline, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout) {
+ return GetDispatchTable(device).CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyPipelineLayout(device, pipelineLayout, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler) {
+ return GetDispatchTable(device).CreateSampler(device, pCreateInfo, pAllocator, pSampler);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroySampler(device, sampler, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout) {
+ return GetDispatchTable(device).CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool) {
+ return GetDispatchTable(device).CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyDescriptorPool(device, descriptorPool, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
+ return GetDispatchTable(device).ResetDescriptorPool(device, descriptorPool, flags);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets) {
+ return GetDispatchTable(device).AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets) {
+ return GetDispatchTable(device).FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
+ GetDispatchTable(device).UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer) {
+ return GetDispatchTable(device).CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyFramebuffer(device, framebuffer, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) {
+ return GetDispatchTable(device).CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyRenderPass(device, renderPass, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
+ GetDispatchTable(device).GetRenderAreaGranularity(device, renderPass, pGranularity);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) {
+ return GetDispatchTable(device).CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroyCommandPool(device, commandPool, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) {
+ return GetDispatchTable(device).ResetCommandPool(device, commandPool, flags);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers) {
+ return AllocateCommandBuffers_Top(device, pAllocateInfo, pCommandBuffers);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) {
+ GetDispatchTable(device).FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
+ return GetDispatchTable(commandBuffer).BeginCommandBuffer(commandBuffer, pBeginInfo);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
+ return GetDispatchTable(commandBuffer).EndCommandBuffer(commandBuffer);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) {
+ return GetDispatchTable(commandBuffer).ResetCommandBuffer(commandBuffer, flags);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
+ GetDispatchTable(commandBuffer).CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports) {
+ GetDispatchTable(commandBuffer).CmdSetViewport(commandBuffer, viewportCount, pViewports);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors) {
+ GetDispatchTable(commandBuffer).CmdSetScissor(commandBuffer, scissorCount, pScissors);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
+ GetDispatchTable(commandBuffer).CmdSetLineWidth(commandBuffer, lineWidth);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) {
+ GetDispatchTable(commandBuffer).CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) {
+ GetDispatchTable(commandBuffer).CmdSetBlendConstants(commandBuffer, blendConstants);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) {
+ GetDispatchTable(commandBuffer).CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) {
+ GetDispatchTable(commandBuffer).CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) {
+ GetDispatchTable(commandBuffer).CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) {
+ GetDispatchTable(commandBuffer).CmdSetStencilReference(commandBuffer, faceMask, reference);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
+ GetDispatchTable(commandBuffer).CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
+ GetDispatchTable(commandBuffer).CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
+ GetDispatchTable(commandBuffer).CmdBindVertexBuffers(commandBuffer, startBinding, bindingCount, pBuffers, pOffsets);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
+ GetDispatchTable(commandBuffer).CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
+ GetDispatchTable(commandBuffer).CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
+ GetDispatchTable(commandBuffer).CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
+ GetDispatchTable(commandBuffer).CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) {
+ GetDispatchTable(commandBuffer).CmdDispatch(commandBuffer, x, y, z);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) {
+ GetDispatchTable(commandBuffer).CmdDispatchIndirect(commandBuffer, buffer, offset);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
+ GetDispatchTable(commandBuffer).CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
+ GetDispatchTable(commandBuffer).CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) {
+ GetDispatchTable(commandBuffer).CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
+ GetDispatchTable(commandBuffer).CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
+ GetDispatchTable(commandBuffer).CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData) {
+ GetDispatchTable(commandBuffer).CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
+ GetDispatchTable(commandBuffer).CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
+ GetDispatchTable(commandBuffer).CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
+ GetDispatchTable(commandBuffer).CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
+ GetDispatchTable(commandBuffer).CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
+ GetDispatchTable(commandBuffer).CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
+ GetDispatchTable(commandBuffer).CmdSetEvent(commandBuffer, event, stageMask);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
+ GetDispatchTable(commandBuffer).CmdResetEvent(commandBuffer, event, stageMask);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers) {
+ GetDispatchTable(commandBuffer).CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, ppMemoryBarriers);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers) {
+ GetDispatchTable(commandBuffer).CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, ppMemoryBarriers);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t entry, VkQueryControlFlags flags) {
+ GetDispatchTable(commandBuffer).CmdBeginQuery(commandBuffer, queryPool, entry, flags);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t entry) {
+ GetDispatchTable(commandBuffer).CmdEndQuery(commandBuffer, queryPool, entry);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
+ GetDispatchTable(commandBuffer).CmdResetQueryPool(commandBuffer, queryPool, startQuery, queryCount);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t entry) {
+ GetDispatchTable(commandBuffer).CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, entry);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) {
+ GetDispatchTable(commandBuffer).CmdCopyQueryPoolResults(commandBuffer, queryPool, startQuery, queryCount, dstBuffer, dstOffset, stride, flags);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues) {
+ GetDispatchTable(commandBuffer).CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
+ GetDispatchTable(commandBuffer).CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
+ GetDispatchTable(commandBuffer).CmdNextSubpass(commandBuffer, contents);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
+ GetDispatchTable(commandBuffer).CmdEndRenderPass(commandBuffer);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount, const VkCommandBuffer* pCommandBuffers) {
+ GetDispatchTable(commandBuffer).CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(instance).DestroySurfaceKHR(instance, surface, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported) {
+ return GetDispatchTable(physicalDevice).GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
+ return GetDispatchTable(physicalDevice).GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats) {
+ return GetDispatchTable(physicalDevice).GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes) {
+ return GetDispatchTable(physicalDevice).GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) {
+ return GetDispatchTable(device).CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) {
+ GetDispatchTable(device).DestroySwapchainKHR(device, swapchain, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) {
+ return GetDispatchTable(device).GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex) {
+ return GetDispatchTable(device).AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) {
+ return GetDispatchTable(queue).QueuePresentKHR(queue, pPresentInfo);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateAndroidSurfaceKHR(VkInstance instance, struct ANativeWindow* window, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
+ return GetDispatchTable(instance).CreateAndroidSurfaceKHR(instance, window, pAllocator, pSurface);
+}
+
+// clang-format on
--- /dev/null
+/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define VK_PROTOTYPES
+#define VK_USE_PLATFORM_ANDROID_KHR
+#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vulkan.h>
+
+namespace vulkan {
+
+struct InstanceDispatchTable {
+ // clang-format off
+ PFN_vkDestroyInstance DestroyInstance;
+ PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
+ PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
+ PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
+ PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
+ PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
+ PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
+ PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
+ PFN_vkCreateDevice CreateDevice;
+ PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
+ PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
+ PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
+ PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
+ PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
+ PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
+ PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
+ PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
+ PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
+ // clang-format on
+};
+
+struct DeviceDispatchTable {
+ // clang-format off
+ PFN_vkDestroyDevice DestroyDevice;
+ PFN_vkGetDeviceQueue GetDeviceQueue;
+ PFN_vkQueueSubmit QueueSubmit;
+ PFN_vkQueueWaitIdle QueueWaitIdle;
+ PFN_vkDeviceWaitIdle DeviceWaitIdle;
+ PFN_vkAllocateMemory AllocateMemory;
+ PFN_vkFreeMemory FreeMemory;
+ PFN_vkMapMemory MapMemory;
+ PFN_vkUnmapMemory UnmapMemory;
+ PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
+ PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
+ PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
+ PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
+ PFN_vkBindBufferMemory BindBufferMemory;
+ PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
+ PFN_vkBindImageMemory BindImageMemory;
+ PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
+ PFN_vkQueueBindSparse QueueBindSparse;
+ PFN_vkCreateFence CreateFence;
+ PFN_vkDestroyFence DestroyFence;
+ PFN_vkResetFences ResetFences;
+ PFN_vkGetFenceStatus GetFenceStatus;
+ PFN_vkWaitForFences WaitForFences;
+ PFN_vkCreateSemaphore CreateSemaphore;
+ PFN_vkDestroySemaphore DestroySemaphore;
+ PFN_vkCreateEvent CreateEvent;
+ PFN_vkDestroyEvent DestroyEvent;
+ PFN_vkGetEventStatus GetEventStatus;
+ PFN_vkSetEvent SetEvent;
+ PFN_vkResetEvent ResetEvent;
+ PFN_vkCreateQueryPool CreateQueryPool;
+ PFN_vkDestroyQueryPool DestroyQueryPool;
+ PFN_vkGetQueryPoolResults GetQueryPoolResults;
+ PFN_vkCreateBuffer CreateBuffer;
+ PFN_vkDestroyBuffer DestroyBuffer;
+ PFN_vkCreateBufferView CreateBufferView;
+ PFN_vkDestroyBufferView DestroyBufferView;
+ PFN_vkCreateImage CreateImage;
+ PFN_vkDestroyImage DestroyImage;
+ PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
+ PFN_vkCreateImageView CreateImageView;
+ PFN_vkDestroyImageView DestroyImageView;
+ PFN_vkCreateShaderModule CreateShaderModule;
+ PFN_vkDestroyShaderModule DestroyShaderModule;
+ PFN_vkCreatePipelineCache CreatePipelineCache;
+ PFN_vkDestroyPipelineCache DestroyPipelineCache;
+ PFN_vkGetPipelineCacheData GetPipelineCacheData;
+ PFN_vkMergePipelineCaches MergePipelineCaches;
+ PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
+ PFN_vkCreateComputePipelines CreateComputePipelines;
+ PFN_vkDestroyPipeline DestroyPipeline;
+ PFN_vkCreatePipelineLayout CreatePipelineLayout;
+ PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
+ PFN_vkCreateSampler CreateSampler;
+ PFN_vkDestroySampler DestroySampler;
+ PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
+ PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
+ PFN_vkCreateDescriptorPool CreateDescriptorPool;
+ PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
+ PFN_vkResetDescriptorPool ResetDescriptorPool;
+ PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
+ PFN_vkFreeDescriptorSets FreeDescriptorSets;
+ PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
+ PFN_vkCreateFramebuffer CreateFramebuffer;
+ PFN_vkDestroyFramebuffer DestroyFramebuffer;
+ PFN_vkCreateRenderPass CreateRenderPass;
+ PFN_vkDestroyRenderPass DestroyRenderPass;
+ PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
+ PFN_vkCreateCommandPool CreateCommandPool;
+ PFN_vkDestroyCommandPool DestroyCommandPool;
+ PFN_vkResetCommandPool ResetCommandPool;
+ PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
+ PFN_vkFreeCommandBuffers FreeCommandBuffers;
+ PFN_vkBeginCommandBuffer BeginCommandBuffer;
+ PFN_vkEndCommandBuffer EndCommandBuffer;
+ PFN_vkResetCommandBuffer ResetCommandBuffer;
+ PFN_vkCmdBindPipeline CmdBindPipeline;
+ PFN_vkCmdSetViewport CmdSetViewport;
+ PFN_vkCmdSetScissor CmdSetScissor;
+ PFN_vkCmdSetLineWidth CmdSetLineWidth;
+ PFN_vkCmdSetDepthBias CmdSetDepthBias;
+ PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
+ PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
+ PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
+ PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
+ PFN_vkCmdSetStencilReference CmdSetStencilReference;
+ PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
+ PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
+ PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
+ PFN_vkCmdDraw CmdDraw;
+ PFN_vkCmdDrawIndexed CmdDrawIndexed;
+ PFN_vkCmdDrawIndirect CmdDrawIndirect;
+ PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
+ PFN_vkCmdDispatch CmdDispatch;
+ PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
+ PFN_vkCmdCopyBuffer CmdCopyBuffer;
+ PFN_vkCmdCopyImage CmdCopyImage;
+ PFN_vkCmdBlitImage CmdBlitImage;
+ PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
+ PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
+ PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
+ PFN_vkCmdFillBuffer CmdFillBuffer;
+ PFN_vkCmdClearColorImage CmdClearColorImage;
+ PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
+ PFN_vkCmdClearAttachments CmdClearAttachments;
+ PFN_vkCmdResolveImage CmdResolveImage;
+ PFN_vkCmdSetEvent CmdSetEvent;
+ PFN_vkCmdResetEvent CmdResetEvent;
+ PFN_vkCmdWaitEvents CmdWaitEvents;
+ PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
+ PFN_vkCmdBeginQuery CmdBeginQuery;
+ PFN_vkCmdEndQuery CmdEndQuery;
+ PFN_vkCmdResetQueryPool CmdResetQueryPool;
+ PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
+ PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
+ PFN_vkCmdPushConstants CmdPushConstants;
+ PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
+ PFN_vkCmdNextSubpass CmdNextSubpass;
+ PFN_vkCmdEndRenderPass CmdEndRenderPass;
+ PFN_vkCmdExecuteCommands CmdExecuteCommands;
+ PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
+ PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
+ PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
+ PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
+ PFN_vkQueuePresentKHR QueuePresentKHR;
+ // clang-format on
+};
+
+struct DriverDispatchTable {
+ // clang-format off
+ PFN_vkDestroyInstance DestroyInstance;
+ PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
+ PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
+ PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
+ PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
+ PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
+ PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
+ PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
+ PFN_vkCreateDevice CreateDevice;
+ PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
+ PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
+ PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
+ PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
+ PFN_vkCreateImage CreateImage;
+ PFN_vkDestroyImage DestroyImage;
+ PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
+ PFN_vkAcquireImageANDROID AcquireImageANDROID;
+ PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
+ // clang-format on
+};
+
+} // namespace vulkan
+++ /dev/null
-/*
-* Copyright 2015 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// This file is generated. Do not edit manually!
-// To regenerate: $ apic template ../api/vulkan.api entry.cpp.tmpl
-// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
-
-#include "loader.h"
-using namespace vulkan;
-
-// clang-format off
-
-namespace {
- inline const InstanceVtbl& GetVtbl(VkInstance instance) {
- return **reinterpret_cast<InstanceVtbl**>(instance);
- }
- inline const InstanceVtbl& GetVtbl(VkPhysicalDevice physicalDevice) {
- return **reinterpret_cast<InstanceVtbl**>(physicalDevice);
- }
- inline const DeviceVtbl& GetVtbl(VkDevice device) {
- return **reinterpret_cast<DeviceVtbl**>(device);
- }
- inline const DeviceVtbl& GetVtbl(VkQueue queue) {
- return **reinterpret_cast<DeviceVtbl**>(queue);
- }
- inline const DeviceVtbl& GetVtbl(VkCommandBuffer commandBuffer) {
- return **reinterpret_cast<DeviceVtbl**>(commandBuffer);
- }
-} // namespace
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) {
- return vulkan::CreateInstance(pCreateInfo, pAllocator, pInstance);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(instance).DestroyInstance(instance, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) {
- return GetVtbl(instance).EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice device, const char* pName) {
- return vulkan::GetDeviceProcAddr(device, pName);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* pName) {
- return vulkan::GetInstanceProcAddr(instance, pName);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties) {
- GetVtbl(physicalDevice).GetPhysicalDeviceProperties(physicalDevice, pProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties) {
- GetVtbl(physicalDevice).GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
- GetVtbl(physicalDevice).GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
- GetVtbl(physicalDevice).GetPhysicalDeviceFeatures(physicalDevice, pFeatures);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
- GetVtbl(physicalDevice).GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
- return GetVtbl(physicalDevice).GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) {
- return GetVtbl(physicalDevice).CreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) {
- vulkan::DestroyDevice(device, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties) {
- return vulkan::EnumerateInstanceLayerProperties(pPropertyCount, pProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) {
- return vulkan::EnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties) {
- return GetVtbl(physicalDevice).EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount, pProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) {
- return GetVtbl(physicalDevice).EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) {
- vulkan::GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) {
- return GetVtbl(queue).QueueSubmit(queue, submitCount, pSubmits, fence);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkQueueWaitIdle(VkQueue queue) {
- return GetVtbl(queue).QueueWaitIdle(queue);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkDeviceWaitIdle(VkDevice device) {
- return GetVtbl(device).DeviceWaitIdle(device);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) {
- return GetVtbl(device).AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).FreeMemory(device, memory, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData) {
- return GetVtbl(device).MapMemory(device, memory, offset, size, flags, ppData);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkUnmapMemory(VkDevice device, VkDeviceMemory memory) {
- GetVtbl(device).UnmapMemory(device, memory);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
- return GetVtbl(device).FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
- return GetVtbl(device).InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
- GetVtbl(device).GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements) {
- GetVtbl(device).GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
- return GetVtbl(device).BindBufferMemory(device, buffer, memory, memoryOffset);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements) {
- GetVtbl(device).GetImageMemoryRequirements(device, image, pMemoryRequirements);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
- return GetVtbl(device).BindImageMemory(device, image, memory, memoryOffset);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
- GetVtbl(device).GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) {
- GetVtbl(physicalDevice).GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
- return GetVtbl(queue).QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) {
- return GetVtbl(device).CreateFence(device, pCreateInfo, pAllocator, pFence);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyFence(device, fence, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
- return GetVtbl(device).ResetFences(device, fenceCount, pFences);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetFenceStatus(VkDevice device, VkFence fence) {
- return GetVtbl(device).GetFenceStatus(device, fence);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
- return GetVtbl(device).WaitForFences(device, fenceCount, pFences, waitAll, timeout);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) {
- return GetVtbl(device).CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroySemaphore(device, semaphore, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent) {
- return GetVtbl(device).CreateEvent(device, pCreateInfo, pAllocator, pEvent);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyEvent(device, event, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetEventStatus(VkDevice device, VkEvent event) {
- return GetVtbl(device).GetEventStatus(device, event);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkSetEvent(VkDevice device, VkEvent event) {
- return GetVtbl(device).SetEvent(device, event);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkResetEvent(VkDevice device, VkEvent event) {
- return GetVtbl(device).ResetEvent(device, event);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool) {
- return GetVtbl(device).CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyQueryPool(device, queryPool, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) {
- return GetVtbl(device).GetQueryPoolResults(device, queryPool, startQuery, queryCount, dataSize, pData, stride, flags);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer) {
- return GetVtbl(device).CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyBuffer(device, buffer, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView) {
- return GetVtbl(device).CreateBufferView(device, pCreateInfo, pAllocator, pView);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyBufferView(device, bufferView, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage) {
- return GetVtbl(device).CreateImage(device, pCreateInfo, pAllocator, pImage);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyImage(device, image, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
- GetVtbl(device).GetImageSubresourceLayout(device, image, pSubresource, pLayout);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView) {
- return GetVtbl(device).CreateImageView(device, pCreateInfo, pAllocator, pView);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyImageView(device, imageView, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule) {
- return GetVtbl(device).CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyShaderModule(device, shaderModule, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache) {
- return GetVtbl(device).CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyPipelineCache(device, pipelineCache, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
- return GetVtbl(device).GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
- return GetVtbl(device).MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
- return GetVtbl(device).CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
- return GetVtbl(device).CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyPipeline(device, pipeline, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout) {
- return GetVtbl(device).CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyPipelineLayout(device, pipelineLayout, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler) {
- return GetVtbl(device).CreateSampler(device, pCreateInfo, pAllocator, pSampler);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroySampler(device, sampler, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout) {
- return GetVtbl(device).CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool) {
- return GetVtbl(device).CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyDescriptorPool(device, descriptorPool, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
- return GetVtbl(device).ResetDescriptorPool(device, descriptorPool, flags);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets) {
- return GetVtbl(device).AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets) {
- return GetVtbl(device).FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
- GetVtbl(device).UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer) {
- return GetVtbl(device).CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyFramebuffer(device, framebuffer, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) {
- return GetVtbl(device).CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyRenderPass(device, renderPass, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
- GetVtbl(device).GetRenderAreaGranularity(device, renderPass, pGranularity);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) {
- return GetVtbl(device).CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroyCommandPool(device, commandPool, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) {
- return GetVtbl(device).ResetCommandPool(device, commandPool, flags);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers) {
- return vulkan::AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) {
- GetVtbl(device).FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
- return GetVtbl(commandBuffer).BeginCommandBuffer(commandBuffer, pBeginInfo);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
- return GetVtbl(commandBuffer).EndCommandBuffer(commandBuffer);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) {
- return GetVtbl(commandBuffer).ResetCommandBuffer(commandBuffer, flags);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
- GetVtbl(commandBuffer).CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports) {
- GetVtbl(commandBuffer).CmdSetViewport(commandBuffer, viewportCount, pViewports);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors) {
- GetVtbl(commandBuffer).CmdSetScissor(commandBuffer, scissorCount, pScissors);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
- GetVtbl(commandBuffer).CmdSetLineWidth(commandBuffer, lineWidth);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) {
- GetVtbl(commandBuffer).CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) {
- GetVtbl(commandBuffer).CmdSetBlendConstants(commandBuffer, blendConstants);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) {
- GetVtbl(commandBuffer).CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) {
- GetVtbl(commandBuffer).CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) {
- GetVtbl(commandBuffer).CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) {
- GetVtbl(commandBuffer).CmdSetStencilReference(commandBuffer, faceMask, reference);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
- GetVtbl(commandBuffer).CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
- GetVtbl(commandBuffer).CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
- GetVtbl(commandBuffer).CmdBindVertexBuffers(commandBuffer, startBinding, bindingCount, pBuffers, pOffsets);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
- GetVtbl(commandBuffer).CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
- GetVtbl(commandBuffer).CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
- GetVtbl(commandBuffer).CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
- GetVtbl(commandBuffer).CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) {
- GetVtbl(commandBuffer).CmdDispatch(commandBuffer, x, y, z);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) {
- GetVtbl(commandBuffer).CmdDispatchIndirect(commandBuffer, buffer, offset);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
- GetVtbl(commandBuffer).CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
- GetVtbl(commandBuffer).CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) {
- GetVtbl(commandBuffer).CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
- GetVtbl(commandBuffer).CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
- GetVtbl(commandBuffer).CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData) {
- GetVtbl(commandBuffer).CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
- GetVtbl(commandBuffer).CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
- GetVtbl(commandBuffer).CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
- GetVtbl(commandBuffer).CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
- GetVtbl(commandBuffer).CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
- GetVtbl(commandBuffer).CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
- GetVtbl(commandBuffer).CmdSetEvent(commandBuffer, event, stageMask);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
- GetVtbl(commandBuffer).CmdResetEvent(commandBuffer, event, stageMask);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers) {
- GetVtbl(commandBuffer).CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, ppMemoryBarriers);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers) {
- GetVtbl(commandBuffer).CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, ppMemoryBarriers);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t entry, VkQueryControlFlags flags) {
- GetVtbl(commandBuffer).CmdBeginQuery(commandBuffer, queryPool, entry, flags);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t entry) {
- GetVtbl(commandBuffer).CmdEndQuery(commandBuffer, queryPool, entry);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
- GetVtbl(commandBuffer).CmdResetQueryPool(commandBuffer, queryPool, startQuery, queryCount);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t entry) {
- GetVtbl(commandBuffer).CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, entry);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) {
- GetVtbl(commandBuffer).CmdCopyQueryPoolResults(commandBuffer, queryPool, startQuery, queryCount, dstBuffer, dstOffset, stride, flags);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues) {
- GetVtbl(commandBuffer).CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
- GetVtbl(commandBuffer).CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
- GetVtbl(commandBuffer).CmdNextSubpass(commandBuffer, contents);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
- GetVtbl(commandBuffer).CmdEndRenderPass(commandBuffer);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount, const VkCommandBuffer* pCommandBuffers) {
- GetVtbl(commandBuffer).CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(instance).DestroySurfaceKHR(instance, surface, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported) {
- return GetVtbl(physicalDevice).GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
- return GetVtbl(physicalDevice).GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats) {
- return GetVtbl(physicalDevice).GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes) {
- return GetVtbl(physicalDevice).GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) {
- return GetVtbl(device).CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) {
- GetVtbl(device).DestroySwapchainKHR(device, swapchain, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) {
- return GetVtbl(device).GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex) {
- return GetVtbl(device).AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) {
- return GetVtbl(queue).QueuePresentKHR(queue, pPresentInfo);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateAndroidSurfaceKHR(VkInstance instance, struct ANativeWindow* window, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
- return GetVtbl(instance).CreateAndroidSurfaceKHR(instance, window, pAllocator, pSurface);
-}
+++ /dev/null
-{{/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */}}
-
-{{Include "../api/templates/vulkan_common.tmpl"}}
-{{Macro "DefineGlobals" $}}
-{{$ | Macro "entry.cpp" | Reflow 4 | Write "entry.cpp"}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Entry point
--------------------------------------------------------------------------------
-*/}}
-{{define "entry.cpp"}}
-/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-¶
-// This file is generated. Do not edit manually!
-// To regenerate: $ apic template ../api/vulkan.api entry.cpp.tmpl
-// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
-¶
-#include "loader.h"
-using namespace vulkan;
-¶
-// clang-format off
-¶
-namespace {
- inline const InstanceVtbl& GetVtbl(VkInstance instance) {
- return **reinterpret_cast<InstanceVtbl**>(instance);
- }
- inline const InstanceVtbl& GetVtbl(VkPhysicalDevice physicalDevice) {
- return **reinterpret_cast<InstanceVtbl**>(physicalDevice);
- }
- inline const DeviceVtbl& GetVtbl(VkDevice device) {
- return **reinterpret_cast<DeviceVtbl**>(device);
- }
- inline const DeviceVtbl& GetVtbl(VkQueue queue) {
- return **reinterpret_cast<DeviceVtbl**>(queue);
- }
- inline const DeviceVtbl& GetVtbl(VkCommandBuffer commandBuffer) {
- return **reinterpret_cast<DeviceVtbl**>(commandBuffer);
- }
-} // namespace
-¶
- {{range $f := AllCommands $}}
- {{if and (not (GetAnnotation $f "pfn")) (Macro "IsExportedEntry" $f)}}
- __attribute__((visibility("default")))
- {{if eq (Macro "IsSpecialEntry" $f.Name) "true"}}
- {{Macro "EmitSpecialEntry" $f}}
- {{else}}
- {{Macro "EmitEntry" $f}}
- {{end}}
- {{end}}
- {{end}}
-
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Decides whether an entrypoint should be exported from the Android Vulkan
- library. Entrypoints in the core API and in mandatory extensions are
- exported.
--------------------------------------------------------------------------------
-*/}}
-{{define "IsExportedEntry"}}
- {{AssertType $ "Function"}}
- {{$ext := GetAnnotation $ "extension"}}
- {{if $ext}}
- {{$extval := index $ext.Arguments 0}}
- {{if eq $extval "VK_KHR_surface"}}true
- {{else if eq $extval "VK_KHR_swapchain"}}true
- {{else if eq $extval "VK_KHR_android_surface"}}true{{end}}
- {{else}}true{{end}}
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Decides whether an entrypoint needs special-case handling. Emits the string
- "true" if so, nothing otherwise.
--------------------------------------------------------------------------------
-*/}}
-{{define "IsSpecialEntry"}}
- {{/* TODO: figure out how to do this in a cleaner or at least multi-line way */}}
- {{if or (eq $ "vkGetInstanceProcAddr") (or (eq $ "vkGetDeviceProcAddr") (or (eq $ "vkGetDeviceQueue") (or (eq $ "vkAllocateCommandBuffers") (eq $ "vkDestroyDevice"))))}}
- true
- {{end}}
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Emits the entrypoint definition for the specified command, which always
- dispatches statically because the function requires special-case handling.
--------------------------------------------------------------------------------
-*/}}
-{{define "EmitSpecialEntry"}}
- {{AssertType $ "Function"}}
-
- VKAPI_ATTR {{Node "Type" $.Return}} {{Macro "FunctionName" $}}({{Macro "Parameters" $}}) {
- {{if not (IsVoid $.Return.Type)}}return §{{end}}
- vulkan::{{TrimPrefix "vk" $.Name}}({{Macro "Arguments" $}});
- }
- ¶
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Emits the entrypoint definition for the specified command. If the first
- parameter is a handle to dispatchable object, it dispatches the call through
- the object's function table. Otherwise, it dispatches statically.
--------------------------------------------------------------------------------
-*/}}
-{{define "EmitEntry"}}
- {{AssertType $ "Function"}}
-
- VKAPI_ATTR {{Node "Type" $.Return}} {{Macro "FunctionName" $}}({{Macro "Parameters" $}}) {
- {{if not (IsVoid $.Return.Type)}}return §{{end}}
- {{Macro "Dispatch" $}}{{TrimPrefix "vk" $.Name}}({{Macro "Arguments" $}});
- }
- ¶
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Emit the dispatch lookup for a function based on its first parameter.
--------------------------------------------------------------------------------
-*/}}
-{{define "Dispatch#VkInstance" }}GetVtbl({{$.Node.Name}}).{{end}}
-{{define "Dispatch#VkPhysicalDevice"}}GetVtbl({{$.Node.Name}}).{{end}}
-{{define "Dispatch#VkDevice" }}GetVtbl({{$.Node.Name}}).{{end}}
-{{define "Dispatch#VkQueue" }}GetVtbl({{$.Node.Name}}).{{end}}
-{{define "Dispatch#VkCommandBuffer" }}GetVtbl({{$.Node.Name}}).{{end}}
-{{define "Dispatch_Default" }}vulkan::{{end}}
-{{define "Dispatch"}}
- {{AssertType $ "Function"}}
-
- {{range $i, $p := $.CallParameters}}
- {{if not $i}}{{Node "Dispatch" $p}}{{end}}
- {{end}}
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Emits a comma-separated list of C parameter names for the given command.
--------------------------------------------------------------------------------
-*/}}
-{{define "Arguments"}}
- {{AssertType $ "Function"}}
-
- {{ForEach $.CallParameters "ParameterName" | JoinWith ", "}}
-{{end}}
+++ /dev/null
-/*
-* Copyright 2015 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// This file is generated. Do not edit manually!
-// To regenerate: $ apic template ../api/vulkan.api get_proc_addr.cpp.tmpl
-// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
-
-#include <algorithm>
-#include <log/log.h>
-#include "loader.h"
-using namespace vulkan;
-
-#define UNLIKELY(expr) __builtin_expect((expr), 0)
-
-namespace {
-
-struct NameProcEntry {
- const char* name;
- PFN_vkVoidFunction proc;
-};
-
-struct NameOffsetEntry {
- const char* name;
- size_t offset;
-};
-
-template <typename TEntry, size_t N>
-const TEntry* FindProcEntry(const TEntry (&table)[N], const char* name) {
- auto entry = std::lower_bound(
- table, table + N, name,
- [](const TEntry& e, const char* n) { return strcmp(e.name, n) < 0; });
- if (entry != (table + N) && strcmp(entry->name, name) == 0)
- return entry;
- return nullptr;
-}
-
-const NameProcEntry kInstanceProcTbl[] = {
- // clang-format off
- {"vkCreateAndroidSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(vkCreateAndroidSurfaceKHR)},
- {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDevice)},
- {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyInstance)},
- {"vkDestroySurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySurfaceKHR)},
- {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateDeviceExtensionProperties)},
- {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateDeviceLayerProperties)},
- {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(vkEnumeratePhysicalDevices)},
- {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(vkGetInstanceProcAddr)},
- {"vkGetPhysicalDeviceFeatures", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceFeatures)},
- {"vkGetPhysicalDeviceFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceFormatProperties)},
- {"vkGetPhysicalDeviceImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceImageFormatProperties)},
- {"vkGetPhysicalDeviceMemoryProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceMemoryProperties)},
- {"vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceProperties)},
- {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceQueueFamilyProperties)},
- {"vkGetPhysicalDeviceSparseImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSparseImageFormatProperties)},
- {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceCapabilitiesKHR)},
- {"vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceFormatsKHR)},
- {"vkGetPhysicalDeviceSurfacePresentModesKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfacePresentModesKHR)},
- {"vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceSupportKHR)},
- // clang-format on
-};
-
-const NameProcEntry kDeviceProcTbl[] = {
- // clang-format off
- {"vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(vkAcquireNextImageKHR)},
- {"vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateCommandBuffers)},
- {"vkAllocateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateDescriptorSets)},
- {"vkAllocateMemory", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateMemory)},
- {"vkBeginCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkBeginCommandBuffer)},
- {"vkBindBufferMemory", reinterpret_cast<PFN_vkVoidFunction>(vkBindBufferMemory)},
- {"vkBindImageMemory", reinterpret_cast<PFN_vkVoidFunction>(vkBindImageMemory)},
- {"vkCmdBeginQuery", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBeginQuery)},
- {"vkCmdBeginRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBeginRenderPass)},
- {"vkCmdBindDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindDescriptorSets)},
- {"vkCmdBindIndexBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindIndexBuffer)},
- {"vkCmdBindPipeline", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindPipeline)},
- {"vkCmdBindVertexBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindVertexBuffers)},
- {"vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBlitImage)},
- {"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearAttachments)},
- {"vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearColorImage)},
- {"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearDepthStencilImage)},
- {"vkCmdCopyBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyBuffer)},
- {"vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyBufferToImage)},
- {"vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyImage)},
- {"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyImageToBuffer)},
- {"vkCmdCopyQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyQueryPoolResults)},
- {"vkCmdDispatch", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDispatch)},
- {"vkCmdDispatchIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDispatchIndirect)},
- {"vkCmdDraw", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDraw)},
- {"vkCmdDrawIndexed", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndexed)},
- {"vkCmdDrawIndexedIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndexedIndirect)},
- {"vkCmdDrawIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndirect)},
- {"vkCmdEndQuery", reinterpret_cast<PFN_vkVoidFunction>(vkCmdEndQuery)},
- {"vkCmdEndRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdEndRenderPass)},
- {"vkCmdExecuteCommands", reinterpret_cast<PFN_vkVoidFunction>(vkCmdExecuteCommands)},
- {"vkCmdFillBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdFillBuffer)},
- {"vkCmdNextSubpass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdNextSubpass)},
- {"vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(vkCmdPipelineBarrier)},
- {"vkCmdPushConstants", reinterpret_cast<PFN_vkVoidFunction>(vkCmdPushConstants)},
- {"vkCmdResetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResetEvent)},
- {"vkCmdResetQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResetQueryPool)},
- {"vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResolveImage)},
- {"vkCmdSetBlendConstants", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetBlendConstants)},
- {"vkCmdSetDepthBias", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetDepthBias)},
- {"vkCmdSetDepthBounds", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetDepthBounds)},
- {"vkCmdSetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetEvent)},
- {"vkCmdSetLineWidth", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetLineWidth)},
- {"vkCmdSetScissor", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetScissor)},
- {"vkCmdSetStencilCompareMask", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilCompareMask)},
- {"vkCmdSetStencilReference", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilReference)},
- {"vkCmdSetStencilWriteMask", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilWriteMask)},
- {"vkCmdSetViewport", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetViewport)},
- {"vkCmdUpdateBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdUpdateBuffer)},
- {"vkCmdWaitEvents", reinterpret_cast<PFN_vkVoidFunction>(vkCmdWaitEvents)},
- {"vkCmdWriteTimestamp", reinterpret_cast<PFN_vkVoidFunction>(vkCmdWriteTimestamp)},
- {"vkCreateBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCreateBuffer)},
- {"vkCreateBufferView", reinterpret_cast<PFN_vkVoidFunction>(vkCreateBufferView)},
- {"vkCreateCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateCommandPool)},
- {"vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(vkCreateComputePipelines)},
- {"vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDescriptorPool)},
- {"vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDescriptorSetLayout)},
- {"vkCreateEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCreateEvent)},
- {"vkCreateFence", reinterpret_cast<PFN_vkVoidFunction>(vkCreateFence)},
- {"vkCreateFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCreateFramebuffer)},
- {"vkCreateGraphicsPipelines", reinterpret_cast<PFN_vkVoidFunction>(vkCreateGraphicsPipelines)},
- {"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(vkCreateImage)},
- {"vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(vkCreateImageView)},
- {"vkCreatePipelineCache", reinterpret_cast<PFN_vkVoidFunction>(vkCreatePipelineCache)},
- {"vkCreatePipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(vkCreatePipelineLayout)},
- {"vkCreateQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateQueryPool)},
- {"vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCreateRenderPass)},
- {"vkCreateSampler", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSampler)},
- {"vkCreateSemaphore", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSemaphore)},
- {"vkCreateShaderModule", reinterpret_cast<PFN_vkVoidFunction>(vkCreateShaderModule)},
- {"vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSwapchainKHR)},
- {"vkDestroyBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyBuffer)},
- {"vkDestroyBufferView", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyBufferView)},
- {"vkDestroyCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyCommandPool)},
- {"vkDestroyDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDescriptorPool)},
- {"vkDestroyDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDescriptorSetLayout)},
- {"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDevice)},
- {"vkDestroyEvent", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyEvent)},
- {"vkDestroyFence", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyFence)},
- {"vkDestroyFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyFramebuffer)},
- {"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyImage)},
- {"vkDestroyImageView", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyImageView)},
- {"vkDestroyPipeline", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipeline)},
- {"vkDestroyPipelineCache", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipelineCache)},
- {"vkDestroyPipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipelineLayout)},
- {"vkDestroyQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyQueryPool)},
- {"vkDestroyRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyRenderPass)},
- {"vkDestroySampler", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySampler)},
- {"vkDestroySemaphore", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySemaphore)},
- {"vkDestroyShaderModule", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyShaderModule)},
- {"vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySwapchainKHR)},
- {"vkDeviceWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(vkDeviceWaitIdle)},
- {"vkEndCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkEndCommandBuffer)},
- {"vkFlushMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(vkFlushMappedMemoryRanges)},
- {"vkFreeCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkFreeCommandBuffers)},
- {"vkFreeDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkFreeDescriptorSets)},
- {"vkFreeMemory", reinterpret_cast<PFN_vkVoidFunction>(vkFreeMemory)},
- {"vkGetBufferMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetBufferMemoryRequirements)},
- {"vkGetDeviceMemoryCommitment", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceMemoryCommitment)},
- {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceProcAddr)},
- {"vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceQueue)},
- {"vkGetEventStatus", reinterpret_cast<PFN_vkVoidFunction>(vkGetEventStatus)},
- {"vkGetFenceStatus", reinterpret_cast<PFN_vkVoidFunction>(vkGetFenceStatus)},
- {"vkGetImageMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageMemoryRequirements)},
- {"vkGetImageSparseMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageSparseMemoryRequirements)},
- {"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageSubresourceLayout)},
- {"vkGetPipelineCacheData", reinterpret_cast<PFN_vkVoidFunction>(vkGetPipelineCacheData)},
- {"vkGetQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(vkGetQueryPoolResults)},
- {"vkGetRenderAreaGranularity", reinterpret_cast<PFN_vkVoidFunction>(vkGetRenderAreaGranularity)},
- {"vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetSwapchainImagesKHR)},
- {"vkInvalidateMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(vkInvalidateMappedMemoryRanges)},
- {"vkMapMemory", reinterpret_cast<PFN_vkVoidFunction>(vkMapMemory)},
- {"vkMergePipelineCaches", reinterpret_cast<PFN_vkVoidFunction>(vkMergePipelineCaches)},
- {"vkQueueBindSparse", reinterpret_cast<PFN_vkVoidFunction>(vkQueueBindSparse)},
- {"vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(vkQueuePresentKHR)},
- {"vkQueueSubmit", reinterpret_cast<PFN_vkVoidFunction>(vkQueueSubmit)},
- {"vkQueueWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(vkQueueWaitIdle)},
- {"vkResetCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkResetCommandBuffer)},
- {"vkResetCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkResetCommandPool)},
- {"vkResetDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkResetDescriptorPool)},
- {"vkResetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkResetEvent)},
- {"vkResetFences", reinterpret_cast<PFN_vkVoidFunction>(vkResetFences)},
- {"vkSetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkSetEvent)},
- {"vkUnmapMemory", reinterpret_cast<PFN_vkVoidFunction>(vkUnmapMemory)},
- {"vkUpdateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkUpdateDescriptorSets)},
- {"vkWaitForFences", reinterpret_cast<PFN_vkVoidFunction>(vkWaitForFences)},
- // clang-format on
-};
-
-const NameOffsetEntry kInstanceOffsetTbl[] = {
- // clang-format off
- {"vkCreateAndroidSurfaceKHR", offsetof(InstanceVtbl, CreateAndroidSurfaceKHR)},
- {"vkCreateDevice", offsetof(InstanceVtbl, CreateDevice)},
- {"vkDestroyInstance", offsetof(InstanceVtbl, DestroyInstance)},
- {"vkDestroySurfaceKHR", offsetof(InstanceVtbl, DestroySurfaceKHR)},
- {"vkEnumerateDeviceExtensionProperties", offsetof(InstanceVtbl, EnumerateDeviceExtensionProperties)},
- {"vkEnumerateDeviceLayerProperties", offsetof(InstanceVtbl, EnumerateDeviceLayerProperties)},
- {"vkEnumeratePhysicalDevices", offsetof(InstanceVtbl, EnumeratePhysicalDevices)},
- {"vkGetInstanceProcAddr", offsetof(InstanceVtbl, GetInstanceProcAddr)},
- {"vkGetPhysicalDeviceFeatures", offsetof(InstanceVtbl, GetPhysicalDeviceFeatures)},
- {"vkGetPhysicalDeviceFormatProperties", offsetof(InstanceVtbl, GetPhysicalDeviceFormatProperties)},
- {"vkGetPhysicalDeviceImageFormatProperties", offsetof(InstanceVtbl, GetPhysicalDeviceImageFormatProperties)},
- {"vkGetPhysicalDeviceMemoryProperties", offsetof(InstanceVtbl, GetPhysicalDeviceMemoryProperties)},
- {"vkGetPhysicalDeviceProperties", offsetof(InstanceVtbl, GetPhysicalDeviceProperties)},
- {"vkGetPhysicalDeviceQueueFamilyProperties", offsetof(InstanceVtbl, GetPhysicalDeviceQueueFamilyProperties)},
- {"vkGetPhysicalDeviceSparseImageFormatProperties", offsetof(InstanceVtbl, GetPhysicalDeviceSparseImageFormatProperties)},
- {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", offsetof(InstanceVtbl, GetPhysicalDeviceSurfaceCapabilitiesKHR)},
- {"vkGetPhysicalDeviceSurfaceFormatsKHR", offsetof(InstanceVtbl, GetPhysicalDeviceSurfaceFormatsKHR)},
- {"vkGetPhysicalDeviceSurfacePresentModesKHR", offsetof(InstanceVtbl, GetPhysicalDeviceSurfacePresentModesKHR)},
- {"vkGetPhysicalDeviceSurfaceSupportKHR", offsetof(InstanceVtbl, GetPhysicalDeviceSurfaceSupportKHR)},
- // clang-format on
-};
-
-const NameOffsetEntry kDeviceOffsetTbl[] = {
- // clang-format off
- {"vkAcquireNextImageKHR", offsetof(DeviceVtbl, AcquireNextImageKHR)},
- {"vkAllocateCommandBuffers", offsetof(DeviceVtbl, AllocateCommandBuffers)},
- {"vkAllocateDescriptorSets", offsetof(DeviceVtbl, AllocateDescriptorSets)},
- {"vkAllocateMemory", offsetof(DeviceVtbl, AllocateMemory)},
- {"vkBeginCommandBuffer", offsetof(DeviceVtbl, BeginCommandBuffer)},
- {"vkBindBufferMemory", offsetof(DeviceVtbl, BindBufferMemory)},
- {"vkBindImageMemory", offsetof(DeviceVtbl, BindImageMemory)},
- {"vkCmdBeginQuery", offsetof(DeviceVtbl, CmdBeginQuery)},
- {"vkCmdBeginRenderPass", offsetof(DeviceVtbl, CmdBeginRenderPass)},
- {"vkCmdBindDescriptorSets", offsetof(DeviceVtbl, CmdBindDescriptorSets)},
- {"vkCmdBindIndexBuffer", offsetof(DeviceVtbl, CmdBindIndexBuffer)},
- {"vkCmdBindPipeline", offsetof(DeviceVtbl, CmdBindPipeline)},
- {"vkCmdBindVertexBuffers", offsetof(DeviceVtbl, CmdBindVertexBuffers)},
- {"vkCmdBlitImage", offsetof(DeviceVtbl, CmdBlitImage)},
- {"vkCmdClearAttachments", offsetof(DeviceVtbl, CmdClearAttachments)},
- {"vkCmdClearColorImage", offsetof(DeviceVtbl, CmdClearColorImage)},
- {"vkCmdClearDepthStencilImage", offsetof(DeviceVtbl, CmdClearDepthStencilImage)},
- {"vkCmdCopyBuffer", offsetof(DeviceVtbl, CmdCopyBuffer)},
- {"vkCmdCopyBufferToImage", offsetof(DeviceVtbl, CmdCopyBufferToImage)},
- {"vkCmdCopyImage", offsetof(DeviceVtbl, CmdCopyImage)},
- {"vkCmdCopyImageToBuffer", offsetof(DeviceVtbl, CmdCopyImageToBuffer)},
- {"vkCmdCopyQueryPoolResults", offsetof(DeviceVtbl, CmdCopyQueryPoolResults)},
- {"vkCmdDispatch", offsetof(DeviceVtbl, CmdDispatch)},
- {"vkCmdDispatchIndirect", offsetof(DeviceVtbl, CmdDispatchIndirect)},
- {"vkCmdDraw", offsetof(DeviceVtbl, CmdDraw)},
- {"vkCmdDrawIndexed", offsetof(DeviceVtbl, CmdDrawIndexed)},
- {"vkCmdDrawIndexedIndirect", offsetof(DeviceVtbl, CmdDrawIndexedIndirect)},
- {"vkCmdDrawIndirect", offsetof(DeviceVtbl, CmdDrawIndirect)},
- {"vkCmdEndQuery", offsetof(DeviceVtbl, CmdEndQuery)},
- {"vkCmdEndRenderPass", offsetof(DeviceVtbl, CmdEndRenderPass)},
- {"vkCmdExecuteCommands", offsetof(DeviceVtbl, CmdExecuteCommands)},
- {"vkCmdFillBuffer", offsetof(DeviceVtbl, CmdFillBuffer)},
- {"vkCmdNextSubpass", offsetof(DeviceVtbl, CmdNextSubpass)},
- {"vkCmdPipelineBarrier", offsetof(DeviceVtbl, CmdPipelineBarrier)},
- {"vkCmdPushConstants", offsetof(DeviceVtbl, CmdPushConstants)},
- {"vkCmdResetEvent", offsetof(DeviceVtbl, CmdResetEvent)},
- {"vkCmdResetQueryPool", offsetof(DeviceVtbl, CmdResetQueryPool)},
- {"vkCmdResolveImage", offsetof(DeviceVtbl, CmdResolveImage)},
- {"vkCmdSetBlendConstants", offsetof(DeviceVtbl, CmdSetBlendConstants)},
- {"vkCmdSetDepthBias", offsetof(DeviceVtbl, CmdSetDepthBias)},
- {"vkCmdSetDepthBounds", offsetof(DeviceVtbl, CmdSetDepthBounds)},
- {"vkCmdSetEvent", offsetof(DeviceVtbl, CmdSetEvent)},
- {"vkCmdSetLineWidth", offsetof(DeviceVtbl, CmdSetLineWidth)},
- {"vkCmdSetScissor", offsetof(DeviceVtbl, CmdSetScissor)},
- {"vkCmdSetStencilCompareMask", offsetof(DeviceVtbl, CmdSetStencilCompareMask)},
- {"vkCmdSetStencilReference", offsetof(DeviceVtbl, CmdSetStencilReference)},
- {"vkCmdSetStencilWriteMask", offsetof(DeviceVtbl, CmdSetStencilWriteMask)},
- {"vkCmdSetViewport", offsetof(DeviceVtbl, CmdSetViewport)},
- {"vkCmdUpdateBuffer", offsetof(DeviceVtbl, CmdUpdateBuffer)},
- {"vkCmdWaitEvents", offsetof(DeviceVtbl, CmdWaitEvents)},
- {"vkCmdWriteTimestamp", offsetof(DeviceVtbl, CmdWriteTimestamp)},
- {"vkCreateBuffer", offsetof(DeviceVtbl, CreateBuffer)},
- {"vkCreateBufferView", offsetof(DeviceVtbl, CreateBufferView)},
- {"vkCreateCommandPool", offsetof(DeviceVtbl, CreateCommandPool)},
- {"vkCreateComputePipelines", offsetof(DeviceVtbl, CreateComputePipelines)},
- {"vkCreateDescriptorPool", offsetof(DeviceVtbl, CreateDescriptorPool)},
- {"vkCreateDescriptorSetLayout", offsetof(DeviceVtbl, CreateDescriptorSetLayout)},
- {"vkCreateEvent", offsetof(DeviceVtbl, CreateEvent)},
- {"vkCreateFence", offsetof(DeviceVtbl, CreateFence)},
- {"vkCreateFramebuffer", offsetof(DeviceVtbl, CreateFramebuffer)},
- {"vkCreateGraphicsPipelines", offsetof(DeviceVtbl, CreateGraphicsPipelines)},
- {"vkCreateImage", offsetof(DeviceVtbl, CreateImage)},
- {"vkCreateImageView", offsetof(DeviceVtbl, CreateImageView)},
- {"vkCreatePipelineCache", offsetof(DeviceVtbl, CreatePipelineCache)},
- {"vkCreatePipelineLayout", offsetof(DeviceVtbl, CreatePipelineLayout)},
- {"vkCreateQueryPool", offsetof(DeviceVtbl, CreateQueryPool)},
- {"vkCreateRenderPass", offsetof(DeviceVtbl, CreateRenderPass)},
- {"vkCreateSampler", offsetof(DeviceVtbl, CreateSampler)},
- {"vkCreateSemaphore", offsetof(DeviceVtbl, CreateSemaphore)},
- {"vkCreateShaderModule", offsetof(DeviceVtbl, CreateShaderModule)},
- {"vkCreateSwapchainKHR", offsetof(DeviceVtbl, CreateSwapchainKHR)},
- {"vkDestroyBuffer", offsetof(DeviceVtbl, DestroyBuffer)},
- {"vkDestroyBufferView", offsetof(DeviceVtbl, DestroyBufferView)},
- {"vkDestroyCommandPool", offsetof(DeviceVtbl, DestroyCommandPool)},
- {"vkDestroyDescriptorPool", offsetof(DeviceVtbl, DestroyDescriptorPool)},
- {"vkDestroyDescriptorSetLayout", offsetof(DeviceVtbl, DestroyDescriptorSetLayout)},
- {"vkDestroyDevice", offsetof(DeviceVtbl, DestroyDevice)},
- {"vkDestroyEvent", offsetof(DeviceVtbl, DestroyEvent)},
- {"vkDestroyFence", offsetof(DeviceVtbl, DestroyFence)},
- {"vkDestroyFramebuffer", offsetof(DeviceVtbl, DestroyFramebuffer)},
- {"vkDestroyImage", offsetof(DeviceVtbl, DestroyImage)},
- {"vkDestroyImageView", offsetof(DeviceVtbl, DestroyImageView)},
- {"vkDestroyPipeline", offsetof(DeviceVtbl, DestroyPipeline)},
- {"vkDestroyPipelineCache", offsetof(DeviceVtbl, DestroyPipelineCache)},
- {"vkDestroyPipelineLayout", offsetof(DeviceVtbl, DestroyPipelineLayout)},
- {"vkDestroyQueryPool", offsetof(DeviceVtbl, DestroyQueryPool)},
- {"vkDestroyRenderPass", offsetof(DeviceVtbl, DestroyRenderPass)},
- {"vkDestroySampler", offsetof(DeviceVtbl, DestroySampler)},
- {"vkDestroySemaphore", offsetof(DeviceVtbl, DestroySemaphore)},
- {"vkDestroyShaderModule", offsetof(DeviceVtbl, DestroyShaderModule)},
- {"vkDestroySwapchainKHR", offsetof(DeviceVtbl, DestroySwapchainKHR)},
- {"vkDeviceWaitIdle", offsetof(DeviceVtbl, DeviceWaitIdle)},
- {"vkEndCommandBuffer", offsetof(DeviceVtbl, EndCommandBuffer)},
- {"vkFlushMappedMemoryRanges", offsetof(DeviceVtbl, FlushMappedMemoryRanges)},
- {"vkFreeCommandBuffers", offsetof(DeviceVtbl, FreeCommandBuffers)},
- {"vkFreeDescriptorSets", offsetof(DeviceVtbl, FreeDescriptorSets)},
- {"vkFreeMemory", offsetof(DeviceVtbl, FreeMemory)},
- {"vkGetBufferMemoryRequirements", offsetof(DeviceVtbl, GetBufferMemoryRequirements)},
- {"vkGetDeviceMemoryCommitment", offsetof(DeviceVtbl, GetDeviceMemoryCommitment)},
- {"vkGetDeviceProcAddr", offsetof(DeviceVtbl, GetDeviceProcAddr)},
- {"vkGetDeviceQueue", offsetof(DeviceVtbl, GetDeviceQueue)},
- {"vkGetEventStatus", offsetof(DeviceVtbl, GetEventStatus)},
- {"vkGetFenceStatus", offsetof(DeviceVtbl, GetFenceStatus)},
- {"vkGetImageMemoryRequirements", offsetof(DeviceVtbl, GetImageMemoryRequirements)},
- {"vkGetImageSparseMemoryRequirements", offsetof(DeviceVtbl, GetImageSparseMemoryRequirements)},
- {"vkGetImageSubresourceLayout", offsetof(DeviceVtbl, GetImageSubresourceLayout)},
- {"vkGetPipelineCacheData", offsetof(DeviceVtbl, GetPipelineCacheData)},
- {"vkGetQueryPoolResults", offsetof(DeviceVtbl, GetQueryPoolResults)},
- {"vkGetRenderAreaGranularity", offsetof(DeviceVtbl, GetRenderAreaGranularity)},
- {"vkGetSwapchainImagesKHR", offsetof(DeviceVtbl, GetSwapchainImagesKHR)},
- {"vkInvalidateMappedMemoryRanges", offsetof(DeviceVtbl, InvalidateMappedMemoryRanges)},
- {"vkMapMemory", offsetof(DeviceVtbl, MapMemory)},
- {"vkMergePipelineCaches", offsetof(DeviceVtbl, MergePipelineCaches)},
- {"vkQueueBindSparse", offsetof(DeviceVtbl, QueueBindSparse)},
- {"vkQueuePresentKHR", offsetof(DeviceVtbl, QueuePresentKHR)},
- {"vkQueueSubmit", offsetof(DeviceVtbl, QueueSubmit)},
- {"vkQueueWaitIdle", offsetof(DeviceVtbl, QueueWaitIdle)},
- {"vkResetCommandBuffer", offsetof(DeviceVtbl, ResetCommandBuffer)},
- {"vkResetCommandPool", offsetof(DeviceVtbl, ResetCommandPool)},
- {"vkResetDescriptorPool", offsetof(DeviceVtbl, ResetDescriptorPool)},
- {"vkResetEvent", offsetof(DeviceVtbl, ResetEvent)},
- {"vkResetFences", offsetof(DeviceVtbl, ResetFences)},
- {"vkSetEvent", offsetof(DeviceVtbl, SetEvent)},
- {"vkUnmapMemory", offsetof(DeviceVtbl, UnmapMemory)},
- {"vkUpdateDescriptorSets", offsetof(DeviceVtbl, UpdateDescriptorSets)},
- {"vkWaitForFences", offsetof(DeviceVtbl, WaitForFences)},
- // clang-format on
-};
-
-} // namespace
-
-namespace vulkan {
-
-PFN_vkVoidFunction GetGlobalInstanceProcAddr(const char* name) {
- const NameProcEntry* entry = FindProcEntry(kInstanceProcTbl, name);
- if (entry)
- return entry->proc;
- // vkGetDeviceProcAddr must be available at the global/instance level for
- // bootstrapping
- if (strcmp(name, "vkGetDeviceProcAddr") == 0)
- return reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceProcAddr);
- return nullptr;
-}
-
-PFN_vkVoidFunction GetGlobalDeviceProcAddr(const char* name) {
- const NameProcEntry* entry = FindProcEntry(kDeviceProcTbl, name);
- if (entry)
- return entry->proc;
- return nullptr;
-}
-
-PFN_vkVoidFunction GetSpecificInstanceProcAddr(const InstanceVtbl* vtbl,
- const char* name) {
- size_t offset;
- const NameOffsetEntry* entry = FindProcEntry(kInstanceOffsetTbl, name);
- if (entry)
- offset = entry->offset;
- else
- return nullptr;
- const unsigned char* base = reinterpret_cast<const unsigned char*>(vtbl);
- return *reinterpret_cast<PFN_vkVoidFunction*>(
- const_cast<unsigned char*>(base) + offset);
-}
-
-PFN_vkVoidFunction GetSpecificDeviceProcAddr(const DeviceVtbl* vtbl,
- const char* name) {
- size_t offset;
- const NameOffsetEntry* entry = FindProcEntry(kDeviceOffsetTbl, name);
- if (entry)
- offset = entry->offset;
- else
- return nullptr;
- const unsigned char* base = reinterpret_cast<const unsigned char*>(vtbl);
- return *reinterpret_cast<PFN_vkVoidFunction*>(
- const_cast<unsigned char*>(base) + offset);
-}
-
-bool LoadInstanceVtbl(VkInstance instance,
- VkInstance instance_next,
- PFN_vkGetInstanceProcAddr get_proc_addr,
- InstanceVtbl& vtbl) {
- bool success = true;
- // clang-format off
- vtbl.GetInstanceProcAddr = reinterpret_cast<PFN_vkGetInstanceProcAddr>(get_proc_addr(instance_next, "vkGetInstanceProcAddr"));
- if (UNLIKELY(!vtbl.GetInstanceProcAddr)) {
- ALOGE("missing instance proc: %s", "vkGetInstanceProcAddr");
- success = false;
- }
- vtbl.CreateInstance = reinterpret_cast<PFN_vkCreateInstance>(get_proc_addr(instance, "vkCreateInstance"));
- if (UNLIKELY(!vtbl.CreateInstance)) {
- // This is allowed to fail as the driver doesn't have to return vkCreateInstance when given an instance
- }
- vtbl.DestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(get_proc_addr(instance, "vkDestroyInstance"));
- if (UNLIKELY(!vtbl.DestroyInstance)) {
- ALOGE("missing instance proc: %s", "vkDestroyInstance");
- success = false;
- }
- vtbl.EnumeratePhysicalDevices = reinterpret_cast<PFN_vkEnumeratePhysicalDevices>(get_proc_addr(instance, "vkEnumeratePhysicalDevices"));
- if (UNLIKELY(!vtbl.EnumeratePhysicalDevices)) {
- ALOGE("missing instance proc: %s", "vkEnumeratePhysicalDevices");
- success = false;
- }
- vtbl.GetPhysicalDeviceProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceProperties"));
- if (UNLIKELY(!vtbl.GetPhysicalDeviceProperties)) {
- ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceProperties");
- success = false;
- }
- vtbl.GetPhysicalDeviceQueueFamilyProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceQueueFamilyProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceQueueFamilyProperties"));
- if (UNLIKELY(!vtbl.GetPhysicalDeviceQueueFamilyProperties)) {
- ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceQueueFamilyProperties");
- success = false;
- }
- vtbl.GetPhysicalDeviceMemoryProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceMemoryProperties"));
- if (UNLIKELY(!vtbl.GetPhysicalDeviceMemoryProperties)) {
- ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceMemoryProperties");
- success = false;
- }
- vtbl.GetPhysicalDeviceFeatures = reinterpret_cast<PFN_vkGetPhysicalDeviceFeatures>(get_proc_addr(instance, "vkGetPhysicalDeviceFeatures"));
- if (UNLIKELY(!vtbl.GetPhysicalDeviceFeatures)) {
- ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceFeatures");
- success = false;
- }
- vtbl.GetPhysicalDeviceFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceFormatProperties"));
- if (UNLIKELY(!vtbl.GetPhysicalDeviceFormatProperties)) {
- ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceFormatProperties");
- success = false;
- }
- vtbl.GetPhysicalDeviceImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceImageFormatProperties"));
- if (UNLIKELY(!vtbl.GetPhysicalDeviceImageFormatProperties)) {
- ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceImageFormatProperties");
- success = false;
- }
- vtbl.CreateDevice = reinterpret_cast<PFN_vkCreateDevice>(get_proc_addr(instance, "vkCreateDevice"));
- if (UNLIKELY(!vtbl.CreateDevice)) {
- ALOGE("missing instance proc: %s", "vkCreateDevice");
- success = false;
- }
- vtbl.EnumerateDeviceLayerProperties = reinterpret_cast<PFN_vkEnumerateDeviceLayerProperties>(get_proc_addr(instance, "vkEnumerateDeviceLayerProperties"));
- if (UNLIKELY(!vtbl.EnumerateDeviceLayerProperties)) {
- ALOGE("missing instance proc: %s", "vkEnumerateDeviceLayerProperties");
- success = false;
- }
- vtbl.EnumerateDeviceExtensionProperties = reinterpret_cast<PFN_vkEnumerateDeviceExtensionProperties>(get_proc_addr(instance, "vkEnumerateDeviceExtensionProperties"));
- if (UNLIKELY(!vtbl.EnumerateDeviceExtensionProperties)) {
- ALOGE("missing instance proc: %s", "vkEnumerateDeviceExtensionProperties");
- success = false;
- }
- vtbl.GetPhysicalDeviceSparseImageFormatProperties = reinterpret_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(get_proc_addr(instance, "vkGetPhysicalDeviceSparseImageFormatProperties"));
- if (UNLIKELY(!vtbl.GetPhysicalDeviceSparseImageFormatProperties)) {
- ALOGE("missing instance proc: %s", "vkGetPhysicalDeviceSparseImageFormatProperties");
- success = false;
- }
- vtbl.DestroySurfaceKHR = reinterpret_cast<PFN_vkDestroySurfaceKHR>(get_proc_addr(instance, "vkDestroySurfaceKHR"));
- vtbl.GetPhysicalDeviceSurfaceSupportKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfaceSupportKHR"));
- vtbl.GetPhysicalDeviceSurfaceCapabilitiesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"));
- vtbl.GetPhysicalDeviceSurfaceFormatsKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"));
- vtbl.GetPhysicalDeviceSurfacePresentModesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR>(get_proc_addr(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"));
- vtbl.CreateAndroidSurfaceKHR = reinterpret_cast<PFN_vkCreateAndroidSurfaceKHR>(get_proc_addr(instance, "vkCreateAndroidSurfaceKHR"));
- // clang-format on
- return success;
-}
-
-bool LoadDeviceVtbl(VkDevice device,
- VkDevice device_next,
- PFN_vkGetDeviceProcAddr get_proc_addr,
- DeviceVtbl& vtbl) {
- bool success = true;
- // clang-format off
- vtbl.GetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(get_proc_addr(device_next, "vkGetDeviceProcAddr"));
- if (UNLIKELY(!vtbl.GetDeviceProcAddr)) {
- ALOGE("missing device proc: %s", "vkGetDeviceProcAddr");
- success = false;
- }
- vtbl.DestroyDevice = reinterpret_cast<PFN_vkDestroyDevice>(get_proc_addr(device, "vkDestroyDevice"));
- if (UNLIKELY(!vtbl.DestroyDevice)) {
- ALOGE("missing device proc: %s", "vkDestroyDevice");
- success = false;
- }
- vtbl.GetDeviceQueue = reinterpret_cast<PFN_vkGetDeviceQueue>(get_proc_addr(device, "vkGetDeviceQueue"));
- if (UNLIKELY(!vtbl.GetDeviceQueue)) {
- ALOGE("missing device proc: %s", "vkGetDeviceQueue");
- success = false;
- }
- vtbl.QueueSubmit = reinterpret_cast<PFN_vkQueueSubmit>(get_proc_addr(device, "vkQueueSubmit"));
- if (UNLIKELY(!vtbl.QueueSubmit)) {
- ALOGE("missing device proc: %s", "vkQueueSubmit");
- success = false;
- }
- vtbl.QueueWaitIdle = reinterpret_cast<PFN_vkQueueWaitIdle>(get_proc_addr(device, "vkQueueWaitIdle"));
- if (UNLIKELY(!vtbl.QueueWaitIdle)) {
- ALOGE("missing device proc: %s", "vkQueueWaitIdle");
- success = false;
- }
- vtbl.DeviceWaitIdle = reinterpret_cast<PFN_vkDeviceWaitIdle>(get_proc_addr(device, "vkDeviceWaitIdle"));
- if (UNLIKELY(!vtbl.DeviceWaitIdle)) {
- ALOGE("missing device proc: %s", "vkDeviceWaitIdle");
- success = false;
- }
- vtbl.AllocateMemory = reinterpret_cast<PFN_vkAllocateMemory>(get_proc_addr(device, "vkAllocateMemory"));
- if (UNLIKELY(!vtbl.AllocateMemory)) {
- ALOGE("missing device proc: %s", "vkAllocateMemory");
- success = false;
- }
- vtbl.FreeMemory = reinterpret_cast<PFN_vkFreeMemory>(get_proc_addr(device, "vkFreeMemory"));
- if (UNLIKELY(!vtbl.FreeMemory)) {
- ALOGE("missing device proc: %s", "vkFreeMemory");
- success = false;
- }
- vtbl.MapMemory = reinterpret_cast<PFN_vkMapMemory>(get_proc_addr(device, "vkMapMemory"));
- if (UNLIKELY(!vtbl.MapMemory)) {
- ALOGE("missing device proc: %s", "vkMapMemory");
- success = false;
- }
- vtbl.UnmapMemory = reinterpret_cast<PFN_vkUnmapMemory>(get_proc_addr(device, "vkUnmapMemory"));
- if (UNLIKELY(!vtbl.UnmapMemory)) {
- ALOGE("missing device proc: %s", "vkUnmapMemory");
- success = false;
- }
- vtbl.FlushMappedMemoryRanges = reinterpret_cast<PFN_vkFlushMappedMemoryRanges>(get_proc_addr(device, "vkFlushMappedMemoryRanges"));
- if (UNLIKELY(!vtbl.FlushMappedMemoryRanges)) {
- ALOGE("missing device proc: %s", "vkFlushMappedMemoryRanges");
- success = false;
- }
- vtbl.InvalidateMappedMemoryRanges = reinterpret_cast<PFN_vkInvalidateMappedMemoryRanges>(get_proc_addr(device, "vkInvalidateMappedMemoryRanges"));
- if (UNLIKELY(!vtbl.InvalidateMappedMemoryRanges)) {
- ALOGE("missing device proc: %s", "vkInvalidateMappedMemoryRanges");
- success = false;
- }
- vtbl.GetDeviceMemoryCommitment = reinterpret_cast<PFN_vkGetDeviceMemoryCommitment>(get_proc_addr(device, "vkGetDeviceMemoryCommitment"));
- if (UNLIKELY(!vtbl.GetDeviceMemoryCommitment)) {
- ALOGE("missing device proc: %s", "vkGetDeviceMemoryCommitment");
- success = false;
- }
- vtbl.GetBufferMemoryRequirements = reinterpret_cast<PFN_vkGetBufferMemoryRequirements>(get_proc_addr(device, "vkGetBufferMemoryRequirements"));
- if (UNLIKELY(!vtbl.GetBufferMemoryRequirements)) {
- ALOGE("missing device proc: %s", "vkGetBufferMemoryRequirements");
- success = false;
- }
- vtbl.BindBufferMemory = reinterpret_cast<PFN_vkBindBufferMemory>(get_proc_addr(device, "vkBindBufferMemory"));
- if (UNLIKELY(!vtbl.BindBufferMemory)) {
- ALOGE("missing device proc: %s", "vkBindBufferMemory");
- success = false;
- }
- vtbl.GetImageMemoryRequirements = reinterpret_cast<PFN_vkGetImageMemoryRequirements>(get_proc_addr(device, "vkGetImageMemoryRequirements"));
- if (UNLIKELY(!vtbl.GetImageMemoryRequirements)) {
- ALOGE("missing device proc: %s", "vkGetImageMemoryRequirements");
- success = false;
- }
- vtbl.BindImageMemory = reinterpret_cast<PFN_vkBindImageMemory>(get_proc_addr(device, "vkBindImageMemory"));
- if (UNLIKELY(!vtbl.BindImageMemory)) {
- ALOGE("missing device proc: %s", "vkBindImageMemory");
- success = false;
- }
- vtbl.GetImageSparseMemoryRequirements = reinterpret_cast<PFN_vkGetImageSparseMemoryRequirements>(get_proc_addr(device, "vkGetImageSparseMemoryRequirements"));
- if (UNLIKELY(!vtbl.GetImageSparseMemoryRequirements)) {
- ALOGE("missing device proc: %s", "vkGetImageSparseMemoryRequirements");
- success = false;
- }
- vtbl.QueueBindSparse = reinterpret_cast<PFN_vkQueueBindSparse>(get_proc_addr(device, "vkQueueBindSparse"));
- if (UNLIKELY(!vtbl.QueueBindSparse)) {
- ALOGE("missing device proc: %s", "vkQueueBindSparse");
- success = false;
- }
- vtbl.CreateFence = reinterpret_cast<PFN_vkCreateFence>(get_proc_addr(device, "vkCreateFence"));
- if (UNLIKELY(!vtbl.CreateFence)) {
- ALOGE("missing device proc: %s", "vkCreateFence");
- success = false;
- }
- vtbl.DestroyFence = reinterpret_cast<PFN_vkDestroyFence>(get_proc_addr(device, "vkDestroyFence"));
- if (UNLIKELY(!vtbl.DestroyFence)) {
- ALOGE("missing device proc: %s", "vkDestroyFence");
- success = false;
- }
- vtbl.ResetFences = reinterpret_cast<PFN_vkResetFences>(get_proc_addr(device, "vkResetFences"));
- if (UNLIKELY(!vtbl.ResetFences)) {
- ALOGE("missing device proc: %s", "vkResetFences");
- success = false;
- }
- vtbl.GetFenceStatus = reinterpret_cast<PFN_vkGetFenceStatus>(get_proc_addr(device, "vkGetFenceStatus"));
- if (UNLIKELY(!vtbl.GetFenceStatus)) {
- ALOGE("missing device proc: %s", "vkGetFenceStatus");
- success = false;
- }
- vtbl.WaitForFences = reinterpret_cast<PFN_vkWaitForFences>(get_proc_addr(device, "vkWaitForFences"));
- if (UNLIKELY(!vtbl.WaitForFences)) {
- ALOGE("missing device proc: %s", "vkWaitForFences");
- success = false;
- }
- vtbl.CreateSemaphore = reinterpret_cast<PFN_vkCreateSemaphore>(get_proc_addr(device, "vkCreateSemaphore"));
- if (UNLIKELY(!vtbl.CreateSemaphore)) {
- ALOGE("missing device proc: %s", "vkCreateSemaphore");
- success = false;
- }
- vtbl.DestroySemaphore = reinterpret_cast<PFN_vkDestroySemaphore>(get_proc_addr(device, "vkDestroySemaphore"));
- if (UNLIKELY(!vtbl.DestroySemaphore)) {
- ALOGE("missing device proc: %s", "vkDestroySemaphore");
- success = false;
- }
- vtbl.CreateEvent = reinterpret_cast<PFN_vkCreateEvent>(get_proc_addr(device, "vkCreateEvent"));
- if (UNLIKELY(!vtbl.CreateEvent)) {
- ALOGE("missing device proc: %s", "vkCreateEvent");
- success = false;
- }
- vtbl.DestroyEvent = reinterpret_cast<PFN_vkDestroyEvent>(get_proc_addr(device, "vkDestroyEvent"));
- if (UNLIKELY(!vtbl.DestroyEvent)) {
- ALOGE("missing device proc: %s", "vkDestroyEvent");
- success = false;
- }
- vtbl.GetEventStatus = reinterpret_cast<PFN_vkGetEventStatus>(get_proc_addr(device, "vkGetEventStatus"));
- if (UNLIKELY(!vtbl.GetEventStatus)) {
- ALOGE("missing device proc: %s", "vkGetEventStatus");
- success = false;
- }
- vtbl.SetEvent = reinterpret_cast<PFN_vkSetEvent>(get_proc_addr(device, "vkSetEvent"));
- if (UNLIKELY(!vtbl.SetEvent)) {
- ALOGE("missing device proc: %s", "vkSetEvent");
- success = false;
- }
- vtbl.ResetEvent = reinterpret_cast<PFN_vkResetEvent>(get_proc_addr(device, "vkResetEvent"));
- if (UNLIKELY(!vtbl.ResetEvent)) {
- ALOGE("missing device proc: %s", "vkResetEvent");
- success = false;
- }
- vtbl.CreateQueryPool = reinterpret_cast<PFN_vkCreateQueryPool>(get_proc_addr(device, "vkCreateQueryPool"));
- if (UNLIKELY(!vtbl.CreateQueryPool)) {
- ALOGE("missing device proc: %s", "vkCreateQueryPool");
- success = false;
- }
- vtbl.DestroyQueryPool = reinterpret_cast<PFN_vkDestroyQueryPool>(get_proc_addr(device, "vkDestroyQueryPool"));
- if (UNLIKELY(!vtbl.DestroyQueryPool)) {
- ALOGE("missing device proc: %s", "vkDestroyQueryPool");
- success = false;
- }
- vtbl.GetQueryPoolResults = reinterpret_cast<PFN_vkGetQueryPoolResults>(get_proc_addr(device, "vkGetQueryPoolResults"));
- if (UNLIKELY(!vtbl.GetQueryPoolResults)) {
- ALOGE("missing device proc: %s", "vkGetQueryPoolResults");
- success = false;
- }
- vtbl.CreateBuffer = reinterpret_cast<PFN_vkCreateBuffer>(get_proc_addr(device, "vkCreateBuffer"));
- if (UNLIKELY(!vtbl.CreateBuffer)) {
- ALOGE("missing device proc: %s", "vkCreateBuffer");
- success = false;
- }
- vtbl.DestroyBuffer = reinterpret_cast<PFN_vkDestroyBuffer>(get_proc_addr(device, "vkDestroyBuffer"));
- if (UNLIKELY(!vtbl.DestroyBuffer)) {
- ALOGE("missing device proc: %s", "vkDestroyBuffer");
- success = false;
- }
- vtbl.CreateBufferView = reinterpret_cast<PFN_vkCreateBufferView>(get_proc_addr(device, "vkCreateBufferView"));
- if (UNLIKELY(!vtbl.CreateBufferView)) {
- ALOGE("missing device proc: %s", "vkCreateBufferView");
- success = false;
- }
- vtbl.DestroyBufferView = reinterpret_cast<PFN_vkDestroyBufferView>(get_proc_addr(device, "vkDestroyBufferView"));
- if (UNLIKELY(!vtbl.DestroyBufferView)) {
- ALOGE("missing device proc: %s", "vkDestroyBufferView");
- success = false;
- }
- vtbl.CreateImage = reinterpret_cast<PFN_vkCreateImage>(get_proc_addr(device, "vkCreateImage"));
- if (UNLIKELY(!vtbl.CreateImage)) {
- ALOGE("missing device proc: %s", "vkCreateImage");
- success = false;
- }
- vtbl.DestroyImage = reinterpret_cast<PFN_vkDestroyImage>(get_proc_addr(device, "vkDestroyImage"));
- if (UNLIKELY(!vtbl.DestroyImage)) {
- ALOGE("missing device proc: %s", "vkDestroyImage");
- success = false;
- }
- vtbl.GetImageSubresourceLayout = reinterpret_cast<PFN_vkGetImageSubresourceLayout>(get_proc_addr(device, "vkGetImageSubresourceLayout"));
- if (UNLIKELY(!vtbl.GetImageSubresourceLayout)) {
- ALOGE("missing device proc: %s", "vkGetImageSubresourceLayout");
- success = false;
- }
- vtbl.CreateImageView = reinterpret_cast<PFN_vkCreateImageView>(get_proc_addr(device, "vkCreateImageView"));
- if (UNLIKELY(!vtbl.CreateImageView)) {
- ALOGE("missing device proc: %s", "vkCreateImageView");
- success = false;
- }
- vtbl.DestroyImageView = reinterpret_cast<PFN_vkDestroyImageView>(get_proc_addr(device, "vkDestroyImageView"));
- if (UNLIKELY(!vtbl.DestroyImageView)) {
- ALOGE("missing device proc: %s", "vkDestroyImageView");
- success = false;
- }
- vtbl.CreateShaderModule = reinterpret_cast<PFN_vkCreateShaderModule>(get_proc_addr(device, "vkCreateShaderModule"));
- if (UNLIKELY(!vtbl.CreateShaderModule)) {
- ALOGE("missing device proc: %s", "vkCreateShaderModule");
- success = false;
- }
- vtbl.DestroyShaderModule = reinterpret_cast<PFN_vkDestroyShaderModule>(get_proc_addr(device, "vkDestroyShaderModule"));
- if (UNLIKELY(!vtbl.DestroyShaderModule)) {
- ALOGE("missing device proc: %s", "vkDestroyShaderModule");
- success = false;
- }
- vtbl.CreatePipelineCache = reinterpret_cast<PFN_vkCreatePipelineCache>(get_proc_addr(device, "vkCreatePipelineCache"));
- if (UNLIKELY(!vtbl.CreatePipelineCache)) {
- ALOGE("missing device proc: %s", "vkCreatePipelineCache");
- success = false;
- }
- vtbl.DestroyPipelineCache = reinterpret_cast<PFN_vkDestroyPipelineCache>(get_proc_addr(device, "vkDestroyPipelineCache"));
- if (UNLIKELY(!vtbl.DestroyPipelineCache)) {
- ALOGE("missing device proc: %s", "vkDestroyPipelineCache");
- success = false;
- }
- vtbl.GetPipelineCacheData = reinterpret_cast<PFN_vkGetPipelineCacheData>(get_proc_addr(device, "vkGetPipelineCacheData"));
- if (UNLIKELY(!vtbl.GetPipelineCacheData)) {
- ALOGE("missing device proc: %s", "vkGetPipelineCacheData");
- success = false;
- }
- vtbl.MergePipelineCaches = reinterpret_cast<PFN_vkMergePipelineCaches>(get_proc_addr(device, "vkMergePipelineCaches"));
- if (UNLIKELY(!vtbl.MergePipelineCaches)) {
- ALOGE("missing device proc: %s", "vkMergePipelineCaches");
- success = false;
- }
- vtbl.CreateGraphicsPipelines = reinterpret_cast<PFN_vkCreateGraphicsPipelines>(get_proc_addr(device, "vkCreateGraphicsPipelines"));
- if (UNLIKELY(!vtbl.CreateGraphicsPipelines)) {
- ALOGE("missing device proc: %s", "vkCreateGraphicsPipelines");
- success = false;
- }
- vtbl.CreateComputePipelines = reinterpret_cast<PFN_vkCreateComputePipelines>(get_proc_addr(device, "vkCreateComputePipelines"));
- if (UNLIKELY(!vtbl.CreateComputePipelines)) {
- ALOGE("missing device proc: %s", "vkCreateComputePipelines");
- success = false;
- }
- vtbl.DestroyPipeline = reinterpret_cast<PFN_vkDestroyPipeline>(get_proc_addr(device, "vkDestroyPipeline"));
- if (UNLIKELY(!vtbl.DestroyPipeline)) {
- ALOGE("missing device proc: %s", "vkDestroyPipeline");
- success = false;
- }
- vtbl.CreatePipelineLayout = reinterpret_cast<PFN_vkCreatePipelineLayout>(get_proc_addr(device, "vkCreatePipelineLayout"));
- if (UNLIKELY(!vtbl.CreatePipelineLayout)) {
- ALOGE("missing device proc: %s", "vkCreatePipelineLayout");
- success = false;
- }
- vtbl.DestroyPipelineLayout = reinterpret_cast<PFN_vkDestroyPipelineLayout>(get_proc_addr(device, "vkDestroyPipelineLayout"));
- if (UNLIKELY(!vtbl.DestroyPipelineLayout)) {
- ALOGE("missing device proc: %s", "vkDestroyPipelineLayout");
- success = false;
- }
- vtbl.CreateSampler = reinterpret_cast<PFN_vkCreateSampler>(get_proc_addr(device, "vkCreateSampler"));
- if (UNLIKELY(!vtbl.CreateSampler)) {
- ALOGE("missing device proc: %s", "vkCreateSampler");
- success = false;
- }
- vtbl.DestroySampler = reinterpret_cast<PFN_vkDestroySampler>(get_proc_addr(device, "vkDestroySampler"));
- if (UNLIKELY(!vtbl.DestroySampler)) {
- ALOGE("missing device proc: %s", "vkDestroySampler");
- success = false;
- }
- vtbl.CreateDescriptorSetLayout = reinterpret_cast<PFN_vkCreateDescriptorSetLayout>(get_proc_addr(device, "vkCreateDescriptorSetLayout"));
- if (UNLIKELY(!vtbl.CreateDescriptorSetLayout)) {
- ALOGE("missing device proc: %s", "vkCreateDescriptorSetLayout");
- success = false;
- }
- vtbl.DestroyDescriptorSetLayout = reinterpret_cast<PFN_vkDestroyDescriptorSetLayout>(get_proc_addr(device, "vkDestroyDescriptorSetLayout"));
- if (UNLIKELY(!vtbl.DestroyDescriptorSetLayout)) {
- ALOGE("missing device proc: %s", "vkDestroyDescriptorSetLayout");
- success = false;
- }
- vtbl.CreateDescriptorPool = reinterpret_cast<PFN_vkCreateDescriptorPool>(get_proc_addr(device, "vkCreateDescriptorPool"));
- if (UNLIKELY(!vtbl.CreateDescriptorPool)) {
- ALOGE("missing device proc: %s", "vkCreateDescriptorPool");
- success = false;
- }
- vtbl.DestroyDescriptorPool = reinterpret_cast<PFN_vkDestroyDescriptorPool>(get_proc_addr(device, "vkDestroyDescriptorPool"));
- if (UNLIKELY(!vtbl.DestroyDescriptorPool)) {
- ALOGE("missing device proc: %s", "vkDestroyDescriptorPool");
- success = false;
- }
- vtbl.ResetDescriptorPool = reinterpret_cast<PFN_vkResetDescriptorPool>(get_proc_addr(device, "vkResetDescriptorPool"));
- if (UNLIKELY(!vtbl.ResetDescriptorPool)) {
- ALOGE("missing device proc: %s", "vkResetDescriptorPool");
- success = false;
- }
- vtbl.AllocateDescriptorSets = reinterpret_cast<PFN_vkAllocateDescriptorSets>(get_proc_addr(device, "vkAllocateDescriptorSets"));
- if (UNLIKELY(!vtbl.AllocateDescriptorSets)) {
- ALOGE("missing device proc: %s", "vkAllocateDescriptorSets");
- success = false;
- }
- vtbl.FreeDescriptorSets = reinterpret_cast<PFN_vkFreeDescriptorSets>(get_proc_addr(device, "vkFreeDescriptorSets"));
- if (UNLIKELY(!vtbl.FreeDescriptorSets)) {
- ALOGE("missing device proc: %s", "vkFreeDescriptorSets");
- success = false;
- }
- vtbl.UpdateDescriptorSets = reinterpret_cast<PFN_vkUpdateDescriptorSets>(get_proc_addr(device, "vkUpdateDescriptorSets"));
- if (UNLIKELY(!vtbl.UpdateDescriptorSets)) {
- ALOGE("missing device proc: %s", "vkUpdateDescriptorSets");
- success = false;
- }
- vtbl.CreateFramebuffer = reinterpret_cast<PFN_vkCreateFramebuffer>(get_proc_addr(device, "vkCreateFramebuffer"));
- if (UNLIKELY(!vtbl.CreateFramebuffer)) {
- ALOGE("missing device proc: %s", "vkCreateFramebuffer");
- success = false;
- }
- vtbl.DestroyFramebuffer = reinterpret_cast<PFN_vkDestroyFramebuffer>(get_proc_addr(device, "vkDestroyFramebuffer"));
- if (UNLIKELY(!vtbl.DestroyFramebuffer)) {
- ALOGE("missing device proc: %s", "vkDestroyFramebuffer");
- success = false;
- }
- vtbl.CreateRenderPass = reinterpret_cast<PFN_vkCreateRenderPass>(get_proc_addr(device, "vkCreateRenderPass"));
- if (UNLIKELY(!vtbl.CreateRenderPass)) {
- ALOGE("missing device proc: %s", "vkCreateRenderPass");
- success = false;
- }
- vtbl.DestroyRenderPass = reinterpret_cast<PFN_vkDestroyRenderPass>(get_proc_addr(device, "vkDestroyRenderPass"));
- if (UNLIKELY(!vtbl.DestroyRenderPass)) {
- ALOGE("missing device proc: %s", "vkDestroyRenderPass");
- success = false;
- }
- vtbl.GetRenderAreaGranularity = reinterpret_cast<PFN_vkGetRenderAreaGranularity>(get_proc_addr(device, "vkGetRenderAreaGranularity"));
- if (UNLIKELY(!vtbl.GetRenderAreaGranularity)) {
- ALOGE("missing device proc: %s", "vkGetRenderAreaGranularity");
- success = false;
- }
- vtbl.CreateCommandPool = reinterpret_cast<PFN_vkCreateCommandPool>(get_proc_addr(device, "vkCreateCommandPool"));
- if (UNLIKELY(!vtbl.CreateCommandPool)) {
- ALOGE("missing device proc: %s", "vkCreateCommandPool");
- success = false;
- }
- vtbl.DestroyCommandPool = reinterpret_cast<PFN_vkDestroyCommandPool>(get_proc_addr(device, "vkDestroyCommandPool"));
- if (UNLIKELY(!vtbl.DestroyCommandPool)) {
- ALOGE("missing device proc: %s", "vkDestroyCommandPool");
- success = false;
- }
- vtbl.ResetCommandPool = reinterpret_cast<PFN_vkResetCommandPool>(get_proc_addr(device, "vkResetCommandPool"));
- if (UNLIKELY(!vtbl.ResetCommandPool)) {
- ALOGE("missing device proc: %s", "vkResetCommandPool");
- success = false;
- }
- vtbl.AllocateCommandBuffers = reinterpret_cast<PFN_vkAllocateCommandBuffers>(get_proc_addr(device, "vkAllocateCommandBuffers"));
- if (UNLIKELY(!vtbl.AllocateCommandBuffers)) {
- ALOGE("missing device proc: %s", "vkAllocateCommandBuffers");
- success = false;
- }
- vtbl.FreeCommandBuffers = reinterpret_cast<PFN_vkFreeCommandBuffers>(get_proc_addr(device, "vkFreeCommandBuffers"));
- if (UNLIKELY(!vtbl.FreeCommandBuffers)) {
- ALOGE("missing device proc: %s", "vkFreeCommandBuffers");
- success = false;
- }
- vtbl.BeginCommandBuffer = reinterpret_cast<PFN_vkBeginCommandBuffer>(get_proc_addr(device, "vkBeginCommandBuffer"));
- if (UNLIKELY(!vtbl.BeginCommandBuffer)) {
- ALOGE("missing device proc: %s", "vkBeginCommandBuffer");
- success = false;
- }
- vtbl.EndCommandBuffer = reinterpret_cast<PFN_vkEndCommandBuffer>(get_proc_addr(device, "vkEndCommandBuffer"));
- if (UNLIKELY(!vtbl.EndCommandBuffer)) {
- ALOGE("missing device proc: %s", "vkEndCommandBuffer");
- success = false;
- }
- vtbl.ResetCommandBuffer = reinterpret_cast<PFN_vkResetCommandBuffer>(get_proc_addr(device, "vkResetCommandBuffer"));
- if (UNLIKELY(!vtbl.ResetCommandBuffer)) {
- ALOGE("missing device proc: %s", "vkResetCommandBuffer");
- success = false;
- }
- vtbl.CmdBindPipeline = reinterpret_cast<PFN_vkCmdBindPipeline>(get_proc_addr(device, "vkCmdBindPipeline"));
- if (UNLIKELY(!vtbl.CmdBindPipeline)) {
- ALOGE("missing device proc: %s", "vkCmdBindPipeline");
- success = false;
- }
- vtbl.CmdSetViewport = reinterpret_cast<PFN_vkCmdSetViewport>(get_proc_addr(device, "vkCmdSetViewport"));
- if (UNLIKELY(!vtbl.CmdSetViewport)) {
- ALOGE("missing device proc: %s", "vkCmdSetViewport");
- success = false;
- }
- vtbl.CmdSetScissor = reinterpret_cast<PFN_vkCmdSetScissor>(get_proc_addr(device, "vkCmdSetScissor"));
- if (UNLIKELY(!vtbl.CmdSetScissor)) {
- ALOGE("missing device proc: %s", "vkCmdSetScissor");
- success = false;
- }
- vtbl.CmdSetLineWidth = reinterpret_cast<PFN_vkCmdSetLineWidth>(get_proc_addr(device, "vkCmdSetLineWidth"));
- if (UNLIKELY(!vtbl.CmdSetLineWidth)) {
- ALOGE("missing device proc: %s", "vkCmdSetLineWidth");
- success = false;
- }
- vtbl.CmdSetDepthBias = reinterpret_cast<PFN_vkCmdSetDepthBias>(get_proc_addr(device, "vkCmdSetDepthBias"));
- if (UNLIKELY(!vtbl.CmdSetDepthBias)) {
- ALOGE("missing device proc: %s", "vkCmdSetDepthBias");
- success = false;
- }
- vtbl.CmdSetBlendConstants = reinterpret_cast<PFN_vkCmdSetBlendConstants>(get_proc_addr(device, "vkCmdSetBlendConstants"));
- if (UNLIKELY(!vtbl.CmdSetBlendConstants)) {
- ALOGE("missing device proc: %s", "vkCmdSetBlendConstants");
- success = false;
- }
- vtbl.CmdSetDepthBounds = reinterpret_cast<PFN_vkCmdSetDepthBounds>(get_proc_addr(device, "vkCmdSetDepthBounds"));
- if (UNLIKELY(!vtbl.CmdSetDepthBounds)) {
- ALOGE("missing device proc: %s", "vkCmdSetDepthBounds");
- success = false;
- }
- vtbl.CmdSetStencilCompareMask = reinterpret_cast<PFN_vkCmdSetStencilCompareMask>(get_proc_addr(device, "vkCmdSetStencilCompareMask"));
- if (UNLIKELY(!vtbl.CmdSetStencilCompareMask)) {
- ALOGE("missing device proc: %s", "vkCmdSetStencilCompareMask");
- success = false;
- }
- vtbl.CmdSetStencilWriteMask = reinterpret_cast<PFN_vkCmdSetStencilWriteMask>(get_proc_addr(device, "vkCmdSetStencilWriteMask"));
- if (UNLIKELY(!vtbl.CmdSetStencilWriteMask)) {
- ALOGE("missing device proc: %s", "vkCmdSetStencilWriteMask");
- success = false;
- }
- vtbl.CmdSetStencilReference = reinterpret_cast<PFN_vkCmdSetStencilReference>(get_proc_addr(device, "vkCmdSetStencilReference"));
- if (UNLIKELY(!vtbl.CmdSetStencilReference)) {
- ALOGE("missing device proc: %s", "vkCmdSetStencilReference");
- success = false;
- }
- vtbl.CmdBindDescriptorSets = reinterpret_cast<PFN_vkCmdBindDescriptorSets>(get_proc_addr(device, "vkCmdBindDescriptorSets"));
- if (UNLIKELY(!vtbl.CmdBindDescriptorSets)) {
- ALOGE("missing device proc: %s", "vkCmdBindDescriptorSets");
- success = false;
- }
- vtbl.CmdBindIndexBuffer = reinterpret_cast<PFN_vkCmdBindIndexBuffer>(get_proc_addr(device, "vkCmdBindIndexBuffer"));
- if (UNLIKELY(!vtbl.CmdBindIndexBuffer)) {
- ALOGE("missing device proc: %s", "vkCmdBindIndexBuffer");
- success = false;
- }
- vtbl.CmdBindVertexBuffers = reinterpret_cast<PFN_vkCmdBindVertexBuffers>(get_proc_addr(device, "vkCmdBindVertexBuffers"));
- if (UNLIKELY(!vtbl.CmdBindVertexBuffers)) {
- ALOGE("missing device proc: %s", "vkCmdBindVertexBuffers");
- success = false;
- }
- vtbl.CmdDraw = reinterpret_cast<PFN_vkCmdDraw>(get_proc_addr(device, "vkCmdDraw"));
- if (UNLIKELY(!vtbl.CmdDraw)) {
- ALOGE("missing device proc: %s", "vkCmdDraw");
- success = false;
- }
- vtbl.CmdDrawIndexed = reinterpret_cast<PFN_vkCmdDrawIndexed>(get_proc_addr(device, "vkCmdDrawIndexed"));
- if (UNLIKELY(!vtbl.CmdDrawIndexed)) {
- ALOGE("missing device proc: %s", "vkCmdDrawIndexed");
- success = false;
- }
- vtbl.CmdDrawIndirect = reinterpret_cast<PFN_vkCmdDrawIndirect>(get_proc_addr(device, "vkCmdDrawIndirect"));
- if (UNLIKELY(!vtbl.CmdDrawIndirect)) {
- ALOGE("missing device proc: %s", "vkCmdDrawIndirect");
- success = false;
- }
- vtbl.CmdDrawIndexedIndirect = reinterpret_cast<PFN_vkCmdDrawIndexedIndirect>(get_proc_addr(device, "vkCmdDrawIndexedIndirect"));
- if (UNLIKELY(!vtbl.CmdDrawIndexedIndirect)) {
- ALOGE("missing device proc: %s", "vkCmdDrawIndexedIndirect");
- success = false;
- }
- vtbl.CmdDispatch = reinterpret_cast<PFN_vkCmdDispatch>(get_proc_addr(device, "vkCmdDispatch"));
- if (UNLIKELY(!vtbl.CmdDispatch)) {
- ALOGE("missing device proc: %s", "vkCmdDispatch");
- success = false;
- }
- vtbl.CmdDispatchIndirect = reinterpret_cast<PFN_vkCmdDispatchIndirect>(get_proc_addr(device, "vkCmdDispatchIndirect"));
- if (UNLIKELY(!vtbl.CmdDispatchIndirect)) {
- ALOGE("missing device proc: %s", "vkCmdDispatchIndirect");
- success = false;
- }
- vtbl.CmdCopyBuffer = reinterpret_cast<PFN_vkCmdCopyBuffer>(get_proc_addr(device, "vkCmdCopyBuffer"));
- if (UNLIKELY(!vtbl.CmdCopyBuffer)) {
- ALOGE("missing device proc: %s", "vkCmdCopyBuffer");
- success = false;
- }
- vtbl.CmdCopyImage = reinterpret_cast<PFN_vkCmdCopyImage>(get_proc_addr(device, "vkCmdCopyImage"));
- if (UNLIKELY(!vtbl.CmdCopyImage)) {
- ALOGE("missing device proc: %s", "vkCmdCopyImage");
- success = false;
- }
- vtbl.CmdBlitImage = reinterpret_cast<PFN_vkCmdBlitImage>(get_proc_addr(device, "vkCmdBlitImage"));
- if (UNLIKELY(!vtbl.CmdBlitImage)) {
- ALOGE("missing device proc: %s", "vkCmdBlitImage");
- success = false;
- }
- vtbl.CmdCopyBufferToImage = reinterpret_cast<PFN_vkCmdCopyBufferToImage>(get_proc_addr(device, "vkCmdCopyBufferToImage"));
- if (UNLIKELY(!vtbl.CmdCopyBufferToImage)) {
- ALOGE("missing device proc: %s", "vkCmdCopyBufferToImage");
- success = false;
- }
- vtbl.CmdCopyImageToBuffer = reinterpret_cast<PFN_vkCmdCopyImageToBuffer>(get_proc_addr(device, "vkCmdCopyImageToBuffer"));
- if (UNLIKELY(!vtbl.CmdCopyImageToBuffer)) {
- ALOGE("missing device proc: %s", "vkCmdCopyImageToBuffer");
- success = false;
- }
- vtbl.CmdUpdateBuffer = reinterpret_cast<PFN_vkCmdUpdateBuffer>(get_proc_addr(device, "vkCmdUpdateBuffer"));
- if (UNLIKELY(!vtbl.CmdUpdateBuffer)) {
- ALOGE("missing device proc: %s", "vkCmdUpdateBuffer");
- success = false;
- }
- vtbl.CmdFillBuffer = reinterpret_cast<PFN_vkCmdFillBuffer>(get_proc_addr(device, "vkCmdFillBuffer"));
- if (UNLIKELY(!vtbl.CmdFillBuffer)) {
- ALOGE("missing device proc: %s", "vkCmdFillBuffer");
- success = false;
- }
- vtbl.CmdClearColorImage = reinterpret_cast<PFN_vkCmdClearColorImage>(get_proc_addr(device, "vkCmdClearColorImage"));
- if (UNLIKELY(!vtbl.CmdClearColorImage)) {
- ALOGE("missing device proc: %s", "vkCmdClearColorImage");
- success = false;
- }
- vtbl.CmdClearDepthStencilImage = reinterpret_cast<PFN_vkCmdClearDepthStencilImage>(get_proc_addr(device, "vkCmdClearDepthStencilImage"));
- if (UNLIKELY(!vtbl.CmdClearDepthStencilImage)) {
- ALOGE("missing device proc: %s", "vkCmdClearDepthStencilImage");
- success = false;
- }
- vtbl.CmdClearAttachments = reinterpret_cast<PFN_vkCmdClearAttachments>(get_proc_addr(device, "vkCmdClearAttachments"));
- if (UNLIKELY(!vtbl.CmdClearAttachments)) {
- ALOGE("missing device proc: %s", "vkCmdClearAttachments");
- success = false;
- }
- vtbl.CmdResolveImage = reinterpret_cast<PFN_vkCmdResolveImage>(get_proc_addr(device, "vkCmdResolveImage"));
- if (UNLIKELY(!vtbl.CmdResolveImage)) {
- ALOGE("missing device proc: %s", "vkCmdResolveImage");
- success = false;
- }
- vtbl.CmdSetEvent = reinterpret_cast<PFN_vkCmdSetEvent>(get_proc_addr(device, "vkCmdSetEvent"));
- if (UNLIKELY(!vtbl.CmdSetEvent)) {
- ALOGE("missing device proc: %s", "vkCmdSetEvent");
- success = false;
- }
- vtbl.CmdResetEvent = reinterpret_cast<PFN_vkCmdResetEvent>(get_proc_addr(device, "vkCmdResetEvent"));
- if (UNLIKELY(!vtbl.CmdResetEvent)) {
- ALOGE("missing device proc: %s", "vkCmdResetEvent");
- success = false;
- }
- vtbl.CmdWaitEvents = reinterpret_cast<PFN_vkCmdWaitEvents>(get_proc_addr(device, "vkCmdWaitEvents"));
- if (UNLIKELY(!vtbl.CmdWaitEvents)) {
- ALOGE("missing device proc: %s", "vkCmdWaitEvents");
- success = false;
- }
- vtbl.CmdPipelineBarrier = reinterpret_cast<PFN_vkCmdPipelineBarrier>(get_proc_addr(device, "vkCmdPipelineBarrier"));
- if (UNLIKELY(!vtbl.CmdPipelineBarrier)) {
- ALOGE("missing device proc: %s", "vkCmdPipelineBarrier");
- success = false;
- }
- vtbl.CmdBeginQuery = reinterpret_cast<PFN_vkCmdBeginQuery>(get_proc_addr(device, "vkCmdBeginQuery"));
- if (UNLIKELY(!vtbl.CmdBeginQuery)) {
- ALOGE("missing device proc: %s", "vkCmdBeginQuery");
- success = false;
- }
- vtbl.CmdEndQuery = reinterpret_cast<PFN_vkCmdEndQuery>(get_proc_addr(device, "vkCmdEndQuery"));
- if (UNLIKELY(!vtbl.CmdEndQuery)) {
- ALOGE("missing device proc: %s", "vkCmdEndQuery");
- success = false;
- }
- vtbl.CmdResetQueryPool = reinterpret_cast<PFN_vkCmdResetQueryPool>(get_proc_addr(device, "vkCmdResetQueryPool"));
- if (UNLIKELY(!vtbl.CmdResetQueryPool)) {
- ALOGE("missing device proc: %s", "vkCmdResetQueryPool");
- success = false;
- }
- vtbl.CmdWriteTimestamp = reinterpret_cast<PFN_vkCmdWriteTimestamp>(get_proc_addr(device, "vkCmdWriteTimestamp"));
- if (UNLIKELY(!vtbl.CmdWriteTimestamp)) {
- ALOGE("missing device proc: %s", "vkCmdWriteTimestamp");
- success = false;
- }
- vtbl.CmdCopyQueryPoolResults = reinterpret_cast<PFN_vkCmdCopyQueryPoolResults>(get_proc_addr(device, "vkCmdCopyQueryPoolResults"));
- if (UNLIKELY(!vtbl.CmdCopyQueryPoolResults)) {
- ALOGE("missing device proc: %s", "vkCmdCopyQueryPoolResults");
- success = false;
- }
- vtbl.CmdPushConstants = reinterpret_cast<PFN_vkCmdPushConstants>(get_proc_addr(device, "vkCmdPushConstants"));
- if (UNLIKELY(!vtbl.CmdPushConstants)) {
- ALOGE("missing device proc: %s", "vkCmdPushConstants");
- success = false;
- }
- vtbl.CmdBeginRenderPass = reinterpret_cast<PFN_vkCmdBeginRenderPass>(get_proc_addr(device, "vkCmdBeginRenderPass"));
- if (UNLIKELY(!vtbl.CmdBeginRenderPass)) {
- ALOGE("missing device proc: %s", "vkCmdBeginRenderPass");
- success = false;
- }
- vtbl.CmdNextSubpass = reinterpret_cast<PFN_vkCmdNextSubpass>(get_proc_addr(device, "vkCmdNextSubpass"));
- if (UNLIKELY(!vtbl.CmdNextSubpass)) {
- ALOGE("missing device proc: %s", "vkCmdNextSubpass");
- success = false;
- }
- vtbl.CmdEndRenderPass = reinterpret_cast<PFN_vkCmdEndRenderPass>(get_proc_addr(device, "vkCmdEndRenderPass"));
- if (UNLIKELY(!vtbl.CmdEndRenderPass)) {
- ALOGE("missing device proc: %s", "vkCmdEndRenderPass");
- success = false;
- }
- vtbl.CmdExecuteCommands = reinterpret_cast<PFN_vkCmdExecuteCommands>(get_proc_addr(device, "vkCmdExecuteCommands"));
- if (UNLIKELY(!vtbl.CmdExecuteCommands)) {
- ALOGE("missing device proc: %s", "vkCmdExecuteCommands");
- success = false;
- }
- vtbl.CreateSwapchainKHR = reinterpret_cast<PFN_vkCreateSwapchainKHR>(get_proc_addr(device, "vkCreateSwapchainKHR"));
- if (UNLIKELY(!vtbl.CreateSwapchainKHR)) {
- ALOGE("missing device proc: %s", "vkCreateSwapchainKHR");
- success = false;
- }
- vtbl.DestroySwapchainKHR = reinterpret_cast<PFN_vkDestroySwapchainKHR>(get_proc_addr(device, "vkDestroySwapchainKHR"));
- if (UNLIKELY(!vtbl.DestroySwapchainKHR)) {
- ALOGE("missing device proc: %s", "vkDestroySwapchainKHR");
- success = false;
- }
- vtbl.GetSwapchainImagesKHR = reinterpret_cast<PFN_vkGetSwapchainImagesKHR>(get_proc_addr(device, "vkGetSwapchainImagesKHR"));
- if (UNLIKELY(!vtbl.GetSwapchainImagesKHR)) {
- ALOGE("missing device proc: %s", "vkGetSwapchainImagesKHR");
- success = false;
- }
- vtbl.AcquireNextImageKHR = reinterpret_cast<PFN_vkAcquireNextImageKHR>(get_proc_addr(device, "vkAcquireNextImageKHR"));
- if (UNLIKELY(!vtbl.AcquireNextImageKHR)) {
- ALOGE("missing device proc: %s", "vkAcquireNextImageKHR");
- success = false;
- }
- vtbl.QueuePresentKHR = reinterpret_cast<PFN_vkQueuePresentKHR>(get_proc_addr(device, "vkQueuePresentKHR"));
- if (UNLIKELY(!vtbl.QueuePresentKHR)) {
- ALOGE("missing device proc: %s", "vkQueuePresentKHR");
- success = false;
- }
- vtbl.GetSwapchainGrallocUsageANDROID = reinterpret_cast<PFN_vkGetSwapchainGrallocUsageANDROID>(get_proc_addr(device, "vkGetSwapchainGrallocUsageANDROID"));
- if (UNLIKELY(!vtbl.GetSwapchainGrallocUsageANDROID)) {
- // TODO(jessehall): temporarily make this optional, until drivers have been updated
- // ALOGE("missing device proc: %s", "vkGetSwapchainGrallocUsageANDROID");
- ALOGW("missing device proc: %s", "vkGetSwapchainGrallocUsageANDROID");
- // success = false;
- }
- vtbl.AcquireImageANDROID = reinterpret_cast<PFN_vkAcquireImageANDROID>(get_proc_addr(device, "vkAcquireImageANDROID"));
- if (UNLIKELY(!vtbl.AcquireImageANDROID)) {
- // TODO(jessehall): temporarily make this optional, until drivers have been updated
- // ALOGE("missing device proc: %s", "vkImportNativeFenceANDROID");
- ALOGW("missing device proc: %s", "vkAcquireImageANDROID");
- // success = false;
- }
- vtbl.QueueSignalReleaseImageANDROID = reinterpret_cast<PFN_vkQueueSignalReleaseImageANDROID>(get_proc_addr(device, "vkQueueSignalReleaseImageANDROID"));
- if (UNLIKELY(!vtbl.QueueSignalReleaseImageANDROID)) {
- // TODO(jessehall): temporarily make this optional, until drivers have been updated
- // ALOGE("missing device proc: %s", "vkQueueSignalReleaseImageANDROID");
- ALOGW("missing device proc: %s", "vkQueueSignalReleaseImageANDROID");
- // success = false;
- }
- // TODO(jessehall): these are deprecated; remove when drivers have been updated
- vtbl.ImportNativeFenceANDROID = reinterpret_cast<PFN_vkImportNativeFenceANDROID>(get_proc_addr(device, "vkImportNativeFenceANDROID"));
- vtbl.QueueSignalNativeFenceANDROID = reinterpret_cast<PFN_vkQueueSignalNativeFenceANDROID>(get_proc_addr(device, "vkQueueSignalNativeFenceANDROID"));
- if (!((!vtbl.AcquireImageANDROID && !vtbl.QueueSignalReleaseImageANDROID && vtbl.ImportNativeFenceANDROID && vtbl.QueueSignalNativeFenceANDROID) ||
- (vtbl.AcquireImageANDROID && vtbl.QueueSignalReleaseImageANDROID && !vtbl.ImportNativeFenceANDROID && !vtbl.QueueSignalNativeFenceANDROID))) {
- ALOGE("driver doesn't support exactly one of old- or new-style VK_ANDROID_native_buffer commands");
- success = false;
- }
- // clang-format on
- return success;
-}
-
-} // namespace vulkan
+++ /dev/null
-{{/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */}}
-
-{{Include "../api/templates/vulkan_common.tmpl"}}
-{{Global "clang-format" (Strings "clang-format" "-style=file")}}
-{{Macro "DefineGlobals" $}}
-{{$ | Macro "get_proc_addr.cpp" | Format (Global "clang-format") | Write "get_proc_addr.cpp"}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Entry point
--------------------------------------------------------------------------------
-*/}}
-{{define "get_proc_addr.cpp"}}
-/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-¶
-// This file is generated. Do not edit manually!
-// To regenerate: $ apic template ../api/vulkan.api get_proc_addr.cpp.tmpl
-// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
-¶
-#include <algorithm>
-#include <log/log.h>
-#include "loader.h"
-using namespace vulkan;
-¶
-#define UNLIKELY(expr) __builtin_expect((expr), 0)
-¶
-namespace {
-¶
-struct NameProcEntry {
- const char* name;
- PFN_vkVoidFunction proc;
-};
-¶
-struct NameOffsetEntry {
- const char* name;
- size_t offset;
-};
-¶
-template <typename TEntry, size_t N>
-const TEntry* FindProcEntry(const TEntry (&table)[N], const char* name) {
- auto entry = std::lower_bound(
- table, table + N, name,
- [](const TEntry& e, const char* n) { return strcmp(e.name, n) < 0; });
- if (entry != (table + N) && strcmp(entry->name, name) == 0)
- return entry;
- return nullptr;
-}
-¶
-const NameProcEntry kInstanceProcTbl[] = {«
- // clang-format off
- {{range $f := SortBy (AllCommands $) "FunctionName"}}
- {{if and (Macro "IsDispatched" $f) (eq (Macro "Vtbl" $f) "Instance")}}
- {"{{Macro "FunctionName" $f}}", reinterpret_cast<PFN_vkVoidFunction>({{Macro "FunctionName" $f}})},
- {{end}}
- {{end}}
- // clang-format on
-»};
-¶
-const NameProcEntry kDeviceProcTbl[] = {«
- // clang-format off
- {{range $f := SortBy (AllCommands $) "FunctionName"}}
- {{if and (Macro "IsDispatched" $f) (eq (Macro "Vtbl" $f) "Device")}}
- {"{{Macro "FunctionName" $f}}", reinterpret_cast<PFN_vkVoidFunction>({{Macro "FunctionName" $f}})},
- {{end}}
- {{end}}
- // clang-format on
-»};
-¶
-const NameOffsetEntry kInstanceOffsetTbl[] = {«
- // clang-format off
- {{range $f := SortBy (AllCommands $) "FunctionName"}}
- {{if and (Macro "IsDispatched" $f) (eq (Macro "Vtbl" $f) "Instance")}}
- {"{{Macro "FunctionName" $f}}", offsetof(InstanceVtbl, {{TrimPrefix "vk" (Macro "FunctionName" $f)}})},
- {{end}}
- {{end}}
- // clang-format on
-»};
-¶
-const NameOffsetEntry kDeviceOffsetTbl[] = {«
- // clang-format off
- {{range $f := SortBy (AllCommands $) "FunctionName"}}
- {{if and (Macro "IsDispatched" $f) (eq (Macro "Vtbl" $f) "Device")}}
- {"{{Macro "FunctionName" $f}}", offsetof(DeviceVtbl, {{TrimPrefix "vk" (Macro "FunctionName" $f)}})},
- {{end}}
- {{end}}
- // clang-format on
-»};
-¶
-} // namespace
-¶
-namespace vulkan {
-¶
-PFN_vkVoidFunction GetGlobalInstanceProcAddr(const char* name) {
- const NameProcEntry* entry = FindProcEntry(kInstanceProcTbl, name);
- if (entry)
- return entry->proc;
- // vkGetDeviceProcAddr must be available at the global/instance level for bootstrapping
- if (strcmp(name, "vkGetDeviceProcAddr") == 0)
- return reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceProcAddr);
- return nullptr;
-}
-¶
-PFN_vkVoidFunction GetGlobalDeviceProcAddr(const char* name) {
- const NameProcEntry* entry = FindProcEntry(kDeviceProcTbl, name);
- if (entry)
- return entry->proc;
- return nullptr;
-}
-¶
-PFN_vkVoidFunction GetSpecificInstanceProcAddr(const InstanceVtbl* vtbl,
- const char* name) {
- size_t offset;
- const NameOffsetEntry* entry = FindProcEntry(kInstanceOffsetTbl, name);
- if (entry)
- offset = entry->offset;
- else
- return nullptr;
- const unsigned char* base = reinterpret_cast<const unsigned char*>(vtbl);
- return *reinterpret_cast<PFN_vkVoidFunction*>(
- const_cast<unsigned char*>(base) + offset);
-}
-¶
-PFN_vkVoidFunction GetSpecificDeviceProcAddr(const DeviceVtbl* vtbl,
- const char* name) {
- size_t offset;
- const NameOffsetEntry* entry = FindProcEntry(kDeviceOffsetTbl, name);
- if (entry)
- offset = entry->offset;
- else
- return nullptr;
- const unsigned char* base = reinterpret_cast<const unsigned char*>(vtbl);
- return *reinterpret_cast<PFN_vkVoidFunction*>(
- const_cast<unsigned char*>(base) + offset);
-}
-¶
-bool LoadInstanceVtbl(VkInstance instance,
- VkInstance instance_next,
- PFN_vkGetInstanceProcAddr get_proc_addr,
- InstanceVtbl& vtbl) {«
- bool success = true;
- // clang-format off
- vtbl.GetInstanceProcAddr = reinterpret_cast<PFN_vkGetInstanceProcAddr>(get_proc_addr(instance_next, "vkGetInstanceProcAddr"));
- if (UNLIKELY(!vtbl.GetInstanceProcAddr)) {
- ALOGE("missing instance proc: %s", "vkGetInstanceProcAddr");
- success = false;
- }
- vtbl.CreateInstance = reinterpret_cast<PFN_vkCreateInstance>(get_proc_addr(instance, "vkCreateInstance"));
- if (UNLIKELY(!vtbl.CreateInstance)) {
- // This is allowed to fail as the driver doesn't have to return vkCreateInstance when given an instance
- }
- {{range $f := AllCommands $}}
- {{if eq (Macro "Vtbl" $f) "Instance"}}
- {{if not (eq (Macro "FunctionName" $f) "vkGetInstanceProcAddr")}}
- {{if not (GetAnnotation $f "extension")}}
- vtbl.{{TrimPrefix "vk" (Macro "FunctionName" $f)}} = §
- reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
- get_proc_addr(instance, "{{Macro "FunctionName" $f}}"));
- if (UNLIKELY(!vtbl.{{TrimPrefix "vk" (Macro "FunctionName" $f)}})) {
- ALOGE("missing instance proc: %s", "{{Macro "FunctionName" $f}}");
- success = false;
- }
- {{end}}
- {{end}}
- {{end}}
- {{end}}
- {{range $f := AllCommands $}}
- {{if eq (Macro "Vtbl" $f) "Instance"}}
- {{if and (GetAnnotation $f "extension") (Macro "IsDispatched" $f)}}
- vtbl.{{TrimPrefix "vk" (Macro "FunctionName" $f)}} = §
- reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
- get_proc_addr(instance, "{{Macro "FunctionName" $f}}"));
- {{end}}
- {{end}}
- {{end}}
- // clang-format on
- return success;
-»}
-¶
-bool LoadDeviceVtbl(VkDevice device,
- VkDevice device_next,
- PFN_vkGetDeviceProcAddr get_proc_addr,
- DeviceVtbl& vtbl) {«
- bool success = true;
- // clang-format off
- vtbl.GetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(get_proc_addr(device_next, "vkGetDeviceProcAddr"));
- if (UNLIKELY(!vtbl.GetDeviceProcAddr)) {
- ALOGE("missing device proc: %s", "vkGetDeviceProcAddr");
- success = false;
- }
- {{range $f := AllCommands $}}
- {{if and (eq (Macro "Vtbl" $f) "Device") (not (eq (Macro "FunctionName" $f) "vkGetDeviceProcAddr"))}}
- {{if not (GetAnnotation $f "extension")}}
- vtbl.{{TrimPrefix "vk" (Macro "FunctionName" $f)}} = §
- reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
- get_proc_addr(device, "{{Macro "FunctionName" $f}}"));
- if (UNLIKELY(!vtbl.{{TrimPrefix "vk" (Macro "FunctionName" $f)}})) {
- ALOGE("missing device proc: %s", "{{Macro "FunctionName" $f}}");
- success = false;
- }
- {{end}}
- {{end}}
- {{end}}
- {{range $f := AllCommands $}}
- {{if eq (Macro "Vtbl" $f) "Device"}}
- {{if and (GetAnnotation $f "extension") (Macro "IsDispatched" $f)}}
- vtbl.{{TrimPrefix "vk" (Macro "FunctionName" $f)}} = §
- reinterpret_cast<{{Macro "FunctionPtrName" $f}}>(§
- get_proc_addr(device, "{{Macro "FunctionName" $f}}"));
- if (UNLIKELY(!vtbl.{{TrimPrefix "vk" (Macro "FunctionName" $f)}})) {
- ALOGE("missing device proc: %s", "{{Macro "FunctionName" $f}}");
- success = false;
- }
- {{end}}
- {{end}}
- {{end}}
- vtbl.GetSwapchainGrallocUsageANDROID = reinterpret_cast<PFN_vkGetSwapchainGrallocUsageANDROID>(get_proc_addr(device, "vkGetSwapchainGrallocUsageANDROID"));
- if (UNLIKELY(!vtbl.GetSwapchainGrallocUsageANDROID)) {
- // TODO(jessehall): temporarily make this optional, until drivers have been updated
- // ALOGE("missing device proc: %s", "vkGetSwapchainGrallocUsageANDROID");
- ALOGW("missing device proc: %s", "vkGetSwapchainGrallocUsageANDROID");
- // success = false;
- }
- vtbl.AcquireImageANDROID = reinterpret_cast<PFN_vkAcquireImageANDROID>(get_proc_addr(device, "vkAcquireImageANDROID"));
- if (UNLIKELY(!vtbl.AcquireImageANDROID)) {
- // TODO(jessehall): temporarily make this optional, until drivers have been updated
- // ALOGE("missing device proc: %s", "vkImportNativeFenceANDROID");
- ALOGW("missing device proc: %s", "vkAcquireImageANDROID");
- // success = false;
- }
- vtbl.QueueSignalReleaseImageANDROID = reinterpret_cast<PFN_vkQueueSignalReleaseImageANDROID>(get_proc_addr(device, "vkQueueSignalReleaseImageANDROID"));
- if (UNLIKELY(!vtbl.QueueSignalReleaseImageANDROID)) {
- // TODO(jessehall): temporarily make this optional, until drivers have been updated
- // ALOGE("missing device proc: %s", "vkQueueSignalReleaseImageANDROID");
- ALOGW("missing device proc: %s", "vkQueueSignalReleaseImageANDROID");
- // success = false;
- }
- // TODO(jessehall): these are deprecated; remove when drivers have been updated
- vtbl.ImportNativeFenceANDROID = reinterpret_cast<PFN_vkImportNativeFenceANDROID>(get_proc_addr(device, "vkImportNativeFenceANDROID"));
- vtbl.QueueSignalNativeFenceANDROID = reinterpret_cast<PFN_vkQueueSignalNativeFenceANDROID>(get_proc_addr(device, "vkQueueSignalNativeFenceANDROID"));
- if (!((!vtbl.AcquireImageANDROID && !vtbl.QueueSignalReleaseImageANDROID && vtbl.ImportNativeFenceANDROID && vtbl.QueueSignalNativeFenceANDROID) ||
- (vtbl.AcquireImageANDROID && vtbl.QueueSignalReleaseImageANDROID && !vtbl.ImportNativeFenceANDROID && !vtbl.QueueSignalNativeFenceANDROID))) {
- ALOGE("driver doesn't support exactly one of old- or new-style VK_ANDROID_native_buffer commands");
- success = false;
- }
- // clang-format on
- return success;
-»}
-¶
-} // namespace vulkan
-¶
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- This function emits nil for extension entrypoints that should not be
- included in dispatch tables, "true" otherwise. Extensions that are ony used
- directly between the loader and driver, or that aren't supported on Android
- at all, should be excluded from dispatch.
--------------------------------------------------------------------------------
-*/}}
-{{define "IsUnsupportedExtension"}}
- {{$ext := index $.Arguments 0}}
- {{ if eq $ext "VK_KHR_display"}}true
- {{else if eq $ext "VK_KHR_display_swapchain"}}true
- {{else if eq $ext "VK_KHR_xlib_surface"}}true
- {{else if eq $ext "VK_KHR_xcb_surface"}}true
- {{else if eq $ext "VK_KHR_wayland_surface"}}true
- {{else if eq $ext "VK_KHR_mir_surface"}}true
- {{else if eq $ext "VK_KHR_win32_surface"}}true
- {{end}}
-{{end}}
-
-{{define "IsDispatched"}}
- {{AssertType $ "Function"}}
- {{$ext := GetAnnotation $ "extension"}}
- {{if not $ext}}true
- {{else if not (Macro "IsUnsupportedExtension" $ext)}}true
- {{end}}
-{{end}}
namespace {
+// Define Handle typedef to be void* as returned from dlopen.
+typedef void* SharedLibraryHandle;
+
// These definitions are taken from the LunarG Vulkan Loader. They are used to
// enforce compatability between the Loader and Layers.
typedef void* (*PFN_vkGetProcAddr)(void* obj, const char* pName);
void* base_object;
} VkLayerLinkedListElem;
-// Define Handle typedef to be void* as returned from dlopen.
-typedef void* SharedLibraryHandle;
+// ----------------------------------------------------------------------------
// Standard-library allocator that delegates to VkAllocationCallbacks.
//
template <class Key,
class T,
class Hash = std::hash<Key>,
- class Pred = std::equal_to<Key> >
+ class Pred = std::equal_to<Key>>
using UnorderedMap =
std::unordered_map<Key,
T,
Hash,
Pred,
- CallbackAllocator<std::pair<const Key, T> > >;
+ CallbackAllocator<std::pair<const Key, T>>>;
template <class T>
-using Vector = std::vector<T, CallbackAllocator<T> >;
-
-typedef std::basic_string<char,
- std::char_traits<char>,
- CallbackAllocator<char> > String;
+using Vector = std::vector<T, CallbackAllocator<T>>;
-} // namespace
-
-// -----------------------------------------------------------------------------
+typedef std::basic_string<char, std::char_traits<char>, CallbackAllocator<char>>
+ String;
-namespace {
+// ----------------------------------------------------------------------------
struct LayerData {
String path;
typedef UnorderedMap<String, LayerData>::iterator LayerMapIterator;
-} // namespace
-
-struct VkInstance_T {
- VkInstance_T(const VkAllocationCallbacks* alloc_callbacks)
- : vtbl(&vtbl_storage),
- alloc(alloc_callbacks),
- num_physical_devices(0),
- layers(CallbackAllocator<std::pair<String, LayerData> >(alloc)),
- active_layers(CallbackAllocator<String>(alloc)) {
- pthread_mutex_init(&layer_lock, 0);
- memset(&vtbl_storage, 0, sizeof(vtbl_storage));
- memset(physical_devices, 0, sizeof(physical_devices));
- memset(&drv.vtbl, 0, sizeof(drv.vtbl));
- drv.GetDeviceProcAddr = nullptr;
- drv.num_physical_devices = 0;
- }
-
- ~VkInstance_T() { pthread_mutex_destroy(&layer_lock); }
-
- InstanceVtbl* vtbl;
- InstanceVtbl vtbl_storage;
-
- const VkAllocationCallbacks* alloc;
- uint32_t num_physical_devices;
- VkPhysicalDevice physical_devices[kMaxPhysicalDevices];
-
- pthread_mutex_t layer_lock;
- // Map of layer names to layer data
- UnorderedMap<String, LayerData> layers;
- // Vector of layers active for this instance
- Vector<LayerMapIterator> active_layers;
- VkDbgMsgCallback message;
-
- struct Driver {
- // Pointers to driver entry points. Used explicitly by the loader; not
- // set as the dispatch table for any objects.
- InstanceVtbl vtbl;
-
- // Pointer to the driver's get_device_proc_addr, must be valid for any
- // of the driver's physical devices. Not part of the InstanceVtbl since
- // it's not an Instance/PhysicalDevice function.
- PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
-
- // Number of physical devices owned by this driver.
- uint32_t num_physical_devices;
- } drv; // may eventually be an array
-};
-
-// -----------------------------------------------------------------------------
-
-namespace {
-
-typedef VkInstance_T Instance;
-
-struct Device {
- Device(Instance* instance_input)
- : instance(instance_input),
- active_layers(CallbackAllocator<LayerMapIterator>(instance->alloc)) {
- memset(&vtbl_storage, 0, sizeof(vtbl_storage));
- vtbl_storage.device = this;
- }
- DeviceVtbl vtbl_storage;
- Instance* instance;
- // Vector of layers active for this device
- Vector<LayerMapIterator> active_layers;
-};
-
-// -----------------------------------------------------------------------------
-// Utility Code
-
-inline const InstanceVtbl* GetVtbl(VkPhysicalDevice physicalDevice) {
- return *reinterpret_cast<InstanceVtbl**>(physicalDevice);
-}
-
-inline const DeviceVtbl* GetVtbl(VkDevice device) {
- return *reinterpret_cast<DeviceVtbl**>(device);
-}
-inline const DeviceVtbl* GetVtbl(VkQueue queue) {
- return *reinterpret_cast<DeviceVtbl**>(queue);
-}
+// ----------------------------------------------------------------------------
VKAPI_ATTR void* DefaultAllocate(void*,
size_t size,
.pfnFree = DefaultFree,
};
+// ----------------------------------------------------------------------------
+
hwvulkan_device_t* g_hwdevice;
bool EnsureInitialized() {
static std::once_flag once_flag;
return module != nullptr && g_hwdevice != nullptr;
}
+// -----------------------------------------------------------------------------
+
+struct Instance {
+ Instance(const VkAllocationCallbacks* alloc_callbacks)
+ : dispatch_ptr(&dispatch),
+ handle(reinterpret_cast<VkInstance>(&dispatch_ptr)),
+ get_instance_proc_addr(nullptr),
+ alloc(alloc_callbacks),
+ num_physical_devices(0),
+ layers(CallbackAllocator<std::pair<String, LayerData>>(alloc)),
+ active_layers(CallbackAllocator<String>(alloc)),
+ message(VK_NULL_HANDLE) {
+ memset(&dispatch, 0, sizeof(dispatch));
+ memset(physical_devices, 0, sizeof(physical_devices));
+ pthread_mutex_init(&layer_lock, 0);
+ drv.instance = VK_NULL_HANDLE;
+ memset(&drv.dispatch, 0, sizeof(drv.dispatch));
+ drv.num_physical_devices = 0;
+ }
+
+ ~Instance() { pthread_mutex_destroy(&layer_lock); }
+
+ const InstanceDispatchTable* dispatch_ptr;
+ const VkInstance handle;
+ InstanceDispatchTable dispatch;
+
+ // TODO(jessehall): Only needed by GetInstanceProcAddr_Top for
+ // vkDbg*MessageCallback. Points to the outermost layer's function. Remove
+ // once the DEBUG_CALLBACK is integrated into the API file.
+ PFN_vkGetInstanceProcAddr get_instance_proc_addr;
+
+ const VkAllocationCallbacks* alloc;
+ uint32_t num_physical_devices;
+ VkPhysicalDevice physical_devices[kMaxPhysicalDevices];
+
+ pthread_mutex_t layer_lock;
+ // Map of layer names to layer data
+ UnorderedMap<String, LayerData> layers;
+ // Vector of layers active for this instance
+ Vector<LayerMapIterator> active_layers;
+ VkDbgMsgCallback message;
+
+ struct {
+ VkInstance instance;
+ DriverDispatchTable dispatch;
+ uint32_t num_physical_devices;
+ } drv; // may eventually be an array
+};
+
+struct Device {
+ Device(Instance* instance_)
+ : instance(instance_),
+ active_layers(CallbackAllocator<LayerMapIterator>(instance->alloc)) {
+ memset(&dispatch, 0, sizeof(dispatch));
+ }
+ DeviceDispatchTable dispatch;
+ Instance* instance;
+ PFN_vkGetDeviceProcAddr get_device_proc_addr;
+ // Vector of layers active for this device
+ Vector<LayerMapIterator> active_layers;
+};
+
+template <typename THandle>
+struct HandleTraits {};
+template <>
+struct HandleTraits<VkInstance> {
+ typedef Instance LoaderObjectType;
+};
+template <>
+struct HandleTraits<VkPhysicalDevice> {
+ typedef Instance LoaderObjectType;
+};
+template <>
+struct HandleTraits<VkDevice> {
+ typedef Device LoaderObjectType;
+};
+template <>
+struct HandleTraits<VkQueue> {
+ typedef Device LoaderObjectType;
+};
+template <>
+struct HandleTraits<VkCommandBuffer> {
+ typedef Device LoaderObjectType;
+};
+
+template <typename THandle>
+typename HandleTraits<THandle>::LoaderObjectType& GetDispatchParent(
+ THandle handle) {
+ // TODO(jessehall): Make Instance and Device POD types (by removing the
+ // non-default constructors), so that offsetof is actually legal to use.
+ // The specific case we're using here is safe in gcc/clang (and probably
+ // most other C++ compilers), but isn't guaranteed by C++.
+ typedef typename HandleTraits<THandle>::LoaderObjectType ObjectType;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Winvalid-offsetof"
+ const size_t kDispatchOffset = offsetof(ObjectType, dispatch);
+#pragma clang diagnostic pop
+
+ const auto& dispatch = GetDispatchTable(handle);
+ uintptr_t dispatch_addr = reinterpret_cast<uintptr_t>(&dispatch);
+ uintptr_t object_addr = dispatch_addr - kDispatchOffset;
+ return *reinterpret_cast<ObjectType*>(object_addr);
+}
+
+// -----------------------------------------------------------------------------
+
void DestroyDevice(Device* device) {
const VkAllocationCallbacks* alloc = device->instance->alloc;
device->~Device();
object->active_layers.push_back(element);
}
-void DeactivateLayer(Instance* instance,
+void DeactivateLayer(Instance& instance,
Vector<LayerMapIterator>::iterator& element) {
LayerMapIterator& layer_map_data = *element;
LayerData& layer_data = layer_map_data->second;
- pthread_mutex_lock(&instance->layer_lock);
+ pthread_mutex_lock(&instance.layer_lock);
layer_data.ref_count--;
if (!layer_data.ref_count) {
dlclose(layer_data.handle);
}
- pthread_mutex_unlock(&instance->layer_lock);
+ pthread_mutex_unlock(&instance.layer_lock);
}
struct InstanceNamesPair {
}
template <class TInfo, class TObject>
-VkResult ActivateAllLayers(TInfo create_info, Instance* instance, TObject* object) {
+VkResult ActivateAllLayers(TInfo create_info,
+ Instance* instance,
+ TObject* object) {
ALOG_ASSERT(create_info->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO ||
create_info->sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
"Cannot activate layers for unknown object %p", object);
auto element = instance->layers.find(layer_name);
if (element == instance->layers.end()) {
ALOGE("requested %s layer '%s' not present",
- create_info->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO ?
- "instance" : "device",
- layer_name.c_str());
+ create_info->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
+ ? "instance"
+ : "device",
+ layer_name.c_str());
return VK_ERROR_LAYER_NOT_PRESENT;
} else {
ActivateLayer(object, instance, layer_name);
return VK_SUCCESS;
}
-VKAPI_ATTR PFN_vkVoidFunction
-GetLayerDeviceProcAddr(VkDevice device, const char* name) {
- // The static_casts are used to ensure that our function actually
- // matches the API function prototype. Otherwise, if the API function
- // prototype changes (only a problem during API development), the compiler
- // has no way of knowing that the function is supposed to match the
- // prototype, so won't warn us if they don't.
- if (strcmp(name, "vkGetDeviceProcAddr") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkGetDeviceProcAddr>(GetLayerDeviceProcAddr));
- }
- if (strcmp(name, "vkCreateDevice") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(Noop);
- }
- // WSI extensions are not in the driver so return the loader functions
- if (strcmp(name, "vkCreateSwapchainKHR") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkCreateSwapchainKHR>(CreateSwapchainKHR));
- }
- if (strcmp(name, "vkDestroySwapchainKHR") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkDestroySwapchainKHR>(DestroySwapchainKHR));
- }
- if (strcmp(name, "vkGetSwapchainImagesKHR") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkGetSwapchainImagesKHR>(GetSwapchainImagesKHR));
- }
- if (strcmp(name, "vkAcquireNextImageKHR") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkAcquireNextImageKHR>(AcquireNextImageKHR));
- }
- if (strcmp(name, "vkQueuePresentKHR") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkQueuePresentKHR>(QueuePresentKHR));
- }
- if (!device)
- return GetGlobalDeviceProcAddr(name);
- Device* loader_device = reinterpret_cast<Device*>(GetVtbl(device)->device);
- return loader_device->instance->drv.GetDeviceProcAddr(device, name);
-}
+} // anonymous namespace
+
+namespace vulkan {
// -----------------------------------------------------------------------------
// "Bottom" functions. These are called at the end of the instance dispatch
// chain.
-VKAPI_ATTR
-void DestroyInstanceBottom(VkInstance instance,
- const VkAllocationCallbacks* allocator) {
- // These checks allow us to call DestroyInstanceBottom from any error path
- // in CreateInstanceBottom, before the driver instance is fully initialized.
- if (instance->drv.vtbl.instance != VK_NULL_HANDLE &&
- instance->drv.vtbl.DestroyInstance) {
- instance->drv.vtbl.DestroyInstance(instance->drv.vtbl.instance,
- allocator);
- }
- if (instance->message) {
- PFN_vkDbgDestroyMsgCallback DebugDestroyMessageCallback;
- DebugDestroyMessageCallback =
- reinterpret_cast<PFN_vkDbgDestroyMsgCallback>(
- vkGetInstanceProcAddr(instance, "vkDbgDestroyMsgCallback"));
- DebugDestroyMessageCallback(instance, instance->message);
- }
- for (auto it = instance->active_layers.begin();
- it != instance->active_layers.end(); ++it) {
- DeactivateLayer(instance, it);
- }
- const VkAllocationCallbacks* alloc = instance->alloc;
- instance->~VkInstance_T();
- alloc->pfnFree(alloc->pUserData, instance);
-}
-
-VKAPI_ATTR
-VkResult CreateInstanceBottom(const VkInstanceCreateInfo* create_info,
- const VkAllocationCallbacks* allocator,
- VkInstance* instance_ptr) {
- Instance* instance = *instance_ptr;
+VkResult CreateInstance_Bottom(const VkInstanceCreateInfo* create_info,
+ const VkAllocationCallbacks* allocator,
+ VkInstance* vkinstance) {
+ Instance& instance = GetDispatchParent(*vkinstance);
VkResult result;
- result = g_hwdevice->CreateInstance(create_info, instance->alloc,
- &instance->drv.vtbl.instance);
+ result = g_hwdevice->CreateInstance(create_info, instance.alloc,
+ &instance.drv.instance);
if (result != VK_SUCCESS) {
- DestroyInstanceBottom(instance, allocator);
+ DestroyInstance_Bottom(instance.handle, allocator);
return result;
}
- if (!LoadInstanceVtbl(
- instance->drv.vtbl.instance, instance->drv.vtbl.instance,
- g_hwdevice->GetInstanceProcAddr, instance->drv.vtbl)) {
- DestroyInstanceBottom(instance, allocator);
- return VK_ERROR_INITIALIZATION_FAILED;
- }
-
- // vkGetDeviceProcAddr has a bootstrapping problem. We require that it be
- // queryable from the Instance, and that the resulting function work for any
- // VkDevice created from the instance.
- instance->drv.GetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(
- g_hwdevice->GetInstanceProcAddr(instance->drv.vtbl.instance,
- "vkGetDeviceProcAddr"));
- if (!instance->drv.GetDeviceProcAddr) {
- ALOGE("missing instance proc: \"%s\"", "vkGetDeviceProcAddr");
- DestroyInstanceBottom(instance, allocator);
+ if (!LoadDriverDispatchTable(instance.drv.instance,
+ g_hwdevice->GetInstanceProcAddr,
+ instance.drv.dispatch)) {
+ DestroyInstance_Bottom(instance.handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
- hwvulkan_dispatch_t* dispatch =
- reinterpret_cast<hwvulkan_dispatch_t*>(instance->drv.vtbl.instance);
- if (dispatch->magic == HWVULKAN_DISPATCH_MAGIC) {
- // Skip setting dispatch->vtbl on the driver instance handle, since we
- // never intentionally call through it; we go through Instance::drv.vtbl
- // instead.
+ hwvulkan_dispatch_t* drv_dispatch =
+ reinterpret_cast<hwvulkan_dispatch_t*>(instance.drv.instance);
+ if (drv_dispatch->magic == HWVULKAN_DISPATCH_MAGIC) {
+ // Skip setting drv_dispatch->vtbl, since we never call through it;
+ // we go through instance.drv.dispatch instead.
} else {
ALOGE("invalid VkInstance dispatch magic: 0x%" PRIxPTR,
- dispatch->magic);
- DestroyInstanceBottom(instance, allocator);
+ drv_dispatch->magic);
+ DestroyInstance_Bottom(instance.handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
uint32_t num_physical_devices = 0;
- result = instance->drv.vtbl.EnumeratePhysicalDevices(
- instance->drv.vtbl.instance, &num_physical_devices, nullptr);
+ result = instance.drv.dispatch.EnumeratePhysicalDevices(
+ instance.drv.instance, &num_physical_devices, nullptr);
if (result != VK_SUCCESS) {
- DestroyInstanceBottom(instance, allocator);
+ DestroyInstance_Bottom(instance.handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
num_physical_devices = std::min(num_physical_devices, kMaxPhysicalDevices);
- result = instance->drv.vtbl.EnumeratePhysicalDevices(
- instance->drv.vtbl.instance, &num_physical_devices,
- instance->physical_devices);
+ result = instance.drv.dispatch.EnumeratePhysicalDevices(
+ instance.drv.instance, &num_physical_devices,
+ instance.physical_devices);
if (result != VK_SUCCESS) {
- DestroyInstanceBottom(instance, allocator);
+ DestroyInstance_Bottom(instance.handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
for (uint32_t i = 0; i < num_physical_devices; i++) {
- dispatch = reinterpret_cast<hwvulkan_dispatch_t*>(
- instance->physical_devices[i]);
- if (dispatch->magic != HWVULKAN_DISPATCH_MAGIC) {
+ hwvulkan_dispatch_t* pdev_dispatch =
+ reinterpret_cast<hwvulkan_dispatch_t*>(
+ instance.physical_devices[i]);
+ if (pdev_dispatch->magic != HWVULKAN_DISPATCH_MAGIC) {
ALOGE("invalid VkPhysicalDevice dispatch magic: 0x%" PRIxPTR,
- dispatch->magic);
- DestroyInstanceBottom(instance, allocator);
+ pdev_dispatch->magic);
+ DestroyInstance_Bottom(instance.handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
- dispatch->vtbl = instance->vtbl;
+ pdev_dispatch->vtbl = instance.dispatch_ptr;
}
- instance->drv.num_physical_devices = num_physical_devices;
+ instance.drv.num_physical_devices = num_physical_devices;
- instance->num_physical_devices = instance->drv.num_physical_devices;
+ instance.num_physical_devices = instance.drv.num_physical_devices;
return VK_SUCCESS;
}
-VKAPI_ATTR
-VkResult EnumeratePhysicalDevicesBottom(VkInstance instance,
- uint32_t* pdev_count,
- VkPhysicalDevice* pdevs) {
- uint32_t count = instance->num_physical_devices;
+PFN_vkVoidFunction GetInstanceProcAddr_Bottom(VkInstance, const char* name) {
+ PFN_vkVoidFunction pfn;
+ if ((pfn = GetLoaderBottomProcAddr(name)))
+ return pfn;
+ // TODO: Possibly move this into the instance table
+ // TODO: Possibly register the callbacks in the loader
+ if (strcmp(name, "vkDbgCreateMsgCallback") == 0 ||
+ strcmp(name, "vkDbgDestroyMsgCallback") == 0) {
+ return reinterpret_cast<PFN_vkVoidFunction>(Noop);
+ }
+ return nullptr;
+}
+
+VkResult EnumeratePhysicalDevices_Bottom(VkInstance vkinstance,
+ uint32_t* pdev_count,
+ VkPhysicalDevice* pdevs) {
+ Instance& instance = GetDispatchParent(vkinstance);
+ uint32_t count = instance.num_physical_devices;
if (pdevs) {
count = std::min(count, *pdev_count);
- std::copy(instance->physical_devices,
- instance->physical_devices + count, pdevs);
+ std::copy(instance.physical_devices, instance.physical_devices + count,
+ pdevs);
}
*pdev_count = count;
return VK_SUCCESS;
}
-VKAPI_ATTR
-void GetPhysicalDeviceFeaturesBottom(VkPhysicalDevice pdev,
- VkPhysicalDeviceFeatures* features) {
- GetVtbl(pdev)->instance->drv.vtbl.GetPhysicalDeviceFeatures(pdev, features);
+void GetPhysicalDeviceProperties_Bottom(
+ VkPhysicalDevice pdev,
+ VkPhysicalDeviceProperties* properties) {
+ GetDispatchParent(pdev).drv.dispatch.GetPhysicalDeviceProperties(
+ pdev, properties);
}
-VKAPI_ATTR
-void GetPhysicalDeviceFormatPropertiesBottom(VkPhysicalDevice pdev,
- VkFormat format,
- VkFormatProperties* properties) {
- GetVtbl(pdev)->instance->drv.vtbl.GetPhysicalDeviceFormatProperties(
+void GetPhysicalDeviceFeatures_Bottom(VkPhysicalDevice pdev,
+ VkPhysicalDeviceFeatures* features) {
+ GetDispatchParent(pdev).drv.dispatch.GetPhysicalDeviceFeatures(pdev,
+ features);
+}
+
+void GetPhysicalDeviceMemoryProperties_Bottom(
+ VkPhysicalDevice pdev,
+ VkPhysicalDeviceMemoryProperties* properties) {
+ GetDispatchParent(pdev).drv.dispatch.GetPhysicalDeviceMemoryProperties(
+ pdev, properties);
+}
+
+void GetPhysicalDeviceQueueFamilyProperties_Bottom(
+ VkPhysicalDevice pdev,
+ uint32_t* pCount,
+ VkQueueFamilyProperties* properties) {
+ GetDispatchParent(pdev).drv.dispatch.GetPhysicalDeviceQueueFamilyProperties(
+ pdev, pCount, properties);
+}
+
+void GetPhysicalDeviceFormatProperties_Bottom(VkPhysicalDevice pdev,
+ VkFormat format,
+ VkFormatProperties* properties) {
+ GetDispatchParent(pdev).drv.dispatch.GetPhysicalDeviceFormatProperties(
pdev, format, properties);
}
-VKAPI_ATTR
-VkResult GetPhysicalDeviceImageFormatPropertiesBottom(
+VkResult GetPhysicalDeviceImageFormatProperties_Bottom(
VkPhysicalDevice pdev,
VkFormat format,
VkImageType type,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageFormatProperties* properties) {
- return GetVtbl(pdev)
- ->instance->drv.vtbl.GetPhysicalDeviceImageFormatProperties(
+ return GetDispatchParent(pdev)
+ .drv.dispatch.GetPhysicalDeviceImageFormatProperties(
pdev, format, type, tiling, usage, flags, properties);
}
-VKAPI_ATTR
-void GetPhysicalDevicePropertiesBottom(VkPhysicalDevice pdev,
- VkPhysicalDeviceProperties* properties) {
- GetVtbl(pdev)
- ->instance->drv.vtbl.GetPhysicalDeviceProperties(pdev, properties);
+void GetPhysicalDeviceSparseImageFormatProperties_Bottom(
+ VkPhysicalDevice pdev,
+ VkFormat format,
+ VkImageType type,
+ VkSampleCountFlagBits samples,
+ VkImageUsageFlags usage,
+ VkImageTiling tiling,
+ uint32_t* properties_count,
+ VkSparseImageFormatProperties* properties) {
+ GetDispatchParent(pdev)
+ .drv.dispatch.GetPhysicalDeviceSparseImageFormatProperties(
+ pdev, format, type, samples, usage, tiling, properties_count,
+ properties);
}
VKAPI_ATTR
-void GetPhysicalDeviceQueueFamilyPropertiesBottom(
+VkResult EnumerateDeviceExtensionProperties_Bottom(
VkPhysicalDevice pdev,
- uint32_t* pCount,
- VkQueueFamilyProperties* properties) {
- GetVtbl(pdev)->instance->drv.vtbl.GetPhysicalDeviceQueueFamilyProperties(
- pdev, pCount, properties);
+ const char* layer_name,
+ uint32_t* properties_count,
+ VkExtensionProperties* properties) {
+ // TODO: what are we supposed to do with layer_name here?
+ return GetDispatchParent(pdev)
+ .drv.dispatch.EnumerateDeviceExtensionProperties(
+ pdev, layer_name, properties_count, properties);
}
VKAPI_ATTR
-void GetPhysicalDeviceMemoryPropertiesBottom(
- VkPhysicalDevice pdev,
- VkPhysicalDeviceMemoryProperties* properties) {
- GetVtbl(pdev)->instance->drv.vtbl.GetPhysicalDeviceMemoryProperties(
- pdev, properties);
+VkResult EnumerateDeviceLayerProperties_Bottom(VkPhysicalDevice pdev,
+ uint32_t* properties_count,
+ VkLayerProperties* properties) {
+ return GetDispatchParent(pdev).drv.dispatch.EnumerateDeviceLayerProperties(
+ pdev, properties_count, properties);
}
VKAPI_ATTR
-VkResult CreateDeviceBottom(VkPhysicalDevice pdev,
- const VkDeviceCreateInfo* create_info,
- const VkAllocationCallbacks* allocator,
- VkDevice* out_device) {
- Instance& instance = *static_cast<Instance*>(GetVtbl(pdev)->instance);
+VkResult CreateDevice_Bottom(VkPhysicalDevice pdev,
+ const VkDeviceCreateInfo* create_info,
+ const VkAllocationCallbacks* allocator,
+ VkDevice* device_out) {
+ Instance& instance = GetDispatchParent(pdev);
VkResult result;
if (!allocator) {
}
VkDevice drv_device;
- result = instance.drv.vtbl.CreateDevice(pdev, create_info, allocator,
- &drv_device);
+ result = instance.drv.dispatch.CreateDevice(pdev, create_info, allocator,
+ &drv_device);
if (result != VK_SUCCESS) {
DestroyDevice(device);
return result;
}
- hwvulkan_dispatch_t* dispatch =
+ hwvulkan_dispatch_t* drv_dispatch =
reinterpret_cast<hwvulkan_dispatch_t*>(drv_device);
- if (dispatch->magic != HWVULKAN_DISPATCH_MAGIC) {
- ALOGE("invalid VkDevice dispatch magic: 0x%" PRIxPTR, dispatch->magic);
+ if (drv_dispatch->magic != HWVULKAN_DISPATCH_MAGIC) {
+ ALOGE("invalid VkDevice dispatch magic: 0x%" PRIxPTR,
+ drv_dispatch->magic);
PFN_vkDestroyDevice destroy_device =
reinterpret_cast<PFN_vkDestroyDevice>(
- instance.drv.GetDeviceProcAddr(drv_device, "vkDestroyDevice"));
+ instance.drv.dispatch.GetDeviceProcAddr(drv_device,
+ "vkDestroyDevice"));
destroy_device(drv_device, allocator);
DestroyDevice(device);
return VK_ERROR_INITIALIZATION_FAILED;
}
- dispatch->vtbl = &device->vtbl_storage;
+ drv_dispatch->vtbl = &device->dispatch;
+ device->get_device_proc_addr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(
+ instance.drv.dispatch.GetDeviceProcAddr(drv_device,
+ "vkGetDeviceProcAddr"));
void* base_object = static_cast<void*>(drv_device);
void* next_object = base_object;
VkLayerLinkedListElem* next_element;
- PFN_vkGetDeviceProcAddr next_get_proc_addr = GetLayerDeviceProcAddr;
+ PFN_vkGetDeviceProcAddr next_get_proc_addr = GetDeviceProcAddr_Bottom;
Vector<VkLayerLinkedListElem> elem_list(
device->active_layers.size(),
CallbackAllocator<VkLayerLinkedListElem>(instance.alloc));
}
}
- if (!LoadDeviceVtbl(static_cast<VkDevice>(base_object),
- static_cast<VkDevice>(next_object), next_get_proc_addr,
- device->vtbl_storage)) {
- DestroyDevice(device);
- return VK_ERROR_INITIALIZATION_FAILED;
- }
+ // This is the magic call that initializes all the layer devices and
+ // allows them to create their device_handle -> device_data mapping.
+ next_get_proc_addr(static_cast<VkDevice>(next_object),
+ "vkGetDeviceProcAddr");
- PFN_vkCreateDevice layer_createDevice =
- reinterpret_cast<PFN_vkCreateDevice>(
- device->vtbl_storage.GetDeviceProcAddr(drv_device,
- "vkCreateDevice"));
- layer_createDevice(pdev, create_info, allocator, &drv_device);
-
- // TODO(mlentine) : This is needed to use WSI layer validation. Remove this
- // when new version of layer initialization exits.
- if (!LoadDeviceVtbl(static_cast<VkDevice>(base_object),
- static_cast<VkDevice>(next_object), next_get_proc_addr,
- device->vtbl_storage)) {
+ // We must create all the layer devices *before* retrieving the device
+ // procaddrs, so that the layers know which extensions are enabled and
+ // therefore which functions to return procaddrs for.
+ PFN_vkCreateDevice create_device = reinterpret_cast<PFN_vkCreateDevice>(
+ next_get_proc_addr(drv_device, "vkCreateDevice"));
+ create_device(pdev, create_info, allocator, &drv_device);
+
+ if (!LoadDeviceDispatchTable(static_cast<VkDevice>(base_object),
+ next_get_proc_addr, device->dispatch)) {
DestroyDevice(device);
return VK_ERROR_INITIALIZATION_FAILED;
}
- *out_device = drv_device;
+ *device_out = drv_device;
return VK_SUCCESS;
}
-VKAPI_ATTR
-VkResult EnumerateDeviceExtensionPropertiesBottom(
- VkPhysicalDevice pdev,
- const char* layer_name,
- uint32_t* properties_count,
- VkExtensionProperties* properties) {
- // TODO: what are we supposed to do with layer_name here?
- return GetVtbl(pdev)->instance->drv.vtbl.EnumerateDeviceExtensionProperties(
- pdev, layer_name, properties_count, properties);
-}
-
-VKAPI_ATTR
-VkResult EnumerateDeviceLayerPropertiesBottom(VkPhysicalDevice pdev,
- uint32_t* properties_count,
- VkLayerProperties* properties) {
- return GetVtbl(pdev)->instance->drv.vtbl.EnumerateDeviceLayerProperties(
- pdev, properties_count, properties);
-}
+void DestroyInstance_Bottom(VkInstance vkinstance,
+ const VkAllocationCallbacks* allocator) {
+ Instance& instance = GetDispatchParent(vkinstance);
-VKAPI_ATTR
-void GetPhysicalDeviceSparseImageFormatPropertiesBottom(
- VkPhysicalDevice pdev,
- VkFormat format,
- VkImageType type,
- VkSampleCountFlagBits samples,
- VkImageUsageFlags usage,
- VkImageTiling tiling,
- uint32_t* properties_count,
- VkSparseImageFormatProperties* properties) {
- GetVtbl(pdev)
- ->instance->drv.vtbl.GetPhysicalDeviceSparseImageFormatProperties(
- pdev, format, type, samples, usage, tiling, properties_count,
- properties);
+ // These checks allow us to call DestroyInstance_Bottom from any error
+ // path in CreateInstance_Bottom, before the driver instance is fully
+ // initialized.
+ if (instance.drv.instance != VK_NULL_HANDLE &&
+ instance.drv.dispatch.DestroyInstance) {
+ instance.drv.dispatch.DestroyInstance(instance.drv.instance, allocator);
+ }
+ if (instance.message) {
+ PFN_vkDbgDestroyMsgCallback DebugDestroyMessageCallback;
+ DebugDestroyMessageCallback =
+ reinterpret_cast<PFN_vkDbgDestroyMsgCallback>(
+ vkGetInstanceProcAddr(vkinstance, "vkDbgDestroyMsgCallback"));
+ DebugDestroyMessageCallback(vkinstance, instance.message);
+ }
+ for (auto it = instance.active_layers.begin();
+ it != instance.active_layers.end(); ++it) {
+ DeactivateLayer(instance, it);
+ }
+ const VkAllocationCallbacks* alloc = instance.alloc;
+ instance.~Instance();
+ alloc->pfnFree(alloc->pUserData, &instance);
}
-VKAPI_ATTR PFN_vkVoidFunction
-GetInstanceProcAddrBottom(VkInstance, const char*);
-
-const InstanceVtbl kBottomInstanceFunctions = {
- // clang-format off
- .instance = nullptr,
-
- .CreateInstance = CreateInstanceBottom,
- .DestroyInstance = DestroyInstanceBottom,
- .GetInstanceProcAddr = GetInstanceProcAddrBottom,
- .EnumeratePhysicalDevices = EnumeratePhysicalDevicesBottom,
-
- .GetPhysicalDeviceFeatures = GetPhysicalDeviceFeaturesBottom,
- .GetPhysicalDeviceFormatProperties = GetPhysicalDeviceFormatPropertiesBottom,
- .GetPhysicalDeviceImageFormatProperties = GetPhysicalDeviceImageFormatPropertiesBottom,
- .GetPhysicalDeviceProperties = GetPhysicalDevicePropertiesBottom,
- .GetPhysicalDeviceQueueFamilyProperties = GetPhysicalDeviceQueueFamilyPropertiesBottom,
- .GetPhysicalDeviceMemoryProperties = GetPhysicalDeviceMemoryPropertiesBottom,
- .CreateDevice = CreateDeviceBottom,
- .EnumerateDeviceExtensionProperties = EnumerateDeviceExtensionPropertiesBottom,
- .EnumerateDeviceLayerProperties = EnumerateDeviceLayerPropertiesBottom,
- .GetPhysicalDeviceSparseImageFormatProperties = GetPhysicalDeviceSparseImageFormatPropertiesBottom,
-
- .GetPhysicalDeviceSurfaceCapabilitiesKHR = GetPhysicalDeviceSurfaceCapabilitiesKHR,
- .GetPhysicalDeviceSurfaceFormatsKHR = GetPhysicalDeviceSurfaceFormatsKHR,
- .GetPhysicalDeviceSurfacePresentModesKHR = GetPhysicalDeviceSurfacePresentModesKHR,
- .CreateAndroidSurfaceKHR = CreateAndroidSurfaceKHR,
- .DestroySurfaceKHR = DestroySurfaceKHR,
- .GetPhysicalDeviceSurfaceSupportKHR = GetPhysicalDeviceSurfaceSupportKHR,
- // clang-format on
-};
-
-VKAPI_ATTR
-PFN_vkVoidFunction GetInstanceProcAddrBottom(VkInstance, const char* name) {
- // TODO: Possibly move this into the instance table
- // TODO: Possibly register the callbacks in the loader
- if (strcmp(name, "vkDbgCreateMsgCallback") == 0 ||
- strcmp(name, "vkDbgDestroyMsgCallback") == 0) {
+PFN_vkVoidFunction GetDeviceProcAddr_Bottom(VkDevice vkdevice,
+ const char* name) {
+ if (strcmp(name, "vkCreateDevice") == 0) {
+ // TODO(jessehall): Blegh, having this here is disgusting. The current
+ // layer init process can't call through the instance dispatch table's
+ // vkCreateDevice, because that goes through the instance layers rather
+ // than through the device layers. So we need to be able to get the
+ // vkCreateDevice pointer through the *device* layer chain.
+ //
+ // Because we've already created the driver device before calling
+ // through the layer vkCreateDevice functions, the loader bottom proc
+ // is a no-op.
return reinterpret_cast<PFN_vkVoidFunction>(Noop);
}
- if (strcmp(name, "vkCreateInstance") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkCreateInstance>(CreateInstanceBottom));
+
+ // VK_ANDROID_native_buffer should be hidden from applications and layers.
+ // TODO(jessehall): Generate this as part of GetLoaderBottomProcAddr.
+ PFN_vkVoidFunction pfn;
+ if (strcmp(name, "vkGetSwapchainGrallocUsageANDROID") == 0 ||
+ strcmp(name, "vkAcquireImageANDROID") == 0 ||
+ strcmp(name, "vkQueueSignalReleaseImageANDROID") == 0) {
+ return nullptr;
}
- return GetSpecificInstanceProcAddr(&kBottomInstanceFunctions, name);
+ if ((pfn = GetLoaderBottomProcAddr(name)))
+ return pfn;
+ return GetDispatchParent(vkdevice).get_device_proc_addr(vkdevice, name);
}
-} // namespace
-
// -----------------------------------------------------------------------------
-// Global functions. These are called directly from the loader entry points,
-// without going through a dispatch table.
-
-namespace vulkan {
+// Loader top functions. These are called directly from the loader entry
+// points or from the application (via vkGetInstanceProcAddr) without going
+// through a dispatch table.
-VkResult EnumerateInstanceExtensionProperties(
+VkResult EnumerateInstanceExtensionProperties_Top(
const char* /*layer_name*/,
uint32_t* count,
VkExtensionProperties* /*properties*/) {
return VK_SUCCESS;
}
-VkResult EnumerateInstanceLayerProperties(uint32_t* count,
- VkLayerProperties* /*properties*/) {
+VkResult EnumerateInstanceLayerProperties_Top(
+ uint32_t* count,
+ VkLayerProperties* /*properties*/) {
if (!EnsureInitialized())
return VK_ERROR_INITIALIZATION_FAILED;
return VK_SUCCESS;
}
-VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
- const VkAllocationCallbacks* allocator,
- VkInstance* out_instance) {
+VkResult CreateInstance_Top(const VkInstanceCreateInfo* create_info,
+ const VkAllocationCallbacks* allocator,
+ VkInstance* instance_out) {
VkResult result;
if (!EnsureInitialized())
return VK_ERROR_OUT_OF_HOST_MEMORY;
Instance* instance = new (instance_mem) Instance(allocator);
- instance->vtbl_storage = kBottomInstanceFunctions;
- instance->vtbl_storage.instance = instance;
- instance->message = VK_NULL_HANDLE;
-
// Scan layers
CallbackAllocator<char> string_allocator(instance->alloc);
String dir_name("/data/local/debug/vulkan/", string_allocator);
result = ActivateAllLayers(create_info, instance, instance);
if (result != VK_SUCCESS) {
- DestroyInstanceBottom(instance, allocator);
+ DestroyInstance_Bottom(instance->handle, allocator);
return result;
}
- void* base_object = static_cast<void*>(instance);
+ void* base_object = static_cast<void*>(instance->handle);
void* next_object = base_object;
VkLayerLinkedListElem* next_element;
- PFN_vkGetInstanceProcAddr next_get_proc_addr =
- kBottomInstanceFunctions.GetInstanceProcAddr;
+ PFN_vkGetInstanceProcAddr next_get_proc_addr = GetInstanceProcAddr_Bottom;
Vector<VkLayerLinkedListElem> elem_list(
instance->active_layers.size(),
CallbackAllocator<VkLayerLinkedListElem>(instance->alloc));
}
}
}
+ instance->get_instance_proc_addr = next_get_proc_addr;
- if (!LoadInstanceVtbl(static_cast<VkInstance>(base_object),
- static_cast<VkInstance>(next_object),
- next_get_proc_addr, instance->vtbl_storage)) {
- DestroyInstanceBottom(instance, allocator);
+ // This is the magic call that initializes all the layer instances and
+ // allows them to create their instance_handle -> instance_data mapping.
+ next_get_proc_addr(static_cast<VkInstance>(next_object),
+ "vkGetInstanceProcAddr");
+
+ if (!LoadInstanceDispatchTable(static_cast<VkInstance>(base_object),
+ next_get_proc_addr, instance->dispatch)) {
+ DestroyInstance_Bottom(instance->handle, allocator);
return VK_ERROR_INITIALIZATION_FAILED;
}
}
}
- *out_instance = instance;
- result = instance->vtbl_storage.CreateInstance(create_info, allocator,
- out_instance);
+ *instance_out = instance->handle;
+ PFN_vkCreateInstance create_instance =
+ reinterpret_cast<PFN_vkCreateInstance>(
+ next_get_proc_addr(instance->handle, "vkCreateInstance"));
+ result = create_instance(create_info, allocator, instance_out);
if (enable_callback)
FreeAllocatedCreateInfo(local_create_info, instance->alloc);
if (result <= 0) {
// - The layer must not call the next layer's DestroyInstance if that
// layer's CreateInstance wasn't called, or returned failure.
- // On failure, CreateInstanceBottom frees the instance struct, so it's
+ // On failure, CreateInstance_Bottom frees the instance struct, so it's
// already gone at this point. Nothing to do.
}
if (enable_logging) {
- PFN_vkDbgCreateMsgCallback DebugCreateMessageCallback;
- DebugCreateMessageCallback =
- reinterpret_cast<PFN_vkDbgCreateMsgCallback>(
- vkGetInstanceProcAddr(instance, "vkDbgCreateMsgCallback"));
- DebugCreateMessageCallback(
- instance, VK_DBG_REPORT_ERROR_BIT | VK_DBG_REPORT_WARN_BIT,
- LogDebugMessageCallback, NULL, &instance->message);
+ PFN_vkDbgCreateMsgCallback dbg_create_msg_callback;
+ dbg_create_msg_callback = reinterpret_cast<PFN_vkDbgCreateMsgCallback>(
+ GetInstanceProcAddr_Top(instance->handle,
+ "vkDbgCreateMsgCallback"));
+ dbg_create_msg_callback(
+ instance->handle, VK_DBG_REPORT_ERROR_BIT | VK_DBG_REPORT_WARN_BIT,
+ LogDebugMessageCallback, nullptr, &instance->message);
}
return result;
}
-PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
- if (!instance)
- return GetGlobalInstanceProcAddr(name);
- // TODO: Possibly move this into the instance table
+PFN_vkVoidFunction GetInstanceProcAddr_Top(VkInstance vkinstance,
+ const char* name) {
+ // vkGetInstanceProcAddr(NULL_HANDLE, ..) only works for global commands
+ if (!vkinstance)
+ return GetLoaderGlobalProcAddr(name);
+
+ const InstanceDispatchTable& dispatch = GetDispatchTable(vkinstance);
+ PFN_vkVoidFunction pfn;
+ // Always go through the loader-top function if there is one.
+ if ((pfn = GetLoaderTopProcAddr(name)))
+ return pfn;
+ // Otherwise, look up the handler in the instance dispatch table
+ if ((pfn = GetDispatchProcAddr(dispatch, name)))
+ return pfn;
+ // TODO(jessehall): Generate these into the instance dispatch table, and
+ // add loader-bottom procs for them.
if (strcmp(name, "vkDbgCreateMsgCallback") == 0 ||
strcmp(name, "vkDbgDestroyMsgCallback") == 0) {
- if (!instance->vtbl)
- return NULL;
- PFN_vkGetInstanceProcAddr gpa = instance->vtbl->GetInstanceProcAddr;
- return reinterpret_cast<PFN_vkVoidFunction>(gpa(instance, name));
- }
- // For special-case functions we always return the loader entry
- if (strcmp(name, "vkGetInstanceProcAddr") == 0 ||
- strcmp(name, "vkGetDeviceProcAddr") == 0) {
- return GetGlobalInstanceProcAddr(name);
+ return GetDispatchParent(vkinstance)
+ .get_instance_proc_addr(vkinstance, name);
}
- return GetSpecificInstanceProcAddr(instance->vtbl, name);
+ // Anything not handled already must be a device-dispatched function
+ // without a loader-top. We must return a function that will dispatch based
+ // on the dispatchable object parameter -- which is exactly what the
+ // exported functions do. So just return them here.
+ return GetLoaderExportProcAddr(name);
}
-PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* name) {
+void DestroyInstance_Top(VkInstance instance,
+ const VkAllocationCallbacks* allocator) {
+ if (!instance)
+ return;
+ GetDispatchTable(instance).DestroyInstance(instance, allocator);
+}
+
+PFN_vkVoidFunction GetDeviceProcAddr_Top(VkDevice device, const char* name) {
+ PFN_vkVoidFunction pfn;
if (!device)
- return GetGlobalDeviceProcAddr(name);
- if (strcmp(name, "vkGetDeviceProcAddr") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkGetDeviceProcAddr>(GetDeviceProcAddr));
- }
- if (strcmp(name, "vkGetDeviceQueue") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkGetDeviceQueue>(GetDeviceQueue));
- }
- if (strcmp(name, "vkAllocateCommandBuffers") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkAllocateCommandBuffers>(AllocateCommandBuffers));
- }
- if (strcmp(name, "vkDestroyDevice") == 0) {
- return reinterpret_cast<PFN_vkVoidFunction>(
- static_cast<PFN_vkDestroyDevice>(DestroyDevice));
- }
- return GetSpecificDeviceProcAddr(GetVtbl(device), name);
+ return nullptr;
+ if ((pfn = GetLoaderTopProcAddr(name)))
+ return pfn;
+ return GetDispatchProcAddr(GetDispatchTable(device), name);
}
-void GetDeviceQueue(VkDevice drv_device,
- uint32_t family,
- uint32_t index,
- VkQueue* out_queue) {
- VkResult result;
- VkQueue queue;
- const DeviceVtbl* vtbl = GetVtbl(drv_device);
- vtbl->GetDeviceQueue(drv_device, family, index, &queue);
- hwvulkan_dispatch_t* dispatch =
- reinterpret_cast<hwvulkan_dispatch_t*>(queue);
- if (dispatch->magic != HWVULKAN_DISPATCH_MAGIC && dispatch->vtbl != vtbl)
- ALOGE("invalid VkQueue dispatch magic: 0x%" PRIxPTR, dispatch->magic);
- dispatch->vtbl = vtbl;
- *out_queue = queue;
+void GetDeviceQueue_Top(VkDevice vkdevice,
+ uint32_t family,
+ uint32_t index,
+ VkQueue* queue_out) {
+ const auto& table = GetDispatchTable(vkdevice);
+ table.GetDeviceQueue(vkdevice, family, index, queue_out);
+ hwvulkan_dispatch_t* queue_dispatch =
+ reinterpret_cast<hwvulkan_dispatch_t*>(*queue_out);
+ if (queue_dispatch->magic != HWVULKAN_DISPATCH_MAGIC &&
+ queue_dispatch->vtbl != &table)
+ ALOGE("invalid VkQueue dispatch magic: 0x%" PRIxPTR,
+ queue_dispatch->magic);
+ queue_dispatch->vtbl = &table;
}
-VkResult AllocateCommandBuffers(VkDevice device,
- const VkCommandBufferAllocateInfo* alloc_info,
- VkCommandBuffer* cmdbufs) {
- const DeviceVtbl* vtbl = GetVtbl(device);
- VkResult result = vtbl->AllocateCommandBuffers(device, alloc_info, cmdbufs);
+VkResult AllocateCommandBuffers_Top(
+ VkDevice vkdevice,
+ const VkCommandBufferAllocateInfo* alloc_info,
+ VkCommandBuffer* cmdbufs) {
+ const auto& table = GetDispatchTable(vkdevice);
+ VkResult result =
+ table.AllocateCommandBuffers(vkdevice, alloc_info, cmdbufs);
if (result != VK_SUCCESS)
return result;
for (uint32_t i = 0; i < alloc_info->bufferCount; i++) {
- hwvulkan_dispatch_t* dispatch =
+ hwvulkan_dispatch_t* cmdbuf_dispatch =
reinterpret_cast<hwvulkan_dispatch_t*>(cmdbufs[i]);
- ALOGE_IF(dispatch->magic != HWVULKAN_DISPATCH_MAGIC,
+ ALOGE_IF(cmdbuf_dispatch->magic != HWVULKAN_DISPATCH_MAGIC,
"invalid VkCommandBuffer dispatch magic: 0x%" PRIxPTR,
- dispatch->magic);
- dispatch->vtbl = vtbl;
+ cmdbuf_dispatch->magic);
+ cmdbuf_dispatch->vtbl = &table;
}
return VK_SUCCESS;
}
-void DestroyDevice(VkDevice drv_device,
- const VkAllocationCallbacks* /*allocator*/) {
- const DeviceVtbl* vtbl = GetVtbl(drv_device);
- Device* device = static_cast<Device*>(vtbl->device);
- for (auto it = device->active_layers.begin();
- it != device->active_layers.end(); ++it) {
- DeactivateLayer(device->instance, it);
+void DestroyDevice_Top(VkDevice vkdevice,
+ const VkAllocationCallbacks* /*allocator*/) {
+ if (!vkdevice)
+ return;
+ Device& device = GetDispatchParent(vkdevice);
+ // TODO(jessehall): This seems very wrong. We might close a layer library
+ // right before we call DestroyDevice in it.
+ for (auto it = device.active_layers.begin();
+ it != device.active_layers.end(); ++it) {
+ DeactivateLayer(*device.instance, it);
}
- vtbl->DestroyDevice(drv_device, device->instance->alloc);
- DestroyDevice(device);
+ device.dispatch.DestroyDevice(vkdevice, device.instance->alloc);
+ DestroyDevice(&device);
}
-void* AllocMem(VkInstance instance,
- size_t size,
- size_t align,
- VkSystemAllocationScope scope) {
- const VkAllocationCallbacks* alloc_cb = instance->alloc;
- return alloc_cb->pfnAllocation(alloc_cb->pUserData, size, align, scope);
-}
-
-void FreeMem(VkInstance instance, void* ptr) {
- const VkAllocationCallbacks* alloc_cb = instance->alloc;
- alloc_cb->pfnFree(alloc_cb->pUserData, ptr);
-}
+// -----------------------------------------------------------------------------
-void* AllocMem(VkDevice device,
- size_t size,
- size_t align,
- VkSystemAllocationScope scope) {
- const VkAllocationCallbacks* alloc_cb =
- static_cast<Device*>(GetVtbl(device)->device)->instance->alloc;
- return alloc_cb->pfnAllocation(alloc_cb->pUserData, size, align, scope);
+const VkAllocationCallbacks* GetAllocator(VkInstance vkinstance) {
+ return GetDispatchParent(vkinstance).alloc;
}
-void FreeMem(VkDevice device, void* ptr) {
- const VkAllocationCallbacks* alloc_cb =
- static_cast<Device*>(GetVtbl(device)->device)->instance->alloc;
- alloc_cb->pfnFree(alloc_cb->pUserData, ptr);
+const VkAllocationCallbacks* GetAllocator(VkDevice vkdevice) {
+ return GetDispatchParent(vkdevice).instance->alloc;
}
-const DeviceVtbl& GetDriverVtbl(VkDevice device) {
- // TODO(jessehall): This actually returns the API-level vtbl for the
- // device, not the driver entry points. Given the current use -- getting
- // the driver's private swapchain-related functions -- that works, but is
- // misleading and likely to cause bugs. Fix as part of separating the
- // loader->driver interface from the app->loader interface.
- return static_cast<Device*>(GetVtbl(device)->device)->vtbl_storage;
+const DriverDispatchTable& GetDriverDispatch(VkDevice device) {
+ return GetDispatchParent(device).instance->drv.dispatch;
}
-const DeviceVtbl& GetDriverVtbl(VkQueue queue) {
- // TODO(jessehall): This actually returns the API-level vtbl for the
- // device, not the driver entry points. Given the current use -- getting
- // the driver's private swapchain-related functions -- that works, but is
- // misleading and likely to cause bugs. Fix as part of separating the
- // loader->driver interface from the app->loader interface.
- return static_cast<Device*>(GetVtbl(queue)->device)->vtbl_storage;
+const DriverDispatchTable& GetDriverDispatch(VkQueue queue) {
+ return GetDispatchParent(queue).instance->drv.dispatch;
}
} // namespace vulkan
#ifndef LIBVULKAN_LOADER_H
#define LIBVULKAN_LOADER_H 1
-#define VK_PROTOTYPES
-#define VK_USE_PLATFORM_ANDROID_KHR
-#include <vulkan/vulkan.h>
-#include <vulkan/vk_android_native_buffer.h>
+#include "dispatch_gen.h"
namespace vulkan {
-// TODO(jessehall): The InstanceVtbl and DeviceVtbl both have a set of
-// functions used in the app->layers/loader interface, and a different set of
-// functions used only in the loader->driver interface. We should probably
-// split them into two structures: one used for dispatch of application calls,
-// and one to hold the driver entry points.
+inline const InstanceDispatchTable& GetDispatchTable(VkInstance instance) {
+ return **reinterpret_cast<InstanceDispatchTable**>(instance);
+}
-struct InstanceVtbl {
- // clang-format off
- VkInstance instance;
+inline const InstanceDispatchTable& GetDispatchTable(
+ VkPhysicalDevice physical_device) {
+ return **reinterpret_cast<InstanceDispatchTable**>(physical_device);
+}
- PFN_vkCreateInstance CreateInstance;
- PFN_vkDestroyInstance DestroyInstance;
- PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
- PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
+inline const DeviceDispatchTable& GetDispatchTable(VkDevice device) {
+ return **reinterpret_cast<DeviceDispatchTable**>(device);
+}
- PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
- PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
- PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
- PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
- PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
- PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
- PFN_vkCreateDevice CreateDevice;
- PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
- PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
- PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
+inline const DeviceDispatchTable& GetDispatchTable(VkQueue queue) {
+ return **reinterpret_cast<DeviceDispatchTable**>(queue);
+}
- // Loader and layers only, not implemented by drivers
- PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
- PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
- PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
- PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
- PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
- PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
- // clang-format on
-};
-
-struct DeviceVtbl {
- void* device;
-
- PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
- PFN_vkDestroyDevice DestroyDevice;
- PFN_vkGetDeviceQueue GetDeviceQueue;
- PFN_vkDeviceWaitIdle DeviceWaitIdle;
- PFN_vkAllocateMemory AllocateMemory;
- PFN_vkFreeMemory FreeMemory;
- PFN_vkMapMemory MapMemory;
- PFN_vkUnmapMemory UnmapMemory;
- PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
- PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
- PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
- PFN_vkBindBufferMemory BindBufferMemory;
- PFN_vkBindImageMemory BindImageMemory;
- PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
- PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
- PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
- PFN_vkCreateFence CreateFence;
- PFN_vkDestroyFence DestroyFence;
- PFN_vkResetFences ResetFences;
- PFN_vkGetFenceStatus GetFenceStatus;
- PFN_vkWaitForFences WaitForFences;
- PFN_vkCreateSemaphore CreateSemaphore;
- PFN_vkDestroySemaphore DestroySemaphore;
- PFN_vkCreateEvent CreateEvent;
- PFN_vkDestroyEvent DestroyEvent;
- PFN_vkGetEventStatus GetEventStatus;
- PFN_vkSetEvent SetEvent;
- PFN_vkResetEvent ResetEvent;
- PFN_vkCreateQueryPool CreateQueryPool;
- PFN_vkDestroyQueryPool DestroyQueryPool;
- PFN_vkGetQueryPoolResults GetQueryPoolResults;
- PFN_vkCreateBuffer CreateBuffer;
- PFN_vkDestroyBuffer DestroyBuffer;
- PFN_vkCreateBufferView CreateBufferView;
- PFN_vkDestroyBufferView DestroyBufferView;
- PFN_vkCreateImage CreateImage;
- PFN_vkDestroyImage DestroyImage;
- PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
- PFN_vkCreateImageView CreateImageView;
- PFN_vkDestroyImageView DestroyImageView;
- PFN_vkCreateShaderModule CreateShaderModule;
- PFN_vkDestroyShaderModule DestroyShaderModule;
- PFN_vkCreatePipelineCache CreatePipelineCache;
- PFN_vkDestroyPipelineCache DestroyPipelineCache;
- PFN_vkGetPipelineCacheData GetPipelineCacheData;
- PFN_vkMergePipelineCaches MergePipelineCaches;
- PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
- PFN_vkCreateComputePipelines CreateComputePipelines;
- PFN_vkDestroyPipeline DestroyPipeline;
- PFN_vkCreatePipelineLayout CreatePipelineLayout;
- PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
- PFN_vkCreateSampler CreateSampler;
- PFN_vkDestroySampler DestroySampler;
- PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
- PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
- PFN_vkCreateDescriptorPool CreateDescriptorPool;
- PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
- PFN_vkResetDescriptorPool ResetDescriptorPool;
- PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
- PFN_vkFreeDescriptorSets FreeDescriptorSets;
- PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
- PFN_vkCreateFramebuffer CreateFramebuffer;
- PFN_vkDestroyFramebuffer DestroyFramebuffer;
- PFN_vkCreateRenderPass CreateRenderPass;
- PFN_vkDestroyRenderPass DestroyRenderPass;
- PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
- PFN_vkCreateCommandPool CreateCommandPool;
- PFN_vkDestroyCommandPool DestroyCommandPool;
- PFN_vkResetCommandPool ResetCommandPool;
- PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
- PFN_vkFreeCommandBuffers FreeCommandBuffers;
-
- PFN_vkQueueSubmit QueueSubmit;
- PFN_vkQueueWaitIdle QueueWaitIdle;
- PFN_vkQueueBindSparse QueueBindSparse;
-
- PFN_vkBeginCommandBuffer BeginCommandBuffer;
- PFN_vkEndCommandBuffer EndCommandBuffer;
- PFN_vkResetCommandBuffer ResetCommandBuffer;
- PFN_vkCmdBindPipeline CmdBindPipeline;
- PFN_vkCmdSetViewport CmdSetViewport;
- PFN_vkCmdSetScissor CmdSetScissor;
- PFN_vkCmdSetLineWidth CmdSetLineWidth;
- PFN_vkCmdSetDepthBias CmdSetDepthBias;
- PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
- PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
- PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
- PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
- PFN_vkCmdSetStencilReference CmdSetStencilReference;
- PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
- PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
- PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
- PFN_vkCmdDraw CmdDraw;
- PFN_vkCmdDrawIndexed CmdDrawIndexed;
- PFN_vkCmdDrawIndirect CmdDrawIndirect;
- PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
- PFN_vkCmdDispatch CmdDispatch;
- PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
- PFN_vkCmdCopyBuffer CmdCopyBuffer;
- PFN_vkCmdCopyImage CmdCopyImage;
- PFN_vkCmdBlitImage CmdBlitImage;
- PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
- PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
- PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
- PFN_vkCmdFillBuffer CmdFillBuffer;
- PFN_vkCmdClearColorImage CmdClearColorImage;
- PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
- PFN_vkCmdClearAttachments CmdClearAttachments;
- PFN_vkCmdResolveImage CmdResolveImage;
- PFN_vkCmdSetEvent CmdSetEvent;
- PFN_vkCmdResetEvent CmdResetEvent;
- PFN_vkCmdWaitEvents CmdWaitEvents;
- PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
- PFN_vkCmdBeginQuery CmdBeginQuery;
- PFN_vkCmdEndQuery CmdEndQuery;
- PFN_vkCmdResetQueryPool CmdResetQueryPool;
- PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
- PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
- PFN_vkCmdPushConstants CmdPushConstants;
- PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
- PFN_vkCmdNextSubpass CmdNextSubpass;
- PFN_vkCmdEndRenderPass CmdEndRenderPass;
- PFN_vkCmdExecuteCommands CmdExecuteCommands;
-
- // Layers and loader only, not implemented by drivers
- PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
- PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
- PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
- PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
- PFN_vkQueuePresentKHR QueuePresentKHR;
-
- // Implemented only by drivers, not by layers or the loader
- PFN_vkGetSwapchainGrallocUsageANDROID GetSwapchainGrallocUsageANDROID;
- PFN_vkAcquireImageANDROID AcquireImageANDROID;
- PFN_vkQueueSignalReleaseImageANDROID QueueSignalReleaseImageANDROID;
- PFN_vkImportNativeFenceANDROID ImportNativeFenceANDROID;
- PFN_vkQueueSignalNativeFenceANDROID QueueSignalNativeFenceANDROID;
-};
+inline const DeviceDispatchTable& GetDispatchTable(
+ VkCommandBuffer command_buffer) {
+ return **reinterpret_cast<DeviceDispatchTable**>(command_buffer);
+}
// -----------------------------------------------------------------------------
-// loader.cpp
-
-VkResult EnumerateInstanceExtensionProperties(
- const char* layer_name,
- uint32_t* count,
- VkExtensionProperties* properties);
-VkResult EnumerateInstanceLayerProperties(uint32_t* count,
- VkLayerProperties* properties);
-VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
- const VkAllocationCallbacks* allocator,
- VkInstance* instance);
-PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name);
-VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice drv_device,
- const char* name);
-VKAPI_ATTR void GetDeviceQueue(VkDevice drv_device,
- uint32_t family,
- uint32_t index,
- VkQueue* out_queue);
-VKAPI_ATTR VkResult
-AllocateCommandBuffers(VkDevice device,
- const VkCommandBufferAllocateInfo* alloc_info,
- VkCommandBuffer* cmdbufs);
-VKAPI_ATTR void DestroyDevice(VkDevice drv_device,
- const VkAllocationCallbacks* allocator);
-
-void* AllocMem(VkInstance instance,
- size_t size,
- size_t align,
- VkSystemAllocationScope scope);
-void FreeMem(VkInstance instance, void* ptr);
-void* AllocMem(VkDevice device,
- size_t size,
- size_t align,
- VkSystemAllocationScope scope);
-void FreeMem(VkDevice device, void* ptr);
-const DeviceVtbl& GetDriverVtbl(VkDevice device);
-const DeviceVtbl& GetDriverVtbl(VkQueue queue);
+// dispatch_gen.cpp
+
+PFN_vkVoidFunction GetLoaderExportProcAddr(const char* name);
+PFN_vkVoidFunction GetLoaderGlobalProcAddr(const char* name);
+PFN_vkVoidFunction GetLoaderTopProcAddr(const char* name);
+PFN_vkVoidFunction GetLoaderBottomProcAddr(const char* name);
+PFN_vkVoidFunction GetDispatchProcAddr(const InstanceDispatchTable& dispatch,
+ const char* name);
+PFN_vkVoidFunction GetDispatchProcAddr(const DeviceDispatchTable& dispatch,
+ const char* name);
+bool LoadInstanceDispatchTable(VkInstance instance,
+ PFN_vkGetInstanceProcAddr get_proc_addr,
+ InstanceDispatchTable& dispatch);
+bool LoadDeviceDispatchTable(VkDevice device,
+ PFN_vkGetDeviceProcAddr get_proc_addr,
+ DeviceDispatchTable& dispatch);
+bool LoadDriverDispatchTable(VkInstance instance,
+ PFN_vkGetInstanceProcAddr get_proc_addr,
+ DriverDispatchTable& dispatch);
// -----------------------------------------------------------------------------
-// get_proc_addr.cpp
-
-PFN_vkVoidFunction GetGlobalInstanceProcAddr(const char* name);
-PFN_vkVoidFunction GetGlobalDeviceProcAddr(const char* name);
-PFN_vkVoidFunction GetSpecificInstanceProcAddr(const InstanceVtbl* vtbl,
- const char* name);
-PFN_vkVoidFunction GetSpecificDeviceProcAddr(const DeviceVtbl* vtbl,
- const char* name);
+// loader.cpp
-bool LoadInstanceVtbl(VkInstance instance,
- VkInstance next_instance,
- PFN_vkGetInstanceProcAddr get_proc_addr,
- InstanceVtbl& vtbl);
-bool LoadDeviceVtbl(VkDevice device,
- VkDevice next_device,
- PFN_vkGetDeviceProcAddr get_proc_addr,
- DeviceVtbl& vtbl);
+// clang-format off
+VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties_Top(const char* layer_name, uint32_t* count, VkExtensionProperties* properties);
+VKAPI_ATTR VkResult EnumerateInstanceLayerProperties_Top(uint32_t* count, VkLayerProperties* properties);
+VKAPI_ATTR VkResult CreateInstance_Top(const VkInstanceCreateInfo* create_info, const VkAllocationCallbacks* allocator, VkInstance* instance_out);
+VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr_Top(VkInstance instance, const char* name);
+VKAPI_ATTR void DestroyInstance_Top(VkInstance instance, const VkAllocationCallbacks* allocator);
+VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr_Top(VkDevice drv_device, const char* name);
+VKAPI_ATTR void GetDeviceQueue_Top(VkDevice drv_device, uint32_t family, uint32_t index, VkQueue* out_queue);
+VKAPI_ATTR VkResult AllocateCommandBuffers_Top(VkDevice device, const VkCommandBufferAllocateInfo* alloc_info, VkCommandBuffer* cmdbufs);
+VKAPI_ATTR void DestroyDevice_Top(VkDevice drv_device, const VkAllocationCallbacks* allocator);
+
+VKAPI_ATTR VkResult CreateInstance_Bottom(const VkInstanceCreateInfo* create_info, const VkAllocationCallbacks* allocator, VkInstance* vkinstance);
+VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr_Bottom(VkInstance, const char* name);
+VKAPI_ATTR VkResult EnumeratePhysicalDevices_Bottom(VkInstance vkinstance, uint32_t* pdev_count, VkPhysicalDevice* pdevs);
+VKAPI_ATTR void GetPhysicalDeviceProperties_Bottom(VkPhysicalDevice pdev, VkPhysicalDeviceProperties* properties);
+VKAPI_ATTR void GetPhysicalDeviceFeatures_Bottom(VkPhysicalDevice pdev, VkPhysicalDeviceFeatures* features);
+VKAPI_ATTR void GetPhysicalDeviceMemoryProperties_Bottom(VkPhysicalDevice pdev, VkPhysicalDeviceMemoryProperties* properties);
+VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties_Bottom(VkPhysicalDevice pdev, uint32_t* properties_count, VkQueueFamilyProperties* properties);
+VKAPI_ATTR void GetPhysicalDeviceFormatProperties_Bottom(VkPhysicalDevice pdev, VkFormat format, VkFormatProperties* properties);
+VKAPI_ATTR VkResult GetPhysicalDeviceImageFormatProperties_Bottom(VkPhysicalDevice pdev, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* properties);
+VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties_Bottom(VkPhysicalDevice pdev, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* properties_count, VkSparseImageFormatProperties* properties);
+VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties_Bottom(VkPhysicalDevice pdev, const char* layer_name, uint32_t* properties_count, VkExtensionProperties* properties);
+VKAPI_ATTR VkResult EnumerateDeviceLayerProperties_Bottom(VkPhysicalDevice pdev, uint32_t* properties_count, VkLayerProperties* properties);
+VKAPI_ATTR VkResult CreateDevice_Bottom(VkPhysicalDevice pdev, const VkDeviceCreateInfo* create_info, const VkAllocationCallbacks* allocator, VkDevice* device_out);
+VKAPI_ATTR void DestroyInstance_Bottom(VkInstance vkinstance, const VkAllocationCallbacks* allocator);
+VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr_Bottom(VkDevice vkdevice, const char* name);
+// clang-format on
+
+const VkAllocationCallbacks* GetAllocator(VkInstance instance);
+const VkAllocationCallbacks* GetAllocator(VkDevice device);
+const DriverDispatchTable& GetDriverDispatch(VkDevice device);
+const DriverDispatchTable& GetDriverDispatch(VkQueue queue);
// -----------------------------------------------------------------------------
// swapchain.cpp
-VKAPI_ATTR VkResult
-CreateAndroidSurfaceKHR(VkInstance instance,
- ANativeWindow* window,
- const VkAllocationCallbacks* allocator,
- VkSurfaceKHR* surface);
-VKAPI_ATTR void DestroySurfaceKHR(VkInstance instance,
- VkSurfaceKHR surface,
- const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice pdev,
- uint32_t queue_family,
- VkSurfaceKHR surface,
- VkBool32* pSupported);
-VKAPI_ATTR VkResult
-GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice pdev,
- VkSurfaceKHR surface,
- VkSurfaceCapabilitiesKHR* capabilities);
-VKAPI_ATTR VkResult
-GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev,
- VkSurfaceKHR surface,
- uint32_t* count,
- VkSurfaceFormatKHR* formats);
-VKAPI_ATTR VkResult
-GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice pdev,
- VkSurfaceKHR surface,
- uint32_t* count,
- VkPresentModeKHR* modes);
-VKAPI_ATTR VkResult
-CreateSwapchainKHR(VkDevice device,
- const VkSwapchainCreateInfoKHR* create_info,
- const VkAllocationCallbacks* allocator,
- VkSwapchainKHR* swapchain_handle);
-VKAPI_ATTR void DestroySwapchainKHR(VkDevice device,
- VkSwapchainKHR swapchain_handle,
- const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult GetSwapchainImagesKHR(VkDevice device,
- VkSwapchainKHR swapchain_handle,
- uint32_t* count,
- VkImage* images);
-VKAPI_ATTR VkResult AcquireNextImageKHR(VkDevice device,
- VkSwapchainKHR swapchain_handle,
- uint64_t timeout,
- VkSemaphore semaphore,
- VkFence fence,
- uint32_t* image_index);
-VKAPI_ATTR VkResult
-QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* present_info);
+// clang-format off
+VKAPI_ATTR VkResult CreateAndroidSurfaceKHR_Bottom(VkInstance instance, ANativeWindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+VKAPI_ATTR void DestroySurfaceKHR_Bottom(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* allocator);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceSupportKHR_Bottom(VkPhysicalDevice pdev, uint32_t queue_family, VkSurfaceKHR surface, VkBool32* pSupported);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR_Bottom(VkPhysicalDevice pdev, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* capabilities);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceFormatsKHR_Bottom(VkPhysicalDevice pdev, VkSurfaceKHR surface, uint32_t* count, VkSurfaceFormatKHR* formats);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfacePresentModesKHR_Bottom(VkPhysicalDevice pdev, VkSurfaceKHR surface, uint32_t* count, VkPresentModeKHR* modes);
+VKAPI_ATTR VkResult CreateSwapchainKHR_Bottom(VkDevice device, const VkSwapchainCreateInfoKHR* create_info, const VkAllocationCallbacks* allocator, VkSwapchainKHR* swapchain_handle);
+VKAPI_ATTR void DestroySwapchainKHR_Bottom(VkDevice device, VkSwapchainKHR swapchain_handle, const VkAllocationCallbacks* allocator);
+VKAPI_ATTR VkResult GetSwapchainImagesKHR_Bottom(VkDevice device, VkSwapchainKHR swapchain_handle, uint32_t* count, VkImage* images);
+VKAPI_ATTR VkResult AcquireNextImageKHR_Bottom(VkDevice device, VkSwapchainKHR swapchain_handle, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* image_index);
+VKAPI_ATTR VkResult QueuePresentKHR_Bottom(VkQueue queue, const VkPresentInfoKHR* present_info);
+// clang-format on
} // namespace vulkan
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE;
};
-template <typename T, typename Host>
+template <typename T>
class VulkanAllocator {
public:
typedef T value_type;
- explicit VulkanAllocator(Host host) : host_(host) {}
+ VulkanAllocator(const VkAllocationCallbacks& allocator,
+ VkSystemAllocationScope scope)
+ : allocator_(allocator), scope_(scope) {}
template <typename U>
- explicit VulkanAllocator(const VulkanAllocator<U, Host>& other)
- : host_(other.host_) {}
+ explicit VulkanAllocator(const VulkanAllocator<U>& other)
+ : allocator_(other.allocator_), scope_(other.scope_) {}
T* allocate(size_t n) const {
- return static_cast<T*>(AllocMem(host_, n * sizeof(T), alignof(T),
- AllocScope<Host>::kScope));
+ return static_cast<T*>(allocator_.pfnAllocation(
+ allocator_.pUserData, n * sizeof(T), alignof(T), scope_));
+ }
+ void deallocate(T* p, size_t) const {
+ return allocator_.pfnFree(allocator_.pUserData, p);
}
- void deallocate(T* p, size_t) const { return FreeMem(host_, p); }
private:
- template <typename U, typename H>
+ template <typename U>
friend class VulkanAllocator;
- Host host_;
+ const VkAllocationCallbacks& allocator_;
+ const VkSystemAllocationScope scope_;
};
template <typename T, typename Host>
std::shared_ptr<T> InitSharedPtr(Host host, T* obj) {
obj->common.incRef(&obj->common);
- return std::shared_ptr<T>(obj, NativeBaseDeleter<T>(),
- VulkanAllocator<T, Host>(host));
+ return std::shared_ptr<T>(
+ obj, NativeBaseDeleter<T>(),
+ VulkanAllocator<T>(*GetAllocator(host), AllocScope<Host>::kScope));
}
// ----------------------------------------------------------------------------
namespace vulkan {
VKAPI_ATTR
-VkResult CreateAndroidSurfaceKHR(VkInstance instance,
- ANativeWindow* window,
- const VkAllocationCallbacks* /*allocator*/,
- VkSurfaceKHR* out_surface) {
- void* mem = AllocMem(instance, sizeof(Surface), alignof(Surface),
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+VkResult CreateAndroidSurfaceKHR_Bottom(VkInstance instance,
+ ANativeWindow* window,
+ const VkAllocationCallbacks* allocator,
+ VkSurfaceKHR* out_surface) {
+ if (!allocator)
+ allocator = GetAllocator(instance);
+ void* mem = allocator->pfnAllocation(allocator->pUserData, sizeof(Surface),
+ alignof(Surface),
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!mem)
return VK_ERROR_OUT_OF_HOST_MEMORY;
Surface* surface = new (mem) Surface;
ALOGE("native_window_api_connect() failed: %s (%d)", strerror(-err),
err);
surface->~Surface();
- FreeMem(instance, surface);
+ allocator->pfnFree(allocator->pUserData, surface);
return VK_ERROR_INITIALIZATION_FAILED;
}
}
VKAPI_ATTR
-void DestroySurfaceKHR(VkInstance instance,
- VkSurfaceKHR surface_handle,
- const VkAllocationCallbacks* /*allocator*/) {
+void DestroySurfaceKHR_Bottom(VkInstance instance,
+ VkSurfaceKHR surface_handle,
+ const VkAllocationCallbacks* allocator) {
Surface* surface = SurfaceFromHandle(surface_handle);
if (!surface)
return;
native_window_api_disconnect(surface->window.get(), NATIVE_WINDOW_API_EGL);
surface->~Surface();
- FreeMem(instance, surface);
+ if (!allocator)
+ allocator = GetAllocator(instance);
+ allocator->pfnFree(allocator->pUserData, surface);
}
VKAPI_ATTR
-VkResult GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice /*pdev*/,
- uint32_t /*queue_family*/,
- VkSurfaceKHR /*surface*/,
- VkBool32* supported) {
+VkResult GetPhysicalDeviceSurfaceSupportKHR_Bottom(VkPhysicalDevice /*pdev*/,
+ uint32_t /*queue_family*/,
+ VkSurfaceKHR /*surface*/,
+ VkBool32* supported) {
*supported = VK_TRUE;
return VK_SUCCESS;
}
VKAPI_ATTR
-VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR(
+VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR_Bottom(
VkPhysicalDevice /*pdev*/,
VkSurfaceKHR surface,
VkSurfaceCapabilitiesKHR* capabilities) {
}
VKAPI_ATTR
-VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice /*pdev*/,
- VkSurfaceKHR /*surface*/,
- uint32_t* count,
- VkSurfaceFormatKHR* formats) {
+VkResult GetPhysicalDeviceSurfaceFormatsKHR_Bottom(
+ VkPhysicalDevice /*pdev*/,
+ VkSurfaceKHR /*surface*/,
+ uint32_t* count,
+ VkSurfaceFormatKHR* formats) {
// TODO(jessehall): Fill out the set of supported formats. Longer term, add
// a new gralloc method to query whether a (format, usage) pair is
// supported, and check that for each gralloc format that corresponds to a
}
VKAPI_ATTR
-VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice /*pdev*/,
- VkSurfaceKHR /*surface*/,
- uint32_t* count,
- VkPresentModeKHR* modes) {
+VkResult GetPhysicalDeviceSurfacePresentModesKHR_Bottom(
+ VkPhysicalDevice /*pdev*/,
+ VkSurfaceKHR /*surface*/,
+ uint32_t* count,
+ VkPresentModeKHR* modes) {
const VkPresentModeKHR kModes[] = {
VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_FIFO_KHR,
};
}
VKAPI_ATTR
-VkResult CreateSwapchainKHR(VkDevice device,
- const VkSwapchainCreateInfoKHR* create_info,
- const VkAllocationCallbacks* /*allocator*/,
- VkSwapchainKHR* swapchain_handle) {
+VkResult CreateSwapchainKHR_Bottom(VkDevice device,
+ const VkSwapchainCreateInfoKHR* create_info,
+ const VkAllocationCallbacks* allocator,
+ VkSwapchainKHR* swapchain_handle) {
int err;
VkResult result = VK_SUCCESS;
+ if (!allocator)
+ allocator = GetAllocator(device);
+
ALOGV_IF(create_info->imageArraySize != 1,
"Swapchain imageArraySize (%u) != 1 not supported",
create_info->imageArraySize);
// -- Configure the native window --
Surface& surface = *SurfaceFromHandle(create_info->surface);
- const DeviceVtbl& driver_vtbl = GetDriverVtbl(device);
+ const DriverDispatchTable& dispatch = GetDriverDispatch(device);
err = native_window_set_buffers_dimensions(surface.window.get(),
create_info->imageExtent.width,
int gralloc_usage = 0;
// TODO(jessehall): Remove conditional once all drivers have been updated
- if (driver_vtbl.GetSwapchainGrallocUsageANDROID) {
- result = driver_vtbl.GetSwapchainGrallocUsageANDROID(
+ if (dispatch.GetSwapchainGrallocUsageANDROID) {
+ result = dispatch.GetSwapchainGrallocUsageANDROID(
device, create_info->imageFormat, create_info->imageUsage,
&gralloc_usage);
if (result != VK_SUCCESS) {
// -- Allocate our Swapchain object --
// After this point, we must deallocate the swapchain on error.
- void* mem = AllocMem(device, sizeof(Swapchain), alignof(Swapchain),
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ void* mem = allocator->pfnAllocation(allocator->pUserData,
+ sizeof(Swapchain), alignof(Swapchain),
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!mem)
return VK_ERROR_OUT_OF_HOST_MEMORY;
Swapchain* swapchain = new (mem) Swapchain(surface, num_images);
// Any failures during or after this must cancel the dequeued buffers.
VkNativeBufferANDROID image_native_buffer = {
-// TODO(jessehall): Figure out how to make extension headers not horrible.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
.sType = VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID,
image_native_buffer.usage = img.buffer->usage;
result =
- driver_vtbl.CreateImage(device, &image_create, nullptr, &img.image);
+ dispatch.CreateImage(device, &image_create, nullptr, &img.image);
if (result != VK_SUCCESS) {
ALOGD("vkCreateImage w/ native buffer failed: %u", result);
break;
}
if (result != VK_SUCCESS) {
if (img.image)
- driver_vtbl.DestroyImage(device, img.image, nullptr);
+ dispatch.DestroyImage(device, img.image, nullptr);
}
}
if (result != VK_SUCCESS) {
swapchain->~Swapchain();
- FreeMem(device, swapchain);
+ allocator->pfnFree(allocator->pUserData, swapchain);
return result;
}
}
VKAPI_ATTR
-void DestroySwapchainKHR(VkDevice device,
- VkSwapchainKHR swapchain_handle,
- const VkAllocationCallbacks* /*allocator*/) {
- const DeviceVtbl& driver_vtbl = GetDriverVtbl(device);
+void DestroySwapchainKHR_Bottom(VkDevice device,
+ VkSwapchainKHR swapchain_handle,
+ const VkAllocationCallbacks* allocator) {
+ const DriverDispatchTable& dispatch = GetDriverDispatch(device);
Swapchain* swapchain = SwapchainFromHandle(swapchain_handle);
const std::shared_ptr<ANativeWindow>& window = swapchain->surface.window;
img.dequeued = false;
}
if (img.image) {
- driver_vtbl.DestroyImage(device, img.image, nullptr);
+ dispatch.DestroyImage(device, img.image, nullptr);
}
}
+ if (!allocator)
+ allocator = GetAllocator(device);
swapchain->~Swapchain();
- FreeMem(device, swapchain);
+ allocator->pfnFree(allocator->pUserData, swapchain);
}
VKAPI_ATTR
-VkResult GetSwapchainImagesKHR(VkDevice,
- VkSwapchainKHR swapchain_handle,
- uint32_t* count,
- VkImage* images) {
+VkResult GetSwapchainImagesKHR_Bottom(VkDevice,
+ VkSwapchainKHR swapchain_handle,
+ uint32_t* count,
+ VkImage* images) {
Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle);
VkResult result = VK_SUCCESS;
if (images) {
}
VKAPI_ATTR
-VkResult AcquireNextImageKHR(VkDevice device,
- VkSwapchainKHR swapchain_handle,
- uint64_t timeout,
- VkSemaphore semaphore,
- VkFence vk_fence,
- uint32_t* image_index) {
+VkResult AcquireNextImageKHR_Bottom(VkDevice device,
+ VkSwapchainKHR swapchain_handle,
+ uint64_t timeout,
+ VkSemaphore semaphore,
+ VkFence vk_fence,
+ uint32_t* image_index) {
Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle);
ANativeWindow* window = swapchain.surface.window.get();
VkResult result;
}
}
- const DeviceVtbl& driver_vtbl = GetDriverVtbl(device);
- if (driver_vtbl.AcquireImageANDROID) {
- result =
- driver_vtbl.AcquireImageANDROID(device, swapchain.images[idx].image,
- fence_clone, semaphore, vk_fence);
- } else {
- ALOG_ASSERT(driver_vtbl.ImportNativeFenceANDROID,
- "Have neither vkAcquireImageANDROID nor "
- "vkImportNativeFenceANDROID");
- result = driver_vtbl.ImportNativeFenceANDROID(device, semaphore,
- fence_clone);
- }
+ result = GetDriverDispatch(device).AcquireImageANDROID(
+ device, swapchain.images[idx].image, fence_clone, semaphore, vk_fence);
if (result != VK_SUCCESS) {
// NOTE: we're relying on AcquireImageANDROID to close fence_clone,
// even if the call fails. We could close it ourselves on failure, but
}
VKAPI_ATTR
-VkResult QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* present_info) {
+VkResult QueuePresentKHR_Bottom(VkQueue queue,
+ const VkPresentInfoKHR* present_info) {
ALOGV_IF(present_info->sType != VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
"vkQueuePresentKHR: invalid VkPresentInfoKHR structure type %d",
present_info->sType);
ALOGV_IF(present_info->pNext, "VkPresentInfo::pNext != NULL");
- const DeviceVtbl& driver_vtbl = GetDriverVtbl(queue);
+ const DriverDispatchTable& dispatch = GetDriverDispatch(queue);
VkResult final_result = VK_SUCCESS;
for (uint32_t sc = 0; sc < present_info->swapchainCount; sc++) {
Swapchain& swapchain =
int err;
int fence = -1;
- if (driver_vtbl.QueueSignalReleaseImageANDROID) {
- result = driver_vtbl.QueueSignalReleaseImageANDROID(
- queue, img.image, &fence);
- } else {
- ALOG_ASSERT(driver_vtbl.QueueSignalNativeFenceANDROID,
- "Have neither vkQueueSignalReleaseImageANDROID nor "
- "vkQueueSignalNativeFenceANDROID");
- result = driver_vtbl.QueueSignalNativeFenceANDROID(queue, &fence);
- }
+ result =
+ dispatch.QueueSignalReleaseImageANDROID(queue, img.image, &fence);
if (result != VK_SUCCESS) {
ALOGE("QueueSignalReleaseImageANDROID failed: %d", result);
if (present_info->pResults)
#include <hardware/hwvulkan.h>
-#include <array>
-#include <algorithm>
#include <inttypes.h>
#include <string.h>
+#include <algorithm>
+#include <array>
// #define LOG_NDEBUG 0
#include <log/log.h>
#include <utils/Errors.h>
-#include "null_driver.h"
+#include "null_driver_gen.h"
using namespace null_driver;
namespace {
-VKAPI_ATTR
-VkResult CreateInstance(const VkInstanceCreateInfo* /*create_info*/,
- const VkAllocationCallbacks* allocator,
- VkInstance* out_instance) {
- // Assume the loader provided alloc callbacks even if the app didn't.
- ALOG_ASSERT(
- allocator,
- "Missing alloc callbacks, loader or app should have provided them");
-
- VkInstance_T* instance =
- static_cast<VkInstance_T*>(allocator->pfnAllocation(
- allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
- VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
- if (!instance)
- return VK_ERROR_OUT_OF_HOST_MEMORY;
-
- instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
- instance->allocator = *allocator;
- instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
-
- *out_instance = instance;
- return VK_SUCCESS;
-}
-
int CloseDevice(struct hw_device_t* /*device*/) {
// nothing to do - opening a device doesn't allocate any resources
return 0;
}
VKAPI_ATTR
-PFN_vkVoidFunction GetInstanceProcAddr(VkInstance, const char* name) {
- PFN_vkVoidFunction proc = LookupInstanceProcAddr(name);
- if (!proc && strcmp(name, "vkGetDeviceProcAddr") == 0)
- proc = reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr);
- return proc;
+VkResult CreateInstance(const VkInstanceCreateInfo* /*create_info*/,
+ const VkAllocationCallbacks* allocator,
+ VkInstance* out_instance) {
+ // Assume the loader provided alloc callbacks even if the app didn't.
+ ALOG_ASSERT(
+ allocator,
+ "Missing alloc callbacks, loader or app should have provided them");
+
+ VkInstance_T* instance =
+ static_cast<VkInstance_T*>(allocator->pfnAllocation(
+ allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
+ VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
+ if (!instance)
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+ instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
+ instance->allocator = *allocator;
+ instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
+
+ *out_instance = instance;
+ return VK_SUCCESS;
+}
+
+VKAPI_ATTR
+PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
+ return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name);
}
VKAPI_ATTR
PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
- PFN_vkVoidFunction proc = LookupDeviceProcAddr(name);
- if (proc)
- return proc;
- if (strcmp(name, "vkGetSwapchainGrallocUsageANDROID") == 0)
- return reinterpret_cast<PFN_vkVoidFunction>(
- GetSwapchainGrallocUsageANDROID);
- if (strcmp(name, "vkAcquireImageANDROID") == 0)
- return reinterpret_cast<PFN_vkVoidFunction>(AcquireImageANDROID);
- if (strcmp(name, "vkQueueSignalReleaseImageANDROID") == 0)
- return reinterpret_cast<PFN_vkVoidFunction>(
- QueueSignalReleaseImageANDROID);
- return nullptr;
+ return GetInstanceProcAddr(name);
}
// -----------------------------------------------------------------------------
return VK_SUCCESS;
}
-VkResult AcquireImageANDROID(VkDevice, VkImage, int fence, VkSemaphore) {
+VkResult AcquireImageANDROID(VkDevice,
+ VkImage,
+ int fence,
+ VkSemaphore,
+ VkFence) {
close(fence);
return VK_SUCCESS;
}
+++ /dev/null
-/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef NULLDRV_NULL_DRIVER_H
-#define NULLDRV_NULL_DRIVER_H 1
-
-#define VK_PROTOTYPES
-#include <vulkan/vulkan.h>
-#include <vulkan/vk_android_native_buffer.h>
-
-namespace null_driver {
-
-PFN_vkVoidFunction LookupInstanceProcAddr(const char* name);
-PFN_vkVoidFunction LookupDeviceProcAddr(const char* name);
-
-// clang-format off
-VKAPI_ATTR void DestroyInstance(VkInstance instance, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult EnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
-VKAPI_ATTR void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
-VKAPI_ATTR void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties);
-VKAPI_ATTR VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties);
-VKAPI_ATTR void GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
-VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pCount, VkQueueFamilyProperties* pQueueFamilyProperties);
-VKAPI_ATTR void GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties);
-VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName);
-VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName);
-VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkDevice* pDevice);
-VKAPI_ATTR void DestroyDevice(VkDevice device, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pCount, VkExtensionProperties* pProperties);
-VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pCount, VkExtensionProperties* pProperties);
-VKAPI_ATTR VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties);
-VKAPI_ATTR VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pCount, VkLayerProperties* pProperties);
-VKAPI_ATTR void GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
-VKAPI_ATTR VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence);
-VKAPI_ATTR VkResult QueueWaitIdle(VkQueue queue);
-VKAPI_ATTR VkResult DeviceWaitIdle(VkDevice device);
-VKAPI_ATTR VkResult AllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocInfo, const VkAllocationCallbacks* allocator, VkDeviceMemory* pMem);
-VKAPI_ATTR void FreeMemory(VkDevice device, VkDeviceMemory mem, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult MapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData);
-VKAPI_ATTR void UnmapMemory(VkDevice device, VkDeviceMemory mem);
-VKAPI_ATTR VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges);
-VKAPI_ATTR VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges);
-VKAPI_ATTR void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes);
-VKAPI_ATTR VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset);
-VKAPI_ATTR VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset);
-VKAPI_ATTR void GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements);
-VKAPI_ATTR void GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements);
-VKAPI_ATTR void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
-VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pNumProperties, VkSparseImageFormatProperties* pProperties);
-VKAPI_ATTR VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence);
-VKAPI_ATTR VkResult CreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkFence* pFence);
-VKAPI_ATTR void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences);
-VKAPI_ATTR VkResult GetFenceStatus(VkDevice device, VkFence fence);
-VKAPI_ATTR VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout);
-VKAPI_ATTR VkResult CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkSemaphore* pSemaphore);
-VKAPI_ATTR void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkEvent* pEvent);
-VKAPI_ATTR void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult GetEventStatus(VkDevice device, VkEvent event);
-VKAPI_ATTR VkResult SetEvent(VkDevice device, VkEvent event);
-VKAPI_ATTR VkResult ResetEvent(VkDevice device, VkEvent event);
-VKAPI_ATTR VkResult CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkQueryPool* pQueryPool);
-VKAPI_ATTR void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags);
-VKAPI_ATTR VkResult CreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkBuffer* pBuffer);
-VKAPI_ATTR void DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkBufferView* pView);
-VKAPI_ATTR void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkImage* pImage);
-VKAPI_ATTR void DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout);
-VKAPI_ATTR VkResult CreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkImageView* pView);
-VKAPI_ATTR void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkShaderModule* pShaderModule);
-VKAPI_ATTR void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkPipelineCache* pPipelineCache);
-VKAPI_ATTR void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData);
-VKAPI_ATTR VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches);
-VKAPI_ATTR VkResult CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t count, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* allocator, VkPipeline* pPipelines);
-VKAPI_ATTR VkResult CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t count, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* allocator, VkPipeline* pPipelines);
-VKAPI_ATTR void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkPipelineLayout* pPipelineLayout);
-VKAPI_ATTR void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkSampler* pSampler);
-VKAPI_ATTR void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkDescriptorSetLayout* pSetLayout);
-VKAPI_ATTR void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkDescriptorPool* pDescriptorPool);
-VKAPI_ATTR void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags);
-VKAPI_ATTR VkResult AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocInfo, VkDescriptorSet* pDescriptorSets);
-VKAPI_ATTR VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets);
-VKAPI_ATTR void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies);
-VKAPI_ATTR VkResult CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkFramebuffer* pFramebuffer);
-VKAPI_ATTR void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkRenderPass* pRenderPass);
-VKAPI_ATTR void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity);
-VKAPI_ATTR VkResult CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* allocator, VkCommandPool* pCmdPool);
-VKAPI_ATTR void DestroyCommandPool(VkDevice device, VkCommandPool cmdPool, const VkAllocationCallbacks* allocator);
-VKAPI_ATTR VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags);
-VKAPI_ATTR VkResult AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocInfo, VkCommandBuffer* pCmdBuffers);
-VKAPI_ATTR void FreeCommandBuffers(VkDevice device, VkCommandPool cmdPool, uint32_t count, const VkCommandBuffer* pCommandBuffers);
-VKAPI_ATTR VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo);
-VKAPI_ATTR VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer);
-VKAPI_ATTR VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags);
-VKAPI_ATTR void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
-VKAPI_ATTR void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports);
-VKAPI_ATTR void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors);
-VKAPI_ATTR void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth);
-VKAPI_ATTR void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias);
-VKAPI_ATTR void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]);
-VKAPI_ATTR void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds);
-VKAPI_ATTR void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask);
-VKAPI_ATTR void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask);
-VKAPI_ATTR void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference);
-VKAPI_ATTR void CmdBindDescriptorSets(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets);
-VKAPI_ATTR void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType);
-VKAPI_ATTR void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets);
-VKAPI_ATTR void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
-VKAPI_ATTR void CmdDrawIndexed(VkCommandBuffer cmdBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance);
-VKAPI_ATTR void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride);
-VKAPI_ATTR void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride);
-VKAPI_ATTR void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z);
-VKAPI_ATTR void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset);
-VKAPI_ATTR void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions);
-VKAPI_ATTR void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions);
-VKAPI_ATTR void CmdBlitImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
-VKAPI_ATTR void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
-VKAPI_ATTR void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
-VKAPI_ATTR void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData);
-VKAPI_ATTR void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data);
-VKAPI_ATTR void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
-VKAPI_ATTR void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
-VKAPI_ATTR void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects);
-VKAPI_ATTR void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions);
-VKAPI_ATTR void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask);
-VKAPI_ATTR void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask);
-VKAPI_ATTR void CmdWaitEvents(VkCommandBuffer cmdBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, uint32_t memBarrierCount, const void* const* ppMemBarriers);
-VKAPI_ATTR void CmdPipelineBarrier(VkCommandBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, VkDependencyFlags dependencyFlags, uint32_t memBarrierCount, const void* const* ppMemBarriers);
-VKAPI_ATTR void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags);
-VKAPI_ATTR void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot);
-VKAPI_ATTR void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount);
-VKAPI_ATTR void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot);
-VKAPI_ATTR void CmdCopyQueryPoolResults(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize destStride, VkQueryResultFlags flags);
-VKAPI_ATTR void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values);
-VKAPI_ATTR void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents);
-VKAPI_ATTR void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents);
-VKAPI_ATTR void CmdEndRenderPass(VkCommandBuffer cmdBuffer);
-VKAPI_ATTR void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers);
-
-VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
-VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore);
-VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, VkImage image, int* pNativeFenceFd);
-// clang-format on
-
-} // namespace null_driver
-
-#endif // NULLDRV_NULL_DRIVER_H
--- /dev/null
+{{/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */}}
+
+{{Include "../api/templates/vulkan_common.tmpl"}}
+{{Global "clang-format" (Strings "clang-format" "-style=file")}}
+{{Macro "DefineGlobals" $}}
+{{$ | Macro "null_driver_gen.h" | Format (Global "clang-format") | Write "null_driver_gen.h" }}
+{{$ | Macro "null_driver_gen.cpp" | Format (Global "clang-format") | Write "null_driver_gen.cpp"}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ null_driver_gen.h
+-------------------------------------------------------------------------------
+*/}}
+{{define "null_driver_gen.h"}}
+/*
+•* Copyright 2015 The Android Open Source Project
+•*
+•* Licensed under the Apache License, Version 2.0 (the "License");
+•* you may not use this file except in compliance with the License.
+•* You may obtain a copy of the License at
+•*
+•* http://www.apache.org/licenses/LICENSE-2.0
+•*
+•* Unless required by applicable law or agreed to in writing, software
+•* distributed under the License is distributed on an "AS IS" BASIS,
+•* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+•* See the License for the specific language governing permissions and
+•* limitations under the License.
+•*/
+¶
+// This file is generated. Do not edit manually!
+// To regenerate: $ apic template ../api/vulkan.api null_driver.tmpl
+// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
+¶
+#ifndef NULLDRV_NULL_DRIVER_H
+#define NULLDRV_NULL_DRIVER_H 1
+¶
+#define VK_PROTOTYPES
+#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vulkan.h>
+¶
+namespace null_driver {«
+¶
+PFN_vkVoidFunction GetGlobalProcAddr(const char* name);
+PFN_vkVoidFunction GetInstanceProcAddr(const char* name);
+¶
+// clang-format off
+ {{range $f := AllCommands $}}
+ {{if (Macro "IsDriverFunction" $f)}}
+VKAPI_ATTR {{Node "Type" $f.Return}} {{Macro "BaseName" $f}}({{Macro "Parameters" $f}});
+ {{end}}
+ {{end}}
+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, VkImage image, int* pNativeFenceFd);
+// clang-format on
+¶
+»} // namespace null_driver
+¶
+#endif // NULLDRV_NULL_DRIVER_H
+¶{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ null_driver_gen.cpp
+-------------------------------------------------------------------------------
+*/}}
+{{define "null_driver_gen.cpp"}}
+/*
+•* Copyright 2015 The Android Open Source Project
+•*
+•* Licensed under the Apache License, Version 2.0 (the "License");
+•* you may not use this file except in compliance with the License.
+•* You may obtain a copy of the License at
+•*
+•* http://www.apache.org/licenses/LICENSE-2.0
+•*
+•* Unless required by applicable law or agreed to in writing, software
+•* distributed under the License is distributed on an "AS IS" BASIS,
+•* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+•* See the License for the specific language governing permissions and
+•* limitations under the License.
+•*/
+¶
+// This file is generated. Do not edit manually!
+// To regenerate: $ apic template ../api/vulkan.api null_driver.tmpl
+// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
+¶
+#include "null_driver_gen.h"
+#include <algorithm>
+¶
+using namespace null_driver;
+¶
+namespace {
+¶
+struct NameProc {
+ const char* name;
+ PFN_vkVoidFunction proc;
+};
+¶
+PFN_vkVoidFunction Lookup(const char* name,
+ const NameProc* begin,
+ const NameProc* end) {
+ const auto& entry = std::lower_bound(
+ begin, end, name,
+ [](const NameProc& e, const char* n) { return strcmp(e.name, n) < 0; });
+ if (entry == end || strcmp(entry->name, name) != 0)
+ return nullptr;
+ return entry->proc;
+}
+¶
+template <size_t N>
+PFN_vkVoidFunction Lookup(const char* name, const NameProc (&procs)[N]) {
+ return Lookup(name, procs, procs + N);
+}
+¶
+const NameProc kGlobalProcs[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if and (Macro "IsDriverFunction" $f) (eq (Macro "Vtbl" $f) "Global")}}
+ {"{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>(§
+ static_cast<{{Macro "FunctionPtrName" $f}}>(§
+ {{Macro "BaseName" $f}}))},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+const NameProc kInstanceProcs[] = {«
+ // clang-format off
+ {{range $f := SortBy (AllCommands $) "FunctionName"}}
+ {{if (Macro "IsDriverFunction" $f)}}
+ {"{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>(§
+ static_cast<{{Macro "FunctionPtrName" $f}}>(§
+ {{Macro "BaseName" $f}}))},
+ {{end}}
+ {{end}}
+ // clang-format on
+»};
+¶
+} // namespace
+¶
+namespace null_driver {
+¶
+PFN_vkVoidFunction GetGlobalProcAddr(const char* name) {
+ return Lookup(name, kGlobalProcs);
+}
+¶
+PFN_vkVoidFunction GetInstanceProcAddr(const char* name) {«
+ PFN_vkVoidFunction pfn;
+ if ((pfn = Lookup(name, kInstanceProcs)))
+ return pfn;
+ if (strcmp(name, "vkGetSwapchainGrallocUsageANDROID") == 0)
+ return reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetSwapchainGrallocUsageANDROID>(GetSwapchainGrallocUsageANDROID));
+ if (strcmp(name, "vkAcquireImageANDROID") == 0)
+ return reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkAcquireImageANDROID>(AcquireImageANDROID));
+ if (strcmp(name, "vkQueueSignalReleaseImageANDROID") == 0)
+ return reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkQueueSignalReleaseImageANDROID>(QueueSignalReleaseImageANDROID));
+ return nullptr;
+»}
+¶
+} // namespace null_driver
+¶
+{{end}}
+
+
+{{/*
+-------------------------------------------------------------------------------
+ Emits a function name without the "vk" prefix.
+-------------------------------------------------------------------------------
+*/}}
+{{define "BaseName"}}
+ {{AssertType $ "Function"}}
+ {{TrimPrefix "vk" $.Name}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Emits 'true' if the API function is implemented by the driver.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsDriverFunction"}}
+ {{AssertType $ "Function"}}
+
+ {{if not (GetAnnotation $ "pfn")}}
+ {{$ext := GetAnnotation $ "extension"}}
+ {{if $ext}}
+ {{Macro "IsDriverExtension" $ext}}
+ {{else}}
+ true
+ {{end}}
+ {{end}}
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Reports whether an extension is implemented by the driver.
+------------------------------------------------------------------------------
+*/}}
+{{define "IsDriverExtension"}}
+ {{$ext := index $.Arguments 0}}
+ {{if eq $ext "VK_ANDROID_native_buffer"}}true
+ {{end}}
+{{end}}
/*
-* Copyright 2015 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
// This file is generated. Do not edit manually!
-// To regenerate: $ apic template ../api/vulkan.api null_driver_gen.cpp.tmpl
+// To regenerate: $ apic template ../api/vulkan.api null_driver.tmpl
// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
+#include "null_driver_gen.h"
#include <algorithm>
-#include "null_driver.h"
using namespace null_driver;
namespace {
-struct NameProcEntry {
+struct NameProc {
const char* name;
PFN_vkVoidFunction proc;
};
+PFN_vkVoidFunction Lookup(const char* name,
+ const NameProc* begin,
+ const NameProc* end) {
+ const auto& entry = std::lower_bound(
+ begin, end, name,
+ [](const NameProc& e, const char* n) { return strcmp(e.name, n) < 0; });
+ if (entry == end || strcmp(entry->name, name) != 0)
+ return nullptr;
+ return entry->proc;
+}
+
template <size_t N>
-PFN_vkVoidFunction LookupProcAddr(const NameProcEntry(&table)[N],
- const char* name) {
- auto entry = std::lower_bound(table, table + N, name,
- [](const NameProcEntry& e, const char* n) {
- return strcmp(e.name, n) < 0;
- });
- if (entry != (table + N) && strcmp(entry->name, name) == 0)
- return entry->proc;
- return nullptr;
+PFN_vkVoidFunction Lookup(const char* name, const NameProc (&procs)[N]) {
+ return Lookup(name, procs, procs + N);
}
-// The reinterpret_cast<..>(static_cast<..>(..)) business is there to ensure
-// that the function declaration in null_driver.h matches the function pointer
-// type in vulkan.h. If we just used reinterpret_cast<>, the compiler wouldn't
-// tell us if there's a mistake in null_driver.h. A better solution would be to
-// generate the declarations in null_driver.h.
-const NameProcEntry kInstanceProcTbl[] = {
+const NameProc kGlobalProcs[] = {
// clang-format off
- {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDevice>(CreateDevice))},
- {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyInstance>(DestroyInstance))},
- {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateDeviceExtensionProperties>(EnumerateDeviceExtensionProperties))},
- {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateDeviceLayerProperties>(EnumerateDeviceLayerProperties))},
- {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumeratePhysicalDevices>(EnumeratePhysicalDevices))},
- {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetInstanceProcAddr>(GetInstanceProcAddr))},
- {"vkGetPhysicalDeviceFeatures", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceFeatures>(GetPhysicalDeviceFeatures))},
- {"vkGetPhysicalDeviceFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceFormatProperties>(GetPhysicalDeviceFormatProperties))},
- {"vkGetPhysicalDeviceImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceImageFormatProperties>(GetPhysicalDeviceImageFormatProperties))},
- {"vkGetPhysicalDeviceMemoryProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(GetPhysicalDeviceMemoryProperties))},
- {"vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceProperties>(GetPhysicalDeviceProperties))},
- {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceQueueFamilyProperties>(GetPhysicalDeviceQueueFamilyProperties))},
- {"vkGetPhysicalDeviceSparseImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(GetPhysicalDeviceSparseImageFormatProperties))},
+ {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateInstance>(CreateInstance))},
+ {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceExtensionProperties>(EnumerateInstanceExtensionProperties))},
+ {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceLayerProperties>(EnumerateInstanceLayerProperties))},
// clang-format on
};
-const NameProcEntry kDeviceProcTbl[] = {
+const NameProc kInstanceProcs[] = {
// clang-format off
{"vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkAllocateCommandBuffers>(AllocateCommandBuffers))},
{"vkAllocateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkAllocateDescriptorSets>(AllocateDescriptorSets))},
{"vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateComputePipelines>(CreateComputePipelines))},
{"vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDescriptorPool>(CreateDescriptorPool))},
{"vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDescriptorSetLayout>(CreateDescriptorSetLayout))},
+ {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateDevice>(CreateDevice))},
{"vkCreateEvent", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateEvent>(CreateEvent))},
{"vkCreateFence", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateFence>(CreateFence))},
{"vkCreateFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateFramebuffer>(CreateFramebuffer))},
{"vkCreateGraphicsPipelines", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateGraphicsPipelines>(CreateGraphicsPipelines))},
{"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateImage>(CreateImage))},
{"vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateImageView>(CreateImageView))},
+ {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateInstance>(CreateInstance))},
{"vkCreatePipelineCache", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreatePipelineCache>(CreatePipelineCache))},
{"vkCreatePipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreatePipelineLayout>(CreatePipelineLayout))},
{"vkCreateQueryPool", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkCreateQueryPool>(CreateQueryPool))},
{"vkDestroyFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyFramebuffer>(DestroyFramebuffer))},
{"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyImage>(DestroyImage))},
{"vkDestroyImageView", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyImageView>(DestroyImageView))},
+ {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyInstance>(DestroyInstance))},
{"vkDestroyPipeline", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyPipeline>(DestroyPipeline))},
{"vkDestroyPipelineCache", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyPipelineCache>(DestroyPipelineCache))},
{"vkDestroyPipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyPipelineLayout>(DestroyPipelineLayout))},
{"vkDestroyShaderModule", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDestroyShaderModule>(DestroyShaderModule))},
{"vkDeviceWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkDeviceWaitIdle>(DeviceWaitIdle))},
{"vkEndCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEndCommandBuffer>(EndCommandBuffer))},
+ {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateDeviceExtensionProperties>(EnumerateDeviceExtensionProperties))},
+ {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateDeviceLayerProperties>(EnumerateDeviceLayerProperties))},
+ {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceExtensionProperties>(EnumerateInstanceExtensionProperties))},
+ {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumerateInstanceLayerProperties>(EnumerateInstanceLayerProperties))},
+ {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkEnumeratePhysicalDevices>(EnumeratePhysicalDevices))},
{"vkFlushMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkFlushMappedMemoryRanges>(FlushMappedMemoryRanges))},
{"vkFreeCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkFreeCommandBuffers>(FreeCommandBuffers))},
{"vkFreeDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkFreeDescriptorSets>(FreeDescriptorSets))},
{"vkGetImageMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetImageMemoryRequirements>(GetImageMemoryRequirements))},
{"vkGetImageSparseMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetImageSparseMemoryRequirements>(GetImageSparseMemoryRequirements))},
{"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetImageSubresourceLayout>(GetImageSubresourceLayout))},
+ {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetInstanceProcAddr>(GetInstanceProcAddr))},
+ {"vkGetPhysicalDeviceFeatures", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceFeatures>(GetPhysicalDeviceFeatures))},
+ {"vkGetPhysicalDeviceFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceFormatProperties>(GetPhysicalDeviceFormatProperties))},
+ {"vkGetPhysicalDeviceImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceImageFormatProperties>(GetPhysicalDeviceImageFormatProperties))},
+ {"vkGetPhysicalDeviceMemoryProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceMemoryProperties>(GetPhysicalDeviceMemoryProperties))},
+ {"vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceProperties>(GetPhysicalDeviceProperties))},
+ {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceQueueFamilyProperties>(GetPhysicalDeviceQueueFamilyProperties))},
+ {"vkGetPhysicalDeviceSparseImageFormatProperties", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPhysicalDeviceSparseImageFormatProperties>(GetPhysicalDeviceSparseImageFormatProperties))},
{"vkGetPipelineCacheData", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetPipelineCacheData>(GetPipelineCacheData))},
{"vkGetQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetQueryPoolResults>(GetQueryPoolResults))},
{"vkGetRenderAreaGranularity", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vkGetRenderAreaGranularity>(GetRenderAreaGranularity))},
namespace null_driver {
-PFN_vkVoidFunction LookupInstanceProcAddr(const char* name) {
- return LookupProcAddr(kInstanceProcTbl, name);
+PFN_vkVoidFunction GetGlobalProcAddr(const char* name) {
+ return Lookup(name, kGlobalProcs);
}
-PFN_vkVoidFunction LookupDeviceProcAddr(const char* name) {
- return LookupProcAddr(kDeviceProcTbl, name);
+PFN_vkVoidFunction GetInstanceProcAddr(const char* name) {
+ PFN_vkVoidFunction pfn;
+ if ((pfn = Lookup(name, kInstanceProcs)))
+ return pfn;
+ if (strcmp(name, "vkGetSwapchainGrallocUsageANDROID") == 0)
+ return reinterpret_cast<PFN_vkVoidFunction>(
+ static_cast<PFN_vkGetSwapchainGrallocUsageANDROID>(
+ GetSwapchainGrallocUsageANDROID));
+ if (strcmp(name, "vkAcquireImageANDROID") == 0)
+ return reinterpret_cast<PFN_vkVoidFunction>(
+ static_cast<PFN_vkAcquireImageANDROID>(AcquireImageANDROID));
+ if (strcmp(name, "vkQueueSignalReleaseImageANDROID") == 0)
+ return reinterpret_cast<PFN_vkVoidFunction>(
+ static_cast<PFN_vkQueueSignalReleaseImageANDROID>(
+ QueueSignalReleaseImageANDROID));
+ return nullptr;
}
} // namespace null_driver
+++ /dev/null
-{{/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */}}
-
-{{Include "../api/templates/vulkan_common.tmpl"}}
-{{Global "clang-format" (Strings "clang-format" "-style=file")}}
-{{Macro "DefineGlobals" $}}
-{{$ | Macro "null_driver_gen.cpp" | Format (Global "clang-format") | Write "null_driver_gen.cpp"}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Entry point
--------------------------------------------------------------------------------
-*/}}
-{{define "null_driver_gen.cpp"}}
-/*
- * Copyright 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-¶
-// This file is generated. Do not edit manually!
-// To regenerate: $ apic template ../api/vulkan.api null_driver_gen.cpp.tmpl
-// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
-¶
-#include <algorithm>
-#include "null_driver.h"
-¶
-using namespace null_driver;
-¶
-namespace {
-¶
-struct NameProcEntry {
- const char* name;
- PFN_vkVoidFunction proc;
-};
-¶
-template <size_t N>
-PFN_vkVoidFunction LookupProcAddr(const NameProcEntry (&table)[N], const char* name) {
- auto entry = std::lower_bound(
- table, table + N, name,
- [](const NameProcEntry& e, const char* n) { return strcmp(e.name, n) < 0; });
- if (entry != (table + N) && strcmp(entry->name, name) == 0)
- return entry->proc;
- return nullptr;
-}
-¶
-// The reinterpret_cast<..>(static_cast<..>(..)) business is there to ensure
-// that the function declaration in null_driver.h matches the function pointer
-// type in vulkan.h. If we just used reinterpret_cast<>, the compiler wouldn't
-// tell us if there's a mistake in null_driver.h. A better solution would be to
-// generate the declarations in null_driver.h.
-const NameProcEntry kInstanceProcTbl[] = {«
- // clang-format off
- {{range $f := SortBy (AllCommands $) "FunctionName"}}
- {{if not (GetAnnotation $f "extension")}}
- {{if eq (Macro "Vtbl" $f) "Instance"}}
- {"{{Macro "FunctionName" $f}}", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vk{{Macro "FunctionNameNoPrefix" $f}}>({{Macro "FunctionNameNoPrefix" $f}}))},
- {{end}}
- {{end}}
- {{end}}
- // clang-format on
-»};
-¶
-const NameProcEntry kDeviceProcTbl[] = {«
- // clang-format off
- {{range $f := SortBy (AllCommands $) "FunctionName"}}
- {{if not (GetAnnotation $f "extension")}}
- {{if eq (Macro "Vtbl" $f) "Device"}}
- {"{{Macro "FunctionName" $f}}", reinterpret_cast<PFN_vkVoidFunction>(static_cast<PFN_vk{{Macro "FunctionNameNoPrefix" $f}}>({{Macro "FunctionNameNoPrefix" $f}}))},
- {{end}}
- {{end}}
- {{end}}
- // clang-format on
-»};
-¶
-} // namespace
-¶
-namespace null_driver {
-¶
-PFN_vkVoidFunction LookupInstanceProcAddr(const char* name) {
- return LookupProcAddr(kInstanceProcTbl, name);
-}
-¶
-PFN_vkVoidFunction LookupDeviceProcAddr(const char* name) {
- return LookupProcAddr(kDeviceProcTbl, name);
-}
-¶
-} // namespace null_driver
-¶
-{{end}}
-
-
-{{/*
--------------------------------------------------------------------------------
- Emits the name of a function without the "vk" prefix.
--------------------------------------------------------------------------------
-*/}}
-{{define "FunctionNameNoPrefix"}}{{AssertType $ "Function"}}{{TrimPrefix "vk" $.Name}}{{end}}
--- /dev/null
+/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This file is generated. Do not edit manually!
+// To regenerate: $ apic template ../api/vulkan.api null_driver.tmpl
+// Requires apic from https://android.googlesource.com/platform/tools/gpu/.
+
+#ifndef NULLDRV_NULL_DRIVER_H
+#define NULLDRV_NULL_DRIVER_H 1
+
+#define VK_PROTOTYPES
+#include <vulkan/vk_android_native_buffer.h>
+#include <vulkan/vulkan.h>
+
+namespace null_driver {
+
+PFN_vkVoidFunction GetGlobalProcAddr(const char* name);
+PFN_vkVoidFunction GetInstanceProcAddr(const char* name);
+
+// clang-format off
+VKAPI_ATTR VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
+VKAPI_ATTR void DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult EnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
+VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName);
+VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName);
+VKAPI_ATTR void GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
+VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties);
+VKAPI_ATTR void GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties);
+VKAPI_ATTR void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
+VKAPI_ATTR void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties);
+VKAPI_ATTR VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties);
+VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
+VKAPI_ATTR void DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult EnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
+VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
+VKAPI_ATTR VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties);
+VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
+VKAPI_ATTR void GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
+VKAPI_ATTR VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
+VKAPI_ATTR VkResult QueueWaitIdle(VkQueue queue);
+VKAPI_ATTR VkResult DeviceWaitIdle(VkDevice device);
+VKAPI_ATTR VkResult AllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
+VKAPI_ATTR void FreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData);
+VKAPI_ATTR void UnmapMemory(VkDevice device, VkDeviceMemory memory);
+VKAPI_ATTR VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+VKAPI_ATTR VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+VKAPI_ATTR void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes);
+VKAPI_ATTR void GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements);
+VKAPI_ATTR VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+VKAPI_ATTR void GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements);
+VKAPI_ATTR VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+VKAPI_ATTR void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
+VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties);
+VKAPI_ATTR VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence);
+VKAPI_ATTR VkResult CreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence);
+VKAPI_ATTR void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences);
+VKAPI_ATTR VkResult GetFenceStatus(VkDevice device, VkFence fence);
+VKAPI_ATTR VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout);
+VKAPI_ATTR VkResult CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore);
+VKAPI_ATTR void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent);
+VKAPI_ATTR void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetEventStatus(VkDevice device, VkEvent event);
+VKAPI_ATTR VkResult SetEvent(VkDevice device, VkEvent event);
+VKAPI_ATTR VkResult ResetEvent(VkDevice device, VkEvent event);
+VKAPI_ATTR VkResult CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool);
+VKAPI_ATTR void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags);
+VKAPI_ATTR VkResult CreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer);
+VKAPI_ATTR void DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView);
+VKAPI_ATTR void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage);
+VKAPI_ATTR void DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout);
+VKAPI_ATTR VkResult CreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView);
+VKAPI_ATTR void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule);
+VKAPI_ATTR void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache);
+VKAPI_ATTR void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData);
+VKAPI_ATTR VkResult MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches);
+VKAPI_ATTR VkResult CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+VKAPI_ATTR VkResult CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+VKAPI_ATTR void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout);
+VKAPI_ATTR void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler);
+VKAPI_ATTR void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout);
+VKAPI_ATTR void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool);
+VKAPI_ATTR void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags);
+VKAPI_ATTR VkResult AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets);
+VKAPI_ATTR VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets);
+VKAPI_ATTR void UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies);
+VKAPI_ATTR VkResult CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer);
+VKAPI_ATTR void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
+VKAPI_ATTR void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity);
+VKAPI_ATTR VkResult CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool);
+VKAPI_ATTR void DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags);
+VKAPI_ATTR VkResult AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
+VKAPI_ATTR void FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+VKAPI_ATTR VkResult BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo);
+VKAPI_ATTR VkResult EndCommandBuffer(VkCommandBuffer commandBuffer);
+VKAPI_ATTR VkResult ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags);
+VKAPI_ATTR void CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
+VKAPI_ATTR void CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports);
+VKAPI_ATTR void CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors);
+VKAPI_ATTR void CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth);
+VKAPI_ATTR void CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor);
+VKAPI_ATTR void CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]);
+VKAPI_ATTR void CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds);
+VKAPI_ATTR void CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask);
+VKAPI_ATTR void CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask);
+VKAPI_ATTR void CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference);
+VKAPI_ATTR void CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets);
+VKAPI_ATTR void CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType);
+VKAPI_ATTR void CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets);
+VKAPI_ATTR void CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
+VKAPI_ATTR void CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance);
+VKAPI_ATTR void CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+VKAPI_ATTR void CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+VKAPI_ATTR void CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z);
+VKAPI_ATTR void CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset);
+VKAPI_ATTR void CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions);
+VKAPI_ATTR void CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions);
+VKAPI_ATTR void CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
+VKAPI_ATTR void CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+VKAPI_ATTR void CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+VKAPI_ATTR void CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData);
+VKAPI_ATTR void CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data);
+VKAPI_ATTR void CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+VKAPI_ATTR void CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+VKAPI_ATTR void CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects);
+VKAPI_ATTR void CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions);
+VKAPI_ATTR void CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+VKAPI_ATTR void CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+VKAPI_ATTR void CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers);
+VKAPI_ATTR void CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const void* const* ppMemoryBarriers);
+VKAPI_ATTR void CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t entry, VkQueryControlFlags flags);
+VKAPI_ATTR void CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t entry);
+VKAPI_ATTR void CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount);
+VKAPI_ATTR void CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t entry);
+VKAPI_ATTR void CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags);
+VKAPI_ATTR void CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues);
+VKAPI_ATTR void CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents);
+VKAPI_ATTR void CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents);
+VKAPI_ATTR void CmdEndRenderPass(VkCommandBuffer commandBuffer);
+VKAPI_ATTR void CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount, const VkCommandBuffer* pCommandBuffers);
+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, VkImage image, int* pNativeFenceFd);
+// clang-format on
+
+} // namespace null_driver
+
+#endif // NULLDRV_NULL_DRIVER_H
*/
#include <inttypes.h>
-#include <sstream>
#include <stdlib.h>
+#include <sstream>
#include <vector>
#define VK_PROTOTYPES
VkMemoryPropertyFlags flags =
mem_props.memoryTypes[type].propertyFlags;
if ((flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) != 0)
- strbuf << "DEVICE_LOCAL";
+ strbuf << " DEVICE_LOCAL";
if ((flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)
- strbuf << "HOST_VISIBLE";
+ strbuf << " HOST_VISIBLE";
if ((flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0)
strbuf << " COHERENT";
if ((flags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) != 0)
strbuf << " CACHED";
if ((flags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) != 0)
strbuf << " LAZILY_ALLOCATED";
- printf(" Type %u: %s\n", type, strbuf.str().c_str());
+ printf(" Type %u:%s\n", type, strbuf.str().c_str());
strbuf.str(std::string());
}
}