From c8a429b9e13b78c5e31a577b6357b92a765a2d56 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 14 Jun 2019 13:37:01 +0200 Subject: [PATCH] [d3d11] Fix CheckMultisampleQualityLevels return code We're supposed to return E_FAIL for unsupported sample counts, and not zero-initialize the returned quality level count if the format is invalid. Fixes wine test failures. --- src/d3d11/d3d11_device.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index f35bedf6..8df643ea 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -1131,12 +1131,10 @@ namespace dxvk { if (!pNumQualityLevels) return E_INVALIDARG; - *pNumQualityLevels = 0; - // For some reason, we can query DXGI_FORMAT_UNKNOWN if (Format == DXGI_FORMAT_UNKNOWN) { *pNumQualityLevels = SampleCount == 1 ? 1 : 0; - return SampleCount ? S_OK : E_INVALIDARG; + return SampleCount ? S_OK : E_FAIL; } // All other unknown formats should result in an error return. @@ -1145,12 +1143,16 @@ namespace dxvk { if (format == VK_FORMAT_UNDEFINED) return E_INVALIDARG; + // Zero-init now, leave value undefined otherwise. + // This does actually match native D3D11 behaviour. + *pNumQualityLevels = 0; + // Non-power of two sample counts are not supported, but querying // support for them is legal, so we return zero quality levels. VkSampleCountFlagBits sampleCountFlag = VK_SAMPLE_COUNT_1_BIT; if (FAILED(DecodeSampleCount(SampleCount, &sampleCountFlag))) - return SampleCount ? S_OK : E_INVALIDARG; + return SampleCount && SampleCount <= 32 ? S_OK : E_FAIL; // Check if the device supports the given combination of format // and sample count. D3D exposes the opaque concept of quality