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:
parent
2db56fa160
commit
9c32beccdc
@ -74,6 +74,8 @@ namespace dxvk {
|
|||||||
m_buffer = m_parent->GetDXVKDevice()->createBuffer(info, GetMemoryFlags());
|
m_buffer = m_parent->GetDXVKDevice()->createBuffer(info, GetMemoryFlags());
|
||||||
m_mapped = m_buffer->getSliceHandle();
|
m_mapped = m_buffer->getSliceHandle();
|
||||||
|
|
||||||
|
m_mapMode = DetermineMapMode();
|
||||||
|
|
||||||
// For Stream Output buffers we need a counter
|
// For Stream Output buffers we need a counter
|
||||||
if (pDesc->BindFlags & D3D11_BIND_STREAM_OUTPUT)
|
if (pDesc->BindFlags & D3D11_BIND_STREAM_OUTPUT)
|
||||||
m_soCounter = CreateSoCounterBuffer();
|
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) {
|
D3D11Buffer* GetCommonBuffer(ID3D11Resource* pResource) {
|
||||||
D3D11_RESOURCE_DIMENSION dimension = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
D3D11_RESOURCE_DIMENSION dimension = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
||||||
pResource->GetType(&dimension);
|
pResource->GetType(&dimension);
|
||||||
|
@ -67,9 +67,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
D3D11_COMMON_BUFFER_MAP_MODE GetMapMode() const {
|
D3D11_COMMON_BUFFER_MAP_MODE GetMapMode() const {
|
||||||
return (m_buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
|
return m_mapMode;
|
||||||
? D3D11_COMMON_BUFFER_MAP_MODE_DIRECT
|
|
||||||
: D3D11_COMMON_BUFFER_MAP_MODE_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rc<DxvkBuffer> GetBuffer() const {
|
Rc<DxvkBuffer> GetBuffer() const {
|
||||||
@ -130,7 +128,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
private:
|
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_buffer;
|
||||||
Rc<DxvkBuffer> m_soCounter;
|
Rc<DxvkBuffer> m_soCounter;
|
||||||
@ -147,6 +146,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
Rc<DxvkBuffer> CreateSoCounterBuffer();
|
Rc<DxvkBuffer> CreateSoCounterBuffer();
|
||||||
|
|
||||||
|
D3D11_COMMON_BUFFER_MAP_MODE DetermineMapMode();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user