diff options
| author | Karl Schultz <karl@lunarg.com> | 2016-09-13 14:23:19 -0600 |
|---|---|---|
| committer | Karl Schultz <karl@lunarg.com> | 2016-09-16 09:27:55 -0600 |
| commit | 261e1c851b4215fd96e78099ceea4eb23b745ec9 (patch) | |
| tree | 7c3165fcb247a08b679f593d97b591b21e703577 | |
| parent | 1a9e03f0c8f80345b1d5e7b6434e377be59a24c8 (diff) | |
| download | usermoji-261e1c851b4215fd96e78099ceea4eb23b745ec9.tar.xz | |
layers: Cleanup unexpected push_constants msgs
Fix to core validation CreatePipelineLayout to change
a message from warning to error.
Fixes to PushConstants layer tests to fix unintended
validation errors and to avoid generating multiple
intentional errors in a single test.
Change-Id: I618d6e5aff55fa918da5bd81c47092174b266da1
| -rw-r--r-- | layers/core_validation.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 0030793d..09f4bcb8 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -6513,7 +6513,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPip bool skip_call = false; layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); // Push Constant Range checks - uint32_t i = 0; + uint32_t i, j; for (i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) { skip_call |= validatePushConstantRange(dev_data, pCreateInfo->pPushConstantRanges[i].offset, pCreateInfo->pPushConstantRanges[i].size, "vkCreatePipelineLayout()", i); @@ -6522,29 +6522,27 @@ VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPip DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "vkCreatePipelineLayout() call has no stageFlags set."); } } + if (skip_call) + return VK_ERROR_VALIDATION_FAILED_EXT; + // Each range has been validated. Now check for overlap between ranges (if they are good). - if (!skip_call) { - uint32_t i, j; - for (i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) { - for (j = i + 1; j < pCreateInfo->pushConstantRangeCount; ++j) { - const uint32_t minA = pCreateInfo->pPushConstantRanges[i].offset; - const uint32_t maxA = minA + pCreateInfo->pPushConstantRanges[i].size; - const uint32_t minB = pCreateInfo->pPushConstantRanges[j].offset; - const uint32_t maxB = minB + pCreateInfo->pPushConstantRanges[j].size; - if ((minA <= minB && maxA > minB) || (minB <= minA && maxB > minA)) { - skip_call |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "vkCreatePipelineLayout() call has push constants with " - "overlapping ranges: %u:[%u, %u), %u:[%u, %u)", - i, minA, maxA, j, minB, maxB); - } + // There's no explicit Valid Usage language against this, so issue a warning instead of an error. + for (i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) { + for (j = i + 1; j < pCreateInfo->pushConstantRangeCount; ++j) { + const uint32_t minA = pCreateInfo->pPushConstantRanges[i].offset; + const uint32_t maxA = minA + pCreateInfo->pPushConstantRanges[i].size; + const uint32_t minB = pCreateInfo->pPushConstantRanges[j].offset; + const uint32_t maxB = minB + pCreateInfo->pPushConstantRanges[j].size; + if ((minA <= minB && maxA > minB) || (minB <= minA && maxB > minA)) { + skip_call |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "vkCreatePipelineLayout() call has push constants with " + "overlapping ranges: %u:[%u, %u), %u:[%u, %u)", + i, minA, maxA, j, minB, maxB); } } } - if (skip_call) - return VK_ERROR_VALIDATION_FAILED_EXT; - VkResult result = dev_data->device_dispatch_table->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); if (VK_SUCCESS == result) { std::lock_guard<std::mutex> lock(global_lock); |
