mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Fix query type enablement in query manager
We cannot use query types as flag indices, since query types added in the future may have gretaer enum values than 32.
This commit is contained in:
parent
f9add97a07
commit
1127a344dc
@ -1797,9 +1797,8 @@ namespace dxvk {
|
|||||||
m_state.om.renderPassOps);
|
m_state.om.renderPassOps);
|
||||||
|
|
||||||
// Begin occlusion queries
|
// Begin occlusion queries
|
||||||
m_queries.beginQueries(m_cmd, {
|
m_queries.beginQueries(m_cmd, VK_QUERY_TYPE_OCCLUSION);
|
||||||
VK_QUERY_TYPE_OCCLUSION,
|
m_queries.beginQueries(m_cmd, VK_QUERY_TYPE_PIPELINE_STATISTICS);
|
||||||
VK_QUERY_TYPE_PIPELINE_STATISTICS });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1811,9 +1810,8 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::GpRenderPassBound)) {
|
if (m_flags.test(DxvkContextFlag::GpRenderPassBound)) {
|
||||||
m_flags.clr(DxvkContextFlag::GpRenderPassBound);
|
m_flags.clr(DxvkContextFlag::GpRenderPassBound);
|
||||||
|
|
||||||
m_queries.endQueries(m_cmd, {
|
m_queries.endQueries(m_cmd, VK_QUERY_TYPE_OCCLUSION);
|
||||||
VK_QUERY_TYPE_OCCLUSION,
|
m_queries.endQueries(m_cmd, VK_QUERY_TYPE_PIPELINE_STATISTICS);
|
||||||
VK_QUERY_TYPE_PIPELINE_STATISTICS });
|
|
||||||
|
|
||||||
this->renderPassUnbindFramebuffer();
|
this->renderPassUnbindFramebuffer();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace dxvk {
|
|||||||
const DxvkQueryRevision& query) {
|
const DxvkQueryRevision& query) {
|
||||||
m_activeQueries.push_back(query);
|
m_activeQueries.push_back(query);
|
||||||
|
|
||||||
if (m_activeTypes.test(query.query->type())) {
|
if (m_activeTypes & getDxvkQueryTypeBit(query.query->type())) {
|
||||||
DxvkQueryHandle handle = this->allocQuery(cmd, query);
|
DxvkQueryHandle handle = this->allocQuery(cmd, query);
|
||||||
|
|
||||||
cmd->cmdBeginQuery(
|
cmd->cmdBeginQuery(
|
||||||
@ -69,7 +69,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (iter != m_activeQueries.end()) {
|
if (iter != m_activeQueries.end()) {
|
||||||
if (m_activeTypes.test(iter->query->type())) {
|
if (m_activeTypes & getDxvkQueryTypeBit(iter->query->type())) {
|
||||||
DxvkQueryHandle handle = iter->query->getHandle();
|
DxvkQueryHandle handle = iter->query->getHandle();
|
||||||
|
|
||||||
cmd->cmdEndQuery(
|
cmd->cmdEndQuery(
|
||||||
@ -84,11 +84,11 @@ namespace dxvk {
|
|||||||
|
|
||||||
void DxvkQueryManager::beginQueries(
|
void DxvkQueryManager::beginQueries(
|
||||||
const Rc<DxvkCommandList>& cmd,
|
const Rc<DxvkCommandList>& cmd,
|
||||||
DxvkQueryTypeFlags types) {
|
VkQueryType type) {
|
||||||
m_activeTypes.set(types);
|
m_activeTypes |= getDxvkQueryTypeBit(type);
|
||||||
|
|
||||||
for (const DxvkQueryRevision& query : m_activeQueries) {
|
for (const DxvkQueryRevision& query : m_activeQueries) {
|
||||||
if (types.test(query.query->type())) {
|
if (type == query.query->type()) {
|
||||||
DxvkQueryHandle handle = this->allocQuery(cmd, query);
|
DxvkQueryHandle handle = this->allocQuery(cmd, query);
|
||||||
|
|
||||||
cmd->cmdBeginQuery(
|
cmd->cmdBeginQuery(
|
||||||
@ -102,11 +102,11 @@ namespace dxvk {
|
|||||||
|
|
||||||
void DxvkQueryManager::endQueries(
|
void DxvkQueryManager::endQueries(
|
||||||
const Rc<DxvkCommandList>& cmd,
|
const Rc<DxvkCommandList>& cmd,
|
||||||
DxvkQueryTypeFlags types) {
|
VkQueryType type) {
|
||||||
m_activeTypes.clr(types);
|
m_activeTypes &= ~getDxvkQueryTypeBit(type);
|
||||||
|
|
||||||
for (const DxvkQueryRevision& query : m_activeQueries) {
|
for (const DxvkQueryRevision& query : m_activeQueries) {
|
||||||
if (types.test(query.query->type())) {
|
if (type == query.query->type()) {
|
||||||
DxvkQueryHandle handle = query.query->getHandle();
|
DxvkQueryHandle handle = query.query->getHandle();
|
||||||
|
|
||||||
cmd->cmdEndQuery(
|
cmd->cmdEndQuery(
|
||||||
@ -152,4 +152,14 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t DxvkQueryManager::getDxvkQueryTypeBit(VkQueryType type) {
|
||||||
|
switch (type) {
|
||||||
|
case VK_QUERY_TYPE_OCCLUSION: return 0x01;
|
||||||
|
case VK_QUERY_TYPE_PIPELINE_STATISTICS: return 0x02;
|
||||||
|
case VK_QUERY_TYPE_TIMESTAMP: return 0x04;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
using DxvkQueryTypeFlags = Flags<VkQueryType>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Query manager
|
* \brief Query manager
|
||||||
*
|
*
|
||||||
@ -71,7 +69,7 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
void beginQueries(
|
void beginQueries(
|
||||||
const Rc<DxvkCommandList>& cmd,
|
const Rc<DxvkCommandList>& cmd,
|
||||||
DxvkQueryTypeFlags types);
|
VkQueryType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Ends active queries
|
* \brief Ends active queries
|
||||||
@ -82,7 +80,7 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
void endQueries(
|
void endQueries(
|
||||||
const Rc<DxvkCommandList>& cmd,
|
const Rc<DxvkCommandList>& cmd,
|
||||||
DxvkQueryTypeFlags types);
|
VkQueryType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Tracks query pools
|
* \brief Tracks query pools
|
||||||
@ -98,7 +96,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
const Rc<vk::DeviceFn> m_vkd;
|
const Rc<vk::DeviceFn> m_vkd;
|
||||||
|
|
||||||
DxvkQueryTypeFlags m_activeTypes;
|
uint32_t m_activeTypes = 0;
|
||||||
|
|
||||||
Rc<DxvkQueryPool> m_occlusion;
|
Rc<DxvkQueryPool> m_occlusion;
|
||||||
Rc<DxvkQueryPool> m_pipeStats;
|
Rc<DxvkQueryPool> m_pipeStats;
|
||||||
@ -113,6 +111,9 @@ namespace dxvk {
|
|||||||
Rc<DxvkQueryPool>& getQueryPool(
|
Rc<DxvkQueryPool>& getQueryPool(
|
||||||
VkQueryType type);
|
VkQueryType type);
|
||||||
|
|
||||||
|
static uint32_t getDxvkQueryTypeBit(
|
||||||
|
VkQueryType type);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user