Update out of range attachment check to use unique enum

Signed-off-by: Chris Forbes <chrisforbes@google.com>
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 7177ee0..e2be92b 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -10323,9 +10323,9 @@
     bool skip_call = false;
     if (attachment >= attachment_count && attachment != VK_ATTACHMENT_UNUSED) {
         skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
-                             DRAWSTATE_INVALID_ATTACHMENT_INDEX, "DS",
-                             "CreateRenderPass: %s attachment %d must be less than the total number of attachments %d.",
-                             type, attachment, attachment_count);
+                             VALIDATION_ERROR_00325, "DS",
+                             "CreateRenderPass: %s attachment %d must be less than the total number of attachments %d. %s",
+                             type, attachment, attachment_count, validation_error_map[VALIDATION_ERROR_00325]);
     }
     return skip_call;
 }
diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt
index 88e6da2..9e42510 100644
--- a/layers/vk_validation_error_database.txt
+++ b/layers/vk_validation_error_database.txt
@@ -328,7 +328,7 @@
 VALIDATION_ERROR_00322~^~U~^~Unknown~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'pRenderPass must be a pointer to a VkRenderPass handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkCreateRenderPass)~^~
 VALIDATION_ERROR_00323~^~U~^~Unknown~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'If any two subpasses operate on attachments with overlapping ranges of the same VkDeviceMemory object, and at least one subpass writes to that area of VkDeviceMemory, a subpass dependency must be included (either directly or via some intermediate subpasses) between them' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkRenderPassCreateInfo)~^~
 VALIDATION_ERROR_00324~^~U~^~Unknown~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'If the attachment member of any element of pInputAttachments, pColorAttachments, pResolveAttachments or pDepthStencilAttachment, or the attachment indexed by any element of pPreserveAttachments in any given element of pSubpasses is bound to a range of a VkDeviceMemory object that overlaps with any other attachment in any subpass (including the same subpass), the VkAttachmentDescription structures describing them must include VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT in flags' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkRenderPassCreateInfo)~^~
-VALIDATION_ERROR_00325~^~U~^~Unknown~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'If the attachment member of any element of pInputAttachments, pColorAttachments, pResolveAttachments or pDepthStencilAttachment, or any element of pPreserveAttachments in any given element of pSubpasses is not VK_ATTACHMENT_UNUSED, it must be less than attachmentCount' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkRenderPassCreateInfo)~^~
+VALIDATION_ERROR_00325~^~Y~^~RenderPassAttachmentOutOfRange~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'If the attachment member of any element of pInputAttachments, pColorAttachments, pResolveAttachments or pDepthStencilAttachment, or any element of pPreserveAttachments in any given element of pSubpasses is not VK_ATTACHMENT_UNUSED, it must be less than attachmentCount' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkRenderPassCreateInfo)~^~
 VALIDATION_ERROR_00326~^~U~^~Unknown~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'The value of any element of the pPreserveAttachments member in any given element of pSubpasses must not be VK_ATTACHMENT_UNUSED' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkRenderPassCreateInfo)~^~
 VALIDATION_ERROR_00327~^~N~^~Unknown~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'sType must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkRenderPassCreateInfo)~^~TBD in parameter validation layer.
 VALIDATION_ERROR_00328~^~N~^~Unknown~^~vkCreateRenderPass~^~For more information refer to Vulkan Spec Section '7.1. Render Pass Creation' which states 'pNext must be NULL' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkRenderPassCreateInfo)~^~TBD in parameter validation layer.
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 41e798b..d3dc8c2 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -2883,19 +2883,27 @@
 TEST_F(VkLayerTest, RenderPassAttachmentIndexOutOfRange) {
     ASSERT_NO_FATAL_FAILURE(InitState());
 
-    VkAttachmentReference ref = { 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
+    // There are no attachments, but refer to attachment 0.
+    VkAttachmentReference ref = {0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL};
     VkSubpassDescription subpasses[] = {
-        { 0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, nullptr, 1, &ref, nullptr, nullptr, 0, nullptr },
+        {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, nullptr, 1, &ref, nullptr,
+         nullptr, 0, nullptr},
     };
 
-    VkRenderPassCreateInfo rpci = {
-        VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, nullptr,
-        0, 0, nullptr, 1, subpasses, 0, nullptr
-    };
+    VkRenderPassCreateInfo rpci = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
+                                   nullptr,
+                                   0,
+                                   0,
+                                   nullptr,
+                                   1,
+                                   subpasses,
+                                   0,
+                                   nullptr};
     VkRenderPass rp;
 
+    // "... must be less than the total number of attachments ..."
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
-                                         "must be less than the total number of attachments");
+                                         VALIDATION_ERROR_00325);
     vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
     m_errorMonitor->VerifyFound();
 }