layers: Add vkCreateRenderPass subpass attachment VUs
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 04399ac..5cef8dd 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -3685,196 +3685,185 @@
}
}
-#if 0
-TEST_F(VkLayerTest, RenderPassDepthStencilAttachmentUnused) {
- TEST_DESCRIPTION("Specify no depth attachement in renderpass then specify "
- "depth attachments in subpass");
- ASSERT_NO_FATAL_FAILURE(Init());
-
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "vkCreateRenderPass has no depth/stencil attachment, yet subpass");
-
- // Create a renderPass with a single color attachment
- VkAttachmentReference attach = {};
- attach.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
- VkSubpassDescription subpass = {};
- VkRenderPassCreateInfo rpci = {};
- rpci.subpassCount = 1;
- rpci.pSubpasses = &subpass;
- rpci.attachmentCount = 1;
- VkAttachmentDescription attach_desc = {};
- attach_desc.format = VK_FORMAT_B8G8R8A8_UNORM;
- attach_desc.samples = VK_SAMPLE_COUNT_1_BIT;
- rpci.pAttachments = &attach_desc;
- rpci.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- VkRenderPass rp;
- subpass.pDepthStencilAttachment = &attach;
- subpass.pColorAttachments = NULL;
- vkCreateRenderPass(m_device->device(), &rpci, NULL, &rp);
- m_errorMonitor->VerifyFound();
-}
-#endif
-
-TEST_F(VkLayerTest, UnusedPreserveAttachment) {
+TEST_F(VkLayerTest, CreateRenderPassAttachments) {
TEST_DESCRIPTION(
- "Create a framebuffer where a subpass has a preserve "
- "attachment reference of VK_ATTACHMENT_UNUSED");
+ "Ensure that CreateRenderPass produces the expected validation errors "
+ "when a subpass's attachments violate the valid usage conditions.");
ASSERT_NO_FATAL_FAILURE(Init());
- ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "must not be VK_ATTACHMENT_UNUSED");
+ std::vector<VkAttachmentDescription> attachments = {
+ // input attachments
+ {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
+ VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_GENERAL,
+ VK_IMAGE_LAYOUT_GENERAL},
+ // color attachments
+ {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
+ VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
+ {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
+ VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
+ // depth attachment
+ {0, VK_FORMAT_D24_UNORM_S8_UINT, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
+ VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL},
+ // resolve attachment
+ {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
+ VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
+ // preserve attachments
+ {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
+ VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
+ };
- VkAttachmentReference color_attach = {};
- color_attach.layout = VK_IMAGE_LAYOUT_GENERAL;
- color_attach.attachment = 0;
- uint32_t preserve_attachment = VK_ATTACHMENT_UNUSED;
- VkSubpassDescription subpass = {};
- subpass.colorAttachmentCount = 1;
- subpass.pColorAttachments = &color_attach;
- subpass.preserveAttachmentCount = 1;
- subpass.pPreserveAttachments = &preserve_attachment;
+ std::vector<VkAttachmentReference> input = {
+ {0, VK_IMAGE_LAYOUT_GENERAL},
+ };
+ std::vector<VkAttachmentReference> color = {
+ {1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, {2, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
+ };
+ VkAttachmentReference depth = {3, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL};
+ std::vector<VkAttachmentReference> resolve = {
+ {4, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, {VK_ATTACHMENT_UNUSED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
+ };
+ std::vector<uint32_t> preserve = {5};
- VkRenderPassCreateInfo rpci = {};
- rpci.subpassCount = 1;
- rpci.pSubpasses = &subpass;
- rpci.attachmentCount = 1;
- VkAttachmentDescription attach_desc = {};
- attach_desc.format = VK_FORMAT_UNDEFINED;
- rpci.pAttachments = &attach_desc;
- rpci.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
+ VkSubpassDescription subpass = {0,
+ VK_PIPELINE_BIND_POINT_GRAPHICS,
+ (uint32_t)input.size(),
+ input.data(),
+ (uint32_t)color.size(),
+ color.data(),
+ resolve.data(),
+ &depth,
+ (uint32_t)preserve.size(),
+ preserve.data()};
+
+ VkRenderPassCreateInfo rpci = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
+ nullptr,
+ 0,
+ (uint32_t)attachments.size(),
+ attachments.data(),
+ 1,
+ &subpass,
+ 0,
+ nullptr};
+
VkRenderPass rp;
- VkResult result = vkCreateRenderPass(m_device->device(), &rpci, NULL, &rp);
-
- m_errorMonitor->VerifyFound();
-
- if (result == VK_SUCCESS) {
- vkDestroyRenderPass(m_device->device(), rp, NULL);
+ VkResult err;
+ // Test too many color attachments
+ {
+ std::vector<VkAttachmentReference> too_many_colors(m_device->props.limits.maxColorAttachments + 1, color[0]);
+ subpass.colorAttachmentCount = (uint32_t)too_many_colors.size();
+ subpass.pColorAttachments = too_many_colors.data();
+ subpass.pResolveAttachments = NULL;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00348);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ subpass.colorAttachmentCount = (uint32_t)color.size();
+ subpass.pColorAttachments = color.data();
+ subpass.pResolveAttachments = resolve.data();
}
-}
-
-TEST_F(VkLayerTest, CreateRenderPassResolveRequiresColorMsaa) {
- TEST_DESCRIPTION(
- "Ensure that CreateRenderPass produces a validation error "
- "when the source of a subpass multisample resolve "
- "does not have multiple samples.");
-
- ASSERT_NO_FATAL_FAILURE(Init());
-
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "Subpass 0 requests multisample resolve from attachment 0 which has "
- "VK_SAMPLE_COUNT_1_BIT");
-
- VkAttachmentDescription attachments[] = {
- {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
- VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
- {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
- VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
- };
-
- VkAttachmentReference color = {
- 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- };
-
- VkAttachmentReference resolve = {
- 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- };
-
- VkSubpassDescription subpass = {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, nullptr, 1, &color, &resolve, nullptr, 0, nullptr};
-
- VkRenderPassCreateInfo rpci = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, nullptr, 0, 2, attachments, 1, &subpass, 0, nullptr};
-
- VkRenderPass rp;
- VkResult err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
-
+ // Test sample count mismatch between color buffers
+ attachments[subpass.pColorAttachments[1].attachment].samples = VK_SAMPLE_COUNT_8_BIT;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00337);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
m_errorMonitor->VerifyFound();
-
if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
-}
-
-TEST_F(VkLayerTest, CreateRenderPassResolveRequiresSingleSampleDest) {
- TEST_DESCRIPTION(
- "Ensure CreateRenderPass produces a validation error "
- "when a subpass multisample resolve operation is "
- "requested, and the destination of that resolve has "
- "multiple samples.");
-
- ASSERT_NO_FATAL_FAILURE(Init());
-
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "Subpass 0 requests multisample resolve into attachment 1, which "
- "must have VK_SAMPLE_COUNT_1_BIT but has VK_SAMPLE_COUNT_4_BIT");
-
- VkAttachmentDescription attachments[] = {
- {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
- VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
- {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
- VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
- };
-
- VkAttachmentReference color = {
- 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- };
-
- VkAttachmentReference resolve = {
- 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- };
-
- VkSubpassDescription subpass = {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, nullptr, 1, &color, &resolve, nullptr, 0, nullptr};
-
- VkRenderPassCreateInfo rpci = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, nullptr, 0, 2, attachments, 1, &subpass, 0, nullptr};
-
- VkRenderPass rp;
- VkResult err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
-
+ attachments[subpass.pColorAttachments[1].attachment].samples = attachments[subpass.pColorAttachments[0].attachment].samples;
+ // Test sample count mismatch between color buffers and depth buffer
+ attachments[subpass.pDepthStencilAttachment->attachment].samples = VK_SAMPLE_COUNT_8_BIT;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00337);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
m_errorMonitor->VerifyFound();
-
if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
-}
-
-TEST_F(VkLayerTest, CreateRenderPassSubpassSampleCountConsistency) {
- TEST_DESCRIPTION(
- "Ensure CreateRenderPass produces a validation error "
- "when the color and depth attachments used by a subpass "
- "have inconsistent sample counts");
-
- ASSERT_NO_FATAL_FAILURE(Init());
-
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "Subpass 0 attempts to render to attachments with inconsistent sample counts");
-
- VkAttachmentDescription attachments[] = {
- {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
- VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
- {0, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_4_BIT, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
- VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
- };
-
- VkAttachmentReference color[] = {
- {
- 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- },
- {
- 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- },
- };
-
- VkSubpassDescription subpass = {0, VK_PIPELINE_BIND_POINT_GRAPHICS, 0, nullptr, 2, color, nullptr, nullptr, 0, nullptr};
-
- VkRenderPassCreateInfo rpci = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, nullptr, 0, 2, attachments, 1, &subpass, 0, nullptr};
-
- VkRenderPass rp;
- VkResult err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
-
+ attachments[subpass.pDepthStencilAttachment->attachment].samples = attachments[subpass.pColorAttachments[0].attachment].samples;
+ // Test resolve attachment with UNUSED color attachment
+ color[0].attachment = VK_ATTACHMENT_UNUSED;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00350);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
m_errorMonitor->VerifyFound();
-
if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ color[0].attachment = 1;
+ // Test resolve from a single-sampled color attachment
+ attachments[subpass.pColorAttachments[0].attachment].samples = VK_SAMPLE_COUNT_1_BIT;
+ attachments[subpass.pColorAttachments[1].attachment].samples = VK_SAMPLE_COUNT_1_BIT; // avoid mismatch (00337)
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00351);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ attachments[subpass.pColorAttachments[0].attachment].samples = VK_SAMPLE_COUNT_4_BIT;
+ attachments[subpass.pColorAttachments[1].attachment].samples = VK_SAMPLE_COUNT_4_BIT;
+ // Test resolve to a multi-sampled resolve attachment
+ attachments[subpass.pResolveAttachments[0].attachment].samples = VK_SAMPLE_COUNT_4_BIT;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00352);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ attachments[subpass.pResolveAttachments[0].attachment].samples = VK_SAMPLE_COUNT_1_BIT;
+ // Test with color/resolve format mismatch
+ attachments[subpass.pColorAttachments[0].attachment].format = VK_FORMAT_R8G8B8A8_SRGB;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00353);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ attachments[subpass.pColorAttachments[0].attachment].format = attachments[subpass.pResolveAttachments[0].attachment].format;
+ // Test for UNUSED preserve attachments
+ preserve[0] = VK_ATTACHMENT_UNUSED;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00356);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ preserve[0] = 5;
+ // Test for preserve attachments used elsewhere in the subpass
+ color[0].attachment = preserve[0];
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00357);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ color[0].attachment = 1;
+ // test for layout mismatch between input attachment and color attachment
+ input[0].attachment = color[0].attachment;
+ input[0].layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00358);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ input[0].attachment = 0;
+ input[0].layout = VK_IMAGE_LAYOUT_GENERAL;
+ // test for layout mismatch between input attachment and depth attachment
+ input[0].attachment = depth.attachment;
+ input[0].layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00358);
+ err = vkCreateRenderPass(m_device->device(), &rpci, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ input[0].attachment = 0;
+ input[0].layout = VK_IMAGE_LAYOUT_GENERAL;
+ // Test for attachment used first as input with loadOp=CLEAR
+ {
+ std::vector<VkSubpassDescription> subpasses = {subpass, subpass, subpass};
+ subpasses[0].inputAttachmentCount = 0;
+ subpasses[1].inputAttachmentCount = 0;
+ attachments[input[0].attachment].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ VkRenderPassCreateInfo rpci_multipass = {VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
+ nullptr,
+ 0,
+ (uint32_t)attachments.size(),
+ attachments.data(),
+ (uint32_t)subpasses.size(),
+ subpasses.data(),
+ 0,
+ nullptr};
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00349);
+ err = vkCreateRenderPass(m_device->device(), &rpci_multipass, nullptr, &rp);
+ m_errorMonitor->VerifyFound();
+ if (err == VK_SUCCESS) vkDestroyRenderPass(m_device->device(), rp, nullptr);
+ attachments[input[0].attachment].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+ }
}
TEST_F(VkLayerTest, FramebufferCreateErrors) {
@@ -9259,8 +9248,8 @@
VkAttachmentReference attach = {};
attach.layout = VK_IMAGE_LAYOUT_GENERAL;
VkSubpassDescription subpass = {};
- subpass.inputAttachmentCount = 1;
- subpass.pInputAttachments = &attach;
+ subpass.colorAttachmentCount = 1;
+ subpass.pColorAttachments = &attach;
VkRenderPassCreateInfo rpci = {};
rpci.subpassCount = 1;
rpci.pSubpasses = &subpass;
@@ -9317,8 +9306,8 @@
VkAttachmentReference attach = {};
attach.layout = VK_IMAGE_LAYOUT_GENERAL;
VkSubpassDescription subpass = {};
- subpass.inputAttachmentCount = 1;
- subpass.pInputAttachments = &attach;
+ subpass.colorAttachmentCount = 1;
+ subpass.pColorAttachments = &attach;
VkRenderPassCreateInfo rpci = {};
rpci.subpassCount = 1;
rpci.pSubpasses = &subpass;
@@ -11718,9 +11707,9 @@
// but add it to be able to run on more devices
// Create a renderpass that will be incompatible with default renderpass
VkAttachmentReference attach = {};
- attach.layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ attach.layout = VK_IMAGE_LAYOUT_GENERAL;
VkAttachmentReference color_att = {};
- color_att.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
+ color_att.layout = VK_IMAGE_LAYOUT_GENERAL;
VkSubpassDescription subpass = {};
subpass.inputAttachmentCount = 1;
subpass.pInputAttachments = &attach;