Skip to content

Commit

Permalink
tests: Add tests for VK_REMAINING_*
Browse files Browse the repository at this point in the history
Add tests for using VK_REMAINING_ARRAY_LAYERS and
VK_REMAINING_MIP_LEVELS on vkCmdClearDepthStencilImage.
  • Loading branch information
rlocatti-nv authored and jeremyg-lunarg committed Aug 25, 2022
1 parent e78782f commit 2995230
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/vklayertests_nvidia_best_practices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,58 @@ TEST_F(VkNvidiaBestPracticesLayerTest, BindPipeline_ZcullDirection)
m_errorMonitor->VerifyFound();
}

discard_barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;

{
SCOPED_TRACE("Transfer clear with VK_REMAINING_ARRAY_LAYERS");

vk::CmdBeginRendering(cmd, &begin_rendering_info);

vk::CmdSetDepthCompareOp(cmd, VK_COMPARE_OP_LESS);
for (int i = 0; i < 60; ++i) m_commandBuffer->Draw(0, 0, 0, 0);

vk::CmdEndRendering(cmd);

VkClearDepthStencilValue ds_value{};
vk::CmdClearDepthStencilImage(cmd, image.handle(), VK_IMAGE_LAYOUT_GENERAL, &ds_value, 1,
&discard_barrier.subresourceRange);

vk::CmdBeginRendering(cmd, &begin_rendering_info);

vk::CmdSetDepthCompareOp(cmd, VK_COMPARE_OP_GREATER);
for (int i = 0; i < 40; ++i) m_commandBuffer->Draw(0, 0, 0, 0);

set_desired_failure_msg();
vk::CmdEndRendering(cmd);
m_errorMonitor->Finish();
}

discard_barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;

{
SCOPED_TRACE("Transfer clear with VK_REMAINING_MIP_LEVELS");

vk::CmdBeginRendering(cmd, &begin_rendering_info);

vk::CmdSetDepthCompareOp(cmd, VK_COMPARE_OP_LESS);
for (int i = 0; i < 60; ++i) m_commandBuffer->Draw(0, 0, 0, 0);

vk::CmdEndRendering(cmd);

VkClearDepthStencilValue ds_value{};
vk::CmdClearDepthStencilImage(cmd, image.handle(), VK_IMAGE_LAYOUT_GENERAL, &ds_value, 1,
&discard_barrier.subresourceRange);

vk::CmdBeginRendering(cmd, &begin_rendering_info);

vk::CmdSetDepthCompareOp(cmd, VK_COMPARE_OP_GREATER);
for (int i = 0; i < 40; ++i) m_commandBuffer->Draw(0, 0, 0, 0);

set_desired_failure_msg();
vk::CmdEndRendering(cmd);
m_errorMonitor->Finish();
}

m_commandBuffer->end();
}

Expand Down

0 comments on commit 2995230

Please sign in to comment.