return pTable->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties);
}
+static PFN_vkVoidFunction
+intercept_core_device_command(const char *name);
+
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) {
- if (!strcmp(funcName, "vkGetDeviceProcAddr"))
- return (PFN_vkVoidFunction)GetDeviceProcAddr;
- if (!strcmp(funcName, "vkDestroyDevice"))
- return (PFN_vkVoidFunction)DestroyDevice;
- if (!strcmp(funcName, "vkCreateImage"))
- return (PFN_vkVoidFunction)CreateImage;
- if (!strcmp(funcName, "vkDestroyImage"))
- return (PFN_vkVoidFunction)DestroyImage;
- if (!strcmp(funcName, "vkCreateImageView"))
- return (PFN_vkVoidFunction)CreateImageView;
- if (!strcmp(funcName, "vkCreateRenderPass"))
- return (PFN_vkVoidFunction)CreateRenderPass;
- if (!strcmp(funcName, "vkCmdClearColorImage"))
- return (PFN_vkVoidFunction)CmdClearColorImage;
- if (!strcmp(funcName, "vkCmdClearDepthStencilImage"))
- return (PFN_vkVoidFunction)CmdClearDepthStencilImage;
- if (!strcmp(funcName, "vkCmdClearAttachments"))
- return (PFN_vkVoidFunction)CmdClearAttachments;
- if (!strcmp(funcName, "vkCmdCopyImage"))
- return (PFN_vkVoidFunction)CmdCopyImage;
- if (!strcmp(funcName, "vkCmdCopyImageToBuffer"))
- return (PFN_vkVoidFunction)CmdCopyImageToBuffer;
- if (!strcmp(funcName, "vkCmdCopyBufferToImage"))
- return (PFN_vkVoidFunction)CmdCopyBufferToImage;
- if (!strcmp(funcName, "vkCmdBlitImage"))
- return (PFN_vkVoidFunction)CmdBlitImage;
- if (!strcmp(funcName, "vkCmdPipelineBarrier"))
- return (PFN_vkVoidFunction)CmdPipelineBarrier;
- if (!strcmp(funcName, "vkCmdResolveImage"))
- return (PFN_vkVoidFunction)CmdResolveImage;
- if (!strcmp(funcName, "vkGetImageSubresourceLayout"))
- return (PFN_vkVoidFunction)GetImageSubresourceLayout;
-
- if (device == NULL) {
- return NULL;
- }
+ PFN_vkVoidFunction proc = intercept_core_device_command(funcName);
+ if (proc)
+ return proc;
+
+ assert(device);
layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
return pTable->GetInstanceProcAddr(instance, funcName);
}
+static PFN_vkVoidFunction
+intercept_core_device_command(const char *name) {
+ static const struct {
+ const char *name;
+ PFN_vkVoidFunction proc;
+ } core_device_commands[] = {
+ { "vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr) },
+ { "vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice) },
+ { "vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage) },
+ { "vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage) },
+ { "vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(CreateImageView) },
+ { "vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CreateRenderPass) },
+ { "vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearColorImage) },
+ { "vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage) },
+ { "vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments) },
+ { "vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage) },
+ { "vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer) },
+ { "vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage) },
+ { "vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(CmdBlitImage) },
+ { "vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(CmdPipelineBarrier) },
+ { "vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage) },
+ { "vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout) },
+ };
+
+ for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) {
+ if (!strcmp(core_device_commands[i].name, name))
+ return core_device_commands[i].proc;
+ }
+
+ return nullptr;
+}
+
} // namespace image
// vk_layer_logging.h expects these to be defined