aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-11-23 10:47:26 -0700
committerTobin Ehlis <tobine@google.com>2016-11-23 16:12:36 -0700
commit926221c83176388394a816ae3806b5ac2553541b (patch)
treee24f280848f4de0595b5b131d00d2a8a11f45541 /layers/core_validation.cpp
parent86330edc484b9689ff74b728ca48c1af26f2ac1b (diff)
downloadusermoji-926221c83176388394a816ae3806b5ac2553541b.tar.xz
layers:Separate push constant max size errors
There's separate valid usage language regarding the relationship between a device's maxPushConstantsSize and the size and offset of VkPushConstantRange. Splitting up the validation callbacks to flag these two errors separately along with their respective unique error enums.
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 5d690d73..36dd1d1d 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -6987,15 +6987,23 @@ static bool validatePushConstantRange(const layer_data *dev_data, const uint32_t
bool skip_call = false;
// Check that offset + size don't exceed the max.
// Prevent arithetic overflow here by avoiding addition and testing in this order.
- // TODO : This check combines VALIDATION_ERROR_00877 & 880, need to break out separately
if ((offset >= maxPushConstantsSize) || (size > maxPushConstantsSize - offset)) {
// This is a pain just to adapt the log message to the caller, but better to sort it out only when there is a problem.
if (0 == strcmp(caller_name, "vkCreatePipelineLayout()")) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- VALIDATION_ERROR_00877, "DS", "%s call has push constants index %u with offset %u and size %u that "
- "exceeds this device's maxPushConstantSize of %u. %s",
- caller_name, index, offset, size, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_00877]);
+ if (offset >= maxPushConstantsSize) {
+ skip_call |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ VALIDATION_ERROR_00877, "DS", "%s call has push constants index %u with offset %u that "
+ "exceeds this device's maxPushConstantSize of %u. %s",
+ caller_name, index, offset, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_00877]);
+ }
+ if (size > maxPushConstantsSize - offset) {
+ skip_call |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ VALIDATION_ERROR_00880, "DS", "%s call has push constants index %u with offset %u and size %u that "
+ "exceeds this device's maxPushConstantSize of %u. %s",
+ caller_name, index, offset, size, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_00880]);
+ }
} else if (0 == strcmp(caller_name, "vkCmdPushConstants()")) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "%s call has push constants with offset %u and size %u that "