1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-18 13:54:16 +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(
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()) {
}

View File

@ -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<ID3D11Buffer> {
static constexpr VkDeviceSize BufferSliceAlignment = 64;
public:
@ -68,8 +57,12 @@ namespace dxvk {
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<DxvkBuffer> m_buffer;
D3D11BufferInfo m_bufferInfo;
DxvkPhysicalBufferSlice m_mappedSlice;
Rc<DxvkBuffer> CreateBuffer(
const D3D11_BUFFER_DESC* pDesc) const;

View File

@ -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();