[vulkan] Avoid executing zero-sized draws calls Submitting empty draw calls can cause crashes on QC Pixel 4 GPU drivers, but since they are no-ops we can simply skip them as a workaround. Remove CTS failure expectations that should now pass. Change-Id: I1e5e237a16d61423c8a60cf38404c4a54f04363b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/326275 Commit-Queue: Natalie Chouinard <chouinard@google.com> Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/dawn/native/vulkan/CommandBufferVk.cpp b/src/dawn/native/vulkan/CommandBufferVk.cpp index d69dc80..07d9466 100644 --- a/src/dawn/native/vulkan/CommandBufferVk.cpp +++ b/src/dawn/native/vulkan/CommandBufferVk.cpp
@@ -1801,10 +1801,13 @@ workCommandCount++; DrawCmd* draw = iter->NextCommand<DrawCmd>(); - DAWN_TRY(state.SyncAndRun([&](const VulkanFunctions& vk, VkCommandBuffer commands) { - vk.CmdDraw(commands, draw->vertexCount, draw->instanceCount, draw->firstVertex, - draw->firstInstance); - })); + if (draw->vertexCount > 0 && draw->instanceCount > 0) { + DAWN_TRY( + state.SyncAndRun([&](const VulkanFunctions& vk, VkCommandBuffer commands) { + vk.CmdDraw(commands, draw->vertexCount, draw->instanceCount, + draw->firstVertex, draw->firstInstance); + })); + } break; } @@ -1812,10 +1815,13 @@ workCommandCount++; DrawIndexedCmd* draw = iter->NextCommand<DrawIndexedCmd>(); - DAWN_TRY(state.SyncAndRun([&](const VulkanFunctions& vk, VkCommandBuffer commands) { - vk.CmdDrawIndexed(commands, draw->indexCount, draw->instanceCount, - draw->firstIndex, draw->baseVertex, draw->firstInstance); - })); + if (draw->indexCount > 0 && draw->instanceCount > 0) { + DAWN_TRY(state.SyncAndRun([&](const VulkanFunctions& vk, + VkCommandBuffer commands) { + vk.CmdDrawIndexed(commands, draw->indexCount, draw->instanceCount, + draw->firstIndex, draw->baseVertex, draw->firstInstance); + })); + } break; }
diff --git a/webgpu-cts/expectations.txt b/webgpu-cts/expectations.txt index a891058..37499ad 100644 --- a/webgpu-cts/expectations.txt +++ b/webgpu-cts/expectations.txt
@@ -1959,8 +1959,6 @@ crbug.com/0000 [ android-pixel-4 ] webgpu:api,operation,render_pipeline,overrides:multi_entry_points:isAsync=true [ Failure ] crbug.com/0000 [ android-pixel-6 ] webgpu:api,operation,rendering,3d_texture_slices:multiple_color_attachments,same_slice_with_diff_mip_levels:format="r16unorm";depthSlice=1 [ Failure ] crbug.com/0000 [ android-pixel-4 ] webgpu:api,operation,rendering,basic:large_draw:indexed=true;indirect=false [ Failure ] -crbug.com/0000 [ android-pixel-4 ] webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 [ Failure ] -crbug.com/0000 [ android-pixel-4 ] webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 [ Failure ] crbug.com/0000 [ android-pixel-4 ] webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 [ Failure ] crbug.com/0000 [ android-pixel-4 ] webgpu:api,operation,rendering,stencil:stencil_accumulation:format="depth24plus-stencil8" [ Failure ] crbug.com/0000 [ android-pixel-4 ] webgpu:api,operation,rendering,stencil:stencil_accumulation:format="depth32float-stencil8" [ Failure ]