[d3d11] Disable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT for typed formats

Yields over 10% performance improvement on RADV in GPU-bound scenarios.
This commit is contained in:
Philip Rebohle 2018-05-05 00:49:23 +02:00
parent fe24d76fd0
commit fb288d8713
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 11 additions and 2 deletions

View File

@ -8,12 +8,13 @@ namespace dxvk {
const D3D11_COMMON_TEXTURE_DESC* pDesc,
D3D11_RESOURCE_DIMENSION Dimension)
: m_device(pDevice), m_desc(*pDesc) {
DXGI_VK_FORMAT_INFO formatInfo = m_device->LookupFormat(m_desc.Format, GetFormatMode());
DXGI_VK_FORMAT_MODE formatMode = GetFormatMode();
DXGI_VK_FORMAT_INFO formatInfo = m_device->LookupFormat(m_desc.Format, formatMode);
DxvkImageCreateInfo imageInfo;
imageInfo.type = GetImageTypeFromResourceDim(Dimension);
imageInfo.format = formatInfo.Format;
imageInfo.flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
imageInfo.flags = 0;
imageInfo.sampleCount = VK_SAMPLE_COUNT_1_BIT;
imageInfo.extent.width = m_desc.Width;
imageInfo.extent.height = m_desc.Height;
@ -28,6 +29,14 @@ namespace dxvk {
imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
imageInfo.layout = VK_IMAGE_LAYOUT_GENERAL;
// Typeless formats require MUTABLE_FORMAT_BIT to be set, but we
// only need to do that for color images since depth-stencil formats
// are not compatible to any other depth-stencil formats
VkImageAspectFlags formatAspect = imageFormatInfo(formatInfo.Format)->aspectMask;
if (formatInfo.Aspect == 0 && formatAspect == VK_IMAGE_ASPECT_COLOR_BIT)
imageInfo.flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
DecodeSampleCount(m_desc.SampleDesc.Count, &imageInfo.sampleCount);
// Adjust image flags based on the corresponding D3D flags