mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against 4336ed0b84b3dd3097bbbbf8e4b9de2e4d444ad7.
This commit is contained in:
parent
5bcba4ef5a
commit
4a427fa757
@ -1,8 +1,7 @@
|
||||
From 980d867a89c72225b595b6e2a7313c1ddd42c9ad Mon Sep 17 00:00:00 2001
|
||||
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 1/3] ddraw: Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB
|
||||
device.
|
||||
Subject: [PATCH] ddraw: Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB device.
|
||||
|
||||
---
|
||||
dlls/ddraw/ddraw.c | 9 +++++++++
|
||||
@ -10,10 +9,10 @@ Subject: [PATCH 1/3] ddraw: Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
|
||||
index 97a11ef..9a19536 100644
|
||||
index 705d0335d95..1d916f93c4f 100644
|
||||
--- a/dlls/ddraw/ddraw.c
|
||||
+++ b/dlls/ddraw/ddraw.c
|
||||
@@ -50,6 +50,7 @@ static struct enum_device_entry
|
||||
@@ -49,6 +49,7 @@ static struct enum_device_entry
|
||||
char interface_name[100];
|
||||
char device_name[100];
|
||||
const GUID *device_guid;
|
||||
@ -21,7 +20,7 @@ index 97a11ef..9a19536 100644
|
||||
} device_list7[] =
|
||||
{
|
||||
/* T&L HAL device */
|
||||
@@ -57,6 +58,7 @@ static struct enum_device_entry
|
||||
@@ -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,
|
||||
@ -29,7 +28,7 @@ index 97a11ef..9a19536 100644
|
||||
},
|
||||
|
||||
/* HAL device */
|
||||
@@ -64,6 +66,7 @@ static struct enum_device_entry
|
||||
@@ -63,6 +65,7 @@ static struct enum_device_entry
|
||||
"WINE Direct3D7 Hardware acceleration using WineD3D",
|
||||
"Direct3D HAL",
|
||||
&IID_IDirect3DHALDevice,
|
||||
@ -37,7 +36,7 @@ index 97a11ef..9a19536 100644
|
||||
},
|
||||
|
||||
/* RGB device */
|
||||
@@ -71,6 +74,7 @@ static struct enum_device_entry
|
||||
@@ -70,6 +73,7 @@ static struct enum_device_entry
|
||||
"WINE Direct3D7 RGB Software Emulation using WineD3D",
|
||||
"Wine D3D7 RGB",
|
||||
&IID_IDirect3DRGBDevice,
|
||||
@ -45,7 +44,7 @@ index 97a11ef..9a19536 100644
|
||||
},
|
||||
};
|
||||
|
||||
@@ -3627,6 +3631,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
|
||||
@@ -3749,6 +3753,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
|
||||
{
|
||||
struct ddraw *ddraw = impl_from_IDirect3D7(iface);
|
||||
D3DDEVICEDESC7 device_desc7;
|
||||
@ -53,7 +52,7 @@ index 97a11ef..9a19536 100644
|
||||
HRESULT hr;
|
||||
size_t i;
|
||||
|
||||
@@ -3643,11 +3648,15 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
|
||||
@@ -3765,11 +3770,15 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
|
||||
return hr;
|
||||
}
|
||||
|
||||
@ -70,11 +69,11 @@ index 97a11ef..9a19536 100644
|
||||
if (ret != DDENUMRET_OK)
|
||||
{
|
||||
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
|
||||
index 3f433a6..aa7214a 100644
|
||||
index d641595baa2..54cc18b74f2 100644
|
||||
--- a/dlls/ddraw/tests/ddraw7.c
|
||||
+++ b/dlls/ddraw/tests/ddraw7.c
|
||||
@@ -311,6 +311,19 @@ static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7
|
||||
return DDENUMRET_OK;
|
||||
@@ -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)
|
||||
@ -92,26 +91,26 @@ index 3f433a6..aa7214a 100644
|
||||
+
|
||||
static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
|
||||
{
|
||||
IDirectDrawSurface7 *surface, *ds;
|
||||
@@ -321,6 +334,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
|
||||
IDirect3D7 *d3d7;
|
||||
HRESULT hr;
|
||||
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;
|
||||
|
||||
if (!(ddraw = create_ddraw()))
|
||||
@@ -364,6 +378,10 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
|
||||
ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
|
||||
if (hal_ok) devtype = &IID_IDirect3DTnLHalDevice;
|
||||
|
||||
+ hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_software_cb , &software_ok);
|
||||
+ 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(d3d7, devtype, enum_z_fmt, &z_fmt);
|
||||
hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
|
||||
if (FAILED(hr) || !z_fmt.dwSize)
|
||||
--
|
||||
2.7.4
|
||||
2.20.1
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
From 87c1fab3efb367d863fcfb4870a4a1b1485f65f7 Mon Sep 17 00:00:00 2001
|
||||
From a6a89266f71551cd6ee6b80dc758825957087a37 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 30 May 2015 02:55:03 +0200
|
||||
Subject: [PATCH] ddraw: Allow size and format conversions in
|
||||
IDirect3DTexture2::Load.
|
||||
|
||||
---
|
||||
dlls/ddraw/surface.c | 151 +++++++++++++++++++++++++++------------------------
|
||||
1 file changed, 80 insertions(+), 71 deletions(-)
|
||||
dlls/ddraw/surface.c | 152 +++++++++++++++++++++++--------------------
|
||||
1 file changed, 81 insertions(+), 71 deletions(-)
|
||||
|
||||
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
|
||||
index 47a143a..a30b44f 100644
|
||||
index 19a1ae3d2d2..ed46ff0534a 100644
|
||||
--- a/dlls/ddraw/surface.c
|
||||
+++ b/dlls/ddraw/surface.c
|
||||
@@ -5187,6 +5187,46 @@ static struct ddraw_surface *get_sub_mimaplevel(struct ddraw_surface *surface)
|
||||
@@ -5310,6 +5310,46 @@ static struct ddraw_surface *get_sub_mimaplevel(struct ddraw_surface *surface)
|
||||
return impl_from_IDirectDrawSurface7(next_level);
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ index 47a143a..a30b44f 100644
|
||||
/*****************************************************************************
|
||||
* IDirect3DTexture2::Load
|
||||
*
|
||||
@@ -5208,7 +5248,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||
@@ -5331,7 +5371,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||
{
|
||||
struct ddraw_surface *dst_surface = impl_from_IDirect3DTexture2(iface);
|
||||
struct ddraw_surface *src_surface = unsafe_impl_from_IDirect3DTexture2(src_texture);
|
||||
@ -68,12 +68,12 @@ index 47a143a..a30b44f 100644
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, src_texture %p.\n", iface, src_texture);
|
||||
@@ -5221,90 +5261,60 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||
@@ -5344,90 +5384,61 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
- dst_resource = wined3d_texture_get_resource(dst_surface->wined3d_texture);
|
||||
- src_resource = wined3d_texture_get_resource(src_surface->wined3d_texture);
|
||||
- dst_resource = wined3d_texture_get_resource(ddraw_surface_get_default_texture(dst_surface, DDRAW_SURFACE_WRITE));
|
||||
- src_resource = wined3d_texture_get_resource(ddraw_surface_get_default_texture(src_surface, DDRAW_SURFACE_READ));
|
||||
-
|
||||
- if (((src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)
|
||||
- != (dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP))
|
||||
@ -184,9 +184,10 @@ index 47a143a..a30b44f 100644
|
||||
|
||||
- wined3d_resource_unmap(dst_resource, dst_surface->sub_resource_idx);
|
||||
- wined3d_resource_unmap(src_resource, src_surface->sub_resource_idx);
|
||||
+ hr = wined3d_texture_blt(dst_surface->wined3d_texture, dst_surface->sub_resource_idx, &dst_rect,
|
||||
+ src_surface->wined3d_texture, src_surface->sub_resource_idx, &src_rect,
|
||||
+ 0, NULL, WINED3D_TEXF_LINEAR);
|
||||
+ hr = wined3d_texture_blt(ddraw_surface_get_default_texture(dst_surface, DDRAW_SURFACE_WRITE),
|
||||
+ dst_surface->sub_resource_idx, &dst_rect,
|
||||
+ ddraw_surface_get_default_texture(src_surface, DDRAW_SURFACE_READ),
|
||||
+ src_surface->sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_LINEAR);
|
||||
+ if (FAILED(hr))
|
||||
+ {
|
||||
+ ERR("Failed to blit surface, hr %#x.\n", hr);
|
||||
@ -195,7 +196,7 @@ index 47a143a..a30b44f 100644
|
||||
}
|
||||
|
||||
if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)
|
||||
@@ -5317,12 +5327,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||
@@ -5440,12 +5451,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||
else
|
||||
dst_surface = NULL;
|
||||
|
||||
@ -212,5 +213,5 @@ index 47a143a..a30b44f 100644
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
--
|
||||
1.9.1
|
||||
2.20.1
|
||||
|
||||
|
@ -1,213 +0,0 @@
|
||||
From 2097fbe83a66a3a423bdd148ecfc4f16c1237110 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Wed, 29 Jul 2015 17:09:50 +0200
|
||||
Subject: [PATCH] ddraw: Create rendering targets in video memory if possible.
|
||||
|
||||
Based on a patch by Henri Verbeet.
|
||||
---
|
||||
dlls/ddraw/ddraw.c | 6 +++---
|
||||
dlls/ddraw/ddraw_private.h | 3 ++-
|
||||
dlls/ddraw/device.c | 23 +++++++++++++---------
|
||||
dlls/ddraw/surface.c | 39 ++++++++++++++++++++++++++++++++++++--
|
||||
4 files changed, 56 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
|
||||
index 050f625f7..9655f9e47 100644
|
||||
--- a/dlls/ddraw/ddraw.c
|
||||
+++ b/dlls/ddraw/ddraw.c
|
||||
@@ -4214,7 +4214,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid,
|
||||
TRACE("iface %p, riid %s, surface %p, device %p.\n", iface, debugstr_guid(riid), surface, device);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
- if (SUCCEEDED(hr = d3d_device_create(ddraw, target, (IUnknown *)surface, 7, &object, NULL)))
|
||||
+ if (SUCCEEDED(hr = d3d_device_create(ddraw, riid, target, (IUnknown *)surface, 7, &object, NULL)))
|
||||
{
|
||||
*device = &object->IDirect3DDevice7_iface;
|
||||
}
|
||||
@@ -4243,7 +4243,7 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid,
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
- if (SUCCEEDED(hr = d3d_device_create(ddraw, surface_impl, (IUnknown *)surface, 3, &device_impl, NULL)))
|
||||
+ if (SUCCEEDED(hr = d3d_device_create(ddraw, riid, surface_impl, (IUnknown *)surface, 3, &device_impl, NULL)))
|
||||
{
|
||||
*device = &device_impl->IDirect3DDevice3_iface;
|
||||
}
|
||||
@@ -4269,7 +4269,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
|
||||
iface, debugstr_guid(riid), surface, device);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
- if (SUCCEEDED(hr = d3d_device_create(ddraw, surface_impl, (IUnknown *)surface, 2, &device_impl, NULL)))
|
||||
+ if (SUCCEEDED(hr = d3d_device_create(ddraw, riid, surface_impl, (IUnknown *)surface, 2, &device_impl, NULL)))
|
||||
{
|
||||
*device = &device_impl->IDirect3DDevice2_iface;
|
||||
}
|
||||
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
|
||||
index f4fe970a6..ba0ec73d8 100644
|
||||
--- a/dlls/ddraw/ddraw_private.h
|
||||
+++ b/dlls/ddraw/ddraw_private.h
|
||||
@@ -313,6 +313,7 @@ struct d3d_device
|
||||
IUnknown IUnknown_inner;
|
||||
LONG ref;
|
||||
UINT version;
|
||||
+ BOOL hw;
|
||||
|
||||
IUnknown *outer_unknown;
|
||||
struct wined3d_device *wined3d_device;
|
||||
@@ -360,7 +361,7 @@ struct d3d_device
|
||||
const struct wined3d_stateblock_state *stateblock_state;
|
||||
};
|
||||
|
||||
-HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface,
|
||||
+HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_surface *target, IUnknown *rt_iface,
|
||||
UINT version, struct d3d_device **device, IUnknown *outer_unknown) DECLSPEC_HIDDEN;
|
||||
enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device *device) DECLSPEC_HIDDEN;
|
||||
|
||||
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
|
||||
index 048ba7fba..ce74a0fb8 100644
|
||||
--- a/dlls/ddraw/device.c
|
||||
+++ b/dlls/ddraw/device.c
|
||||
@@ -1858,7 +1858,7 @@ static HRESULT d3d_device7_SetRenderTarget(IDirect3DDevice7 *iface,
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
- if (!(target_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
+ if (device->hw && !(target_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
{
|
||||
WARN("Surface %p is not in video memory.\n", target_impl);
|
||||
wined3d_mutex_unlock();
|
||||
@@ -1934,7 +1934,7 @@ static HRESULT WINAPI d3d_device3_SetRenderTarget(IDirect3DDevice3 *iface,
|
||||
return DDERR_INVALIDPIXELFORMAT;
|
||||
}
|
||||
|
||||
- if (!(target_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
+ if (device->hw && !(target_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
{
|
||||
WARN("Surface %p is not in video memory.\n", target_impl);
|
||||
IDirectDrawSurface4_AddRef(target);
|
||||
@@ -1983,7 +1983,7 @@ static HRESULT WINAPI d3d_device2_SetRenderTarget(IDirect3DDevice2 *iface,
|
||||
return DDERR_INVALIDPIXELFORMAT;
|
||||
}
|
||||
|
||||
- if (!(target_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
+ if (device->hw && !(target_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
{
|
||||
WARN("Surface %p is not in video memory.\n", target_impl);
|
||||
IDirectDrawSurface_AddRef(target);
|
||||
@@ -6951,7 +6951,7 @@ static void ddraw_reset_viewport_state(struct ddraw *ddraw)
|
||||
wined3d_stateblock_set_scissor_rect(ddraw->state, &rect);
|
||||
}
|
||||
|
||||
-static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw,
|
||||
+static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, BOOL hw,
|
||||
struct ddraw_surface *target, IUnknown *rt_iface, UINT version, IUnknown *outer_unknown)
|
||||
{
|
||||
static const struct wined3d_matrix ident =
|
||||
@@ -6974,6 +6974,7 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw,
|
||||
device->IUnknown_inner.lpVtbl = &d3d_device_inner_vtbl;
|
||||
device->ref = 1;
|
||||
device->version = version;
|
||||
+ device->hw = hw;
|
||||
|
||||
if (outer_unknown)
|
||||
device->outer_unknown = outer_unknown;
|
||||
@@ -7032,14 +7033,18 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw,
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
-HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface,
|
||||
+HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_surface *target, IUnknown *rt_iface,
|
||||
UINT version, struct d3d_device **device, IUnknown *outer_unknown)
|
||||
{
|
||||
struct d3d_device *object;
|
||||
+ BOOL hw = TRUE;
|
||||
HRESULT hr;
|
||||
|
||||
- TRACE("ddraw %p, target %p, version %u, device %p, outer_unknown %p.\n",
|
||||
- ddraw, target, version, device, outer_unknown);
|
||||
+ TRACE("ddraw %p, guid %s, target %p, version %u, device %p, outer_unknown %p.\n",
|
||||
+ ddraw, debugstr_guid(guid), target, version, device, outer_unknown);
|
||||
+
|
||||
+ if (IsEqualGUID(guid, &IID_IDirect3DRGBDevice))
|
||||
+ hw = FALSE;
|
||||
|
||||
if (!(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
|
||||
|| (target->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
|
||||
@@ -7062,7 +7067,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUn
|
||||
return DDERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
- if (!(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
+ if (hw && !(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
{
|
||||
WARN("Surface %p is not in video memory.\n", target);
|
||||
return D3DERR_SURFACENOTINVIDMEM;
|
||||
@@ -7080,7 +7085,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUn
|
||||
return DDERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
- if (FAILED(hr = d3d_device_init(object, ddraw, target, rt_iface, version, outer_unknown)))
|
||||
+ if (FAILED(hr = d3d_device_init(object, ddraw, hw, target, rt_iface, version, outer_unknown)))
|
||||
{
|
||||
WARN("Failed to initialize device, hr %#x.\n", hr);
|
||||
heap_free(object);
|
||||
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
|
||||
index 85c1ef496..01522f515 100644
|
||||
--- a/dlls/ddraw/surface.c
|
||||
+++ b/dlls/ddraw/surface.c
|
||||
@@ -223,7 +223,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
- if (FAILED(hr = d3d_device_create(This->ddraw, This, (IUnknown *)&This->IDirectDrawSurface_iface,
|
||||
+ if (FAILED(hr = d3d_device_create(This->ddraw, riid, This, (IUnknown *)&This->IDirectDrawSurface_iface,
|
||||
1, &This->device1, (IUnknown *)&This->IDirectDrawSurface_iface)))
|
||||
{
|
||||
This->device1 = NULL;
|
||||
@@ -6192,7 +6192,42 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||
|
||||
if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
|
||||
{
|
||||
- wined3d_desc.access = WINED3D_RESOURCE_ACCESS_CPU
|
||||
+ unsigned int bind_flags = 0;
|
||||
+
|
||||
+ if (!(desc->dwFlags & DDSD_LPSURFACE))
|
||||
+ {
|
||||
+ if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
||||
+ {
|
||||
+ bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
+ }
|
||||
+ else if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
||||
+ {
|
||||
+ bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
+ }
|
||||
+
|
||||
+ if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
|
||||
+ bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
|
||||
+ else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
|
||||
+ bind_flags |= WINED3D_BIND_RENDER_TARGET;
|
||||
+ }
|
||||
+ /*
|
||||
+ * The ddraw RGB device allows to use system memory surfaces as rendering target.
|
||||
+ * This does not cause problems because the RGB device does software rasterization
|
||||
+ * though it will fail with hardware accelerated ddraw. In order to be partially
|
||||
+ * compatible with games requesting explicitly the RGB device, we ignore the
|
||||
+ * specified location and try to create rendering targets in video memory if
|
||||
+ * possible.
|
||||
+ */
|
||||
+ if (bind_flags
|
||||
+ && SUCCEEDED(hr = wined3d_check_device_format(ddraw->wined3d, ddraw->wined3d_adapter,
|
||||
+ WINED3D_DEVICE_TYPE_HAL, mode.format_id, 0,
|
||||
+ bind_flags, WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
|
||||
+ {
|
||||
+ FIXME("Application wants to create rendering target in system memory, using video memory instead\n");
|
||||
+ wined3d_desc.bind_flags = bind_flags;
|
||||
+ }
|
||||
+ else
|
||||
+ wined3d_desc.access = WINED3D_RESOURCE_ACCESS_CPU
|
||||
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
|
||||
}
|
||||
else
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [34906] Use video memory for rendering targets if possible
|
@ -1,4 +1,4 @@
|
||||
From 43cd59c9043af0c515b558c8dfeafdcabb93215c Mon Sep 17 00:00:00 2001
|
||||
From 3cf6891f84548a9519bed5db83ad19e801ad8d22 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Thu, 4 Apr 2019 02:25:00 +0300
|
||||
Subject: [PATCH] ddraw: Allow setting texture without DDSCAPS_TEXTURE for
|
||||
@ -6,15 +6,15 @@ Subject: [PATCH] ddraw: Allow setting texture without DDSCAPS_TEXTURE for
|
||||
|
||||
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
---
|
||||
dlls/ddraw/device.c | 20 ++++--
|
||||
dlls/ddraw/tests/ddraw4.c | 128 +++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 141 insertions(+), 7 deletions(-)
|
||||
dlls/ddraw/device.c | 20 ++++++--
|
||||
dlls/ddraw/tests/ddraw4.c | 102 ++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 118 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
|
||||
index 33066329407..11a881522d9 100644
|
||||
index c99eafc7524..49aae2feef5 100644
|
||||
--- a/dlls/ddraw/device.c
|
||||
+++ b/dlls/ddraw/device.c
|
||||
@@ -4775,7 +4775,8 @@ static HRESULT d3d_device7_SetTexture(IDirect3DDevice7 *iface,
|
||||
@@ -4822,7 +4822,8 @@ static HRESULT d3d_device7_SetTexture(IDirect3DDevice7 *iface,
|
||||
struct ddraw_surface *surf = unsafe_impl_from_IDirectDrawSurface7(texture);
|
||||
struct wined3d_texture *wined3d_texture = NULL;
|
||||
|
||||
@ -23,8 +23,8 @@ index 33066329407..11a881522d9 100644
|
||||
+ iface, stage, texture, surf, surf ? surf->surface_desc.ddsCaps.dwCaps : 0);
|
||||
|
||||
if (surf && (surf->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
||||
wined3d_texture = surf->wined3d_texture;
|
||||
@@ -4811,19 +4812,30 @@ static HRESULT WINAPI d3d_device3_SetTexture(IDirect3DDevice3 *iface,
|
||||
wined3d_texture = surf->draw_texture ? surf->draw_texture : surf->wined3d_texture;
|
||||
@@ -4858,19 +4859,30 @@ static HRESULT WINAPI d3d_device3_SetTexture(IDirect3DDevice3 *iface,
|
||||
{
|
||||
struct d3d_device *device = impl_from_IDirect3DDevice3(iface);
|
||||
struct ddraw_surface *tex = unsafe_impl_from_IDirect3DTexture2(texture);
|
||||
@ -36,7 +36,7 @@ index 33066329407..11a881522d9 100644
|
||||
wined3d_mutex_lock();
|
||||
|
||||
- hr = IDirect3DDevice7_SetTexture(&device->IDirect3DDevice7_iface, stage, &tex->IDirectDrawSurface7_iface);
|
||||
+ if (tex && ((tex->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) || !device->hw))
|
||||
+ if (tex && ((tex->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) || !device->hardware_device))
|
||||
+ {
|
||||
+ if (!(tex->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
||||
+ WARN("Setting texture without DDSCAPS_TEXTURE.\n");
|
||||
@ -59,73 +59,14 @@ index 33066329407..11a881522d9 100644
|
||||
|
||||
static const struct tss_lookup
|
||||
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
|
||||
index 6e003fbfb7e..30f2282c12c 100644
|
||||
index 5af824c3f78..032ae01fbf8 100644
|
||||
--- a/dlls/ddraw/tests/ddraw4.c
|
||||
+++ b/dlls/ddraw/tests/ddraw4.c
|
||||
@@ -427,7 +427,7 @@ static IDirectDraw4 *create_ddraw(void)
|
||||
return ddraw4;
|
||||
}
|
||||
|
||||
-static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
|
||||
+static IDirect3DDevice3 *create_device_ex(HWND window, DWORD coop_level, BOOL software)
|
||||
{
|
||||
IDirectDrawSurface4 *surface, *ds;
|
||||
IDirect3DDevice3 *device = NULL;
|
||||
@@ -447,6 +447,8 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
|
||||
+ if (software)
|
||||
+ surface_desc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
|
||||
@@ -475,7 +477,8 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
|
||||
}
|
||||
|
||||
memset(&z_fmt, 0, sizeof(z_fmt));
|
||||
- hr = IDirect3D3_EnumZBufferFormats(d3d3, &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt);
|
||||
+ hr = IDirect3D3_EnumZBufferFormats(d3d3, software ? &IID_IDirect3DRGBDevice
|
||||
+ : &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt);
|
||||
if (FAILED(hr) || !z_fmt.dwSize)
|
||||
{
|
||||
IDirect3D3_Release(d3d3);
|
||||
@@ -487,6 +490,8 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER;
|
||||
+ if (software)
|
||||
+ surface_desc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
U4(surface_desc).ddpfPixelFormat = z_fmt;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
@@ -509,7 +514,8 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- hr = IDirect3D3_CreateDevice(d3d3, &IID_IDirect3DHALDevice, surface, &device, NULL);
|
||||
+ hr = IDirect3D3_CreateDevice(d3d3, software ? &IID_IDirect3DRGBDevice
|
||||
+ : &IID_IDirect3DHALDevice, surface, &device, NULL);
|
||||
IDirect3D3_Release(d3d3);
|
||||
IDirectDrawSurface4_Release(surface);
|
||||
if (FAILED(hr))
|
||||
@@ -518,6 +524,11 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
|
||||
return device;
|
||||
}
|
||||
|
||||
+static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
|
||||
+{
|
||||
+ return create_device_ex(window, coop_level, FALSE);
|
||||
+}
|
||||
+
|
||||
static IDirect3DViewport3 *create_viewport(IDirect3DDevice3 *device, UINT x, UINT y, UINT w, UINT h)
|
||||
{
|
||||
IDirect3DViewport3 *viewport;
|
||||
@@ -18331,6 +18342,116 @@ static void run_for_each_device_type(void (*test_func)(const GUID *))
|
||||
@@ -18326,6 +18326,107 @@ static void run_for_each_device_type(void (*test_func)(const GUID *))
|
||||
test_func(&IID_IDirect3DRGBDevice);
|
||||
}
|
||||
|
||||
+static void test_texture_wrong_caps_(BOOL software)
|
||||
+static void test_texture_wrong_caps(const GUID *device_guid)
|
||||
+{
|
||||
+ static struct
|
||||
+ {
|
||||
@ -158,7 +99,7 @@ index 6e003fbfb7e..30f2282c12c 100644
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ window = create_window();
|
||||
+ if (!(device = create_device_ex(window, DDSCL_NORMAL, software)))
|
||||
+ if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid)))
|
||||
+ {
|
||||
+ skip("Failed to create a 3D device, skipping test.\n");
|
||||
+ DestroyWindow(window);
|
||||
@ -213,7 +154,7 @@ index 6e003fbfb7e..30f2282c12c 100644
|
||||
+ hr = IDirect3DDevice3_EndScene(device);
|
||||
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
+
|
||||
+ expected_color = software ? 0x0000ff00 : 0x00ffffff;
|
||||
+ expected_color = is_software_device_type(device_guid) ? 0x0000ff00 : 0x00ffffff;
|
||||
+ color = get_surface_color(rt, 320, 240);
|
||||
+ ok(color == expected_color, "Got color 0x%08x, expected 0x%08x.\n", color, expected_color);
|
||||
+
|
||||
@ -225,24 +166,15 @@ index 6e003fbfb7e..30f2282c12c 100644
|
||||
+ ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
+ DestroyWindow(window);
|
||||
+}
|
||||
+
|
||||
+static void test_texture_wrong_caps(void)
|
||||
+{
|
||||
+ trace("Hardware device.\n");
|
||||
+ test_texture_wrong_caps_(FALSE);
|
||||
+
|
||||
+ trace("Software device.\n");
|
||||
+ test_texture_wrong_caps_(TRUE);
|
||||
+}
|
||||
+
|
||||
START_TEST(ddraw4)
|
||||
{
|
||||
DDDEVICEIDENTIFIER identifier;
|
||||
@@ -18463,6 +18584,7 @@ START_TEST(ddraw4)
|
||||
@@ -18458,6 +18559,7 @@ START_TEST(ddraw4)
|
||||
test_gdi_surface();
|
||||
test_alphatest();
|
||||
test_clipper_refcount();
|
||||
+ test_texture_wrong_caps();
|
||||
+ run_for_each_device_type(test_texture_wrong_caps);
|
||||
test_caps();
|
||||
test_d32_support();
|
||||
test_surface_format_conversion_alpha();
|
||||
|
@ -1,3 +1 @@
|
||||
Fixes: [46948] Allow setting texture without DDSCAPS_TEXTURE for software device
|
||||
Depends: ddraw-Rendering_Targets
|
||||
|
||||
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "0ae1669ec2798193b11fd2d2ac74d51203f673b2"
|
||||
echo "4336ed0b84b3dd3097bbbbf8e4b9de2e4d444ad7"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -110,7 +110,6 @@ patch_enable_all ()
|
||||
enable_dbghelp_Debug_Symbols="$1"
|
||||
enable_ddraw_Device_Caps="$1"
|
||||
enable_ddraw_IDirect3DTexture2_Load="$1"
|
||||
enable_ddraw_Rendering_Targets="$1"
|
||||
enable_ddraw_Silence_FIXMEs="$1"
|
||||
enable_ddraw_Texture_Wrong_Caps="$1"
|
||||
enable_ddraw_version_check="$1"
|
||||
@ -400,9 +399,6 @@ patch_enable ()
|
||||
ddraw-IDirect3DTexture2_Load)
|
||||
enable_ddraw_IDirect3DTexture2_Load="$2"
|
||||
;;
|
||||
ddraw-Rendering_Targets)
|
||||
enable_ddraw_Rendering_Targets="$2"
|
||||
;;
|
||||
ddraw-Silence_FIXMEs)
|
||||
enable_ddraw_Silence_FIXMEs="$2"
|
||||
;;
|
||||
@ -1578,13 +1574,6 @@ if test "$enable_ddraw_version_check" -eq 1; then
|
||||
enable_ddraw_Device_Caps=1
|
||||
fi
|
||||
|
||||
if test "$enable_ddraw_Texture_Wrong_Caps" -eq 1; then
|
||||
if test "$enable_ddraw_Rendering_Targets" -gt 1; then
|
||||
abort "Patchset ddraw-Rendering_Targets disabled, but ddraw-Texture_Wrong_Caps depends on that."
|
||||
fi
|
||||
enable_ddraw_Rendering_Targets=1
|
||||
fi
|
||||
|
||||
if test "$enable_d3d11_Deferred_Context" -eq 1; then
|
||||
if test "$enable_nvapi_Stub_DLL" -gt 1; then
|
||||
abort "Patchset nvapi-Stub_DLL disabled, but d3d11-Deferred_Context depends on that."
|
||||
@ -2079,18 +2068,6 @@ if test "$enable_ddraw_IDirect3DTexture2_Load" -eq 1; then
|
||||
patch_apply ddraw-IDirect3DTexture2_Load/0002-ddraw-tests-Add-more-tests-for-IDirect3DTexture2-Loa.patch
|
||||
fi
|
||||
|
||||
# Patchset ddraw-Rendering_Targets
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#34906] Use video memory for rendering targets if possible
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ddraw/ddraw.c, dlls/ddraw/ddraw_private.h, dlls/ddraw/device.c, dlls/ddraw/surface.c
|
||||
# |
|
||||
if test "$enable_ddraw_Rendering_Targets" -eq 1; then
|
||||
patch_apply ddraw-Rendering_Targets/0001-ddraw-Create-rendering-targets-in-video-memory-if-po.patch
|
||||
fi
|
||||
|
||||
# Patchset ddraw-Silence_FIXMEs
|
||||
# |
|
||||
# | Modified files:
|
||||
@ -2102,9 +2079,6 @@ fi
|
||||
|
||||
# Patchset ddraw-Texture_Wrong_Caps
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ddraw-Rendering_Targets
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#46948] Allow setting texture without DDSCAPS_TEXTURE for software device
|
||||
# |
|
||||
|
@ -1 +1 @@
|
||||
0ae1669ec2798193b11fd2d2ac74d51203f673b2
|
||||
4336ed0b84b3dd3097bbbbf8e4b9de2e4d444ad7
|
||||
|
Loading…
Reference in New Issue
Block a user