Skip to content

Commit

Permalink
tests: Fix render pass max multiview instance index test
Browse files Browse the repository at this point in the history
  • Loading branch information
ziga-lunarg authored and spencer-lunarg committed Dec 28, 2024
1 parent e79ba45 commit f5453e1
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion tests/unit/multiview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,47 @@ TEST_F(NegativeMultiview, MaxInstanceIndex) {
if (multiview_props.maxMultiviewInstanceIndex == std::numeric_limits<uint32_t>::max()) {
GTEST_SKIP() << "maxMultiviewInstanceIndex is uint32_t max";
}

uint32_t viewMask = 0x1u;
VkRenderPassMultiviewCreateInfo renderPassMultiviewCreateInfo = vku::InitStructHelper();
renderPassMultiviewCreateInfo.subpassCount = 1;
renderPassMultiviewCreateInfo.pViewMasks = &viewMask;

RenderPassSingleSubpass rp(*this);
rp.AddAttachmentDescription(VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_LAYOUT_UNDEFINED);
rp.AddAttachmentReference({0, VK_IMAGE_LAYOUT_GENERAL});
rp.AddColorAttachment(0);
rp.CreateRenderPass(&renderPassMultiviewCreateInfo);

VkImageCreateInfo image_create_info = vku::InitStructHelper();
image_create_info.flags = 0u;
image_create_info.imageType = VK_IMAGE_TYPE_2D;
image_create_info.format = VK_FORMAT_B8G8R8A8_UNORM;
image_create_info.extent = {32u, 32u, 1u};
image_create_info.mipLevels = 1u;
image_create_info.arrayLayers = 2u;
image_create_info.samples = VK_SAMPLE_COUNT_1_BIT;
image_create_info.tiling = VK_IMAGE_TILING_OPTIMAL;
image_create_info.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
vkt::Image image(*m_device, image_create_info, vkt::set_layout);
vkt::ImageView imageView = image.CreateView(VK_IMAGE_VIEW_TYPE_2D_ARRAY);

vkt::Framebuffer framebuffer(*m_device, rp.Handle(), 1, &imageView.handle());

VkRenderPassBeginInfo render_pass_bi = vku::InitStructHelper();
render_pass_bi.renderPass = rp.Handle();
render_pass_bi.framebuffer = framebuffer.handle();
render_pass_bi.renderArea.extent.width = 32u;
render_pass_bi.renderArea.extent.height = 32u;
render_pass_bi.clearValueCount = 1u;
render_pass_bi.pClearValues = m_renderPassClearValues.data();

CreatePipelineHelper pipe(*this);
pipe.gp_ci_.renderPass = rp.Handle();
pipe.CreateGraphicsPipeline();

m_command_buffer.Begin();
m_command_buffer.BeginRenderPass(m_renderPassBeginInfo);
m_command_buffer.BeginRenderPass(render_pass_bi);
vk::CmdBindPipeline(m_command_buffer.handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.Handle());

m_errorMonitor->SetDesiredError("VUID-vkCmdDraw-maxMultiviewInstanceIndex-02688");
Expand Down

0 comments on commit f5453e1

Please sign in to comment.