From 9dbe352c514fd259590c84d162ded8c6165812b0 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 18 Jan 2019 21:26:48 +0100 Subject: [PATCH] [dxvk] Fix incorrect buffer view range for views with non-zero offset --- src/dxvk/dxvk_buffer.cpp | 11 ++++++----- src/dxvk/dxvk_buffer.h | 9 ++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/dxvk/dxvk_buffer.cpp b/src/dxvk/dxvk_buffer.cpp index 254dede1..547b44bd 100644 --- a/src/dxvk/dxvk_buffer.cpp +++ b/src/dxvk/dxvk_buffer.cpp @@ -143,7 +143,7 @@ namespace dxvk { const Rc& buffer, const DxvkBufferViewCreateInfo& info) : m_vkd(vkd), m_info(info), m_buffer(buffer), - m_bufferSlice (m_buffer->getSliceHandle()), + m_bufferSlice (getSliceHandle()), m_bufferView (createBufferView(m_bufferSlice)) { } @@ -188,13 +188,14 @@ namespace dxvk { } - void DxvkBufferView::updateBufferView() { + void DxvkBufferView::updateBufferView( + const DxvkBufferSliceHandle& slice) { if (m_views.empty()) m_views.insert({ m_bufferSlice, m_bufferView }); - m_bufferSlice = m_buffer->getSliceHandle(); - auto entry = m_views.find(m_bufferSlice); - + m_bufferSlice = slice; + + auto entry = m_views.find(slice); if (entry != m_views.end()) { m_bufferView = entry->second; } else { diff --git a/src/dxvk/dxvk_buffer.h b/src/dxvk/dxvk_buffer.h index 5957d9f9..3a641515 100644 --- a/src/dxvk/dxvk_buffer.h +++ b/src/dxvk/dxvk_buffer.h @@ -515,8 +515,10 @@ namespace dxvk { * prior to using the buffer view handle. */ void updateView() { - if (!m_bufferSlice.eq(m_buffer->getSliceHandle())) - this->updateBufferView(); + DxvkBufferSliceHandle slice = getSliceHandle(); + + if (!m_bufferSlice.eq(slice)) + this->updateBufferView(slice); } private: @@ -536,7 +538,8 @@ namespace dxvk { VkBufferView createBufferView( const DxvkBufferSliceHandle& slice); - void updateBufferView(); + void updateBufferView( + const DxvkBufferSliceHandle& slice); };