diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 9c9ca14a..61ad7016 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -4832,13 +4832,14 @@ namespace dxvk { VkDeviceSize ctrOffsets[MaxNumXfbBuffers]; 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; ctrOffsets[i] = physSlice.offset; if (physSlice.handle != VK_NULL_HANDLE) - m_cmd->trackResource(m_state.xfb.counters[i].buffer()); + m_cmd->trackResource(m_state.xfb.activeCounters[i].buffer()); } m_cmd->cmdBeginTransformFeedback( @@ -4858,13 +4859,15 @@ namespace dxvk { VkDeviceSize ctrOffsets[MaxNumXfbBuffers]; 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; ctrOffsets[i] = physSlice.offset; if (physSlice.handle != VK_NULL_HANDLE) - m_cmd->trackResource(m_state.xfb.counters[i].buffer()); + m_cmd->trackResource(m_state.xfb.activeCounters[i].buffer()); + + m_state.xfb.activeCounters[i] = DxvkBufferSlice(); } m_queryManager.endQueries(m_cmd, @@ -6073,7 +6076,7 @@ namespace dxvk { && m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback)) { for (uint32_t i = 0; i < MaxNumXfbBuffers && !requiresBarrier; 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()) { requiresBarrier = this->checkBufferBarrier(xfbBufferSlice, diff --git a/src/dxvk/dxvk_context_state.h b/src/dxvk/dxvk_context_state.h index 34018f0e..23f2e248 100644 --- a/src/dxvk/dxvk_context_state.h +++ b/src/dxvk/dxvk_context_state.h @@ -123,6 +123,7 @@ namespace dxvk { struct DxvkXfbState { std::array buffers; std::array counters; + std::array activeCounters; };