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 | |||||
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 43 | Error Query::getResult(GLuint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 44 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 45 | return mQuery->getResult(params); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 46 | } |
47 | |||||
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 48 | Error Query::isResultAvailable(GLuint *available) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 49 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 50 | return mQuery->isResultAvailable(available); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 51 | } |
52 | |||||
53 | GLenum Query::getType() const | ||||
54 | { | ||||
shannon.woods@transgaming.com | b32e198 | 2013-02-28 23:02:59 +0000 | [diff] [blame] | 55 | return mQuery->getType(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 56 | } |
57 | |||||
Geoff Lang | f0aa842 | 2015-09-29 15:08:34 -0400 | [diff] [blame] | 58 | rx::QueryImpl *Query::getImplementation() |
59 | { | ||||
60 | return mQuery; | ||||
61 | } | ||||
62 | |||||
63 | const rx::QueryImpl *Query::getImplementation() const | ||||
64 | { | ||||
65 | return mQuery; | ||||
66 | } | ||||
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 67 | } |