mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-07 16:54:14 +01:00
[d3d11] Avoid unnecessary buffer slice copy when mapping buffer
This commit is contained in:
parent
820904f22d
commit
72106a02cb
@ -334,11 +334,13 @@ namespace dxvk {
|
|||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DxvkPhysicalBufferSlice physicalSlice;
|
||||||
|
|
||||||
if (MapType == D3D11_MAP_WRITE_DISCARD) {
|
if (MapType == D3D11_MAP_WRITE_DISCARD) {
|
||||||
// Allocate a new backing slice for the buffer and set
|
// Allocate a new backing slice for the buffer and set
|
||||||
// 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();
|
physicalSlice = buffer->allocPhysicalSlice();
|
||||||
pResource->SetMappedSlice(physicalSlice);
|
pResource->SetMappedSlice(physicalSlice);
|
||||||
|
|
||||||
EmitCs([
|
EmitCs([
|
||||||
@ -350,13 +352,13 @@ namespace dxvk {
|
|||||||
} else if (MapType != D3D11_MAP_WRITE_NO_OVERWRITE) {
|
} else if (MapType != D3D11_MAP_WRITE_NO_OVERWRITE) {
|
||||||
if (!WaitForResource(buffer->resource(), MapFlags))
|
if (!WaitForResource(buffer->resource(), MapFlags))
|
||||||
return DXGI_ERROR_WAS_STILL_DRAWING;
|
return DXGI_ERROR_WAS_STILL_DRAWING;
|
||||||
|
|
||||||
|
physicalSlice = pResource->GetMappedSlice();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
DxvkPhysicalBufferSlice physicalSlice = pResource->GetMappedSlice();
|
|
||||||
|
|
||||||
pMappedResource->pData = physicalSlice.mapPtr(0);
|
pMappedResource->pData = physicalSlice.mapPtr(0);
|
||||||
pMappedResource->RowPitch = pResource->GetSize();
|
pMappedResource->RowPitch = pResource->GetSize();
|
||||||
pMappedResource->DepthPitch = pResource->GetSize();
|
pMappedResource->DepthPitch = pResource->GetSize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user