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 void Query::setLabel(const Context *context, const std::string &label)
32 {
33     mLabel = label;
34 }
35 
getLabel() const36 const std::string &Query::getLabel() const
37 {
38     return mLabel;
39 }
40 
begin(const Context * context)41 angle::Result Query::begin(const Context *context)
42 {
43     return mQuery->begin(context);
44 }
45 
end(const Context * context)46 angle::Result Query::end(const Context *context)
47 {
48     return mQuery->end(context);
49 }
50 
queryCounter(const Context * context)51 angle::Result Query::queryCounter(const Context *context)
52 {
53     return mQuery->queryCounter(context);
54 }
55 
getResult(const Context * context,GLint * params)56 angle::Result Query::getResult(const Context *context, GLint *params)
57 {
58     return mQuery->getResult(context, params);
59 }
60 
getResult(const Context * context,GLuint * params)61 angle::Result Query::getResult(const Context *context, GLuint *params)
62 {
63     return mQuery->getResult(context, params);
64 }
65 
getResult(const Context * context,GLint64 * params)66 angle::Result Query::getResult(const Context *context, GLint64 *params)
67 {
68     return mQuery->getResult(context, params);
69 }
70 
getResult(const Context * context,GLuint64 * params)71 angle::Result Query::getResult(const Context *context, GLuint64 *params)
72 {
73     return mQuery->getResult(context, params);
74 }
75 
isResultAvailable(const Context * context,bool * available)76 angle::Result Query::isResultAvailable(const Context *context, bool *available)
77 {
78     return mQuery->isResultAvailable(context, available);
79 }
80 
getType() const81 QueryType Query::getType() const
82 {
83     return mQuery->getType();
84 }
85 
getImplementation() const86 rx::QueryImpl *Query::getImplementation() const
87 {
88     return mQuery;
89 }
90 }  // namespace gl
91