Rebase against 4e55dfb7c5e26d45794406a4ce8e50a6bc725b74.

This commit is contained in:
Alistair Leslie-Hughes
2022-08-25 15:32:33 +10:00
parent fa8d0abc9d
commit b31a964e1e
4 changed files with 4 additions and 146 deletions

View File

@@ -1,116 +0,0 @@
From 861cd6c6409efce4eb03aad3bc01f5df772e77fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 6 Feb 2016 01:15:07 +0100
Subject: [PATCH] ddraw: Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB device.
---
dlls/ddraw/ddraw.c | 9 +++++++++
dlls/ddraw/tests/ddraw7.c | 18 ++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 705d0335d95..1d916f93c4f 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -49,6 +49,7 @@ static struct enum_device_entry
char interface_name[100];
char device_name[100];
const GUID *device_guid;
+ DWORD remove_caps;
} device_list7[] =
{
/* T&L HAL device */
@@ -56,6 +57,7 @@ static struct enum_device_entry
"WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D",
"Wine D3D7 T&L HAL",
&IID_IDirect3DTnLHalDevice,
+ 0,
},
/* HAL device */
@@ -63,6 +65,7 @@ static struct enum_device_entry
"WINE Direct3D7 Hardware acceleration using WineD3D",
"Direct3D HAL",
&IID_IDirect3DHALDevice,
+ 0,
},
/* RGB device */
@@ -70,6 +73,7 @@ static struct enum_device_entry
"WINE Direct3D7 RGB Software Emulation using WineD3D",
"Wine D3D7 RGB",
&IID_IDirect3DRGBDevice,
+ D3DDEVCAPS_HWTRANSFORMANDLIGHT,
},
};
@@ -3749,6 +3753,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
{
struct ddraw *ddraw = impl_from_IDirect3D7(iface);
D3DDEVICEDESC7 device_desc7;
+ DWORD dev_caps;
HRESULT hr;
size_t i;
@@ -3765,11 +3770,15 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
return hr;
}
+ dev_caps = device_desc7.dwDevCaps;
+
for (i = 0; i < ARRAY_SIZE(device_list7); i++)
{
HRESULT ret;
device_desc7.deviceGUID = *device_list7[i].device_guid;
+ device_desc7.dwDevCaps = dev_caps & ~device_list7[i].remove_caps;
+
ret = callback(device_list7[i].interface_name, device_list7[i].device_name, &device_desc7, context);
if (ret != DDENUMRET_OK)
{
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index d641595baa2..54cc18b74f2 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -577,6 +577,19 @@ static IDirect3DDevice7 *create_device_ex(HWND window, DWORD coop_level, const G
return device;
}
+static HRESULT WINAPI enum_devtype_software_cb(char *desc_str, char *name, D3DDEVICEDESC7 *desc, void *ctx)
+{
+ BOOL *software_ok = ctx;
+ if (IsEqualGUID(&desc->deviceGUID, &IID_IDirect3DRGBDevice))
+ {
+ ok(!(desc->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT),
+ "RGB emulation device shouldn't have HWTRANSFORMANDLIGHT flag\n");
+ *software_ok = TRUE;
+ return DDENUMRET_CANCEL;
+ }
+ return DDENUMRET_OK;
+}
+
static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
{
const GUID *device_guid = &IID_IDirect3DHALDevice;
@@ -6719,6 +6732,7 @@ static void test_surface_lock(void)
ULONG refcount;
DDPIXELFORMAT z_fmt;
BOOL hal_ok = FALSE;
+ BOOL software_ok = FALSE;
const GUID *devtype = &IID_IDirect3DHALDevice;
D3DDEVICEDESC7 device_desc;
BOOL cubemap_supported;
@@ -6844,6 +6858,10 @@ static void test_surface_lock(void)
if (hal_ok)
devtype = &IID_IDirect3DTnLHalDevice;
+ hr = IDirect3D7_EnumDevices(d3d, enum_devtype_software_cb, &software_ok);
+ ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
+ if (!software_ok) win_skip("RGB device not found, unable to check flags\n");
+
memset(&z_fmt, 0, sizeof(z_fmt));
hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
--
2.20.1