blob: cd1fb5f4bc7db96cb6003276c5ceef84b398380c [file] [log] [blame]
daniel@transgaming.com86bdb822012-01-20 18:24:39 +00001//
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 Lang2b5420c2014-11-19 14:20:15 -05009#include "libANGLE/Query.h"
10#include "libANGLE/renderer/QueryImpl.h"
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000011
12namespace gl
13{
Geoff Lang70d0f492015-12-10 17:45:46 -050014Query::Query(rx::QueryImpl *impl, GLuint id) : RefCountObject(id), mQuery(impl), mLabel()
Brandon Jones3b579e32014-08-08 10:54:25 -070015{
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000016}
17
18Query::~Query()
19{
Geoff Lang5aad9672014-09-08 11:10:42 -040020 SafeDelete(mQuery);
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000021}
22
Geoff Lang70d0f492015-12-10 17:45:46 -050023void Query::setLabel(const std::string &label)
24{
25 mLabel = label;
26}
27
28const std::string &Query::getLabel() const
29{
30 return mLabel;
31}
32
Geoff Lang5aad9672014-09-08 11:10:42 -040033Error Query::begin()
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000034{
Geoff Lang5aad9672014-09-08 11:10:42 -040035 return mQuery->begin();
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000036}
37
Geoff Lang5aad9672014-09-08 11:10:42 -040038Error Query::end()
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000039{
Geoff Lang5aad9672014-09-08 11:10:42 -040040 return mQuery->end();
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000041}
42
Ian Ewell3ffd78b2016-01-22 16:09:42 -050043Error Query::queryCounter()
44{
45 return mQuery->queryCounter();
46}
47
48Error Query::getResult(GLint *params)
49{
50 return mQuery->getResult(params);
51}
52
Geoff Lang5aad9672014-09-08 11:10:42 -040053Error Query::getResult(GLuint *params)
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000054{
Geoff Lang5aad9672014-09-08 11:10:42 -040055 return mQuery->getResult(params);
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000056}
57
Ian Ewell3ffd78b2016-01-22 16:09:42 -050058Error Query::getResult(GLint64 *params)
59{
60 return mQuery->getResult(params);
61}
62
63Error Query::getResult(GLuint64 *params)
64{
65 return mQuery->getResult(params);
66}
67
68Error Query::isResultAvailable(bool *available)
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000069{
Geoff Lang5aad9672014-09-08 11:10:42 -040070 return mQuery->isResultAvailable(available);
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000071}
72
73GLenum Query::getType() const
74{
shannon.woods@transgaming.comb32e1982013-02-28 23:02:59 +000075 return mQuery->getType();
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000076}
77
Geoff Langf0aa8422015-09-29 15:08:34 -040078rx::QueryImpl *Query::getImplementation()
79{
80 return mQuery;
81}
82
83const rx::QueryImpl *Query::getImplementation() const
84{
85 return mQuery;
86}
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000087}