From a760f4a8dc58f41839d06dedbe449112e50c6092 Mon Sep 17 00:00:00 2001
From: WinterSnowfall <WinterSnowfall@users.noreply.github.com>
Date: Mon, 14 Oct 2024 10:29:59 +0300
Subject: [PATCH] [d3d9] Fixed return code on CheckAdapterFormat with
 D3DFMT_UNKNOWN

---
 src/d3d9/d3d9_adapter.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/d3d9/d3d9_adapter.cpp b/src/d3d9/d3d9_adapter.cpp
index 5ae10210a..d166d7138 100644
--- a/src/d3d9/d3d9_adapter.cpp
+++ b/src/d3d9/d3d9_adapter.cpp
@@ -114,6 +114,9 @@ namespace dxvk {
           DWORD           Usage,
           D3DRESOURCETYPE RType,
           D3D9Format      CheckFormat) {
+    if(unlikely(AdapterFormat == D3D9Format::Unknown))
+      return D3DERR_INVALIDCALL;
+
     if (!IsSupportedAdapterFormat(AdapterFormat))
       return D3DERR_NOTAVAILABLE;