From 6a8933cf310852490fb4cdd4b1566edc9844be27 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 18 Mar 2020 06:00:28 +0000 Subject: [PATCH] [d3d9] Allow arbitrary backbuffer/adapter formats It seems these aren't linked in the way the docs made out, this fixes a crash when starting some titles. Closes #1508 --- src/d3d9/d3d9_adapter.cpp | 6 ++++-- src/d3d9/d3d9_monitor.cpp | 13 ------------- src/d3d9/d3d9_monitor.h | 5 ----- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/d3d9/d3d9_adapter.cpp b/src/d3d9/d3d9_adapter.cpp index 2cab599c..80941fe4 100644 --- a/src/d3d9/d3d9_adapter.cpp +++ b/src/d3d9/d3d9_adapter.cpp @@ -90,8 +90,10 @@ namespace dxvk { D3D9Format AdapterFormat, D3D9Format BackBufferFormat, BOOL bWindowed) { - if (!IsSupportedBackBufferFormat( - AdapterFormat, BackBufferFormat, bWindowed)) + if (!IsSupportedAdapterFormat(AdapterFormat, bWindowed)) + return D3DERR_NOTAVAILABLE; + + if (!IsSupportedBackBufferFormat(BackBufferFormat, bWindowed)) return D3DERR_NOTAVAILABLE; return D3D_OK; diff --git a/src/d3d9/d3d9_monitor.cpp b/src/d3d9/d3d9_monitor.cpp index 9d9812ab..559dea26 100644 --- a/src/d3d9/d3d9_monitor.cpp +++ b/src/d3d9/d3d9_monitor.cpp @@ -35,19 +35,6 @@ namespace dxvk { } - bool IsSupportedBackBufferFormat( - D3D9Format AdapterFormat, - D3D9Format BackBufferFormat, - BOOL Windowed) { - if (!IsSupportedAdapterFormat(AdapterFormat, Windowed)) - return false; - - return AdapterFormat == BackBufferFormat - || (AdapterFormat == D3D9Format::X8R8G8B8 && BackBufferFormat == D3D9Format::A8R8G8B8) - || (AdapterFormat == D3D9Format::X1R5G5B5 && BackBufferFormat == D3D9Format::A1R5G5B5); - } - - bool IsSupportedBackBufferFormat( D3D9Format BackBufferFormat, BOOL Windowed) { diff --git a/src/d3d9/d3d9_monitor.h b/src/d3d9/d3d9_monitor.h index 3f4f450c..8c187513 100644 --- a/src/d3d9/d3d9_monitor.h +++ b/src/d3d9/d3d9_monitor.h @@ -26,11 +26,6 @@ namespace dxvk { D3D9Format Format, BOOL Windowed); - bool IsSupportedBackBufferFormat( - D3D9Format AdapterFormat, - D3D9Format BackBufferFormat, - BOOL Windowed); - bool IsSupportedBackBufferFormat( D3D9Format BackBufferFormat, BOOL Windowed);