[PATCH 3/8] d3dx10: Add ID3DX10ThreadPump:GetWorkItemCount implementation.

Piotr Caban wine at gitlab.winehq.org
Sat Jun 18 06:56:55 CDT 2022


From: Piotr Caban <piotr at codeweavers.com>

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
 dlls/d3dx10_43/d3dx10_43_main.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dx10_43/d3dx10_43_main.c b/dlls/d3dx10_43/d3dx10_43_main.c
index d66d83d3e7f..5d718f6de2b 100644
--- a/dlls/d3dx10_43/d3dx10_43_main.c
+++ b/dlls/d3dx10_43/d3dx10_43_main.c
@@ -205,6 +205,8 @@ struct thread_pump
     ID3DX10ThreadPump ID3DX10ThreadPump_iface;
     LONG refcount;
 
+    LONG processing_count;
+
     SRWLOCK io_lock;
     UINT io_count;
     struct list io_queue;
@@ -324,6 +326,7 @@ static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10D
     if (object)
         *object = NULL;
 
+    InterlockedIncrement(&thread_pump->processing_count);
     AcquireSRWLockExclusive(&thread_pump->io_lock);
     thread_pump->io_count++;
     list_add_tail(&thread_pump->io_queue, &work_item->entry);
@@ -334,8 +337,15 @@ static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10D
 
 static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface)
 {
-    FIXME("iface %p stub!\n", iface);
-    return 0;
+    struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface);
+    UINT ret;
+
+    TRACE("iface %p.\n", iface);
+
+    AcquireSRWLockExclusive(&thread_pump->device_lock);
+    ret = thread_pump->processing_count + thread_pump->device_count;
+    ReleaseSRWLockExclusive(&thread_pump->device_lock);
+    return ret;
 }
 
 static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface)
@@ -411,6 +421,7 @@ static DWORD WINAPI io_thread(void *arg)
             if (work_item->result)
                 *work_item->result = hr;
             work_item_free(work_item, FALSE);
+            InterlockedDecrement(&thread_pump->processing_count);
             continue;
         }
 
@@ -466,6 +477,7 @@ static DWORD WINAPI proc_thread(void *arg)
             if (work_item->result)
                 *work_item->result = hr;
             work_item_free(work_item, FALSE);
+            InterlockedDecrement(&thread_pump->processing_count);
             continue;
         }
 
@@ -480,6 +492,7 @@ static DWORD WINAPI proc_thread(void *arg)
             if (work_item->result)
                 *work_item->result = hr;
             work_item_free(work_item, FALSE);
+            InterlockedDecrement(&thread_pump->processing_count);
             continue;
         }
 
@@ -493,6 +506,7 @@ static DWORD WINAPI proc_thread(void *arg)
 
         list_add_tail(&thread_pump->device_queue, &work_item->entry);
         thread_pump->device_count++;
+        InterlockedDecrement(&thread_pump->processing_count);
         ReleaseSRWLockExclusive(&thread_pump->device_lock);
     }
     return 0;
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/272



More information about the wine-devel mailing list