From d12e0e8972e13addf37c2ad885ea3ae5357d69f4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 13 Nov 2013 17:15:23 -0800 Subject: [PATCH] mesa: Handle !m->Ended for performance monitor result availability. 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 Reviewed-by: Ian Romanick --- 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 c168bf5d423..6491b4200f5 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); -- 2.30.2