If a performance monitor has never ended, then no result can be
available.  Core Mesa can easily handle this, saving drivers a tiny bit
of complexity.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
Cc: Eric Anholt <e...@anholt.net>
Cc: Carl Worth <cwo...@cworth.org>
Cc: Juha-Pekka Heikkilä <juha-pekka.heikk...@intel.com>
---
 src/mesa/main/performance_monitor.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/performance_monitor.c 
b/src/mesa/main/performance_monitor.c
index c168bf5..6491b42 100644
--- a/src/mesa/main/performance_monitor.c
+++ b/src/mesa/main/performance_monitor.c
@@ -568,8 +568,12 @@ _mesa_GetPerfMonitorCounterDataAMD(GLuint monitor, GLenum 
pname,
       return;
    }
 
+   /* If the monitor has never ended, there is no result. */
+   bool result_available = m->Ended &&
+      ctx->Driver.IsPerfMonitorResultAvailable(ctx, m);
+
    /* AMD appears to return 0 for all queries unless a result is available. */
-   if (!ctx->Driver.IsPerfMonitorResultAvailable(ctx, m)) {
+   if (!result_available) {
       *data = 0;
       if (bytesWritten != NULL)
          *bytesWritten = sizeof(GLuint);
-- 
1.8.3.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to