layers: Check that indirect buffers have the correct usage flag
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index beaf3fb..7e7c730 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -6694,6 +6694,8 @@
         ValidateCmdDrawType(dev_data, cmd_buffer, indexed, bind_point, CMD_DRAWINDIRECT, cb_state, caller, VK_QUEUE_GRAPHICS_BIT,
                             VALIDATION_ERROR_1aa02415, VALIDATION_ERROR_1aa00017, VALIDATION_ERROR_1aa003cc);
     *buffer_state = GetBufferState(dev_data, buffer);
+    skip |= ValidateBufferUsageFlags(dev_data, *buffer_state, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, true, VALIDATION_ERROR_1aa00cf8,
+                                     "vkCmdDrawIndirect()", "VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT");
     skip |= ValidateMemoryIsBoundToBuffer(dev_data, *buffer_state, caller, VALIDATION_ERROR_1aa003b4);
     // TODO: If the drawIndirectFirstInstance feature is not enabled, all the firstInstance members of the
     // VkDrawIndirectCommand structures accessed by this command must be 0, which will require access to the contents of 'buffer'.
@@ -6730,6 +6732,8 @@
         ValidateCmdDrawType(dev_data, cmd_buffer, indexed, bind_point, CMD_DRAWINDEXEDINDIRECT, cb_state, caller,
                             VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1a602415, VALIDATION_ERROR_1a600017, VALIDATION_ERROR_1a600434);
     *buffer_state = GetBufferState(dev_data, buffer);
+    skip |= ValidateBufferUsageFlags(dev_data, *buffer_state, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, true, VALIDATION_ERROR_1a600d02,
+                                     "vkCmdDrawIndexedIndirect()", "VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT");
     skip |= ValidateMemoryIsBoundToBuffer(dev_data, *buffer_state, caller, VALIDATION_ERROR_1a60041c);
     // TODO: If the drawIndirectFirstInstance feature is not enabled, all the firstInstance members of the
     // VkDrawIndexedIndirectCommand structures accessed by this command must be 0, which will require access to the contents of
@@ -6792,6 +6796,8 @@
         ValidateCmdDrawType(dev_data, cmd_buffer, indexed, bind_point, CMD_DISPATCHINDIRECT, cb_state, caller, VK_QUEUE_COMPUTE_BIT,
                             VALIDATION_ERROR_1a002415, VALIDATION_ERROR_1a000017, VALIDATION_ERROR_UNDEFINED);
     *buffer_state = GetBufferState(dev_data, buffer);
+    skip |= ValidateBufferUsageFlags(dev_data, *buffer_state, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT, true, VALIDATION_ERROR_1a00032a,
+                                     "vkCmdDispatchIndirect()", "VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT");
     skip |= ValidateMemoryIsBoundToBuffer(dev_data, *buffer_state, caller, VALIDATION_ERROR_1a000322);
     return skip;
 }
diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt
index 8c8bd59..fe7df55 100644
--- a/layers/vk_validation_error_database.txt
+++ b/layers/vk_validation_error_database.txt
@@ -2047,7 +2047,7 @@
 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 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 descriptorsets-compatibility' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-None-00402)~^~
 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 bound VkPipeline object, specified via vkCmdBindPipeline' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-None-00403)~^~
 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)~^~
-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)~^~
+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)~^~
 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)~^~
 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)~^~
 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 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 descriptorsets-compatibility' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdDispatchIndirect-None-00408)~^~
@@ -2153,7 +2153,7 @@
 VALIDATION_ERROR_1a60044e~^~N~^~Unknown~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-maxMultiviewInstanceIndex-00551~^~(VK_VERSION_1_1,VK_KHR_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 VkPhysicalDeviceMultiviewProperties::maxMultiviewInstanceIndex.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-maxMultiviewInstanceIndex-00551)~^~
 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)~^~
 VALIDATION_ERROR_1a600bd8~^~N~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-sampleLocationsEnable-01516~^~(VK_EXT_sample_locations)~^~The spec valid usage text states 'If the 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)~^~
-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)~^~
+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)~^~
 VALIDATION_ERROR_1a600e8c~^~N~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-commandBuffer-01862~^~(VK_VERSION_1_1)~^~The spec valid usage text states 'If commandBuffer is an unprotected command buffer, and any pipeline stage in the VkPipeline object bound to VK_PIPELINE_BIND_POINT_GRAPHICS reads from or writes to any image or buffer, that image or buffer must not be a protected image or protected buffer.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-commandBuffer-01862)~^~
 VALIDATION_ERROR_1a600e8e~^~N~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-commandBuffer-01863~^~(VK_VERSION_1_1)~^~The spec valid usage text states 'If commandBuffer is a protected command buffer, and any pipeline stage in the VkPipeline object bound to VK_PIPELINE_BIND_POINT_GRAPHICS writes to any image or buffer, that image or buffer must not be an unprotected image or unprotected buffer.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-commandBuffer-01863)~^~
 VALIDATION_ERROR_1a600e90~^~N~^~None~^~vkCmdDrawIndexedIndirect~^~VUID-vkCmdDrawIndexedIndirect-commandBuffer-01864~^~(VK_VERSION_1_1)~^~The spec valid usage text states 'If commandBuffer is a protected command buffer, and any pipeline stage other than the framebuffer-space pipeline stages in the VkPipeline object bound to VK_PIPELINE_BIND_POINT_GRAPHICS reads from or writes to any image or buffer, the image or buffer must not be a protected image or protected buffer.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndexedIndirect-commandBuffer-01864)~^~
@@ -2231,7 +2231,7 @@
 VALIDATION_ERROR_1aa003e6~^~N~^~Unknown~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-maxMultiviewInstanceIndex-00499~^~(VK_VERSION_1_1,VK_KHR_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 VkPhysicalDeviceMultiviewProperties::maxMultiviewInstanceIndex.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndirect-maxMultiviewInstanceIndex-00499)~^~
 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)~^~
 VALIDATION_ERROR_1aa00bd4~^~N~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-sampleLocationsEnable-01514~^~(VK_EXT_sample_locations)~^~The spec valid usage text states 'If the 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)~^~
-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)~^~
+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)~^~
 VALIDATION_ERROR_1aa00e80~^~N~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-commandBuffer-01856~^~(VK_VERSION_1_1)~^~The spec valid usage text states 'If commandBuffer is an unprotected command buffer, and any pipeline stage in the VkPipeline object bound to VK_PIPELINE_BIND_POINT_GRAPHICS reads from or writes to any image or buffer, that image or buffer must not be a protected image or protected buffer.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndirect-commandBuffer-01856)~^~
 VALIDATION_ERROR_1aa00e82~^~N~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-commandBuffer-01857~^~(VK_VERSION_1_1)~^~The spec valid usage text states 'If commandBuffer is a protected command buffer, and any pipeline stage in the VkPipeline object bound to VK_PIPELINE_BIND_POINT_GRAPHICS writes to any image or buffer, that image or buffer must not be an unprotected image or unprotected buffer.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndirect-commandBuffer-01857)~^~
 VALIDATION_ERROR_1aa00e84~^~N~^~None~^~vkCmdDrawIndirect~^~VUID-vkCmdDrawIndirect-commandBuffer-01858~^~(VK_VERSION_1_1)~^~The spec valid usage text states 'If commandBuffer is a protected command buffer, and any pipeline stage other than the framebuffer-space pipeline stages in the VkPipeline object bound to VK_PIPELINE_BIND_POINT_GRAPHICS reads from or writes to any image or buffer, the image or buffer must not be a protected image or protected buffer.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-vkCmdDrawIndirect-commandBuffer-01858)~^~