wined3d: Submit command buffers after 512 draw or dispatch commands.
commitcb723c6dd3baf13583b0bde2fc71191b86100229
authorZebediah Figura <zfigura@codeweavers.com>
Wed, 24 Apr 2024 23:30:08 +0000 (24 18:30 -0500)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 7 May 2024 11:36:06 +0000 (7 13:36 +0200)
treeee302a00c84d84057db1daa135766334c8cac315
parente7db99d85f8214eafc299e75f644ce222ea655fc
wined3d: Submit command buffers after 512 draw or dispatch commands.

This improves performance for the game "Grounded", on a AMD Radeon RX 6700 XT,
with radv from Mesa 22.3.6. Testing was done with the "cb_access_map_w" option
enabled, which also improves performance with the game by itself.

Grounded generally makes about 4000 draw calls per frame, which seems not
atypical. This change makes it submit at most an extra 8 times per frame, but in
practice due to WINED3D_PERIODIC_SUBMIT_MAX_BUFFERS it submits less (usually
only 2-3).

The most demanding game I've seen made about 20,000 draw calls per frame, at
which point the overhead of adapter_vk_draw_primitive() itself becomes a serious
bottleneck. For such a game we would submit 40 more times per frame with these
settings, although WINED3D_PERIODIC_SUBMIT_MAX_BUFFERS means we would likely
submit less than that. In any case if submission itself becomes a bottleneck, we
should offload it to a separate thread.

Credit goes to Philip Rebohle and his work on DXVK for helping me to notice that
periodic submission might make a difference.
dlls/wined3d/adapter_vk.c
dlls/wined3d/context_vk.c
dlls/wined3d/wined3d_vk.h