mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Fix query scopes
Occlusion queries must begin and end in the same render pass. Fixes a rendering issue in Shadow Warrior 2 on AMD drivers.
This commit is contained in:
parent
5f3b65014f
commit
3fc9466a07
@ -40,16 +40,11 @@ namespace dxvk {
|
|||||||
DxvkContextFlag::CpDirtyPipeline,
|
DxvkContextFlag::CpDirtyPipeline,
|
||||||
DxvkContextFlag::CpDirtyPipelineState,
|
DxvkContextFlag::CpDirtyPipelineState,
|
||||||
DxvkContextFlag::CpDirtyResources);
|
DxvkContextFlag::CpDirtyResources);
|
||||||
|
|
||||||
// Restart queries that were active during
|
|
||||||
// the last command buffer submission.
|
|
||||||
this->beginActiveQueries();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Rc<DxvkCommandList> DxvkContext::endRecording() {
|
Rc<DxvkCommandList> DxvkContext::endRecording() {
|
||||||
this->spillRenderPass();
|
this->spillRenderPass();
|
||||||
this->endActiveQueries();
|
|
||||||
|
|
||||||
this->trackQueryPool(m_queryPools[VK_QUERY_TYPE_OCCLUSION]);
|
this->trackQueryPool(m_queryPools[VK_QUERY_TYPE_OCCLUSION]);
|
||||||
this->trackQueryPool(m_queryPools[VK_QUERY_TYPE_PIPELINE_STATISTICS]);
|
this->trackQueryPool(m_queryPools[VK_QUERY_TYPE_PIPELINE_STATISTICS]);
|
||||||
@ -61,24 +56,29 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxvkContext::beginQuery(const DxvkQueryRevision& query) {
|
void DxvkContext::beginQuery(const DxvkQueryRevision& query) {
|
||||||
DxvkQueryHandle handle = this->allocQuery(query);
|
|
||||||
|
|
||||||
m_cmd->cmdBeginQuery(
|
|
||||||
handle.queryPool,
|
|
||||||
handle.queryId,
|
|
||||||
handle.flags);
|
|
||||||
|
|
||||||
query.query->beginRecording(query.revision);
|
query.query->beginRecording(query.revision);
|
||||||
|
|
||||||
|
if (m_flags.test(DxvkContextFlag::GpRenderPassBound)) {
|
||||||
|
DxvkQueryHandle handle = this->allocQuery(query);
|
||||||
|
|
||||||
|
m_cmd->cmdBeginQuery(
|
||||||
|
handle.queryPool,
|
||||||
|
handle.queryId,
|
||||||
|
handle.flags);
|
||||||
|
}
|
||||||
|
|
||||||
this->insertActiveQuery(query);
|
this->insertActiveQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::endQuery(const DxvkQueryRevision& query) {
|
void DxvkContext::endQuery(const DxvkQueryRevision& query) {
|
||||||
DxvkQueryHandle handle = query.query->getHandle();
|
if (m_flags.test(DxvkContextFlag::GpRenderPassBound)) {
|
||||||
|
DxvkQueryHandle handle = query.query->getHandle();
|
||||||
m_cmd->cmdEndQuery(
|
|
||||||
handle.queryPool,
|
m_cmd->cmdEndQuery(
|
||||||
handle.queryId);
|
handle.queryPool,
|
||||||
|
handle.queryId);
|
||||||
|
}
|
||||||
|
|
||||||
query.query->endRecording(query.revision);
|
query.query->endRecording(query.revision);
|
||||||
this->eraseActiveQuery(query);
|
this->eraseActiveQuery(query);
|
||||||
@ -1559,6 +1559,8 @@ namespace dxvk {
|
|||||||
this->resetRenderPassOps(
|
this->resetRenderPassOps(
|
||||||
m_state.om.renderTargets,
|
m_state.om.renderTargets,
|
||||||
m_state.om.renderPassOps);
|
m_state.om.renderPassOps);
|
||||||
|
|
||||||
|
this->beginActiveQueries();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1569,6 +1571,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
if (m_flags.test(DxvkContextFlag::GpRenderPassBound)) {
|
if (m_flags.test(DxvkContextFlag::GpRenderPassBound)) {
|
||||||
m_flags.clr(DxvkContextFlag::GpRenderPassBound);
|
m_flags.clr(DxvkContextFlag::GpRenderPassBound);
|
||||||
|
this->endActiveQueries();
|
||||||
this->renderPassUnbindFramebuffer();
|
this->renderPassUnbindFramebuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2096,7 +2099,7 @@ namespace dxvk {
|
|||||||
m_queryPools[queryType] = m_device->createQueryPool(queryType, MaxNumQueryCountPerPool);
|
m_queryPools[queryType] = m_device->createQueryPool(queryType, MaxNumQueryCountPerPool);
|
||||||
queryPool = m_queryPools[queryType];
|
queryPool = m_queryPools[queryType];
|
||||||
|
|
||||||
this->resetQueryPool(queryPool);
|
queryPool->reset(m_cmd);
|
||||||
queryHandle = queryPool->allocQuery(query);
|
queryHandle = queryPool->allocQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2104,13 +2107,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::resetQueryPool(const Rc<DxvkQueryPool>& pool) {
|
|
||||||
this->spillRenderPass();
|
|
||||||
|
|
||||||
pool->reset(m_cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::trackQueryPool(const Rc<DxvkQueryPool>& pool) {
|
void DxvkContext::trackQueryPool(const Rc<DxvkQueryPool>& pool) {
|
||||||
if (pool != nullptr) {
|
if (pool != nullptr) {
|
||||||
DxvkQueryRange range = pool->getActiveQueryRange();
|
DxvkQueryRange range = pool->getActiveQueryRange();
|
||||||
|
@ -692,9 +692,6 @@ namespace dxvk {
|
|||||||
DxvkQueryHandle allocQuery(
|
DxvkQueryHandle allocQuery(
|
||||||
const DxvkQueryRevision& query);
|
const DxvkQueryRevision& query);
|
||||||
|
|
||||||
void resetQueryPool(
|
|
||||||
const Rc<DxvkQueryPool>& pool);
|
|
||||||
|
|
||||||
void trackQueryPool(
|
void trackQueryPool(
|
||||||
const Rc<DxvkQueryPool>& pool);
|
const Rc<DxvkQueryPool>& pool);
|
||||||
|
|
||||||
|
@ -55,12 +55,9 @@ namespace dxvk {
|
|||||||
std::unique_lock<std::mutex> lock(m_mutex);
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
if (m_revision == revision) {
|
if (m_revision == revision) {
|
||||||
if (m_queryIndex < m_queryCount) {
|
m_status = m_queryIndex < m_queryCount
|
||||||
m_status = DxvkQueryStatus::Pending;
|
? DxvkQueryStatus::Pending
|
||||||
} else {
|
: DxvkQueryStatus::Available;
|
||||||
m_status = DxvkQueryStatus::Available;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_handle = DxvkQueryHandle();
|
m_handle = DxvkQueryHandle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user