1 //
2 // Copyright 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
9 #include "libANGLE/Query.h"
10
11 #include "libANGLE/renderer/GLImplFactory.h"
12 #include "libANGLE/renderer/QueryImpl.h"
13
14 namespace gl
15 {
Query(rx::GLImplFactory * factory,QueryType type,QueryID id)16 Query::Query(rx::GLImplFactory *factory, QueryType type, QueryID id)
17 : RefCountObject(factory->generateSerial(), id), mQuery(factory->createQuery(type)), mLabel()
18 {}
19
~Query()20 Query::~Query()
21 {
22 SafeDelete(mQuery);
23 }
24
onDestroy(const Context * context)25 void Query::onDestroy(const Context *context)
26 {
27 ASSERT(mQuery);
28 mQuery->onDestroy(context);
29 }
30
setLabel(const Context * context,const std::string & label)31 angle::Result Query::setLabel(const Context *context, const std::string &label)
32 {
33 mLabel = label;
34
35 if (mQuery)
36 {
37 return mQuery->onLabelUpdate(context);
38 }
39 return angle::Result::Continue;
40 }
41
getLabel() const42 const std::string &Query::getLabel() const
43 {
44 return mLabel;
45 }
46
begin(const Context * context)47 angle::Result Query::begin(const Context *context)
48 {
49 return mQuery->begin(context);
50 }
51
end(const Context * context)52 angle::Result Query::end(const Context *context)
53 {
54 return mQuery->end(context);
55 }
56
queryCounter(const Context * context)57 angle::Result Query::queryCounter(const Context *context)
58 {
59 return mQuery->queryCounter(context);
60 }
61
getResult(const Context * context,GLint * params)62 angle::Result Query::getResult(const Context *context, GLint *params)
63 {
64 return mQuery->getResult(context, params);
65 }
66
getResult(const Context * context,GLuint * params)67 angle::Result Query::getResult(const Context *context, GLuint *params)
68 {
69 return mQuery->getResult(context, params);
70 }
71
getResult(const Context * context,GLint64 * params)72 angle::Result Query::getResult(const Context *context, GLint64 *params)
73 {
74 return mQuery->getResult(context, params);
75 }
76
getResult(const Context * context,GLuint64 * params)77 angle::Result Query::getResult(const Context *context, GLuint64 *params)
78 {
79 return mQuery->getResult(context, params);
80 }
81
isResultAvailable(const Context * context,bool * available)82 angle::Result Query::isResultAvailable(const Context *context, bool *available)
83 {
84 return mQuery->isResultAvailable(context, available);
85 }
86
getType() const87 QueryType Query::getType() const
88 {
89 return mQuery->getType();
90 }
91
getImplementation() const92 rx::QueryImpl *Query::getImplementation() const
93 {
94 return mQuery;
95 }
96 } // namespace gl
97