mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
160 lines
5.8 KiB
Diff
160 lines
5.8 KiB
Diff
|
From d7c4217174337d31778a5582b71b8c98e8a55852 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||
|
Date: Sun, 28 Feb 2016 05:02:48 +0100
|
||
|
Subject: ddraw: Accept d3d1 and d3d2 versions of D3DFINDDEVICERESULT in
|
||
|
IDirect3D_FindDevice.
|
||
|
|
||
|
---
|
||
|
dlls/ddraw/ddraw.c | 24 +++++++++++++++++++----
|
||
|
dlls/ddraw/tests/d3d.c | 14 ++++++++++++++
|
||
|
include/d3dcaps.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
3 files changed, 86 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
|
||
|
index 782b6b5..0d2ec53 100644
|
||
|
--- a/dlls/ddraw/ddraw.c
|
||
|
+++ b/dlls/ddraw/ddraw.c
|
||
|
@@ -3992,8 +3992,8 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
|
||
|
|
||
|
if (!fds || !fdr) return DDERR_INVALIDPARAMS;
|
||
|
|
||
|
- if (fds->dwSize != sizeof(D3DFINDDEVICESEARCH)
|
||
|
- || fdr->dwSize != sizeof(D3DFINDDEVICERESULT))
|
||
|
+ if (fds->dwSize != sizeof(D3DFINDDEVICESEARCH) || (fdr->dwSize != sizeof(D3DFINDDEVICERESULT1) &&
|
||
|
+ fdr->dwSize != sizeof(D3DFINDDEVICERESULT2) && fdr->dwSize != sizeof(D3DFINDDEVICERESULT)))
|
||
|
return DDERR_INVALIDPARAMS;
|
||
|
|
||
|
if ((fds->dwFlags & D3DFDS_COLORMODEL)
|
||
|
@@ -4022,8 +4022,24 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
|
||
|
/* Now return our own GUID */
|
||
|
ddraw_d3dcaps1_from_7(&desc1, &desc7);
|
||
|
fdr->guid = IID_D3DDEVICE_WineD3D;
|
||
|
- fdr->ddHwDesc = desc1;
|
||
|
- fdr->ddSwDesc = desc1;
|
||
|
+
|
||
|
+ if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT1))
|
||
|
+ {
|
||
|
+ D3DFINDDEVICERESULT1 *fdr1 = (D3DFINDDEVICERESULT1 *)fdr;
|
||
|
+ memcpy(&fdr1->ddHwDesc, &desc1, sizeof(fdr1->ddHwDesc));
|
||
|
+ memcpy(&fdr1->ddSwDesc, &desc1, sizeof(fdr1->ddSwDesc));
|
||
|
+ }
|
||
|
+ else if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT2))
|
||
|
+ {
|
||
|
+ D3DFINDDEVICERESULT2 *fdr2 = (D3DFINDDEVICERESULT2 *)fdr;
|
||
|
+ memcpy(&fdr2->ddHwDesc, &desc1, sizeof(fdr2->ddHwDesc));
|
||
|
+ memcpy(&fdr2->ddSwDesc, &desc1, sizeof(fdr2->ddSwDesc));
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ fdr->ddHwDesc = desc1;
|
||
|
+ fdr->ddSwDesc = desc1;
|
||
|
+ }
|
||
|
|
||
|
TRACE("Returning Wine's wined3d device with (undumped) capabilities.\n");
|
||
|
|
||
|
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
|
||
|
index 06f16f3..12db306 100644
|
||
|
--- a/dlls/ddraw/tests/d3d.c
|
||
|
+++ b/dlls/ddraw/tests/d3d.c
|
||
|
@@ -3211,6 +3211,8 @@ static void FindDevice(void)
|
||
|
|
||
|
D3DFINDDEVICESEARCH search = {0};
|
||
|
D3DFINDDEVICERESULT result = {0};
|
||
|
+ D3DFINDDEVICERESULT1 result1 = {0};
|
||
|
+ D3DFINDDEVICERESULT2 result2 = {0};
|
||
|
IDirect3DDevice *d3dhal;
|
||
|
HRESULT hr;
|
||
|
int i;
|
||
|
@@ -3251,6 +3253,18 @@ static void FindDevice(void)
|
||
|
ok(hr == D3D_OK,
|
||
|
"Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr);
|
||
|
|
||
|
+ result1.dwSize = sizeof(result1);
|
||
|
+
|
||
|
+ hr = IDirect3D_FindDevice(Direct3D1, &search, (D3DFINDDEVICERESULT *)&result1);
|
||
|
+ ok(hr == D3D_OK,
|
||
|
+ "Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr);
|
||
|
+
|
||
|
+ result2.dwSize = sizeof(result2);
|
||
|
+
|
||
|
+ hr = IDirect3D_FindDevice(Direct3D1, &search, (D3DFINDDEVICERESULT *)&result2);
|
||
|
+ ok(hr == D3D_OK,
|
||
|
+ "Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr);
|
||
|
+
|
||
|
/* Try an arbitrary non-device GUID. */
|
||
|
search.dwSize = sizeof(search);
|
||
|
search.dwFlags = D3DFDS_GUID;
|
||
|
diff --git a/include/d3dcaps.h b/include/d3dcaps.h
|
||
|
index 4fc76ba..51e3efa 100644
|
||
|
--- a/include/d3dcaps.h
|
||
|
+++ b/include/d3dcaps.h
|
||
|
@@ -193,6 +193,44 @@ typedef struct _D3dPrimCaps {
|
||
|
#define D3DPTADDRESSCAPS_BORDER 0x00000008
|
||
|
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010
|
||
|
|
||
|
+typedef struct _D3DDeviceDesc1 {
|
||
|
+ DWORD dwSize;
|
||
|
+ DWORD dwFlags;
|
||
|
+ D3DCOLORMODEL dcmColorModel;
|
||
|
+ DWORD dwDevCaps;
|
||
|
+ D3DTRANSFORMCAPS dtcTransformCaps;
|
||
|
+ BOOL bClipping;
|
||
|
+ D3DLIGHTINGCAPS dlcLightingCaps;
|
||
|
+ D3DPRIMCAPS dpcLineCaps;
|
||
|
+ D3DPRIMCAPS dpcTriCaps;
|
||
|
+ DWORD dwDeviceRenderBitDepth;
|
||
|
+ DWORD dwDeviceZBufferBitDepth;
|
||
|
+ DWORD dwMaxBufferSize;
|
||
|
+ DWORD dwMaxVertexCount;
|
||
|
+} D3DDEVICEDESC1,*LPD3DDEVICEDESC1;
|
||
|
+#define D3DDEVICEDESCSIZE1 (sizeof(D3DDEVICEDESC1))
|
||
|
+
|
||
|
+typedef struct _D3DDeviceDesc2 {
|
||
|
+ DWORD dwSize;
|
||
|
+ DWORD dwFlags;
|
||
|
+ D3DCOLORMODEL dcmColorModel;
|
||
|
+ DWORD dwDevCaps;
|
||
|
+ D3DTRANSFORMCAPS dtcTransformCaps;
|
||
|
+ BOOL bClipping;
|
||
|
+ D3DLIGHTINGCAPS dlcLightingCaps;
|
||
|
+ D3DPRIMCAPS dpcLineCaps;
|
||
|
+ D3DPRIMCAPS dpcTriCaps;
|
||
|
+ DWORD dwDeviceRenderBitDepth;
|
||
|
+ DWORD dwDeviceZBufferBitDepth;
|
||
|
+ DWORD dwMaxBufferSize;
|
||
|
+ DWORD dwMaxVertexCount;
|
||
|
+
|
||
|
+ DWORD dwMinTextureWidth,dwMinTextureHeight;
|
||
|
+ DWORD dwMaxTextureWidth,dwMaxTextureHeight;
|
||
|
+ DWORD dwMinStippleWidth,dwMaxStippleWidth;
|
||
|
+ DWORD dwMinStippleHeight,dwMaxStippleHeight;
|
||
|
+} D3DDEVICEDESC2,*LPD3DDEVICEDESC2;
|
||
|
+#define D3DDEVICEDESCSIZE2 (sizeof(D3DDEVICEDESC2))
|
||
|
|
||
|
typedef struct _D3DDeviceDesc {
|
||
|
DWORD dwSize;
|
||
|
@@ -382,6 +420,20 @@ typedef struct _D3DFINDDEVICESEARCH {
|
||
|
D3DPRIMCAPS dpcPrimCaps;
|
||
|
} D3DFINDDEVICESEARCH,*LPD3DFINDDEVICESEARCH;
|
||
|
|
||
|
+typedef struct _D3DFINDDEVICERESULT1 {
|
||
|
+ DWORD dwSize;
|
||
|
+ GUID guid;
|
||
|
+ D3DDEVICEDESC1 ddHwDesc;
|
||
|
+ D3DDEVICEDESC1 ddSwDesc;
|
||
|
+} D3DFINDDEVICERESULT1,*LPD3DFINDDEVICERESULT1;
|
||
|
+
|
||
|
+typedef struct _D3DFINDDEVICERESULT2 {
|
||
|
+ DWORD dwSize;
|
||
|
+ GUID guid;
|
||
|
+ D3DDEVICEDESC2 ddHwDesc;
|
||
|
+ D3DDEVICEDESC2 ddSwDesc;
|
||
|
+} D3DFINDDEVICERESULT2,*LPD3DFINDDEVICERESULT2;
|
||
|
+
|
||
|
typedef struct _D3DFINDDEVICERESULT {
|
||
|
DWORD dwSize;
|
||
|
GUID guid;
|
||
|
--
|
||
|
2.7.1
|
||
|
|