From 89c7d75a45b6712d97cbd9fdce8f9132120666e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 9 Jan 2014 00:24:59 +0100 Subject: [PATCH] Fix return value from *Query::result(). This is just a convenience wrapper around result(), so we can implement it using that. And return true whenever the result is nonzero (previously was returning true for 1 and false for 0, 2, 3, etc., which is wrong). The tests now pass again. --- src/Query.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/Query.cpp b/src/Query.cpp index 1e3adfa56..d847bb635 100644 --- a/src/Query.cpp +++ b/src/Query.cpp @@ -90,21 +90,6 @@ bool AbstractQuery::resultAvailable() { } #ifndef DOXYGEN_GENERATING_OUTPUT -template<> bool AbstractQuery::result() { - CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); - - /** @todo Re-enable when extension loader is available for ES */ - GLuint result; - #ifndef MAGNUM_TARGET_GLES2 - glGetQueryObjectuiv(_id, GL_QUERY_RESULT, &result); - #elif defined(CORRADE_TARGET_NACL) - glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT, &result); - #else - CORRADE_INTERNAL_ASSERT(false); - #endif - return result == GL_TRUE; -} - template<> UnsignedInt AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); @@ -120,6 +105,8 @@ template<> UnsignedInt AbstractQuery::result() { return result; } +template<> bool AbstractQuery::result() { return result() != 0; } + template<> Int AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {});