16 gl46core::glGenQueries(1, &
_queryID);
23 gl46core::glDeleteQueries(1, &
_queryID);
30 gl46core::GLint available = 0;
31 gl46core::glGetQueryObjectiv(
getID(), gl46core::GL_QUERY_RESULT_AVAILABLE, &available);
32 return available != 0;
37 gl46core::GLint64 res = 0;
38 gl46core::glGetQueryObjecti64v(
getID(), gl46core::GL_QUERY_RESULT, &res);
44 gl46core::GLint64 res = 0;
45 gl46core::glGetQueryObjecti64v(
getID(), gl46core::GL_QUERY_RESULT_NO_WAIT, &res);
81 const size_t crtCount =
_queries.size();
94 for (
size_t i = 0; i < countToAdd; ++i)
129 for (
auto [type, size] : sizes)
131 const U32 j = std::max(size, 1u);
134 for (
U32 i = 0; i < j; ++i)
136 pool.emplace_back(std::make_unique<glHardwareQueryRing>(
_context, type, 1, i));
153 const gl46core::GLenum type = query.
type();
156 for (
U32 i = 0; i < index; ++i)
158 if (pool[i]->
id() == query.
id())
160 std::swap(pool[i], pool[index - 1]);
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
I32 queueReadIndex() const noexcept
virtual void resize(U16 queueLength)
U16 queueLength() const noexcept
I32 queueWriteIndex() const noexcept
bool isResultAvailable() const
I64 getResultNoWait() const
U32 getID() const noexcept
void create(gl46core::GLenum queryType)
glHardwareQuery() noexcept
hashMap< gl46core::GLenum, vector< std::unique_ptr< glHardwareQueryRing > > > _queryPool
glHardwareQueryPool(GFXDevice &context)
void init(const hashMap< gl46core::GLenum, U32 > &sizes)
glHardwareQueryRing & allocate(gl46core::GLenum queryType)
void deallocate(const glHardwareQueryRing &query)
hashMap< gl46core::GLenum, U32 > _index
vector< glHardwareQuery > _queries
glHardwareQueryRing(GFXDevice &context, gl46core::GLenum queryType, U16 queueLength, U32 id=0)
~glHardwareQueryRing() override
const glHardwareQuery & readQuery() const
gl46core::GLenum _queryType
void resize(U16 queueLength) override
gl46core::GLenum type() const noexcept
const glHardwareQuery & writeQuery() const
Handle console commands that start with a forward slash.
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap