From cf6142e78225373809286765d681d447e5f7bf68 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Fri, 14 Feb 2020 00:46:02 +0000 Subject: [PATCH] [d3d9] Don't expose formats with alpha as adapter formats Impacts #1440 --- src/d3d9/d3d9_adapter.cpp | 9 +++------ src/d3d9/d3d9_monitor.cpp | 16 +--------------- src/d3d9/d3d9_monitor.h | 3 --- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/d3d9/d3d9_adapter.cpp b/src/d3d9/d3d9_adapter.cpp index ae5b99fb..8e75febe 100644 --- a/src/d3d9/d3d9_adapter.cpp +++ b/src/d3d9/d3d9_adapter.cpp @@ -102,10 +102,7 @@ namespace dxvk { DWORD Usage, D3DRESOURCETYPE RType, D3D9Format CheckFormat) { - if (!IsSupportedAdapterFormat(AdapterFormat)) - return D3DERR_INVALIDCALL; - - if (!IsSupportedDisplayFormat(AdapterFormat, false)) + if (!IsSupportedAdapterFormat(AdapterFormat, false)) return D3DERR_NOTAVAILABLE; const bool dmap = Usage & D3DUSAGE_DMAP; @@ -213,7 +210,7 @@ namespace dxvk { D3D9Format AdapterFormat, D3D9Format RenderTargetFormat, D3D9Format DepthStencilFormat) { - if (!IsSupportedAdapterFormat(AdapterFormat)) + if (!IsSupportedAdapterFormat(AdapterFormat, false)) return D3DERR_NOTAVAILABLE; if (!IsDepthFormat(DepthStencilFormat)) @@ -771,7 +768,7 @@ namespace dxvk { m_modeCacheFormat = Format; // Skip unsupported formats - if (!IsSupportedAdapterFormat(Format) || !IsSupportedDisplayFormat(Format, false)) + if (!IsSupportedAdapterFormat(Format, false)) return; auto& options = m_parent->GetOptions(); diff --git a/src/d3d9/d3d9_monitor.cpp b/src/d3d9/d3d9_monitor.cpp index b6e0d6c5..e4af614a 100644 --- a/src/d3d9/d3d9_monitor.cpp +++ b/src/d3d9/d3d9_monitor.cpp @@ -26,17 +26,6 @@ namespace dxvk { bool IsSupportedAdapterFormat( - D3D9Format Format) { - return Format == D3D9Format::A2R10G10B10 - || Format == D3D9Format::X8R8G8B8 - || Format == D3D9Format::A8R8G8B8 - || Format == D3D9Format::X1R5G5B5 - || Format == D3D9Format::A1R5G5B5 - || Format == D3D9Format::R5G6B5; - } - - - bool IsSupportedDisplayFormat( D3D9Format Format, BOOL Windowed) { return (Format == D3D9Format::A2R10G10B10 && !Windowed) @@ -50,10 +39,7 @@ namespace dxvk { D3D9Format AdapterFormat, D3D9Format BackBufferFormat, BOOL Windowed) { - if (!IsSupportedAdapterFormat(AdapterFormat)) - return false; - - if (AdapterFormat == D3D9Format::A2R10G10B10 && Windowed) + if (!IsSupportedAdapterFormat(AdapterFormat, Windowed)) return false; return AdapterFormat == BackBufferFormat diff --git a/src/d3d9/d3d9_monitor.h b/src/d3d9/d3d9_monitor.h index 480f275d..996881dc 100644 --- a/src/d3d9/d3d9_monitor.h +++ b/src/d3d9/d3d9_monitor.h @@ -23,9 +23,6 @@ namespace dxvk { * \returns If it is supported as a swapchain/backbuffer format. */ bool IsSupportedAdapterFormat( - D3D9Format Format); - - bool IsSupportedDisplayFormat( D3D9Format Format, BOOL Windowed);