diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 4ae9c9ddb..f9eb1e264 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -9,10 +9,10 @@ namespace dxvk { D3D11Buffer::D3D11Buffer( D3D11Device* pDevice, const D3D11_BUFFER_DESC* pDesc) - : m_device (pDevice), - m_desc (*pDesc), - m_buffer (CreateBuffer(pDesc)), - m_bufferInfo{ m_buffer->slice() } { + : m_device (pDevice), + m_desc (*pDesc), + m_buffer (CreateBuffer(pDesc)), + m_mappedSlice (m_buffer->slice()) { } diff --git a/src/d3d11/d3d11_buffer.h b/src/d3d11/d3d11_buffer.h index 90bad1ca2..b39d21589 100644 --- a/src/d3d11/d3d11_buffer.h +++ b/src/d3d11/d3d11_buffer.h @@ -11,17 +11,6 @@ namespace dxvk { class D3D11DeviceContext; - /** - * \brief Common buffer info - * - * Stores where the buffer was last - * mapped on the immediate context. - */ - struct D3D11BufferInfo { - DxvkPhysicalBufferSlice mappedSlice; - }; - - class D3D11Buffer : public D3D11DeviceChild { static constexpr VkDeviceSize BufferSliceAlignment = 64; public: @@ -67,9 +56,13 @@ namespace dxvk { VkDeviceSize GetSize() const { return m_buffer->info().size; } - - D3D11BufferInfo* GetBufferInfo() { - return &m_bufferInfo; + + DxvkPhysicalBufferSlice GetMappedSlice() const { + return m_mappedSlice; + } + + void SetMappedSlice(const DxvkPhysicalBufferSlice& slice) { + m_mappedSlice = slice; } private: @@ -78,7 +71,7 @@ namespace dxvk { const D3D11_BUFFER_DESC m_desc; Rc m_buffer; - D3D11BufferInfo m_bufferInfo; + DxvkPhysicalBufferSlice m_mappedSlice; Rc CreateBuffer( const D3D11_BUFFER_DESC* pDesc) const; diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index b1499f475..d76548755 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -339,7 +339,7 @@ namespace dxvk { // it as the 'new' mapped slice. This assumes that the // only way to invalidate a buffer is by mapping it. auto physicalSlice = buffer->allocPhysicalSlice(); - pResource->GetBufferInfo()->mappedSlice = physicalSlice; + pResource->SetMappedSlice(physicalSlice); EmitCs([ cBuffer = buffer, @@ -355,8 +355,7 @@ namespace dxvk { // Use map pointer from previous map operation. This // way we don't have to synchronize with the CS thread // if the map mode is D3D11_MAP_WRITE_NO_OVERWRITE. - const DxvkPhysicalBufferSlice physicalSlice - = pResource->GetBufferInfo()->mappedSlice; + const DxvkPhysicalBufferSlice physicalSlice = pResource->GetMappedSlice(); pMappedResource->pData = physicalSlice.mapPtr(0); pMappedResource->RowPitch = physicalSlice.length();