1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 22:08:59 +01:00

[d3d11] Store buffer map mode in D3D11Buffer

Matches what we do for textures, and makes it so that we don't
have to dereference the resource pointer to figure this out.
This commit is contained in:
Philip Rebohle 2022-02-08 23:44:23 +01:00
parent 2db56fa160
commit 9c32beccdc
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 19 additions and 9 deletions

View File

@ -74,6 +74,8 @@ namespace dxvk {
m_buffer = m_parent->GetDXVKDevice()->createBuffer(info, GetMemoryFlags());
m_mapped = m_buffer->getSliceHandle();
m_mapMode = DetermineMapMode();
// For Stream Output buffers we need a counter
if (pDesc->BindFlags & D3D11_BIND_STREAM_OUTPUT)
m_soCounter = CreateSoCounterBuffer();
@ -275,6 +277,13 @@ namespace dxvk {
}
D3D11_COMMON_BUFFER_MAP_MODE D3D11Buffer::DetermineMapMode() {
return (m_buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
? D3D11_COMMON_BUFFER_MAP_MODE_DIRECT
: D3D11_COMMON_BUFFER_MAP_MODE_NONE;
}
D3D11Buffer* GetCommonBuffer(ID3D11Resource* pResource) {
D3D11_RESOURCE_DIMENSION dimension = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&dimension);

View File

@ -67,9 +67,7 @@ namespace dxvk {
}
D3D11_COMMON_BUFFER_MAP_MODE GetMapMode() const {
return (m_buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
? D3D11_COMMON_BUFFER_MAP_MODE_DIRECT
: D3D11_COMMON_BUFFER_MAP_MODE_NONE;
return m_mapMode;
}
Rc<DxvkBuffer> GetBuffer() const {
@ -130,7 +128,8 @@ namespace dxvk {
private:
const D3D11_BUFFER_DESC m_desc;
D3D11_BUFFER_DESC m_desc;
D3D11_COMMON_BUFFER_MAP_MODE m_mapMode;
Rc<DxvkBuffer> m_buffer;
Rc<DxvkBuffer> m_soCounter;
@ -147,6 +146,8 @@ namespace dxvk {
Rc<DxvkBuffer> CreateSoCounterBuffer();
D3D11_COMMON_BUFFER_MAP_MODE DetermineMapMode();
};