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

[d3d9] Enforce various CheckDeviceMultiSampleType validations

This commit is contained in:
WinterSnowfall 2024-10-04 18:42:08 +03:00 committed by Philip Rebohle
parent eae12e6f23
commit 912a530d1c
2 changed files with 21 additions and 1 deletions

View File

@ -186,6 +186,12 @@ namespace dxvk {
if (pQualityLevels != nullptr)
*pQualityLevels = 1;
if (unlikely(MultiSampleType > D3DMULTISAMPLE_16_SAMPLES))
return D3DERR_INVALIDCALL;
if (unlikely(SurfaceFormat == D3D9Format::Unknown))
return D3DERR_INVALIDCALL;
auto dst = ConvertFormatUnfixed(SurfaceFormat);
if (dst.FormatColor == VK_FORMAT_UNDEFINED)
return D3DERR_NOTAVAILABLE;
@ -194,7 +200,12 @@ namespace dxvk {
&& (SurfaceFormat == D3D9Format::D32_LOCKABLE
|| SurfaceFormat == D3D9Format::D32F_LOCKABLE
|| SurfaceFormat == D3D9Format::D16_LOCKABLE
|| SurfaceFormat == D3D9Format::INTZ))
|| SurfaceFormat == D3D9Format::INTZ
|| SurfaceFormat == D3D9Format::DXT1
|| SurfaceFormat == D3D9Format::DXT2
|| SurfaceFormat == D3D9Format::DXT3
|| SurfaceFormat == D3D9Format::DXT4
|| SurfaceFormat == D3D9Format::DXT5))
return D3DERR_NOTAVAILABLE;
uint32_t sampleCount = std::max<uint32_t>(MultiSampleType, 1u);

View File

@ -3948,6 +3948,15 @@ namespace dxvk {
if (unlikely(ppSurface == nullptr))
return D3DERR_INVALIDCALL;
if (unlikely(MultiSample > D3DMULTISAMPLE_16_SAMPLES))
return D3DERR_INVALIDCALL;
uint32_t sampleCount = std::max<uint32_t>(MultiSample, 1u);
// Check if this is a power of two...
if (sampleCount & (sampleCount - 1))
return D3DERR_NOTAVAILABLE;
D3D9_COMMON_TEXTURE_DESC desc;
desc.Width = Width;
desc.Height = Height;