Commit d205ee3a by Jamie Madill Committed by Commit Bot

Pass GLImplFactory to Query constructor.

This makes the code more consistent and allows for the Query constructor to generate a Serial. Bug: angleproject:4223 Change-Id: I6cc683b11ed364f13d303f97aa0984e63260953e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1969061Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 545c6142
...@@ -1355,7 +1355,7 @@ Query *Context::getQuery(QueryID handle, bool create, QueryType type) ...@@ -1355,7 +1355,7 @@ Query *Context::getQuery(QueryID handle, bool create, QueryType type)
if (!query && create) if (!query && create)
{ {
ASSERT(type != QueryType::InvalidEnum); ASSERT(type != QueryType::InvalidEnum);
query = new Query(mImplementation->createQuery(type), handle); query = new Query(mImplementation.get(), type, handle);
query->addRef(); query->addRef();
mQueryMap.assign(handle, query); mQueryMap.assign(handle, query);
} }
......
...@@ -7,11 +7,15 @@ ...@@ -7,11 +7,15 @@
// Query.cpp: Implements the gl::Query class // Query.cpp: Implements the gl::Query class
#include "libANGLE/Query.h" #include "libANGLE/Query.h"
#include "libANGLE/renderer/GLImplFactory.h"
#include "libANGLE/renderer/QueryImpl.h" #include "libANGLE/renderer/QueryImpl.h"
namespace gl namespace gl
{ {
Query::Query(rx::QueryImpl *impl, QueryID id) : RefCountObject(id), mQuery(impl), mLabel() {} Query::Query(rx::GLImplFactory *factory, QueryType type, QueryID id)
: RefCountObject(id), mQuery(factory->createQuery(type)), mLabel()
{}
Query::~Query() Query::~Query()
{ {
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
namespace rx namespace rx
{ {
class GLImplFactory;
class QueryImpl; class QueryImpl;
} } // namespace rx
namespace gl namespace gl
{ {
...@@ -29,7 +30,7 @@ namespace gl ...@@ -29,7 +30,7 @@ namespace gl
class Query final : public RefCountObject<QueryID>, public LabeledObject class Query final : public RefCountObject<QueryID>, public LabeledObject
{ {
public: public:
Query(rx::QueryImpl *impl, QueryID id); Query(rx::GLImplFactory *factory, QueryType type, QueryID id);
~Query() override; ~Query() override;
void onDestroy(const Context *context) override; void onDestroy(const Context *context) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment