From: Kenneth Graunke Date: Thu, 14 Nov 2013 01:15:23 +0000 (-0800) Subject: mesa: Handle !m->Ended for performance monitor result availability. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d12e0e8972e13addf37c2ad885ea3ae5357d69f4;p=mesa.git 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 --- 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);