From 5e3464fdc5641facac9f6f128ccf759bbcb860a8 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 28 Jun 2016 11:51:16 -0600 Subject: layers: Moved devlimits UpdateDescrSets to PV DevLimits GetDeviceQueue validation was redundant, moved updateDescriptorSets devlimits validation into parameter validation. Change-Id: Ic7bf2450c835cb5a35b687be5872cbbd0d70ac95 --- layers/core_validation_error_enums.h | 6 +++--- layers/parameter_validation.cpp | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/layers/core_validation_error_enums.h b/layers/core_validation_error_enums.h index 7f6329c0..7602fe9f 100644 --- a/layers/core_validation_error_enums.h +++ b/layers/core_validation_error_enums.h @@ -255,8 +255,8 @@ enum DEV_LIMITS_ERROR { DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call sequence by the app DEVLIMITS_INVALID_FEATURE_REQUESTED, // App requested a feature not supported by physical device DEVLIMITS_COUNT_MISMATCH, // App requesting a count value different than actual value - DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on queue family properties - DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, // Uniform buffer offset violates device limit granularity - DEVLIMITS_INVALID_STORAGE_BUFFER_OFFSET, // Storage buffer offset violates device limit granularity +// LUGMAL DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on queue family properties -> deleted +// LUGMAL DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, // Uniform buffer offset violates device limit granularity -> device_limit +// LUGMAL DEVLIMITS_INVALID_STORAGE_BUFFER_OFFSET, // Storage buffer offset violates device limit granularity -> device_limit }; #endif // CORE_VALIDATION_ERROR_ENUMS_H_ diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp index d6ffe63b..a724cabf 100644 --- a/layers/parameter_validation.cpp +++ b/layers/parameter_validation.cpp @@ -1709,7 +1709,6 @@ bool PreGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queu queueIndex); return false; } - return true; } @@ -3516,6 +3515,38 @@ UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWri } } } + + if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || + (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { + VkDeviceSize uniformAlignment = device_data->device_limits.minUniformBufferOffsetAlignment; + for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { + if (pDescriptorWrites[i].pBufferInfo != NULL) { + if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { + skip_call |= + log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVICE_LIMIT, "PARAMCHECK", + "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 + ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64, + i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment); + } + } + } + } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || + (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { + VkDeviceSize storageAlignment = device_data->device_limits.minStorageBufferOffsetAlignment; + for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { + if (pDescriptorWrites[i].pBufferInfo != NULL) { + if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { + skip_call |= + log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, __LINE__, DEVICE_LIMIT, "PARAMCHECK", + "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 + ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64, + i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment); + } + } + } + } } } -- cgit v1.2.3