// Call down the call chain:
result = my_data->instance_dispatch_table->GetPhysicalDeviceMirPresentationSupportKHR(
physicalDevice, queueFamilyIndex, connection);
-
- if (pPhysicalDevice) {
- // Record the result of this query:
- pPhysicalDevice->queueFamilyIndexSupport[queueFamilyIndex] = result;
- }
}
return result;
}
// Call down the call chain:
result = my_data->instance_dispatch_table->GetPhysicalDeviceWaylandPresentationSupportKHR(
physicalDevice, queueFamilyIndex, display);
-
- if (pPhysicalDevice) {
- // Record the result of this query:
- pPhysicalDevice->queueFamilyIndexSupport[queueFamilyIndex] = result;
- }
}
return result;
}
// Call down the call chain:
result = my_data->instance_dispatch_table->GetPhysicalDeviceWin32PresentationSupportKHR(
physicalDevice, queueFamilyIndex);
-
- if (pPhysicalDevice) {
- // Record the result of this query:
- pPhysicalDevice->queueFamilyIndexSupport[queueFamilyIndex] = result;
- }
}
return result;
}
// Call down the call chain:
result = my_data->instance_dispatch_table->GetPhysicalDeviceXcbPresentationSupportKHR(
physicalDevice, queueFamilyIndex, connection, visual_id);
-
- if (pPhysicalDevice) {
- // Record the result of this query:
- pPhysicalDevice->queueFamilyIndexSupport[queueFamilyIndex] = result;
- }
}
return result;
}
// Call down the call chain:
result = my_data->instance_dispatch_table->GetPhysicalDeviceXlibPresentationSupportKHR(
physicalDevice, queueFamilyIndex, dpy, visualID);
-
- if (pPhysicalDevice) {
- // Record the result of this query:
- pPhysicalDevice->queueFamilyIndexSupport[queueFamilyIndex] = result;
- }
}
return result;
}
if ((result == VK_SUCCESS) && pSupported && pPhysicalDevice) {
// Record the result of this query:
pPhysicalDevice->queueFamilyIndexSupport[queueFamilyIndex] =
- *pSupported;
+ surface;
+ pPhysicalDevice->surfaceSupport[surface] =
+ queueFamilyIndex;
// TODO: We need to compare this with the actual queue used for
// presentation, to ensure it was advertised to the application as
// supported for presentation.
"vkGetPhysicalDeviceSurfaceCapabilitiesKHR().",
fn);
} else if (pCreateInfo) {
+ // Validate pCreateInfo->surface to make sure that
+ // vkGetPhysicalDeviceSurfaceSupportKHR() reported this as a supported
+ // surface:
+ uint32_t queueFamilyIndex = pPhysicalDevice->surfaceSupport[pCreateInfo->surface];
+ if (!queueFamilyIndex) {
+ skipCall |= LOG_ERROR(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, device, "VkDevice",
+ SWAPCHAIN_CREATE_UNSUPPORTED_SURFACE,
+ "%s() called with pCreateInfo->surface that "
+ "was not returned by "
+ "vkGetPhysicalDeviceSurfaceSupportKHR() "
+ "for the device.",
+ fn);
+ }
+
// Validate pCreateInfo->minImageCount against
// VkSurfaceCapabilitiesKHR::{min|max}ImageCount:
VkSurfaceCapabilitiesKHR *pCapabilities = &pPhysicalDevice->surfaceCapabilities;
SWAPCHAIN_NULL_POINTER, // Pointer set to NULL, instead of being a valid pointer
SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, // Did not enable WSI extension, but called WSI function
SWAPCHAIN_DEL_DEVICE_BEFORE_SWAPCHAINS, // Called vkDestroyDevice() before vkDestroySwapchainKHR()
+ SWAPCHAIN_CREATE_UNSUPPORTED_SURFACE, // Called vkCreateSwapchainKHR() with a pCreateInfo->surface that wasn't seen as supported by vkGetPhysicalDeviceSurfaceSupportKHR for the device
SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, // Called vkCreateSwapchainKHR() without calling a query (e.g. vkGetPhysicalDeviceSurfaceCapabilitiesKHR())
SWAPCHAIN_CREATE_SWAP_BAD_MIN_IMG_COUNT, // Called vkCreateSwapchainKHR() with out-of-bounds minImageCount
SWAPCHAIN_CREATE_SWAP_OUT_OF_BOUNDS_EXTENTS,// Called vkCreateSwapchainKHR() with out-of-bounds imageExtent
// VkInstance that this VkPhysicalDevice is associated with:
SwpInstance *pInstance;
- // Which queueFamilyIndices support presenting with WSI swapchains:
- unordered_map<uint32_t, VkBool32> queueFamilyIndexSupport;
+ // Record all supported queueFamilyIndex-surface pairs that support
+ // presenting with WSI swapchains:
+ unordered_map<uint32_t, VkSurfaceKHR> queueFamilyIndexSupport;
+
+ // Record all supported surface-queueFamilyIndex pairs that support
+ // presenting with WSI swapchains:
+ unordered_map<VkSurfaceKHR, uint32_t> surfaceSupport;
// TODO: Record/use this info per-surface, not per-device, once a
// non-dispatchable surface object is added to WSI:
| Valid pointer | If a NULL pointer is used, this error will be flagged | NULL_POINTER | vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfacePresentModesKHR vkCreateSwapchainKHR vkGetSwapchainImagesKHR vkAcquireNextImageKHR vkQueuePresentKHR | NA | None |
| Extension enabled before use | Validates that a WSI extension is enabled before its functions are used | EXT_NOT_ENABLED_BUT_USED | vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfacePresentModesKHR vkCreateSwapchainKHR vkDestroySwapchainKHR vkGetSwapchainImagesKHR vkAcquireNextImageKHR vkQueuePresentKHR | NA | None |
| Swapchains destroyed before devices | Validates that vkDestroySwapchainKHR() is called for all swapchains associated with a device before vkDestroyDevice() is called | DEL_DEVICE_BEFORE_SWAPCHAINS | vkDestroyDevice | NA | None |
+| Supported surface used with a swapchain | Validates that vkGetPhysicalDeviceSurfaceSupportKHR() was seen to support the surface used with a swapchain | CREATE_SWAP_UNSUPPORTED_SURFACE | vkCreateSwapchainKHR | NA | None |
| Queries occur before swapchain creation | Validates that vkGetPhysicalDeviceSurfaceCapabilitiesKHR(), vkGetPhysicalDeviceSurfaceFormatsKHR() and vkGetPhysicalDeviceSurfacePresentModesKHR() are called before vkCreateSwapchainKHR() | CREATE_SWAP_WITHOUT_QUERY | vkCreateSwapchainKHR | NA | None |
| vkCreateSwapchainKHR(pCreateInfo->minImageCount) | Validates vkCreateSwapchainKHR(pCreateInfo->minImageCount) | CREATE_SWAP_BAD_MIN_IMG_COUNT | vkCreateSwapchainKHR | NA | None |
| vkCreateSwapchainKHR(pCreateInfo->imageExtent) | Validates vkCreateSwapchainKHR(pCreateInfo->imageExtent) when window has no fixed size | CREATE_SWAP_OUT_OF_BOUNDS_EXTENTS | vkCreateSwapchainKHR | NA | None |