Skip to content
This repository was archived by the owner on Jul 19, 2018. It is now read-only.

Commit 0e13e2e

Browse files
committed
layers: Check that indirect buffers have the correct usage flag
1 parent 874fbda commit 0e13e2e

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

layers/core_validation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6129,6 +6129,8 @@ static bool PreCallValidateCmdDrawIndirect(layer_data *dev_data, VkCommandBuffer
61296129
ValidateCmdDrawType(dev_data, cmd_buffer, indexed, bind_point, CMD_DRAWINDIRECT, cb_state, caller, VK_QUEUE_GRAPHICS_BIT,
61306130
VALIDATION_ERROR_1aa02415, VALIDATION_ERROR_1aa00017, VALIDATION_ERROR_1aa003cc);
61316131
*buffer_state = GetBufferState(dev_data, buffer);
6132+
skip |= ValidateBufferUsageFlags(dev_data, *buffer_state, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, true, VALIDATION_ERROR_1aa00cf8,
6133+
"vkCmdDrawIndirect()", "VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT");
61326134
skip |= ValidateMemoryIsBoundToBuffer(dev_data, *buffer_state, caller, VALIDATION_ERROR_1aa003b4);
61336135
// TODO: If the drawIndirectFirstInstance feature is not enabled, all the firstInstance members of the
61346136
// VkDrawIndirectCommand structures accessed by this command must be 0, which will require access to the contents of 'buffer'.
@@ -6165,6 +6167,8 @@ static bool PreCallValidateCmdDrawIndexedIndirect(layer_data *dev_data, VkComman
61656167
ValidateCmdDrawType(dev_data, cmd_buffer, indexed, bind_point, CMD_DRAWINDEXEDINDIRECT, cb_state, caller,
61666168
VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1a602415, VALIDATION_ERROR_1a600017, VALIDATION_ERROR_1a600434);
61676169
*buffer_state = GetBufferState(dev_data, buffer);
6170+
skip |= ValidateBufferUsageFlags(dev_data, *buffer_state, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, true, VALIDATION_ERROR_1a600d02,
6171+
"vkCmdDrawIndexedIndirect()", "VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT");
61686172
skip |= ValidateMemoryIsBoundToBuffer(dev_data, *buffer_state, caller, VALIDATION_ERROR_1a60041c);
61696173
// TODO: If the drawIndirectFirstInstance feature is not enabled, all the firstInstance members of the
61706174
// VkDrawIndexedIndirectCommand structures accessed by this command must be 0, which will require access to the contents of
@@ -6227,6 +6231,8 @@ static bool PreCallValidateCmdDispatchIndirect(layer_data *dev_data, VkCommandBu
62276231
ValidateCmdDrawType(dev_data, cmd_buffer, indexed, bind_point, CMD_DISPATCHINDIRECT, cb_state, caller, VK_QUEUE_COMPUTE_BIT,
62286232
VALIDATION_ERROR_1a002415, VALIDATION_ERROR_1a000017, VALIDATION_ERROR_UNDEFINED);
62296233
*buffer_state = GetBufferState(dev_data, buffer);
6234+
skip |= ValidateBufferUsageFlags(dev_data, *buffer_state, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, true, VALIDATION_ERROR_1a00032a,
6235+
"vkCmdDispatchIndirect()", "VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT");
62306236
skip |= ValidateMemoryIsBoundToBuffer(dev_data, *buffer_state, caller, VALIDATION_ERROR_1a000322);
62316237
return skip;
62326238
}

layers/vk_validation_error_database.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ VALIDATION_ERROR_1a000322~^~Y~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDisp
20582058
VALIDATION_ERROR_1a000324~^~N~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-None-00402~^~core~^~The spec valid usage text states 'For each set n that is statically used by the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_COMPUTE, a descriptor set must have been bound to n at VK_PIPELINE_BIND_POINT_COMPUTE, with a VkPipelineLayout that is compatible for set n, with the VkPipelineLayout used to create the current VkPipeline, as described in Pipeline Layout Compatibility' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-None-00402)~^~
20592059
VALIDATION_ERROR_1a000326~^~N~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-None-00403~^~core~^~The spec valid usage text states 'Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the currently bound VkPipeline object, specified via vkCmdBindPipeline' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-None-00403)~^~
20602060
VALIDATION_ERROR_1a000328~^~N~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-None-00404~^~core~^~The spec valid usage text states 'A valid compute pipeline must be bound to the current command buffer with VK_PIPELINE_BIND_POINT_COMPUTE' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-None-00404)~^~
2061-
VALIDATION_ERROR_1a00032a~^~N~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-buffer-00405~^~core~^~The spec valid usage text states 'buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-buffer-00405)~^~
2061+
VALIDATION_ERROR_1a00032a~^~Y~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-buffer-00405~^~core~^~The spec valid usage text states 'buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-buffer-00405)~^~
20622062
VALIDATION_ERROR_1a00032c~^~N~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-offset-00406~^~core~^~The spec valid usage text states 'offset must be a multiple of 4' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-offset-00406)~^~
20632063
VALIDATION_ERROR_1a00032e~^~N~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-offset-00407~^~core~^~The spec valid usage text states 'The sum of offset and the size of VkDispatchIndirectCommand must be less than or equal to the size of buffer' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-offset-00407)~^~
20642064
VALIDATION_ERROR_1a000330~^~N~^~Unknown~^~vkCmdDispatchIndirect~^~VUID-vkCmdDispatchIndirect-None-00408~^~core~^~The spec valid usage text states 'For each push constant that is statically used by the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_COMPUTE, a push constant value must have been set for VK_PIPELINE_BIND_POINT_COMPUTE, with a VkPipelineLayout that is compatible for push constants with the one used to create the current VkPipeline, as described in Pipeline Layout Compatibility' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-None-00408)~^~
@@ -2155,7 +2155,7 @@ VALIDATION_ERROR_1a60044c~^~N~^~Unknown~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdD
21552155
VALIDATION_ERROR_1a60044e~^~N~^~Unknown~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-maxMultiviewInstanceIndex-00551~^~(VK_KHX_multiview)~^~The spec valid usage text states 'If the draw is recorded in a render pass instance with multiview enabled, the maximum instance index must be less than or equal to VkPhysicalDeviceMultiviewPropertiesKHX::maxMultiviewInstanceIndex.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-maxMultiviewInstanceIndex-00551)~^~
21562156
VALIDATION_ERROR_1a600bbe~^~N~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-None-01503~^~core~^~The spec valid usage text states 'Image subresources used as attachments in the current render pass must not be accessed in any way other than as an attachment by this command.' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-None-01503)~^~
21572157
VALIDATION_ERROR_1a600bd8~^~N~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-sampleLocationsEnable-01516~^~(VK_EXT_sample_locations)~^~The spec valid usage text states 'If the currently bound graphics pipeline was created with VkPipelineSampleLocationsStateCreateInfoEXT::sampleLocationsEnable set to VK_TRUE and the current subpass has a depth/stencil attachment, then that attachment must have been created with the VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-sampleLocationsEnable-01516)~^~
2158-
VALIDATION_ERROR_1a600d02~^~N~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-buffer-01665~^~core~^~The spec valid usage text states 'buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-buffer-01665)~^~
2158+
VALIDATION_ERROR_1a600d02~^~Y~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-buffer-01665~^~core~^~The spec valid usage text states 'buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-buffer-01665)~^~
21592159
VALIDATION_ERROR_1a601a01~^~Y~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-buffer-parameter~^~core~^~The spec valid usage text states 'buffer must be a valid VkBuffer handle' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-buffer-parameter)~^~implicit
21602160
VALIDATION_ERROR_1a602401~^~Y~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-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-vkCmdDrawIndexedIndirect-commandBuffer-parameter)~^~implicit
21612161
VALIDATION_ERROR_1a602413~^~N~^~Unknown~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-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-vkCmdDrawIndexedIndirect-commandBuffer-recording)~^~implicit
@@ -2227,7 +2227,7 @@ VALIDATION_ERROR_1aa003e4~^~N~^~Unknown~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndi
22272227
VALIDATION_ERROR_1aa003e6~^~N~^~Unknown~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-maxMultiviewInstanceIndex-00499~^~(VK_KHX_multiview)~^~The spec valid usage text states 'If the draw is recorded in a render pass instance with multiview enabled, the maximum instance index must be less than or equal to VkPhysicalDeviceMultiviewPropertiesKHX::maxMultiviewInstanceIndex.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndirect-maxMultiviewInstanceIndex-00499)~^~
22282228
VALIDATION_ERROR_1aa00bba~^~N~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-None-01501~^~core~^~The spec valid usage text states 'Image subresources used as attachments in the current render pass must not be accessed in any way other than as an attachment by this command.' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndirect-None-01501)~^~
22292229
VALIDATION_ERROR_1aa00bd4~^~N~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-sampleLocationsEnable-01514~^~(VK_EXT_sample_locations)~^~The spec valid usage text states 'If the currently bound graphics pipeline was created with VkPipelineSampleLocationsStateCreateInfoEXT::sampleLocationsEnable set to VK_TRUE and the current subpass has a depth/stencil attachment, then that attachment must have been created with the VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndirect-sampleLocationsEnable-01514)~^~
2230-
VALIDATION_ERROR_1aa00cf8~^~N~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-buffer-01660~^~core~^~The spec valid usage text states 'buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndirect-buffer-01660)~^~
2230+
VALIDATION_ERROR_1aa00cf8~^~Y~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-buffer-01660~^~core~^~The spec valid usage text states 'buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndirect-buffer-01660)~^~
22312231
VALIDATION_ERROR_1aa01a01~^~Y~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-buffer-parameter~^~core~^~The spec valid usage text states 'buffer must be a valid VkBuffer handle' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDrawIndirect-buffer-parameter)~^~implicit
22322232
VALIDATION_ERROR_1aa02401~^~Y~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-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-vkCmdDrawIndirect-commandBuffer-parameter)~^~implicit
22332233
VALIDATION_ERROR_1aa02413~^~N~^~Unknown~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-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-vkCmdDrawIndirect-commandBuffer-recording)~^~implicit

0 commit comments

Comments
 (0)