1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Move BufferInfo struct into D3D11Buffer

This commit is contained in:
Philip Rebohle 2018-08-05 18:24:01 +02:00
parent 31140373eb
commit ace8e42213
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 14 additions and 22 deletions

View File

@ -9,10 +9,10 @@ namespace dxvk {
D3D11Buffer::D3D11Buffer( D3D11Buffer::D3D11Buffer(
D3D11Device* pDevice, D3D11Device* pDevice,
const D3D11_BUFFER_DESC* pDesc) const D3D11_BUFFER_DESC* pDesc)
: m_device (pDevice), : m_device (pDevice),
m_desc (*pDesc), m_desc (*pDesc),
m_buffer (CreateBuffer(pDesc)), m_buffer (CreateBuffer(pDesc)),
m_bufferInfo{ m_buffer->slice() } { m_mappedSlice (m_buffer->slice()) {
} }

View File

@ -11,17 +11,6 @@ namespace dxvk {
class D3D11DeviceContext; 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<ID3D11Buffer> { class D3D11Buffer : public D3D11DeviceChild<ID3D11Buffer> {
static constexpr VkDeviceSize BufferSliceAlignment = 64; static constexpr VkDeviceSize BufferSliceAlignment = 64;
public: public:
@ -67,9 +56,13 @@ namespace dxvk {
VkDeviceSize GetSize() const { VkDeviceSize GetSize() const {
return m_buffer->info().size; return m_buffer->info().size;
} }
D3D11BufferInfo* GetBufferInfo() { DxvkPhysicalBufferSlice GetMappedSlice() const {
return &m_bufferInfo; return m_mappedSlice;
}
void SetMappedSlice(const DxvkPhysicalBufferSlice& slice) {
m_mappedSlice = slice;
} }
private: private:
@ -78,7 +71,7 @@ namespace dxvk {
const D3D11_BUFFER_DESC m_desc; const D3D11_BUFFER_DESC m_desc;
Rc<DxvkBuffer> m_buffer; Rc<DxvkBuffer> m_buffer;
D3D11BufferInfo m_bufferInfo; DxvkPhysicalBufferSlice m_mappedSlice;
Rc<DxvkBuffer> CreateBuffer( Rc<DxvkBuffer> CreateBuffer(
const D3D11_BUFFER_DESC* pDesc) const; const D3D11_BUFFER_DESC* pDesc) const;

View File

@ -339,7 +339,7 @@ namespace dxvk {
// it as the 'new' mapped slice. This assumes that the // it as the 'new' mapped slice. This assumes that the
// only way to invalidate a buffer is by mapping it. // only way to invalidate a buffer is by mapping it.
auto physicalSlice = buffer->allocPhysicalSlice(); auto physicalSlice = buffer->allocPhysicalSlice();
pResource->GetBufferInfo()->mappedSlice = physicalSlice; pResource->SetMappedSlice(physicalSlice);
EmitCs([ EmitCs([
cBuffer = buffer, cBuffer = buffer,
@ -355,8 +355,7 @@ namespace dxvk {
// Use map pointer from previous map operation. This // Use map pointer from previous map operation. This
// way we don't have to synchronize with the CS thread // way we don't have to synchronize with the CS thread
// if the map mode is D3D11_MAP_WRITE_NO_OVERWRITE. // if the map mode is D3D11_MAP_WRITE_NO_OVERWRITE.
const DxvkPhysicalBufferSlice physicalSlice const DxvkPhysicalBufferSlice physicalSlice = pResource->GetMappedSlice();
= pResource->GetBufferInfo()->mappedSlice;
pMappedResource->pData = physicalSlice.mapPtr(0); pMappedResource->pData = physicalSlice.mapPtr(0);
pMappedResource->RowPitch = physicalSlice.length(); pMappedResource->RowPitch = physicalSlice.length();