bool skip = false;
layer_data *device_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map);
- if (viewportCount > 0 && pViewports != nullptr) {
- const VkPhysicalDeviceLimits &limits = device_data->device_limits;
- for (uint32_t viewportIndex = 0; viewportIndex < viewportCount; ++viewportIndex) {
- const VkViewport &viewport = pViewports[viewportIndex];
-
- if (device_data->physical_device_features.multiViewport == false) {
- if (viewportCount != 1) {
- skip |= log_msg(
- device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
- VALIDATION_ERROR_1e000992, __LINE__, DEVICE_FEATURE, LayerName,
- "vkCmdSetViewport(): The multiViewport feature is not enabled, so viewportCount must be 1 but is %d. %s",
- viewportCount, validation_error_map[VALIDATION_ERROR_1e000992]);
- }
- if (firstViewport != 0) {
- skip |= log_msg(
- device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
- VALIDATION_ERROR_1e000990, __LINE__, DEVICE_FEATURE, LayerName,
- "vkCmdSetViewport(): The multiViewport feature is not enabled, so firstViewport must be 0 but is %d. %s",
+ if (!device_data->physical_device_features.multiViewport) {
+ if (firstViewport != 0) {
+ skip |=
+ log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1e000990, LayerName,
+ "vkCmdSetViewport: The multiViewport feature is disabled, but firstViewport (=%" PRIu32 ") is not 0. %s",
firstViewport, validation_error_map[VALIDATION_ERROR_1e000990]);
- }
- }
+ }
+ if (viewportCount > 1) {
+ skip |=
+ log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1e000992, LayerName,
+ "vkCmdSetViewport: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 ") is not 1. %s",
+ viewportCount, validation_error_map[VALIDATION_ERROR_1e000992]);
+ }
+ } else { // multiViewport enabled
+ const uint64_t sum = (uint64_t)firstViewport + viewportCount;
+ if (sum > device_data->device_limits.maxViewports) {
+ skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_1e00098e, LayerName,
+ "vkCmdSetViewport: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64
+ ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 "). %s",
+ firstViewport, viewportCount, sum, device_data->device_limits.maxViewports,
+ validation_error_map[VALIDATION_ERROR_1e00098e]);
}
}
VALIDATION_ERROR_1de08401~^~N~^~Unknown~^~vkCmdSetStencilWriteMask~^~VUID-vkCmdSetStencilWriteMask-faceMask-parameter~^~core~^~The spec valid usage text states 'faceMask must be a valid combination of VkStencilFaceFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetStencilWriteMask-faceMask-parameter)~^~implicit
VALIDATION_ERROR_1de08403~^~Y~^~Unknown~^~vkCmdSetStencilWriteMask~^~VUID-vkCmdSetStencilWriteMask-faceMask-requiredbitmask~^~core~^~The spec valid usage text states 'faceMask must not be 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetStencilWriteMask-faceMask-requiredbitmask)~^~implicit
VALIDATION_ERROR_1e00098a~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-None-01221~^~core~^~The spec valid usage text states 'The currently bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_VIEWPORT dynamic state enabled' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-None-01221)~^~
-VALIDATION_ERROR_1e00098c~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01222~^~core~^~The spec valid usage text states 'firstViewport must be less than VkPhysicalDeviceLimits::maxViewports' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01222)~^~
-VALIDATION_ERROR_1e00098e~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01223~^~core~^~The spec valid usage text states 'The sum of firstViewport and viewportCount must be between 1 and VkPhysicalDeviceLimits::maxViewports, inclusive' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01223)~^~
+VALIDATION_ERROR_1e00098c~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01222~^~core~^~The spec valid usage text states 'firstViewport must be less than VkPhysicalDeviceLimits::maxViewports' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01222)~^~redundant VU
+VALIDATION_ERROR_1e00098e~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01223~^~core~^~The spec valid usage text states 'The sum of firstViewport and viewportCount must be between 1 and VkPhysicalDeviceLimits::maxViewports, inclusive' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01223)~^~
VALIDATION_ERROR_1e000990~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-firstViewport-01224~^~core~^~The spec valid usage text states 'If the multiple viewports feature is not enabled, firstViewport must be 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-firstViewport-01224)~^~
VALIDATION_ERROR_1e000992~^~Y~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-viewportCount-01225~^~core~^~The spec valid usage text states 'If the multiple viewports feature is not enabled, viewportCount must be 1' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-viewportCount-01225)~^~
-VALIDATION_ERROR_1e000994~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-pViewports-01226~^~core~^~The spec valid usage text states 'pViewports must be a valid pointer to an array of viewportCount valid VkViewport structures' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-pViewports-01226)~^~
+VALIDATION_ERROR_1e000994~^~N~^~Unknown~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-pViewports-01226~^~core~^~The spec valid usage text states 'pViewports must be a valid pointer to an array of viewportCount valid VkViewport structures' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-pViewports-01226)~^~removed from spec
VALIDATION_ERROR_1e002401~^~Y~^~None~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-commandBuffer-parameter~^~core~^~The spec valid usage text states 'commandBuffer must be a valid VkCommandBuffer handle' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-commandBuffer-parameter)~^~implicit
VALIDATION_ERROR_1e002413~^~Y~^~None~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-commandBuffer-recording~^~core~^~The spec valid usage text states 'commandBuffer must be in the recording state' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-commandBuffer-recording)~^~implicit
VALIDATION_ERROR_1e002415~^~Y~^~CommandQueueFlags~^~vkCmdSetViewport~^~VUID-vkCmdSetViewport-commandBuffer-cmdpool~^~core~^~The spec valid usage text states 'The VkCommandPool that commandBuffer was allocated from must support graphics operations' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdSetViewport-commandBuffer-cmdpool)~^~implicit