1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 11:52:12 +01:00

[dxvk] Implemented query allocation

This commit is contained in:
Philip Rebohle 2018-02-18 17:14:02 +01:00
parent 7ae4904ae9
commit 43200010c1
2 changed files with 24 additions and 10 deletions

View File

@ -64,7 +64,7 @@ namespace dxvk {
void DxvkContext::beginQuery(const DxvkQueryRevision& query) { void DxvkContext::beginQuery(const DxvkQueryRevision& query) {
DxvkQueryHandle handle = this->allocateQuery(query); DxvkQueryHandle handle = this->allocQuery(query);
m_cmd->cmdBeginQuery( m_cmd->cmdBeginQuery(
handle.queryPool, handle.queryPool,
@ -1198,7 +1198,7 @@ namespace dxvk {
void DxvkContext::writeTimestamp(const DxvkQueryRevision& query) { void DxvkContext::writeTimestamp(const DxvkQueryRevision& query) {
DxvkQueryHandle handle = this->allocateQuery(query); DxvkQueryHandle handle = this->allocQuery(query);
m_cmd->cmdWriteTimestamp( m_cmd->cmdWriteTimestamp(
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
@ -1624,9 +1624,24 @@ namespace dxvk {
DxvkQueryHandle DxvkContext::allocateQuery(const DxvkQueryRevision& query) { DxvkQueryHandle DxvkContext::allocQuery(const DxvkQueryRevision& query) {
// TODO implement const VkQueryType queryType = query.query->type();
return DxvkQueryHandle();
DxvkQueryHandle queryHandle = { VK_NULL_HANDLE, 0 };
Rc<DxvkQueryPool> queryPool = m_queryPools[queryType];
if (queryPool != nullptr)
queryHandle = queryPool->allocQuery(query);
if (queryHandle.queryPool == VK_NULL_HANDLE) {
m_queryPools[queryType] = m_device->createQueryPool(queryType, MaxNumQueryCountPerPool);
queryPool = m_queryPools[queryType];
this->resetQueryPool(queryPool);
queryHandle = queryPool->allocQuery(query);
}
return queryHandle;
} }
@ -1639,7 +1654,7 @@ namespace dxvk {
void DxvkContext::beginActiveQueries() { void DxvkContext::beginActiveQueries() {
for (const DxvkQueryRevision& query : m_activeQueries) { for (const DxvkQueryRevision& query : m_activeQueries) {
DxvkQueryHandle handle = this->allocateQuery(query); DxvkQueryHandle handle = this->allocQuery(query);
m_cmd->cmdBeginQuery( m_cmd->cmdBeginQuery(
handle.queryPool, handle.queryPool,

View File

@ -558,9 +558,8 @@ namespace dxvk {
DxvkContextState m_state; DxvkContextState m_state;
DxvkBarrierSet m_barriers; DxvkBarrierSet m_barriers;
Rc<DxvkQueryPool> m_occlusionQueries; // TODO implement this properly...
Rc<DxvkQueryPool> m_statisticQueries; Rc<DxvkQueryPool> m_queryPools[3] = { nullptr, nullptr, nullptr };
Rc<DxvkQueryPool> m_timestampQueries;
VkPipeline m_gpActivePipeline = VK_NULL_HANDLE; VkPipeline m_gpActivePipeline = VK_NULL_HANDLE;
VkPipeline m_cpActivePipeline = VK_NULL_HANDLE; VkPipeline m_cpActivePipeline = VK_NULL_HANDLE;
@ -607,7 +606,7 @@ namespace dxvk {
void commitComputeBarriers(); void commitComputeBarriers();
DxvkQueryHandle allocateQuery( DxvkQueryHandle allocQuery(
const DxvkQueryRevision& query); const DxvkQueryRevision& query);
void resetQueryPool( void resetQueryPool(