mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Use appropriate memory types for directly mapped images
This commit is contained in:
parent
177e70949c
commit
33cf522647
@ -203,11 +203,8 @@ namespace dxvk {
|
|||||||
// in case it is going to be mapped directly.
|
// in case it is going to be mapped directly.
|
||||||
VkMemoryPropertyFlags memoryProperties = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
VkMemoryPropertyFlags memoryProperties = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
||||||
|
|
||||||
if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
|
if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT)
|
||||||
memoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
|
memoryProperties = GetMemoryFlags();
|
||||||
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
|
|
||||||
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vkImage == VK_NULL_HANDLE)
|
if (vkImage == VK_NULL_HANDLE)
|
||||||
m_image = m_device->GetDXVKDevice()->createImage(imageInfo, memoryProperties);
|
m_image = m_device->GetDXVKDevice()->createImage(imageInfo, memoryProperties);
|
||||||
@ -531,6 +528,19 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VkMemoryPropertyFlags D3D11CommonTexture::GetMemoryFlags() const {
|
||||||
|
VkMemoryPropertyFlags memoryFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
|
||||||
|
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
||||||
|
|
||||||
|
if ((m_desc.CPUAccessFlags & D3D11_CPU_ACCESS_READ) || m_device->GetOptions()->apitraceMode)
|
||||||
|
memoryFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
|
||||||
|
else if (m_desc.Usage == D3D11_USAGE_DEFAULT || m_desc.BindFlags)
|
||||||
|
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
||||||
|
|
||||||
|
return memoryFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
D3D11_COMMON_TEXTURE_MAP_MODE D3D11CommonTexture::DetermineMapMode(
|
D3D11_COMMON_TEXTURE_MAP_MODE D3D11CommonTexture::DetermineMapMode(
|
||||||
const DxvkImageCreateInfo* pImageInfo) const {
|
const DxvkImageCreateInfo* pImageInfo) const {
|
||||||
// Don't map an image unless the application requests it
|
// Don't map an image unless the application requests it
|
||||||
|
@ -414,6 +414,8 @@ namespace dxvk {
|
|||||||
VkFormat Format,
|
VkFormat Format,
|
||||||
UINT CpuAccess) const;
|
UINT CpuAccess) const;
|
||||||
|
|
||||||
|
VkMemoryPropertyFlags GetMemoryFlags() const;
|
||||||
|
|
||||||
D3D11_COMMON_TEXTURE_MAP_MODE DetermineMapMode(
|
D3D11_COMMON_TEXTURE_MAP_MODE DetermineMapMode(
|
||||||
const DxvkImageCreateInfo* pImageInfo) const;
|
const DxvkImageCreateInfo* pImageInfo) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user