From ae55897d6c2dcd49c097e1b49ed168a877e6470f Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Wed, 2 Aug 2017 10:45:24 -0600 Subject: layers: Fix incorrect VUID for negative viewport ht Layers used the wrong VUID for the checks for negative viewport height if the extensions were not enabled. Fixed existing test, added a new test, and updated the database, and removed special case from validation_stats script. Change-Id: Ia165e6245990a4fabb3745102b345a7b4f1b0202 --- layers/parameter_validation.cpp | 26 +++++++++++++++++--------- layers/vk_validation_error_database.txt | 6 +++--- scripts/vk_validation_stats.py | 4 ---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp index c3c7122f..85d25b27 100644 --- a/layers/parameter_validation.cpp +++ b/layers/parameter_validation.cpp @@ -3176,16 +3176,24 @@ static bool preCmdSetViewport(layer_data *my_data, uint32_t first_viewport, uint viewport.width, limits.maxViewportDimensions[0], validation_error_map[VALIDATION_ERROR_15000996]); } - bool invalid_height = (viewport.height <= 0 || viewport.height > limits.maxViewportDimensions[1]); - if ((my_data->extensions.vk_amd_negative_viewport_height || my_data->extensions.vk_khr_maintenance1) && - (viewport.height < 0)) { // VALIDATION_ERROR_1500099c - invalid_height = false; - } - if (invalid_height) { - skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, - VALIDATION_ERROR_1500099a, LayerName, + if (my_data->extensions.vk_amd_negative_viewport_height || my_data->extensions.vk_khr_maintenance1) { + // Check lower bound against negative viewport height instead of zero + if (viewport.height <= -(static_cast(limits.maxViewportDimensions[1])) || + (viewport.height > limits.maxViewportDimensions[1])) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, VALIDATION_ERROR_1500099a, LayerName, + "vkCmdSetViewport %d: height (%f) exceeds permitted bounds (-%u,%u). %s", viewportIndex, + viewport.height, limits.maxViewportDimensions[1], limits.maxViewportDimensions[1], + validation_error_map[VALIDATION_ERROR_1500099a]); + } + } else { + if ((viewport.height <= 0) || (viewport.height > limits.maxViewportDimensions[1])) { + skip |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_15000998, LayerName, "vkCmdSetViewport %d: height (%f) exceeds permitted bounds (0,%u). %s", viewportIndex, - viewport.height, limits.maxViewportDimensions[1], validation_error_map[VALIDATION_ERROR_1500099a]); + viewport.height, limits.maxViewportDimensions[1], validation_error_map[VALIDATION_ERROR_15000998]); + } } if (viewport.x < limits.viewportBoundsRange[0] || viewport.x > limits.viewportBoundsRange[1]) { diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index 399869f7..db1c7717 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -1384,9 +1384,9 @@ VALIDATION_ERROR_14e1c40d~^~Y~^~Unknown~^~vkCreateViSurfaceNN~^~VUID-VkViSurface VALIDATION_ERROR_14e2b00b~^~Y~^~Unknown~^~vkCreateViSurfaceNN~^~VUID-VkViSurfaceCreateInfoNN-sType-sType~^~core~^~The spec valid usage text states 'sType must be VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViSurfaceCreateInfoNN-sType-sType)~^~implicit VALIDATION_ERROR_14e30e01~^~Y~^~Unknown~^~vkCreateViSurfaceNN~^~VUID-VkViSurfaceCreateInfoNN-window-parameter~^~core~^~The spec valid usage text states 'window must be a pointer' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViSurfaceCreateInfoNN-window-parameter)~^~implicit VALIDATION_ERROR_15000996~^~Y~^~ViewportAndScissorBoundsChecking~^~vkCmdSetViewport~^~VUID-VkViewport-width-01227~^~core~^~The spec valid usage text states 'width must be greater than 0.0 and less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[0]' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViewport-width-01227)~^~ -VALIDATION_ERROR_15000998~^~N~^~None~^~vkCmdSetViewport~^~VUID-VkViewport-height-01228~^~!(VK_KHR_maintenance1)~^~The spec valid usage text states 'height must be greater than 0.0 and less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[1]' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViewport-height-01228)~^~ -VALIDATION_ERROR_1500099a~^~Y~^~ViewportAndScissorBoundsChecking~^~vkCmdSetViewport~^~VUID-VkViewport-height-01229~^~(VK_KHR_maintenance1)~^~The spec valid usage text states 'height must be greater than or equal to -VkPhysicalDeviceLimits::maxViewportDimensions[1] and less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[1]' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkViewport-height-01229)~^~ -VALIDATION_ERROR_1500099c~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-VkViewport-height-01230~^~(VK_AMD_negative_viewport_height)~^~The spec valid usage text states 'If the VK_AMD_negative_viewport_height extension is enabled, height can also be negative.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkViewport-height-01230)~^~ +VALIDATION_ERROR_15000998~^~Y~^~ViewportAndScissorBoundsChecking~^~vkCmdSetViewport~^~VUID-VkViewport-height-01228~^~!(VK_KHR_maintenance1)~^~The spec valid usage text states 'height must be greater than 0.0 and less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[1]' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViewport-height-01228)~^~ +VALIDATION_ERROR_1500099a~^~Y~^~ViewportBoundsCheckingWithNVHExtensionEnabled~^~vkCmdSetViewport~^~VUID-VkViewport-height-01229~^~(VK_KHR_maintenance1)~^~The spec valid usage text states 'height must be greater than or equal to -VkPhysicalDeviceLimits::maxViewportDimensions[1] and less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[1]' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkViewport-height-01229)~^~ +VALIDATION_ERROR_1500099c~^~N~^~None~^~vkCmdSetViewport~^~VUID-VkViewport-height-01230~^~(VK_AMD_negative_viewport_height)~^~The spec valid usage text states 'If the VK_AMD_negative_viewport_height extension is enabled, height can also be negative.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkViewport-height-01230)~^~ VALIDATION_ERROR_1500099e~^~Y~^~ViewportAndScissorBoundsChecking~^~vkCmdSetViewport~^~VUID-VkViewport-x-01231~^~core~^~The spec valid usage text states 'x and y must each be between viewportBoundsRange[0] and viewportBoundsRange[1], inclusive' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViewport-x-01231)~^~ VALIDATION_ERROR_150009a0~^~Y~^~ViewportAndScissorBoundsChecking~^~vkCmdSetViewport~^~VUID-VkViewport-x-01232~^~core~^~The spec valid usage text states '(x + width) must be less than or equal to viewportBoundsRange[1]' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViewport-x-01232)~^~ VALIDATION_ERROR_150009a2~^~Y~^~ViewportAndScissorBoundsChecking~^~vkCmdSetViewport~^~VUID-VkViewport-y-01233~^~core~^~The spec valid usage text states '(y + height) must be less than or equal to viewportBoundsRange[1]' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkViewport-y-01233)~^~ diff --git a/scripts/vk_validation_stats.py b/scripts/vk_validation_stats.py index 93836cf1..33493dd3 100755 --- a/scripts/vk_validation_stats.py +++ b/scripts/vk_validation_stats.py @@ -195,10 +195,6 @@ class ValidationSource: self.source_files.extend(qualified_paths) self.enum_count_dict = {} # dict of enum values to the count of how much they're used, and location of where they're used - # 1500099c is a special case that provides an exception when an extension is enabled. No specific error is flagged, but the exception is handled so add it here - self.enum_count_dict['VALIDATION_ERROR_1500099c'] = {} - self.enum_count_dict['VALIDATION_ERROR_1500099c']['count'] = 1 - self.enum_count_dict['VALIDATION_ERROR_1500099c']['file_line'] = [] def parse(self): duplicate_checks = 0 for sf in self.source_files: -- cgit v1.2.3