From 6aef41c1a30ce0beca92b43740cfe0a9140b049b Mon Sep 17 00:00:00 2001 From: ziga-lunarg Date: Thu, 9 Jan 2025 14:24:42 +0200 Subject: [PATCH 1/2] layers: Fix robustBufferAccess2 check for 08798 --- layers/gpu/cmd_validation/gpuav_draw.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layers/gpu/cmd_validation/gpuav_draw.cpp b/layers/gpu/cmd_validation/gpuav_draw.cpp index f6cd38d581c..1867575d060 100644 --- a/layers/gpu/cmd_validation/gpuav_draw.cpp +++ b/layers/gpu/cmd_validation/gpuav_draw.cpp @@ -1148,6 +1148,10 @@ void DrawIndexedIndirectIndexBuffer(Validator &gpuav, CommandBuffer &cb_state, c } if (gpuav.enabled_features.robustBufferAccess2) { + return; + } + + if (gpuav.enabled_features.pipelineRobustness) { const LvlBindPoint lv_bind_point = ConvertToLvlBindPoint(VK_PIPELINE_BIND_POINT_GRAPHICS); const LastBound &last_bound = cb_state.lastBound[lv_bind_point]; const vvl::Pipeline *pipeline_state = last_bound.pipeline_state; From 5e4969b4e92db22f0ecdba1b1999f4c6af86b705 Mon Sep 17 00:00:00 2001 From: ziga-lunarg Date: Thu, 9 Jan 2025 14:24:56 +0200 Subject: [PATCH 2/2] tests: Test index oob with robustBufferAccess2 --- tests/unit/gpu_av_index_buffer_positive.cpp | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/unit/gpu_av_index_buffer_positive.cpp b/tests/unit/gpu_av_index_buffer_positive.cpp index 6ec7c1f220a..695b4fb6250 100644 --- a/tests/unit/gpu_av_index_buffer_positive.cpp +++ b/tests/unit/gpu_av_index_buffer_positive.cpp @@ -164,3 +164,36 @@ TEST_F(PositiveGpuAVIndexBuffer, DrawIndexedDynamicStates) { m_default_queue->Wait(); m_errorMonitor->VerifyFound(); } + +TEST_F(PositiveGpuAVIndexBuffer, IndexedIndirectRobustness) { + AddRequiredExtensions(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME); + RETURN_IF_SKIP(InitGpuAvFramework()); + AddRequiredFeature(vkt::Feature::robustBufferAccess); + AddRequiredFeature(vkt::Feature::robustBufferAccess2); + RETURN_IF_SKIP(InitState()); + InitRenderTarget(); + + CreatePipelineHelper pipe(*this); + pipe.CreateGraphicsPipeline(); + + VkDrawIndexedIndirectCommand draw_params{}; + draw_params.indexCount = 4; + draw_params.instanceCount = 1; + draw_params.firstIndex = 0; + draw_params.vertexOffset = 0; + draw_params.firstInstance = 0; + vkt::Buffer draw_params_buffer = vkt::IndirectBuffer(*m_device, {draw_params}); + + VkCommandBufferBeginInfo begin_info = vku::InitStructHelper(); + m_command_buffer.Begin(&begin_info); + m_command_buffer.BeginRenderPass(m_renderPassBeginInfo); + vk::CmdBindPipeline(m_command_buffer.handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.Handle()); + vkt::Buffer index_buffer = vkt::IndexBuffer(*m_device, {0, std::numeric_limits::max(), 42}); + + vk::CmdBindIndexBuffer(m_command_buffer.handle(), index_buffer.handle(), 0, VK_INDEX_TYPE_UINT32); + vk::CmdDrawIndexedIndirect(m_command_buffer.handle(), draw_params_buffer.handle(), 0, 1, 0); + m_command_buffer.EndRenderPass(); + m_command_buffer.End(); + m_default_queue->Submit(m_command_buffer); + m_default_queue->Wait(); +}