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 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'layers/parameter_validation.cpp') 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]) { -- cgit v1.2.3