mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-18 22:54:15 +01:00
[d3d11] Move BufferInfo struct into D3D11Buffer
This commit is contained in:
parent
31140373eb
commit
ace8e42213
@ -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()) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
@ -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<DxvkBuffer> m_buffer;
|
||||
D3D11BufferInfo m_bufferInfo;
|
||||
DxvkPhysicalBufferSlice m_mappedSlice;
|
||||
|
||||
Rc<DxvkBuffer> CreateBuffer(
|
||||
const D3D11_BUFFER_DESC* pDesc) const;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user