}
my_device_data->deviceMap[device].device = device;
my_device_data->deviceMap[device].swapchainExtensionEnabled = false;
+ my_device_data->deviceMap[device].displaySwapchainExtensionEnabled = false;
// Record whether the WSI device extension was enabled for this VkDevice.
// No need to check if the extension was advertised by
// vkEnumerateDeviceExtensionProperties(), since the loader handles that.
for (i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) {
-
my_device_data->deviceMap[device].swapchainExtensionEnabled = true;
}
+ if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME) == 0) {
+ my_device_data->deviceMap[device].displaySwapchainExtensionEnabled = true;
+ }
}
}
return VK_ERROR_VALIDATION_FAILED_EXT;
}
-VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) {
+VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
+ const VkSwapchainCreateInfoKHR *pCreateInfos,
+ const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) {
+ VkResult result = VK_SUCCESS;
+ bool skip_call = false;
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ std::unique_lock<std::mutex> lock(global_lock);
+ SwpDevice *pDevice = nullptr;
+ {
+ auto it = my_data->deviceMap.find(device);
+ pDevice = (it == my_data->deviceMap.end()) ? nullptr : &it->second;
+ }
+
+ // Validate that the swapchain extension was enabled:
+ if (pDevice && !pDevice->displaySwapchainExtensionEnabled) {
+ skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
+ reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name,
+ "vkCreateSharedSwapchainsKHR() called even though the %s extension was not enabled for this VkDevice.",
+ VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME);
+ }
+ if (!pCreateInfos || !pSwapchains) {
+ skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
+ reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_NULL_POINTER, swapchain_layer_name,
+ "vkCreateSharedSwapchainsKHR() called with NULL pointer");
+ }
+ if (swapchainCount == 0) {
+ skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
+ reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_INVALID_COUNT, swapchain_layer_name,
+ "vkCreateSharedSwapchainsKHR() called with invalid swapchain count of %d.", swapchainCount);
+ } else {
+ SwpSwapchain *pSwapchain = nullptr;
+ for (uint32_t iii = 0; iii < swapchainCount; iii++) {
+ if (pCreateInfos[iii].sType != VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR) {
+ skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
+ reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_WRONG_STYPE, swapchain_layer_name,
+ "vkCreateSharedSwapchainsKHR() called with invalid stype in pCreateInfos[%d].", iii);
+ }
+ auto it = my_data->swapchainMap.find(pSwapchains[iii]);
+ pSwapchain = (it == my_data->swapchainMap.end()) ? nullptr : &it->second;
+ if (nullptr == pSwapchain) {
+ skip_call |=
+ log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
+ reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_INVALID_HANDLE, swapchain_layer_name,
+ "vkCreateSharedSwapchainsKHR() called with invalid Swapchain Handle in pCreateInfos[%d].", iii);
+ }
+ }
+ }
+ lock.unlock();
+
+ if (!skip_call) {
+ // Call down the call chain:
+ result = my_data->device_dispatch_table->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator,
+ pSwapchains);
+ return result;
+ }
+ return VK_ERROR_VALIDATION_FAILED_EXT;
+}
+
+VKAPI_ATTR void VKAPI_CALL
+GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) {
bool skip_call = false;
layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
],
)
+ext_khr_display_swapchain = Extension(
+ name="VK_KHR_display_swapchain",
+ headers=["vulkan/vulkan.h"],
+ objects=["VkDisplayPresentInfoKHR"],
+ protos=[
+ Proto("VkResult", "CreateSharedSwapchainsKHR",
+ [Param("VkDevice", "device"),
+ Param("uint32_t", "swapchainCount"),
+ Param("const VkSwapchainCreateInfoKHR*", "pCreateInfos"),
+ Param("const VkAllocationCallbacks*", "pAllocator"),
+ Param("VkSwapchainKHR*", "pSwapchains")]),
+ ],
+)
+
ext_khr_xcb_surface = Extension(
name="VK_KHR_xcb_surface",
headers=["vulkan/vulkan.h"],
Param("uint32_t", "queueFamilyIndex")]),
],
)
-lunarg_debug_report = Extension(
+ext_debug_report = Extension(
name="VK_EXT_debug_report",
headers=["vulkan/vulkan.h"],
objects=[
Param("const char *", "pMsg")]),
],
)
+ext_debug_marker = Extension(
+ name="VK_EXT_debug_marker",
+ headers=["vulkan/vulkan.h"],
+ objects=[
+ "VkDebugMarkerObjectNameInfoEXT",
+ "VkDebugMarkerObjectTagInfoEXT",
+ "VkDebugMarkerMarkerInfoEXT"
+ ],
+ protos=[
+ Proto("VkResult", "DebugMarkerSetObjectTagEXT",
+ [Param("VkDevice", "device"),
+ Param("VkDebugMarkerObjectTagInfoEXT*", "pTagInfo")]),
+
+ Proto("VkResult", "DebugMarkerSetObjectNameEXT",
+ [Param("VkDevice", "device"),
+ Param("VkDebugMarkerObjectNameInfoEXT*", "pNameInfo")]),
+
+ Proto("void", "CmdDebugMarkerBeginEXT",
+ [Param("VkCommandBuffer", "commandBuffer"),
+ Param("VkDebugMarkerMarkerInfoEXT*", "pMarkerInfo")]),
+
+ Proto("void", "CmdDebugMarkerEndEXT",
+ [Param("VkCommandBuffer*", "commandBuffer")]),
+
+ Proto("void", "CmdDebugMarkerInsertEXT",
+ [Param("VkCommandBuffer", "commandBuffer"),
+ Param("VkDebugMarkerMarkerInfoEXT*", "pMarkerInfo")]),
+ ],
+)
import sys
if sys.argv[1] == 'AllPlatforms':
- extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display, ext_khr_android_surface, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, ext_nv_external_memory_win32]
- extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display, ext_khr_android_surface, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, ext_nv_external_memory_win32, lunarg_debug_report]
+ extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_xcb_surface,
+ ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display,
+ ext_khr_android_surface, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
+ ext_khr_display_swapchain]
+ extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
+ ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
+ ext_khr_display, ext_khr_android_surface, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
+ ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
else :
if len(sys.argv) > 3:
if sys.platform.startswith('win32') and sys.argv[1] != 'Android':
- extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_display, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, ext_nv_external_memory_win32]
- extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_display, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, ext_nv_external_memory_win32, lunarg_debug_report]
+ extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
+ ext_khr_display, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
+ ext_khr_display_swapchain]
+ extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
+ ext_khr_display, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
+ ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
elif sys.platform.startswith('linux') and sys.argv[1] != 'Android':
- extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities]
- extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, lunarg_debug_report]
+ extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
+ ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display,
+ ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities,
+ ext_khr_display_swapchain]
+ extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
+ ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
+ ext_khr_display, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_khr_display_swapchain,
+ ext_debug_report, ext_debug_marker]
else: # android
- extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities]
- extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, lunarg_debug_report]
+ extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
+ ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities,
+ ext_khr_display_swapchain]
+ extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
+ ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities,
+ ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
else :
if sys.argv[1] == 'Win32':
- extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_display, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, ext_nv_external_memory_win32]
- extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_display, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, ext_nv_external_memory_win32, lunarg_debug_report]
+ extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
+ ext_khr_display, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
+ ext_khr_display_swapchain]
+ extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
+ ext_khr_display, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
+ ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
elif sys.argv[1] == 'Android':
- extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities]
- extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities, lunarg_debug_report]
+ extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
+ ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities,
+ ext_khr_display_swapchain]
+ extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
+ ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities,
+ ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
elif sys.argv[1] == 'Xcb' or sys.argv[1] == 'Xlib' or sys.argv[1] == 'Wayland' or sys.argv[1] == 'Mir' or sys.argv[1] == 'Display':
- extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities]
- extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display, lunarg_debug_report, ext_amd_extension_draw_indirect_count, ext_nv_external_memory_capabilities]
+ extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
+ ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
+ ext_khr_display, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_khr_display_swapchain]
+ extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
+ ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
+ ext_khr_display, ext_amd_extension_draw_indirect_count,
+ ext_nv_external_memory_capabilities, ext_khr_display_swapchain,
+ ext_debug_report, ext_debug_marker]
else:
print('Error: Undefined DisplayServer')
extensions = []