blob: 09bf53dcc7df6b0fc31cd51869c4e14f1e8fa637 [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
Geoff Lang5aad9672014-09-08 11:10:42 -040043Error Query::getResult(GLuint *params)
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000044{
Geoff Lang5aad9672014-09-08 11:10:42 -040045 return mQuery->getResult(params);
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000046}
47
Geoff Lang5aad9672014-09-08 11:10:42 -040048Error Query::isResultAvailable(GLuint *available)
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000049{
Geoff Lang5aad9672014-09-08 11:10:42 -040050 return mQuery->isResultAvailable(available);
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000051}
52
53GLenum Query::getType() const
54{
shannon.woods@transgaming.comb32e1982013-02-28 23:02:59 +000055 return mQuery->getType();
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000056}
57
Geoff Langf0aa8422015-09-29 15:08:34 -040058rx::QueryImpl *Query::getImplementation()
59{
60 return mQuery;
61}
62
63const rx::QueryImpl *Query::getImplementation() const
64{
65 return mQuery;
66}
daniel@transgaming.com86bdb822012-01-20 18:24:39 +000067}