[Mesa-dev] [PATCH v3 17/19] st/nine: Queries: allow app to call GetData without Issuing first

David Heidelberg david at ixit.cz
Mon Nov 24 15:38:17 PST 2014


From: Axel Davy <axel.davy at ens.fr>

Nine was allowing that behaviour, but was not filling the result.

Cc: "10.4" <mesa-stable at lists.freedesktop.org>
Tested-by: David Heidelberg <david at ixit.cz>
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/query9.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/nine/query9.c b/src/gallium/state_trackers/nine/query9.c
index e174586..04ad3db 100644
--- a/src/gallium/state_trackers/nine/query9.c
+++ b/src/gallium/state_trackers/nine/query9.c
@@ -197,7 +197,7 @@ NineQuery9_GetData( struct NineQuery9 *This,
                     DWORD dwGetDataFlags )
 {
     struct pipe_context *pipe = This->base.device->pipe;
-    boolean ok, flush_if_needed;
+    boolean ok, flush_if_needed, wait_query_result = FALSE;
     unsigned i;
     union pipe_query_result presult;
     union nine_query_result nresult;
@@ -213,8 +213,14 @@ NineQuery9_GetData( struct NineQuery9 *This,
     user_assert(dwGetDataFlags == 0 ||
                 dwGetDataFlags == D3DGETDATA_FLUSH, D3DERR_INVALIDCALL);
 
-    if (This->state == NINE_QUERY_STATE_FRESH)
-        return S_OK;
+    if (This->state == NINE_QUERY_STATE_FRESH) {
+        /* App forgot calling Issue. call it for it.
+         * However Wine states that return value should
+         * be S_OK, so wait for the result to return S_OK. */
+        NineQuery9_Issue(This, D3DISSUE_END);
+        dwGetDataFlags = D3DGETDATA_FLUSH; /* flush if needed */
+        wait_query_result = TRUE;
+    }
 
     flush_if_needed = dwGetDataFlags &&
                       This->state != NINE_QUERY_STATE_FLUSHED;
@@ -222,7 +228,7 @@ NineQuery9_GetData( struct NineQuery9 *This,
     ok = pipe->get_query_result(pipe, This->pq, FALSE, &presult);
     if (!ok && flush_if_needed) {
         pipe->flush(pipe, NULL, 0);
-        ok = pipe->get_query_result(pipe, This->pq, FALSE, &presult);
+        ok = pipe->get_query_result(pipe, This->pq, wait_query_result, &presult);
         This->state = NINE_QUERY_STATE_FLUSHED;
     }
 
-- 
2.1.3



More information about the mesa-dev mailing list