daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // Query.cpp: Implements the gl::Query class |
| 8 | |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 9 | #include "libANGLE/Query.h" |
| 10 | #include "libANGLE/renderer/QueryImpl.h" |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 11 | |
| 12 | namespace gl |
| 13 | { |
Geoff Lang | 70d0f49 | 2015-12-10 17:45:46 -0500 | [diff] [blame] | 14 | Query::Query(rx::QueryImpl *impl, GLuint id) : RefCountObject(id), mQuery(impl), mLabel() |
Brandon Jones | 3b579e3 | 2014-08-08 10:54:25 -0700 | [diff] [blame] | 15 | { |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | Query::~Query() |
| 19 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 20 | SafeDelete(mQuery); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 21 | } |
| 22 | |
Geoff Lang | 70d0f49 | 2015-12-10 17:45:46 -0500 | [diff] [blame] | 23 | void Query::setLabel(const std::string &label) |
| 24 | { |
| 25 | mLabel = label; |
| 26 | } |
| 27 | |
| 28 | const std::string &Query::getLabel() const |
| 29 | { |
| 30 | return mLabel; |
| 31 | } |
| 32 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 33 | Error Query::begin() |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 34 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 35 | return mQuery->begin(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 38 | Error Query::end() |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 39 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 40 | return mQuery->end(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Ian Ewell | 3ffd78b | 2016-01-22 16:09:42 -0500 | [diff] [blame^] | 43 | Error Query::queryCounter() |
| 44 | { |
| 45 | return mQuery->queryCounter(); |
| 46 | } |
| 47 | |
| 48 | Error Query::getResult(GLint *params) |
| 49 | { |
| 50 | return mQuery->getResult(params); |
| 51 | } |
| 52 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 53 | Error Query::getResult(GLuint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 54 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 55 | return mQuery->getResult(params); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 56 | } |
| 57 | |
Ian Ewell | 3ffd78b | 2016-01-22 16:09:42 -0500 | [diff] [blame^] | 58 | Error Query::getResult(GLint64 *params) |
| 59 | { |
| 60 | return mQuery->getResult(params); |
| 61 | } |
| 62 | |
| 63 | Error Query::getResult(GLuint64 *params) |
| 64 | { |
| 65 | return mQuery->getResult(params); |
| 66 | } |
| 67 | |
| 68 | Error Query::isResultAvailable(bool *available) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 69 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 70 | return mQuery->isResultAvailable(available); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | GLenum Query::getType() const |
| 74 | { |
shannon.woods@transgaming.com | b32e198 | 2013-02-28 23:02:59 +0000 | [diff] [blame] | 75 | return mQuery->getType(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 76 | } |
| 77 | |
Geoff Lang | f0aa842 | 2015-09-29 15:08:34 -0400 | [diff] [blame] | 78 | rx::QueryImpl *Query::getImplementation() |
| 79 | { |
| 80 | return mQuery; |
| 81 | } |
| 82 | |
| 83 | const rx::QueryImpl *Query::getImplementation() const |
| 84 | { |
| 85 | return mQuery; |
| 86 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 87 | } |