mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Fix CheckMultisampleQualityLevels behaviour
- Querying DXGI_FORMAT_UNKNOWN should not return an error, and should advertize support for a sample count of 1 - Querying non-power of two sample counts should not fail - Invalid arguments should be handled properly
This commit is contained in:
parent
6282280f8d
commit
2f1f8ba0a4
@ -1057,21 +1057,29 @@ namespace dxvk {
|
|||||||
// There are many error conditions, so we'll just assume
|
// There are many error conditions, so we'll just assume
|
||||||
// that we will fail and return a non-zero value in case
|
// that we will fail and return a non-zero value in case
|
||||||
// the device does actually support the format.
|
// the device does actually support the format.
|
||||||
|
if (!pNumQualityLevels)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
*pNumQualityLevels = 0;
|
*pNumQualityLevels = 0;
|
||||||
|
|
||||||
// We need to check whether the format is
|
// For some reason, we can query DXGI_FORMAT_UNKNOWN
|
||||||
VkFormat format = LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY).Format;
|
if (Format == DXGI_FORMAT_UNKNOWN) {
|
||||||
|
*pNumQualityLevels = SampleCount == 1 ? 1 : 0;
|
||||||
if (format == VK_FORMAT_UNDEFINED) {
|
return SampleCount ? S_OK : E_INVALIDARG;
|
||||||
Logger::err(str::format("D3D11: Unsupported format: ", Format));
|
|
||||||
return E_INVALIDARG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// D3D may legally query non-power-of-two sample counts as well
|
// All other unknown formats should result in an error return.
|
||||||
|
VkFormat format = LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY).Format;
|
||||||
|
|
||||||
|
if (format == VK_FORMAT_UNDEFINED)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
// 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;
|
VkSampleCountFlagBits sampleCountFlag = VK_SAMPLE_COUNT_1_BIT;
|
||||||
|
|
||||||
if (FAILED(DecodeSampleCount(SampleCount, &sampleCountFlag)))
|
if (FAILED(DecodeSampleCount(SampleCount, &sampleCountFlag)))
|
||||||
return E_INVALIDARG;
|
return SampleCount ? S_OK : E_INVALIDARG;
|
||||||
|
|
||||||
// Check if the device supports the given combination of format
|
// Check if the device supports the given combination of format
|
||||||
// and sample count. D3D exposes the opaque concept of quality
|
// and sample count. D3D exposes the opaque concept of quality
|
||||||
|
Loading…
x
Reference in New Issue
Block a user