1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-14 04:29:15 +01:00

[d3d11] Adjust preferred mapping modes for default images

This commit is contained in:
Philip Rebohle 2022-09-05 04:44:25 +02:00
parent fdcbdeb28f
commit bd912212b5

View File

@ -599,10 +599,18 @@ namespace dxvk {
// If supported and requested, create a linear image. Default images
// can be used for resolves and other operations regardless of bind
// flags, so we need to use a proper image for those.
if (m_desc.TextureLayout == D3D11_TEXTURE_LAYOUT_ROW_MAJOR
|| m_desc.Usage == D3D11_USAGE_DEFAULT)
if (m_desc.TextureLayout == D3D11_TEXTURE_LAYOUT_ROW_MAJOR)
return D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT;
// For default images, prefer direct mapping if the image is CPU readable
// since mapping for reads would have to stall otherwise. If the image is
// only writable, prefer a write-through buffer.
if (m_desc.Usage == D3D11_USAGE_DEFAULT) {
return (m_desc.CPUAccessFlags & D3D11_CPU_ACCESS_READ)
? D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT
: D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER;
}
// The overhead of frequently uploading large dynamic images may outweigh
// the benefit of linear tiling, so use a linear image in those cases.
VkDeviceSize threshold = m_device->GetOptions()->maxDynamicImageBufferSize;