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();
@ -273,6 +275,13 @@ namespace dxvk {
| VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT;
return device->createBuffer(info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
}
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) {

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,14 +128,15 @@ 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;
DxvkBufferSliceHandle m_mapped;
Rc<DxvkBuffer> m_buffer;
Rc<DxvkBuffer> m_soCounter;
DxvkBufferSliceHandle m_mapped;
D3D11DXGIResource m_resource;
D3D10Buffer m_d3d10;
D3D11DXGIResource m_resource;
D3D10Buffer m_d3d10;
BOOL CheckFormatFeatureSupport(
VkFormat Format,
@ -147,6 +146,8 @@ namespace dxvk {
Rc<DxvkBuffer> CreateSoCounterBuffer();
D3D11_COMMON_BUFFER_MAP_MODE DetermineMapMode();
};