aboutsummaryrefslogtreecommitdiff
path: root/layers/object_tracker.h
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2016-06-28 16:59:36 -0600
committerJon Ashburn <jon@lunarg.com>2016-06-30 11:18:44 -0600
commitb8b0c3ae1ce0242d9614e27a7a68346ffcee597e (patch)
treed68e46ef9731a34bbe44034cbd77d2d4a1a61c3e /layers/object_tracker.h
parent147f25d8f03692b361a70f024bd8f2d8062eb90f (diff)
downloadusermoji-b8b0c3ae1ce0242d9614e27a7a68346ffcee597e.tar.xz
layers: FIx object_tracker displayKHR and displayModeKHR creation
For displayModeKHR there are two separate Vulkan commands that can create these objects. For displayKHR there is one command that creates the object: GetPhysicalDeviceDisplayPropertiesKHR. GetDisplayPlaneSupportedDisplaysKHR doesn't create new objects but returns existing objects. The existing code had the creation in GetDisplayPlaneSupportedDisplaysKHR rather than in GetPhysicalDeviceDisplayPropertiesKHR. Change-Id: I63df7c41a0d17acd8b06ebb1a5742ac032159a09
Diffstat (limited to 'layers/object_tracker.h')
-rw-r--r--layers/object_tracker.h43
1 files changed, 37 insertions, 6 deletions
diff --git a/layers/object_tracker.h b/layers/object_tracker.h
index a20760f4..4bba6985 100644
--- a/layers/object_tracker.h
+++ b/layers/object_tracker.h
@@ -290,6 +290,7 @@ static void create_device(VkDevice dispatchable_object, VkDevice object, VkDebug
static void create_device(VkPhysicalDevice dispatchable_object, VkDevice object, VkDebugReportObjectTypeEXT objType);
static void create_queue(VkDevice dispatchable_object, VkQueue vkObj, VkDebugReportObjectTypeEXT objType);
static void create_display_khr(VkPhysicalDevice dispatchable_object, VkDisplayKHR vkObj, VkDebugReportObjectTypeEXT objType);
+static void create_display_mode_khr(VkPhysicalDevice dispatchable_object, VkDisplayModeKHR vkObj, VkDebugReportObjectTypeEXT objType);
static bool validate_image(VkQueue dispatchable_object, VkImage object, VkDebugReportObjectTypeEXT objType, bool null_allowed);
static bool validate_instance(VkInstance dispatchable_object, VkInstance object, VkDebugReportObjectTypeEXT objType,
bool null_allowed);
@@ -315,6 +316,10 @@ static bool validate_pipeline_layout(VkDevice dispatchable_object, VkPipelineLay
bool null_allowed);
static bool validate_pipeline(VkDevice dispatchable_object, VkPipeline object, VkDebugReportObjectTypeEXT objType,
bool null_allowed);
+static bool validate_display_khr(VkPhysicalDevice dispatchable_object, VkDisplayKHR object, VkDebugReportObjectTypeEXT objType,
+ bool null_allowed);
+static bool validate_display_mode_khr(VkInstance dispatchable_object, VkDisplayModeKHR object, VkDebugReportObjectTypeEXT objType,
+ bool null_allowed);
static void destroy_command_pool(VkDevice dispatchable_object, VkCommandPool object);
static void destroy_descriptor_pool(VkDevice dispatchable_object, VkDescriptorPool object);
static void destroy_descriptor_set(VkDevice dispatchable_object, VkDescriptorSet object);
@@ -1027,21 +1032,47 @@ VkResult explicit_GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchai
return result;
}
-VkResult VKAPI_CALL explicit_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays)
+VkResult explicit_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties)
{
bool skipCall = false;
{
std::lock_guard<std::mutex> lock(global_lock);
- skipCall |= validate_physical_device(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false);
+ if (physicalDevice) {
+ skipCall |= validate_physical_device(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false);
+ }
}
if (skipCall)
return VK_ERROR_VALIDATION_FAILED_EXT;
- VkResult result = get_dispatch_table(object_tracker_instance_table_map, physicalDevice)->GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays);
+ VkResult result = get_dispatch_table(object_tracker_instance_table_map, physicalDevice)->GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties);
+ if (VK_SUCCESS == result && pProperties) {
+ std::lock_guard<std::mutex> lock(global_lock);
+ for (uint32_t idx0=0; idx0<*pPropertyCount; ++idx0) {
+ if (pProperties[idx0].display) {
+ create_display_khr(physicalDevice, pProperties[idx0].display, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT);
+ }
+ }
+ }
+ return result;
+}
+
+VkResult explicit_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties)
+{
+ bool skipCall = false;
{
std::lock_guard<std::mutex> lock(global_lock);
- if (result == VK_SUCCESS) {
- for (uint32_t idx=0; idx<*pDisplayCount; ++idx) {
- create_display_khr(physicalDevice, pDisplays[idx], VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT);
+ skipCall |= validate_display_khr(physicalDevice, display, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, false);
+ if (physicalDevice) {
+ skipCall |= validate_physical_device(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false);
+ }
+ }
+ if (skipCall)
+ return VK_ERROR_VALIDATION_FAILED_EXT;
+ VkResult result = get_dispatch_table(object_tracker_instance_table_map, physicalDevice)->GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties);
+ if (VK_SUCCESS == result && pProperties) {
+ std::lock_guard<std::mutex> lock(global_lock);
+ for (uint32_t idx0=0; idx0<*pPropertyCount; ++idx0) {
+ if (pProperties[idx0].displayMode) {
+ create_display_mode_khr(physicalDevice, pProperties[idx0].displayMode, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT);
}
}
}