QueryPoolVk.h#
The PVRVk QueryPool, a pool that can create queries.
Includes#
PVRVk/DeviceVk.h
Included By#
Namespaces#
Classes#
Source Code#
#pragma once
#include "PVRVk/DeviceVk.h"
namespace pvrvk {
struct QueryPoolCreateInfo
{
public:
QueryPoolCreateInfo(QueryType queryType, uint32_t queryCount, QueryPipelineStatisticFlags pipelineStatistics = QueryPipelineStatisticFlags::e_NONE,
QueryPoolCreateFlags flags = QueryPoolCreateFlags::e_NONE)
: _flags(flags), _queryType(queryType), _queryCount(queryCount), _pipelineStatistics(pipelineStatistics)
{}
inline QueryPoolCreateFlags getFlags() const { return _flags; }
inline void setFlags(QueryPoolCreateFlags flags) { this->_flags = flags; }
inline QueryPipelineStatisticFlags getPipelineStatisticFlags() const { return _pipelineStatistics; }
inline void setPipelineStatisticFlags(QueryPipelineStatisticFlags pipelineStatistics) { this->_pipelineStatistics = pipelineStatistics; }
inline QueryType getQueryType() const { return _queryType; }
inline void setQueryType(QueryType queryType) { this->_queryType = queryType; }
inline uint32_t getNumQueries() const { return _queryCount; }
inline void setNumQueries(uint32_t queryCount) { this->_queryCount = queryCount; }
private:
QueryPoolCreateFlags _flags;
QueryType _queryType;
uint32_t _queryCount;
QueryPipelineStatisticFlags _pipelineStatistics;
};
namespace impl {
class QueryPool_ : public PVRVkDeviceObjectBase<VkQueryPool, ObjectType::e_QUERY_POOL>, public DeviceObjectDebugUtils<QueryPool_>
{
private:
friend class Device_;
class make_shared_enabler
{
protected:
make_shared_enabler() {}
friend class QueryPool_;
};
static QueryPool constructShared(const DeviceWeakPtr& device, const QueryPoolCreateInfo& createInfo)
{
return std::make_shared<QueryPool_>(make_shared_enabler{}, device, createInfo);
}
QueryPoolCreateInfo _createInfo;
public:
DECLARE_NO_COPY_SEMANTICS(QueryPool_)
QueryPool_(make_shared_enabler, const DeviceWeakPtr& device, const QueryPoolCreateInfo& createInfo);
~QueryPool_()
{
if (getVkHandle() != VK_NULL_HANDLE)
{
if (!_device.expired())
{
getDevice()->getVkBindings().vkDestroyQueryPool(getDevice()->getVkHandle(), getVkHandle(), nullptr);
_vkHandle = VK_NULL_HANDLE;
}
else
{
reportDestroyedAfterDevice();
}
}
}
bool getResults(uint32_t queryIndex, size_t dataSize, void* data, QueryResultFlags flags);
bool getResults(uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* data, VkDeviceSize stride, QueryResultFlags flags);
inline QueryPoolCreateFlags getFlags() const { return _createInfo.getFlags(); }
inline QueryPipelineStatisticFlags getQueryPipelineStatisticFlags() const { return _createInfo.getPipelineStatisticFlags(); }
inline QueryType getQueryType() const { return _createInfo.getQueryType(); }
inline uint32_t getNumQueries() const { return _createInfo.getNumQueries(); }
QueryPoolCreateInfo getCreateInfo() const { return _createInfo; }
};
} // namespace impl
} // namespace pvrvk