aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Barbour <tony@LunarG.com>2017-05-10 11:14:03 -0600
committerTony-LunarG <tony@lunarg.com>2017-05-11 14:34:43 -0600
commit2b8725c2e537ba0c5606dd34967928db760d865e (patch)
tree4960d2df4d00db7b30eaee7e3fcdc89570e937ed
parent2a2dc884bdab95edbf6c7d88ac5901768c165598 (diff)
downloadusermoji-2b8725c2e537ba0c5606dd34967928db760d865e.tar.xz
layers: Validate pOffsets in vkCmdBindVertexBuffers
Change-Id: Ie618d7657af6eca555050507a623be02af2e21fe
-rw-r--r--layers/core_validation.cpp6
-rw-r--r--layers/vk_validation_error_database.txt2
2 files changed, 7 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 2ce055d2..50030c94 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -7068,6 +7068,12 @@ VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, u
return ValidateBufferMemoryIsValid(dev_data, buffer_state, "vkCmdBindVertexBuffers()");
};
cb_node->validate_functions.push_back(function);
+ if (pOffsets[i] >= buffer_state->createInfo.size) {
+ skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT,
+ reinterpret_cast<uint64_t &>(buffer_state->buffer), __LINE__, VALIDATION_ERROR_01417, "DS",
+ "vkCmdBindVertexBuffers() offset (0x%" PRIxLEAST64 ") is beyond the end of the buffer. %s",
+ pOffsets[i], validation_error_map[VALIDATION_ERROR_01417]);
+ }
}
UpdateCmdBufferLastCmd(cb_node, CMD_BINDVERTEXBUFFER);
updateResourceTracking(cb_node, firstBinding, bindingCount, pBuffers);
diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt
index 27ad10c5..a6d38f49 100644
--- a/layers/vk_validation_error_database.txt
+++ b/layers/vk_validation_error_database.txt
@@ -1362,7 +1362,7 @@ VALIDATION_ERROR_01413~^~Y~^~CreatePipelineBadVertexAttributeFormat~^~vkCmdDrawI
VALIDATION_ERROR_01414~^~N~^~Unknown~^~vkCmdDrawIndexedIndirectCountAMD~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'format must be a valid VkFormat value' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkVertexInputAttributeDescription)~^~implicit
VALIDATION_ERROR_01415~^~N~^~Unknown~^~vkCmdBindVertexBuffers~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'firstBinding must be less than VkPhysicalDeviceLimits::maxVertexInputBindings' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkCmdBindVertexBuffers)~^~
VALIDATION_ERROR_01416~^~N~^~Unknown~^~vkCmdBindVertexBuffers~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'The sum of firstBinding and bindingCount must be less than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkCmdBindVertexBuffers)~^~
-VALIDATION_ERROR_01417~^~N~^~Unknown~^~vkCmdBindVertexBuffers~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'All elements of pOffsets must be less than the size of the corresponding element in pBuffers' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkCmdBindVertexBuffers)~^~
+VALIDATION_ERROR_01417~^~Y~^~BadVertexBufferOffset~^~vkCmdBindVertexBuffers~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'All elements of pOffsets must be less than the size of the corresponding element in pBuffers' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkCmdBindVertexBuffers)~^~
VALIDATION_ERROR_01418~^~N~^~Unknown~^~vkCmdBindVertexBuffers~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'All elements of pBuffers must have been created with the VK_BUFFER_USAGE_VERTEX_BUFFER_BIT flag' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkCmdBindVertexBuffers)~^~
VALIDATION_ERROR_01419~^~Y~^~None~^~vkCmdBindVertexBuffers~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'commandBuffer must be a valid VkCommandBuffer handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkCmdBindVertexBuffers)~^~implicit
VALIDATION_ERROR_01420~^~Y~^~None~^~vkCmdBindVertexBuffers~^~For more information refer to Vulkan Spec Section '20.2. Vertex Input Description' which states 'pBuffers must be a pointer to an array of bindingCount valid VkBuffer handles' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkCmdBindVertexBuffers)~^~implicit