1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-11 19:24:11 +01:00

[d3d11] Minor map optimization on deferred contexts

This commit is contained in:
Philip Rebohle 2019-02-04 10:25:49 +01:00
parent 8d493d9445
commit 6c17fa075b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 6 additions and 3 deletions

View File

@ -94,6 +94,10 @@ namespace dxvk {
return m_soCounter; return m_soCounter;
} }
DxvkBufferSliceHandle AllocSlice() {
return m_buffer->allocSlice();
}
DxvkBufferSliceHandle DiscardSlice() { DxvkBufferSliceHandle DiscardSlice() {
m_mapped = m_buffer->allocSlice(); m_mapped = m_buffer->allocSlice();
return m_mapped; return m_mapped;

View File

@ -165,9 +165,8 @@ namespace dxvk {
UINT MapFlags, UINT MapFlags,
D3D11DeferredContextMapEntry* pMapEntry) { D3D11DeferredContextMapEntry* pMapEntry) {
D3D11Buffer* pBuffer = static_cast<D3D11Buffer*>(pResource); D3D11Buffer* pBuffer = static_cast<D3D11Buffer*>(pResource);
const Rc<DxvkBuffer> buffer = pBuffer->GetBuffer();
if (!(buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) { if (unlikely(pBuffer->GetMapMode() == D3D11_COMMON_BUFFER_MAP_MODE_NONE)) {
Logger::err("D3D11: Cannot map a device-local buffer"); Logger::err("D3D11: Cannot map a device-local buffer");
return E_INVALIDARG; return E_INVALIDARG;
} }
@ -182,7 +181,7 @@ namespace dxvk {
// For resources that cannot be written by the GPU, // For resources that cannot be written by the GPU,
// we may write to the buffer resource directly and // we may write to the buffer resource directly and
// just swap in the buffer slice as needed. // just swap in the buffer slice as needed.
pMapEntry->BufferSlice = buffer->allocSlice(); pMapEntry->BufferSlice = pBuffer->AllocSlice();
pMapEntry->MapPointer = pMapEntry->BufferSlice.mapPtr; pMapEntry->MapPointer = pMapEntry->BufferSlice.mapPtr;
} else { } else {
// For GPU-writable resources, we need a data slice // For GPU-writable resources, we need a data slice