1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxvk] Fix xfb counter buffer draw tracking

This commit is contained in:
Philip Rebohle 2023-08-23 13:44:35 +02:00
parent 915244c00c
commit c2cd129b89
2 changed files with 9 additions and 5 deletions

View File

@ -4832,13 +4832,14 @@ namespace dxvk {
VkDeviceSize ctrOffsets[MaxNumXfbBuffers]; VkDeviceSize ctrOffsets[MaxNumXfbBuffers];
for (uint32_t i = 0; i < MaxNumXfbBuffers; i++) { for (uint32_t i = 0; i < MaxNumXfbBuffers; i++) {
auto physSlice = m_state.xfb.counters[i].getSliceHandle(); m_state.xfb.activeCounters[i] = m_state.xfb.counters[i];
auto physSlice = m_state.xfb.activeCounters[i].getSliceHandle();
ctrBuffers[i] = physSlice.handle; ctrBuffers[i] = physSlice.handle;
ctrOffsets[i] = physSlice.offset; ctrOffsets[i] = physSlice.offset;
if (physSlice.handle != VK_NULL_HANDLE) if (physSlice.handle != VK_NULL_HANDLE)
m_cmd->trackResource<DxvkAccess::Read>(m_state.xfb.counters[i].buffer()); m_cmd->trackResource<DxvkAccess::Read>(m_state.xfb.activeCounters[i].buffer());
} }
m_cmd->cmdBeginTransformFeedback( m_cmd->cmdBeginTransformFeedback(
@ -4858,13 +4859,15 @@ namespace dxvk {
VkDeviceSize ctrOffsets[MaxNumXfbBuffers]; VkDeviceSize ctrOffsets[MaxNumXfbBuffers];
for (uint32_t i = 0; i < MaxNumXfbBuffers; i++) { for (uint32_t i = 0; i < MaxNumXfbBuffers; i++) {
auto physSlice = m_state.xfb.counters[i].getSliceHandle(); auto physSlice = m_state.xfb.activeCounters[i].getSliceHandle();
ctrBuffers[i] = physSlice.handle; ctrBuffers[i] = physSlice.handle;
ctrOffsets[i] = physSlice.offset; ctrOffsets[i] = physSlice.offset;
if (physSlice.handle != VK_NULL_HANDLE) if (physSlice.handle != VK_NULL_HANDLE)
m_cmd->trackResource<DxvkAccess::Write>(m_state.xfb.counters[i].buffer()); m_cmd->trackResource<DxvkAccess::Write>(m_state.xfb.activeCounters[i].buffer());
m_state.xfb.activeCounters[i] = DxvkBufferSlice();
} }
m_queryManager.endQueries(m_cmd, m_queryManager.endQueries(m_cmd,
@ -6073,7 +6076,7 @@ namespace dxvk {
&& m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback)) { && m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback)) {
for (uint32_t i = 0; i < MaxNumXfbBuffers && !requiresBarrier; i++) { for (uint32_t i = 0; i < MaxNumXfbBuffers && !requiresBarrier; i++) {
const auto& xfbBufferSlice = m_state.xfb.buffers[i]; const auto& xfbBufferSlice = m_state.xfb.buffers[i];
const auto& xfbCounterSlice = m_state.xfb.counters[i]; const auto& xfbCounterSlice = m_state.xfb.activeCounters[i];
if (xfbBufferSlice.length()) { if (xfbBufferSlice.length()) {
requiresBarrier = this->checkBufferBarrier<DoEmit>(xfbBufferSlice, requiresBarrier = this->checkBufferBarrier<DoEmit>(xfbBufferSlice,

View File

@ -123,6 +123,7 @@ namespace dxvk {
struct DxvkXfbState { struct DxvkXfbState {
std::array<DxvkBufferSlice, MaxNumXfbBuffers> buffers; std::array<DxvkBufferSlice, MaxNumXfbBuffers> buffers;
std::array<DxvkBufferSlice, MaxNumXfbBuffers> counters; std::array<DxvkBufferSlice, MaxNumXfbBuffers> counters;
std::array<DxvkBufferSlice, MaxNumXfbBuffers> activeCounters;
}; };