summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony-LunarG <tony@lunarg.com>2022-02-25 09:31:55 -0700
committerTony Barbour <tony@lunarg.com>2022-03-07 16:25:48 -0700
commitaa55372856f80b5e7d70e00086c52a0037c47bed (patch)
tree060a96189d4136a5563605214cc1aaf37666c448
parent463bae3d083c6447c32fc25871df7516023a4d27 (diff)
downloadVulkan-ValidationLayers-aa55372856f80b5e7d70e00086c52a0037c47bed.tar.gz
Vulkan-ValidationLayers-aa55372856f80b5e7d70e00086c52a0037c47bed.tar.bz2
Vulkan-ValidationLayers-aa55372856f80b5e7d70e00086c52a0037c47bed.zip
tests: Add gpu-av dyn rendering test
-rw-r--r--tests/vklayertests_gpu.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/tests/vklayertests_gpu.cpp b/tests/vklayertests_gpu.cpp
index 64025b8d8..219211f04 100644
--- a/tests/vklayertests_gpu.cpp
+++ b/tests/vklayertests_gpu.cpp
@@ -1714,7 +1714,7 @@ TEST_F(VkGpuAssistedLayerTest, GpuBuildAccelerationStructureValidationRestoresSt
TEST_F(VkGpuAssistedLayerTest, GpuDrawIndirectCountDeviceLimit) {
TEST_DESCRIPTION("GPU validation: Validate maxDrawIndirectCount limit");
- SetTargetApiVersion(VK_API_VERSION_1_1);
+ SetTargetApiVersion(VK_API_VERSION_1_3);
InitGpuAssistedFramework(false);
if (IsPlatform(kMockICD) || DeviceSimulation()) {
printf("%s GPU-Assisted validation test requires a driver that can draw.\n", kSkipPrefix);
@@ -1726,6 +1726,12 @@ TEST_F(VkGpuAssistedLayerTest, GpuDrawIndirectCountDeviceLimit) {
printf("%s VK_KHR_draw_indirect_count extension not supported, skipping test\n", kSkipPrefix);
return;
}
+
+ VkPhysicalDeviceVulkan13Features features13 = LvlInitStruct<VkPhysicalDeviceVulkan13Features>();
+ if (DeviceValidationVersion() >= VK_API_VERSION_1_3) {
+ features13.dynamicRendering = true;
+ }
+
PFN_vkSetPhysicalDeviceLimitsEXT fpvkSetPhysicalDeviceLimitsEXT =
(PFN_vkSetPhysicalDeviceLimitsEXT)vk::GetInstanceProcAddr(instance(), "vkSetPhysicalDeviceLimitsEXT");
PFN_vkGetOriginalPhysicalDeviceLimitsEXT fpvkGetOriginalPhysicalDeviceLimitsEXT =
@@ -1740,7 +1746,8 @@ TEST_F(VkGpuAssistedLayerTest, GpuDrawIndirectCountDeviceLimit) {
props.limits.maxDrawIndirectCount = 1;
fpvkSetPhysicalDeviceLimitsEXT(gpu(), &props.limits);
- ASSERT_NO_FATAL_FAILURE(InitState());
+ VkCommandPoolCreateFlags pool_flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
+ ASSERT_NO_FATAL_FAILURE(InitState(nullptr, features13.dynamicRendering ? (void *)&features13 : nullptr, pool_flags));
ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
auto vkCmdDrawIndirectCountKHR =
@@ -1801,6 +1808,31 @@ TEST_F(VkGpuAssistedLayerTest, GpuDrawIndirectCountDeviceLimit) {
ASSERT_VK_SUCCESS(err);
m_errorMonitor->VerifyFound();
+ if (features13.dynamicRendering) {
+ VkPipelineObj dr_pipe(m_device);
+ dr_pipe.AddShader(&vs);
+ dr_pipe.AddDefaultColorAttachment();
+ err = dr_pipe.CreateVKPipeline(pipeline_layout, VK_NULL_HANDLE);
+ ASSERT_VK_SUCCESS(err);
+
+ m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkCmdDrawIndirectCount-countBuffer-02717");
+ m_commandBuffer->begin();
+ m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo);
+ vk::CmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
+ vk::CmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport);
+ vk::CmdSetScissor(m_commandBuffer->handle(), 0, 1, &scissor);
+
+ vkCmdDrawIndirectCountKHR(m_commandBuffer->handle(), draw_buffer.handle(), 0, count_buffer.handle(), 0, 2,
+ sizeof(VkDrawIndirectCommand));
+
+ m_commandBuffer->EndRenderPass();
+ m_commandBuffer->end();
+ m_commandBuffer->QueueCommandBuffer();
+ err = vk::QueueWaitIdle(m_device->m_queue);
+ ASSERT_VK_SUCCESS(err);
+ m_errorMonitor->VerifyFound();
+ }
+
vk::DestroyPipelineLayout(m_device->handle(), pipeline_layout, nullptr);
}