[PATCH 2/2] wined3d: Avoid referencing empty command buffers in wined3d_query_event_vk_issue().

Henri Verbeet hverbeet at codeweavers.com
Tue Dec 15 07:14:21 CST 2020


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
This fixes a deadlock in "Ryse: Son of Rome" when starting a new campaign.

 dlls/wined3d/query.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 9e0e22b32e5..4670bbfddff 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -1720,6 +1720,14 @@ static BOOL wined3d_query_event_vk_issue(struct wined3d_query *query, uint32_t f
     {
         context_vk = wined3d_context_vk(context_acquire(&device_vk->d, NULL, 0));
         wined3d_context_vk_reference_query(context_vk, query_vk);
+        /* Because we don't actually submit any commands to the command buffer
+         * for event queries, the context's current command buffer may still
+         * be empty, and we should wait on the preceding command buffer
+         * instead. That's not merely an optimisation; if the command buffer
+         * referenced by the query is still empty by the time the application
+         * waits for it, that wait will never complete. */
+        if (!context_vk->current_command_buffer.vk_command_buffer)
+            --query_vk->command_buffer_id;
         context_release(&context_vk->c);
 
         return TRUE;
-- 
2.20.1




More information about the wine-devel mailing list