Make layer require VK_KHR_bind_memory2 extension and intercept KHR

Enables the layer to intercept vkBindImageMemory2KHR, and by requiring
the extension we ensure we can always call the entrypoint down the
chain as well.

Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I1ec5f8c6ba648151e08101549cb795e990c84aeb
This commit is contained in:
Dennis Tsiang 2025-03-25 12:24:01 +00:00
parent 0562f6c433
commit 201914d7cc
2 changed files with 9 additions and 0 deletions

View file

@ -523,6 +523,7 @@ wsi_layer_vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice,
VWL_VKAPI_CALL(PFN_vkVoidFunction)
wsi_layer_vkGetDeviceProcAddr(VkDevice device, const char *funcName) VWL_API_POST
{
uint64_t api_version = layer::device_private_data::get(device).instance_data.api_version;
if (layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_SWAPCHAIN_EXTENSION_NAME))
{
GET_PROC_ADDR(vkCreateSwapchainKHR);
@ -553,6 +554,13 @@ wsi_layer_vkGetDeviceProcAddr(VkDevice device, const char *funcName) VWL_API_POS
GET_PROC_ADDR(vkCreateImage);
GET_PROC_ADDR(vkBindImageMemory2);
if (!strcmp(funcName, "vkBindImageMemory2KHR") &&
layer::device_private_data::get(device).disp.get_user_enabled_entrypoint(device, api_version, funcName) !=
nullptr)
{
return (PFN_vkVoidFunction)&wsi_layer_vkBindImageMemory2;
}
/* VK_EXT_swapchain_maintenance1 */
if (layer::device_private_data::get(device).is_device_extension_enabled(
VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME))

View file

@ -171,6 +171,7 @@ VkResult add_device_extensions_required_by_layer(VkPhysicalDevice phys_dev,
#if ENABLE_INSTRUMENTATION
VK_EXT_FRAME_BOUNDARY_EXTENSION_NAME,
#endif
VK_KHR_BIND_MEMORY_2_EXTENSION_NAME,
};
for (auto extension : optional_extensions)