glDeleteQueries(queries.size(), queries.data());
}
-void OpenGLQueryPool::resize(unsigned s)
+void OpenGLQueryPool::resize()
{
- if(s<queries.size())
- glDeleteQueries(queries.size()-s, queries.data()+s);
+ unsigned size = static_cast<const QueryPool *>(this)->size;
+ if(size<queries.size())
+ glDeleteQueries(queries.size()-size, queries.data()+size);
unsigned old_size = queries.size();
- queries.resize(s);
- if(s>old_size)
- glGenQueries(s-old_size, queries.data()+old_size);
+ queries.resize(size);
+ if(size>old_size)
+ glGenQueries(size-old_size, queries.data()+old_size);
}
unsigned OpenGLQueryPool::get_result(unsigned i) const
QueryPool::QueryPool(QueryType t, unsigned s):
QueryPoolBackend(t),
- type(t)
+ type(t),
+ size(0)
{
resize(s);
}
+void QueryPool::resize(unsigned s)
+{
+ size = s;
+ QueryPoolBackend::resize();
+}
+
QueryPool::Activate::Activate(Renderer &r, const QueryPool &p, unsigned i):
renderer(r),
private:
QueryType type;
+ unsigned size;
public:
QueryPool(QueryType type, unsigned);
- using QueryPoolBackend::resize;
- using QueryPoolBackend::get_size;
+ void resize(unsigned);
+ unsigned get_size() const { return size; }
using QueryPoolBackend::get_result;
};