Rebase against 7afeec4bf2908d92be30220871fc70c0b981211f.

This commit is contained in:
Sebastian Lackner 2016-01-29 04:31:08 +01:00
parent 7a8203d691
commit 74a1d8d0fb
7 changed files with 220 additions and 346 deletions

View File

@ -1,17 +1,17 @@
From f1ad7b7975ed611a4989986f35ea3695eca0f26c Mon Sep 17 00:00:00 2001
From 5b0590e3b6935cd82f7b88a69c92f7530edff337 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: ddraw: Allow size and format conversions in IDirect3DTexture2::Load.
---
dlls/ddraw/surface.c | 147 ++++++++++++++++++++++++++-------------------------
1 file changed, 76 insertions(+), 71 deletions(-)
dlls/ddraw/surface.c | 149 +++++++++++++++++++++++++++------------------------
1 file changed, 79 insertions(+), 70 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 8a10eff..cb71a65 100644
index baf6201..7d91d47 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -5062,6 +5062,46 @@ static struct ddraw_surface *get_sub_mimaplevel(struct ddraw_surface *surface)
@@ -5042,6 +5042,46 @@ static struct ddraw_surface *get_sub_mimaplevel(struct ddraw_surface *surface)
return impl_from_IDirectDrawSurface7(next_level);
}
@ -58,7 +58,15 @@ index 8a10eff..cb71a65 100644
/*****************************************************************************
* IDirect3DTexture2::Load
*
@@ -5095,90 +5135,56 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
@@ -5063,6 +5103,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);
+ RECT src_rect, dst_rect;
HRESULT hr;
TRACE("iface %p, src_texture %p.\n", iface, src_texture);
@@ -5075,90 +5116,59 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
wined3d_mutex_lock();
@ -162,18 +170,20 @@ index 8a10eff..cb71a65 100644
- wined3d_mutex_unlock();
- return D3DERR_TEXTURE_LOAD_FAILED;
- }
-
+ /* Suppress the ALLOCONLOAD flag */
+ dst_surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
- if (dst_surface->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
- memcpy(dst_map_desc.data, src_map_desc.data, src_surface->surface_desc.u1.dwLinearSize);
- else
- memcpy(dst_map_desc.data, src_map_desc.data, src_map_desc.row_pitch * src_desc->dwHeight);
+ /* Suppress the ALLOCONLOAD flag */
+ dst_surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
+ SetRect(&src_rect, 0, 0, src_surface->surface_desc.dwWidth, src_surface->surface_desc.dwHeight);
+ SetRect(&dst_rect, 0, 0, dst_surface->surface_desc.dwWidth, dst_surface->surface_desc.dwHeight);
- wined3d_surface_unmap(src_surface->wined3d_surface);
- wined3d_surface_unmap(dst_surface->wined3d_surface);
+ hr = wined3d_surface_blt(dst_surface->wined3d_surface, NULL, src_surface->wined3d_surface,
+ NULL, 0, NULL, WINED3D_TEXF_LINEAR);
+ hr = wined3d_surface_blt(dst_surface->wined3d_surface, &dst_rect, src_surface->wined3d_surface,
+ &src_rect, 0, NULL, WINED3D_TEXF_LINEAR);
+ if (FAILED(hr))
+ {
+ ERR("Failed to blit surface, hr %#x.\n", hr);
@ -182,7 +192,7 @@ index 8a10eff..cb71a65 100644
}
if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)
@@ -5191,12 +5197,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
@@ -5171,12 +5181,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
else
dst_surface = NULL;
@ -199,5 +209,5 @@ index 8a10eff..cb71a65 100644
wined3d_mutex_unlock();
--
2.6.2
2.7.0

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "bb29a9bf5b42a9848faae749b6d0bd79576f665a"
echo "7afeec4bf2908d92be30220871fc70c0b981211f"
}
# Show version information

View File

@ -1,4 +1,4 @@
From 803e39eb0ca711ad7a2867bdac796cc4360c4c27 Mon Sep 17 00:00:00 2001
From 4aad31fd3b9d3949b86cc73e4b4b5f98cce42ea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sat, 4 Jan 2014 00:53:47 +0100
Subject: wined3d: Remove surface_validate_location.
@ -13,10 +13,10 @@ Subject: wined3d: Remove surface_validate_location.
6 files changed, 18 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index e8526d8..a87b09b 100644
index 7731230..78f24cd 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7888,7 +7888,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
@@ -7902,7 +7902,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_
context_release(context);
@ -26,7 +26,7 @@ index e8526d8..a87b09b 100644
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2312267..c10c1fc 100644
index 7c9e96d..613235d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -398,7 +398,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
@ -38,7 +38,7 @@ index 2312267..c10c1fc 100644
surface_invalidate_location(rt, ~rt->container->resource.draw_binding);
}
}
@@ -4047,7 +4047,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4124,7 +4124,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
context_release(context);
@ -48,10 +48,10 @@ index 2312267..c10c1fc 100644
}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 50282c0..4fb2578 100644
index ea601ff..516b50f1 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1158,14 +1158,14 @@ static void surface_unload(struct wined3d_resource *resource)
@@ -1134,14 +1134,14 @@ static void surface_unload(struct wined3d_resource *resource)
* and all flags get lost */
if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL)
{
@ -68,7 +68,7 @@ index 50282c0..4fb2578 100644
surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM);
}
}
@@ -1695,7 +1695,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
@@ -1677,7 +1677,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
context_release(context);
@ -77,7 +77,7 @@ index 50282c0..4fb2578 100644
surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB);
return WINED3D_OK;
@@ -2133,7 +2133,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
@@ -2115,7 +2115,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
valid_location = WINED3D_LOCATION_SYSMEM;
}
@ -86,7 +86,7 @@ index 50282c0..4fb2578 100644
return WINED3D_OK;
}
@@ -2679,7 +2679,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
@@ -2662,7 +2662,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
{
TRACE("WINED3D_MAP_DISCARD flag passed, marking %s as up to date.\n",
wined3d_debug_location(surface->resource.map_binding));
@ -95,7 +95,7 @@ index 50282c0..4fb2578 100644
}
else
{
@@ -3167,7 +3167,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
@@ -3144,7 +3144,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
/* The texture is now most up to date - If the surface is a render target
* and has a drawable, this path is never entered. */
@ -104,7 +104,7 @@ index 50282c0..4fb2578 100644
surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB);
}
@@ -3440,7 +3440,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
@@ -3417,7 +3417,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
/* The texture is now most up to date - If the surface is a render target
* and has a drawable, this path is never entered. */
@ -113,7 +113,7 @@ index 50282c0..4fb2578 100644
surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB);
}
@@ -3918,13 +3918,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
@@ -3895,13 +3895,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
surface->ds_current_size.cy = surface->resource.height;
}
@ -127,7 +127,7 @@ index 50282c0..4fb2578 100644
void surface_invalidate_location(struct wined3d_surface *surface, DWORD location)
{
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
@@ -4319,7 +4312,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
@@ -4296,7 +4289,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
break;
}
@ -136,7 +136,7 @@ index 50282c0..4fb2578 100644
if (location != WINED3D_LOCATION_SYSMEM && (surface->resource.locations & WINED3D_LOCATION_SYSMEM))
surface_evict_sysmem(surface);
@@ -4493,7 +4486,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter,
@@ -4479,7 +4472,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT,
(old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
@ -145,8 +145,8 @@ index 50282c0..4fb2578 100644
surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding);
}
@@ -5474,7 +5467,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
dst_surface, dst_surface->container->resource.draw_binding, &dst_rect);
@@ -5456,7 +5449,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
dst_surface, dst_surface->container->resource.draw_binding, dst_rect);
context_release(context);
- surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding);
@ -154,7 +154,7 @@ index 50282c0..4fb2578 100644
surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding);
return WINED3D_OK;
@@ -5564,7 +5557,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
@@ -5543,7 +5536,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
}
surface->container = container;
@ -163,7 +163,7 @@ index 50282c0..4fb2578 100644
list_init(&surface->renderbuffers);
list_init(&surface->overlays);
@@ -5596,7 +5589,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
@@ -5575,7 +5568,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
if (surface->resource.map_binding == WINED3D_LOCATION_DIB)
{
wined3d_resource_free_sysmem(&surface->resource);
@ -173,10 +173,10 @@ index 50282c0..4fb2578 100644
}
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index e45fe17..9758be4 100644
index 7728cdc..a97d1f7 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -562,7 +562,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
@@ -570,7 +570,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0));
@ -185,7 +185,7 @@ index e45fe17..9758be4 100644
surface_invalidate_location(front, ~WINED3D_LOCATION_DRAWABLE);
/* If the swapeffect is DISCARD, the back buffer is undefined. That means the SYSMEM
* and INTEXTURE copies can keep their old content if they have any defined content.
@@ -835,7 +835,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
@@ -843,7 +843,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
front_buffer = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0));
if (!(device->wined3d->flags & WINED3D_NO3D))
{
@ -195,7 +195,7 @@ index e45fe17..9758be4 100644
}
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 0f40a3c..6b41db8 100644
index 093cc56..40b668c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -795,9 +795,7 @@ static void texture2d_sub_resource_invalidate_location(struct wined3d_resource *
@ -210,10 +210,10 @@ index 0f40a3c..6b41db8 100644
static void texture2d_sub_resource_upload_data(struct wined3d_resource *sub_resource,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 87cd0d0..3848e76 100644
index f03e8a1..d912668 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2477,7 +2477,6 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
@@ -2505,7 +2505,6 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch) DECLSPEC_HIDDEN;
HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
@ -222,5 +222,5 @@ index 87cd0d0..3848e76 100644
GLenum target, unsigned int level, unsigned int layer, DWORD flags,
struct wined3d_surface **surface) DECLSPEC_HIDDEN;
--
2.6.2
2.7.0

View File

@ -1,4 +1,4 @@
From b7612231d57a3c77fc57a24690d14d118791824a Mon Sep 17 00:00:00 2001
From e1e98fc97f883a0ed00d7475bc2131df7d46c224 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 17 Nov 2013 20:33:17 +0100
Subject: wined3d: Replace surface_load_location with resource_load_location.
@ -15,10 +15,10 @@ FIXME: Check if this patch is complete enough to make sense.
7 files changed, 45 insertions(+), 88 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 230946d..1325dc9 100644
index 9408cd9..0d9de90 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2292,7 +2292,7 @@ static void context_validate_onscreen_formats(struct wined3d_context *context,
@@ -2293,7 +2293,7 @@ static void context_validate_onscreen_formats(struct wined3d_context *context,
WARN("Depth stencil format is not supported by WGL, rendering the backbuffer in an FBO\n");
/* The currently active context is the necessary context to access the swapchain's onscreen buffers */
@ -28,7 +28,7 @@ index 230946d..1325dc9 100644
swapchain_update_draw_bindings(swapchain);
context_set_render_offscreen(context, TRUE);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a9ac2ca..0a07197 100644
index d34aa4e..5e02b97 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -324,7 +324,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
@ -40,7 +40,7 @@ index a9ac2ca..0a07197 100644
else
wined3d_surface_prepare(rt, context, rt->container->resource.draw_binding);
}
@@ -4056,7 +4056,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4116,7 +4116,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
&& src_rect.bottom == sub_resource->height)
wined3d_texture_prepare_texture(texture, context, FALSE);
else
@ -63,7 +63,7 @@ index 9ba6ef7..0afeff9 100644
}
else
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 032d284..2d87c08 100644
index 151dcd0..9987919 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -735,7 +735,7 @@ static void surface_unmap(struct wined3d_surface *surface)
@ -133,7 +133,7 @@ index 032d284..2d87c08 100644
static const struct wined3d_surface_ops surface_ops =
{
surface_private_setup,
@@ -1677,7 +1659,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
@@ -1683,7 +1665,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
if (update_w == dst_w && update_h == dst_h)
wined3d_texture_prepare_texture(dst_surface->container, context, FALSE);
else
@ -142,7 +142,7 @@ index 032d284..2d87c08 100644
wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE);
surface_get_memory(src_surface, &data, src_surface->resource.locations);
@@ -1810,7 +1792,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte
@@ -1816,7 +1798,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte
}
TRACE("Reloading because surface is dirty.\n");
@ -151,7 +151,7 @@ index 032d284..2d87c08 100644
surface_evict_sysmem(surface);
}
@@ -2683,7 +2665,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
@@ -2690,7 +2672,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
if (surface->resource.device->d3d_initialized)
context = context_acquire(surface->resource.device, NULL);
@ -160,7 +160,7 @@ index 032d284..2d87c08 100644
if (context)
context_release(context);
}
@@ -2798,7 +2780,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
@@ -2805,7 +2787,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
surface->resource.map_binding = WINED3D_LOCATION_DIB;
}
@ -169,7 +169,7 @@ index 032d284..2d87c08 100644
wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB);
if (context)
@@ -2847,7 +2829,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
@@ -2854,7 +2836,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
if (device->d3d_initialized)
context = context_acquire(device, NULL);
@ -178,7 +178,7 @@ index 032d284..2d87c08 100644
wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB);
if (context)
context_release(context);
@@ -3484,8 +3466,8 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
@@ -3491,8 +3473,8 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
gl_info = context->gl_info;
/* Make sure the surface is up-to-date. This should probably use
@ -189,7 +189,7 @@ index 032d284..2d87c08 100644
wined3d_texture_load(src_surface->container, context, FALSE);
/* Activate the destination context, set it up for blitting */
@@ -3905,29 +3887,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
@@ -3912,29 +3894,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
surface->ds_current_size.cy = surface->resource.height;
}
@ -219,7 +219,7 @@ index 032d284..2d87c08 100644
static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD location)
{
struct wined3d_device *device = surface->resource.device;
@@ -3977,7 +3936,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
@@ -3984,7 +3943,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
}
if (surface->resource.locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
@ -228,7 +228,7 @@ index 032d284..2d87c08 100644
/* Download the surface to system memory. */
if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
@@ -4013,7 +3972,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
@@ -4020,7 +3979,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
}
surface_get_rect(surface, NULL, &r);
@ -237,7 +237,7 @@ index 032d284..2d87c08 100644
surface_blt_to_drawable(surface->resource.device, context,
WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r);
@@ -4086,7 +4045,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -4093,7 +4052,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* Performance warning... */
FIXME("Downloading RGB surface %p to reload it as sRGB.\n", surface);
surface_prepare_map_memory(surface);
@ -246,7 +246,7 @@ index 032d284..2d87c08 100644
}
}
else
@@ -4097,7 +4056,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -4104,7 +4063,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* Performance warning... */
FIXME("Downloading sRGB surface %p to reload it as RGB.\n", surface);
surface_prepare_map_memory(surface);
@ -255,7 +255,7 @@ index 032d284..2d87c08 100644
}
}
@@ -4106,7 +4065,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -4113,7 +4072,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
WARN("Trying to load a texture from sysmem, but no simple location is valid.\n");
/* Lets hope we get it from somewhere... */
surface_prepare_system_memory(surface);
@ -264,7 +264,7 @@ index 032d284..2d87c08 100644
}
wined3d_texture_prepare_texture(texture, context, srgb);
@@ -4132,7 +4091,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -4139,7 +4098,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
surface->resource.map_binding = WINED3D_LOCATION_SYSMEM;
surface_prepare_map_memory(surface);
@ -273,7 +273,7 @@ index 032d284..2d87c08 100644
surface_remove_pbo(surface, gl_info);
}
@@ -4207,9 +4166,11 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
@@ -4214,9 +4173,11 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
surface, src_location, &rect, surface, dst_location, &rect);
}
@ -287,7 +287,7 @@ index 032d284..2d87c08 100644
HRESULT hr;
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
@@ -4236,20 +4197,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
@@ -4243,20 +4204,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
}
}
@ -308,7 +308,7 @@ index 032d284..2d87c08 100644
if (!surface->resource.locations)
{
ERR("Surface %p does not have any up to date location.\n", surface);
@@ -5413,7 +5360,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5411,7 +5358,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
{
struct wined3d_context *context = context_acquire(device, dst_surface);
@ -318,8 +318,8 @@ index 032d284..2d87c08 100644
context_release(context);
}
return WINED3D_OK;
@@ -5487,6 +5435,17 @@ cpu:
return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter);
@@ -5481,6 +5429,17 @@ cpu:
return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter);
}
+static const struct wined3d_resource_ops surface_resource_ops =
@ -337,7 +337,7 @@ index 032d284..2d87c08 100644
const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags)
{
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 5e2c515..7463ae2 100644
index 4009dac..346129e 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -315,7 +315,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
@ -376,7 +376,7 @@ index 5e2c515..7463ae2 100644
src_dc = front->hDC;
window = swapchain->win_handle;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 71f1c47..e05238d 100644
index 2c768a0..36c32e0 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -774,7 +774,7 @@ static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub
@ -389,10 +389,10 @@ index 71f1c47..e05238d 100644
wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6fa239e..a5af340 100644
index 0866451..f3c47ec 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2468,8 +2468,6 @@ void surface_load_ds_location(struct wined3d_surface *surface,
@@ -2494,8 +2494,6 @@ void surface_load_ds_location(struct wined3d_surface *surface,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
struct wined3d_context *context) DECLSPEC_HIDDEN;
@ -402,5 +402,5 @@ index 6fa239e..a5af340 100644
void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context,
DWORD location) DECLSPEC_HIDDEN;
--
2.6.4
2.7.0

View File

@ -1,4 +1,4 @@
From eb73b6b42378386ce8af3594094ad61cd2c61754 Mon Sep 17 00:00:00 2001
From 35337f1570ec9899633d2bd65bed78c3a086ebbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Mon, 29 Apr 2013 18:49:53 +0200
Subject: wined3d: Send blits through the command stream.
@ -7,13 +7,13 @@ This needs more work. This patch breaks error handling, and the split
between surface_blt and surface_blt_ugly isn't particularly nice.
---
dlls/d3d9/tests/visual.c | 2 +-
dlls/wined3d/cs.c | 50 +++++++
dlls/wined3d/surface.c | 309 +++++++++++++++++++++++------------------
dlls/wined3d/cs.c | 50 ++++++++
dlls/wined3d/surface.c | 260 +++++++++++++++++++++++------------------
dlls/wined3d/wined3d_private.h | 8 ++
4 files changed, 229 insertions(+), 140 deletions(-)
4 files changed, 204 insertions(+), 116 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 120d688..fadba7b 100644
index 8b56dbe..ae4004a 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -1339,7 +1339,7 @@ static void color_fill_test(void)
@ -122,32 +122,24 @@ index de9fc9b..9fc92cf 100644
{
struct wined3d_cs_block *block;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 3c1ba32..c437fb3 100644
index bbbfe27..b13bc48 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4846,14 +4846,13 @@ const struct blit_shader cpu_blit = {
@@ -4850,7 +4850,7 @@ const struct blit_shader cpu_blit = {
cpu_blit_blit_surface,
};
-HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
- struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags,
-HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
{
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
struct wined3d_device *device = dst_surface->resource.device;
DWORD src_ds_flags, dst_ds_flags;
- RECT src_rect, dst_rect;
BOOL scale, convert;
static const DWORD simple_blit = WINEDDBLT_ASYNC
@@ -4865,111 +4864,6 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -4868,103 +4868,6 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
| WINEDDBLT_DONOTWAIT
| WINEDDBLT_ALPHATEST;
- TRACE("dst_surface %p, dst_rect_in %s, src_surface %p, src_rect_in %s, flags %#x, fx %p, filter %s.\n",
- dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in),
- TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
- dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
- flags, fx, debug_d3dtexturefiltertype(filter));
- TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->resource.usage));
-
@ -188,13 +180,11 @@ index 3c1ba32..c437fb3 100644
- return WINEDDERR_SURFACEBUSY;
- }
-
- surface_get_rect(dst_surface, dst_rect_in, &dst_rect);
-
- if (dst_rect.left >= dst_rect.right || dst_rect.top >= dst_rect.bottom
- || dst_rect.left > dst_surface->resource.width || dst_rect.left < 0
- || dst_rect.top > dst_surface->resource.height || dst_rect.top < 0
- || dst_rect.right > dst_surface->resource.width || dst_rect.right < 0
- || dst_rect.bottom > dst_surface->resource.height || dst_rect.bottom < 0)
- if (dst_rect->left >= dst_rect->right || dst_rect->top >= dst_rect->bottom
- || dst_rect->left > dst_surface->resource.width || dst_rect->left < 0
- || dst_rect->top > dst_surface->resource.height || dst_rect->top < 0
- || dst_rect->right > dst_surface->resource.width || dst_rect->right < 0
- || dst_rect->bottom > dst_surface->resource.height || dst_rect->bottom < 0)
- {
- WARN("The application gave us a bad destination rectangle.\n");
- return WINEDDERR_INVALIDRECT;
@ -202,22 +192,16 @@ index 3c1ba32..c437fb3 100644
-
- if (src_surface)
- {
- surface_get_rect(src_surface, src_rect_in, &src_rect);
-
- if (src_rect.left >= src_rect.right || src_rect.top >= src_rect.bottom
- || src_rect.left > src_surface->resource.width || src_rect.left < 0
- || src_rect.top > src_surface->resource.height || src_rect.top < 0
- || src_rect.right > src_surface->resource.width || src_rect.right < 0
- || src_rect.bottom > src_surface->resource.height || src_rect.bottom < 0)
- if (src_rect->left >= src_rect->right || src_rect->top >= src_rect->bottom
- || src_rect->left > src_surface->resource.width || src_rect->left < 0
- || src_rect->top > src_surface->resource.height || src_rect->top < 0
- || src_rect->right > src_surface->resource.width || src_rect->right < 0
- || src_rect->bottom > src_surface->resource.height || src_rect->bottom < 0)
- {
- WARN("Application gave us bad source rectangle for Blt.\n");
- WARN("The application gave us a bad source rectangle.\n");
- return WINEDDERR_INVALIDRECT;
- }
- }
- else
- {
- memset(&src_rect, 0, sizeof(src_rect));
- }
-
- if (!fx || !(fx->dwDDFX))
- flags &= ~WINEDDBLT_DDFX;
@ -254,27 +238,15 @@ index 3c1ba32..c437fb3 100644
if (!device->d3d_initialized)
{
WARN("D3D not initialized, using fallback.\n");
@@ -5012,8 +4906,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
}
scale = src_surface
- && (src_rect.right - src_rect.left != dst_rect.right - dst_rect.left
- || src_rect.bottom - src_rect.top != dst_rect.bottom - dst_rect.top);
+ && (src_rect->right - src_rect->left != dst_rect->right - dst_rect->left
+ || src_rect->bottom - src_rect->top != dst_rect->bottom - dst_rect->top);
convert = src_surface && src_surface->resource.format->id != dst_surface->resource.format->id;
dst_ds_flags = dst_surface->container->resource.format_flags
@@ -5033,22 +4927,16 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5028,22 +4931,16 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
TRACE("Depth fill.\n");
if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth))
- return WINED3DERR_INVALIDCALL;
+ return;
- if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, &dst_rect, depth)))
if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth)))
- return WINED3D_OK;
+ if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth)))
+ return;
}
else
@ -286,37 +258,22 @@ index 3c1ba32..c437fb3 100644
- }
-
if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->container->resource.draw_binding,
- &src_rect, dst_surface, dst_surface->container->resource.draw_binding, &dst_rect)))
src_rect, dst_surface, dst_surface->container->resource.draw_binding, dst_rect)))
- return WINED3D_OK;
+ src_rect, dst_surface, dst_surface->container->resource.draw_binding, dst_rect)))
+ return;
}
}
else
@@ -5079,8 +4967,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
palette, fx->u5.dwFillColor, &color))
@@ -5075,7 +4972,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
goto fallback;
- if (SUCCEEDED(surface_color_fill(dst_surface, &dst_rect, &color)))
if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color)))
- return WINED3D_OK;
+ if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color)))
+ return;
}
else
{
@@ -5112,9 +5000,9 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
TRACE("Not doing upload because of format conversion.\n");
else
{
- POINT dst_point = {dst_rect.left, dst_rect.top};
+ POINT dst_point = {dst_rect->left, dst_rect->top};
- if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, &src_rect)))
+ if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, src_rect)))
{
if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
{
@@ -5123,7 +5011,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5118,7 +5015,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
dst_surface->container->resource.draw_binding);
context_release(context);
}
@ -325,7 +282,7 @@ index 3c1ba32..c437fb3 100644
}
}
}
@@ -5147,51 +5035,194 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5142,7 +5039,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0);
dst_swapchain->desc.swap_effect = swap_effect;
@ -334,22 +291,7 @@ index 3c1ba32..c437fb3 100644
}
if (fbo_blit_supported(&device->adapter->gl_info, blit_op,
- &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
- &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
+ src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
+ dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
{
struct wined3d_context *context;
TRACE("Using FBO blit.\n");
context = context_acquire(device, NULL);
surface_blt_fbo(device, context, filter,
- src_surface, src_surface->container->resource.draw_binding, &src_rect,
- dst_surface, dst_surface->container->resource.draw_binding, &dst_rect);
+ src_surface, src_surface->container->resource.draw_binding, src_rect,
+ dst_surface, dst_surface->container->resource.draw_binding, dst_rect);
context_release(context);
@@ -5161,7 +5058,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding);
wined3d_resource_invalidate_location(&dst_surface->resource, ~dst_surface->container->resource.draw_binding);
@ -358,16 +300,11 @@ index 3c1ba32..c437fb3 100644
}
blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op,
- &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
- &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format);
+ src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
+ dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format);
if (blitter)
@@ -5171,18 +5068,151 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
{
blitter->blit_surface(device, blit_op, filter, src_surface,
- &src_rect, dst_surface, &dst_rect, color_key);
src_rect, dst_surface, dst_rect, color_key);
- return WINED3D_OK;
+ src_rect, dst_surface, dst_rect, color_key);
+ return;
}
}
@ -375,7 +312,7 @@ index 3c1ba32..c437fb3 100644
fallback:
/* Special cases for render targets. */
- if (SUCCEEDED(surface_blt_special(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter)))
- if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter)))
- return WINED3D_OK;
+ if ((dst_surface->resource.usage & WINED3DUSAGE_RENDERTARGET)
+ || (src_surface && (src_surface->resource.usage & WINED3DUSAGE_RENDERTARGET)))
@ -385,24 +322,19 @@ index 3c1ba32..c437fb3 100644
+ }
cpu:
/* For the rest call the X11 surface implementation. For render targets
* this should be implemented OpenGL accelerated in surface_blt_special(),
* other blits are rather rare. */
- return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter);
- return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter);
+ surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter);
+ return;
+}
+
+HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
+ struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags,
+HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
+ const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
+{
+ struct wined3d_device *device = dst_surface->resource.device;
+ RECT src_rect, dst_rect;
+
+ TRACE("dst_surface %p, dst_rect_in %s, src_surface %p, src_rect_in %s, flags %#x, fx %p, filter %s.\n",
+ dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in),
+ TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
+ dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
+ flags, fx, debug_d3dtexturefiltertype(filter));
+ TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->resource.usage));
+
@ -456,13 +388,11 @@ index 3c1ba32..c437fb3 100644
+ }
+ }
+
+ surface_get_rect(dst_surface, dst_rect_in, &dst_rect);
+
+ if (dst_rect.left >= dst_rect.right || dst_rect.top >= dst_rect.bottom
+ || dst_rect.left > dst_surface->resource.width || dst_rect.left < 0
+ || dst_rect.top > dst_surface->resource.height || dst_rect.top < 0
+ || dst_rect.right > dst_surface->resource.width || dst_rect.right < 0
+ || dst_rect.bottom > dst_surface->resource.height || dst_rect.bottom < 0)
+ if (dst_rect->left >= dst_rect->right || dst_rect->top >= dst_rect->bottom
+ || dst_rect->left > dst_surface->resource.width || dst_rect->left < 0
+ || dst_rect->top > dst_surface->resource.height || dst_rect->top < 0
+ || dst_rect->right > dst_surface->resource.width || dst_rect->right < 0
+ || dst_rect->bottom > dst_surface->resource.height || dst_rect->bottom < 0)
+ {
+ WARN("The application gave us a bad destination rectangle.\n");
+ return WINEDDERR_INVALIDRECT;
@ -472,15 +402,13 @@ index 3c1ba32..c437fb3 100644
+ {
+ DWORD src_ds_flags, dst_ds_flags;
+
+ surface_get_rect(src_surface, src_rect_in, &src_rect);
+
+ if (src_rect.left >= src_rect.right || src_rect.top >= src_rect.bottom
+ || src_rect.left > src_surface->resource.width || src_rect.left < 0
+ || src_rect.top > src_surface->resource.height || src_rect.top < 0
+ || src_rect.right > src_surface->resource.width || src_rect.right < 0
+ || src_rect.bottom > src_surface->resource.height || src_rect.bottom < 0)
+ if (src_rect->left >= src_rect->right || src_rect->top >= src_rect->bottom
+ || src_rect->left > src_surface->resource.width || src_rect->left < 0
+ || src_rect->top > src_surface->resource.height || src_rect->top < 0
+ || src_rect->right > src_surface->resource.width || src_rect->right < 0
+ || src_rect->bottom > src_surface->resource.height || src_rect->bottom < 0)
+ {
+ WARN("Application gave us bad source rectangle for Blt.\n");
+ WARN("The application gave us a bad source rectangle.\n");
+ return WINEDDERR_INVALIDRECT;
+ }
+
@ -493,11 +421,6 @@ index 3c1ba32..c437fb3 100644
+ WARN("Rejecting depth / stencil blit between incompatible formats.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ }
+ else
+ {
+ memset(&src_rect, 0, sizeof(src_rect));
+ }
+
+ if (!fx || !(fx->dwDDFX))
@ -526,7 +449,7 @@ index 3c1ba32..c437fb3 100644
+ }
+
+ TRACE("Emitting blit %p <== %p\n", dst_surface, src_surface);
+ wined3d_cs_emit_blt(device->cs, dst_surface, &dst_rect, src_surface, &src_rect,
+ wined3d_cs_emit_blt(device->cs, dst_surface, dst_rect, src_surface, src_rect,
+ flags, fx, filter);
+
+ return WINED3D_OK;
@ -534,10 +457,10 @@ index 3c1ba32..c437fb3 100644
static const struct wined3d_resource_ops surface_resource_ops =
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9979cb0..cca82ab 100644
index b5b1c81..43de51a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2522,6 +2522,9 @@ void wined3d_surface_destroy(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
@@ -2548,6 +2548,9 @@ void wined3d_surface_destroy(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point,
BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN;
@ -547,7 +470,7 @@ index 9979cb0..cca82ab 100644
void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context,
const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
@@ -2669,6 +2672,7 @@ struct wined3d_cs
@@ -2694,6 +2697,7 @@ struct wined3d_cs
struct wined3d_device *device;
struct wined3d_state state;
HANDLE thread;
@ -555,7 +478,7 @@ index 9979cb0..cca82ab 100644
DWORD tls_idx;
struct wined3d_surface *onscreen_depth_stencil;
@@ -2747,6 +2751,10 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs,
@@ -2772,6 +2776,10 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs,
GLenum primitive_type) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enable) DECLSPEC_HIDDEN;
@ -567,5 +490,5 @@ index 9979cb0..cca82ab 100644
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.6.2
2.7.0

View File

@ -1,4 +1,4 @@
From e366ff98587ac212a25fd28f9f26f18ca5f30382 Mon Sep 17 00:00:00 2001
From 190f220b618f92af812a06ea75d1a7cf93ef6194 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 28 Aug 2015 00:01:39 +0200
Subject: wined3d: Hack to reject unsupported color fills.
@ -8,11 +8,11 @@ Subject: wined3d: Hack to reject unsupported color fills.
1 file changed, 8 insertions(+)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e318bf106..f815b65 100644
index bf1f1cf..0a460cf 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -5302,6 +5302,14 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
memset(&src_rect, 0, sizeof(src_rect));
@@ -5220,6 +5220,14 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
}
}
+ /* FIXME: We should select the blitter in the main thread, that way we can return an error if the blit
@ -27,5 +27,5 @@ index e318bf106..f815b65 100644
flags &= ~WINEDDBLT_DDFX;
--
2.5.1
2.7.0

View File

@ -6614,19 +6614,10 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if ((surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->resource.map_binding))
== WINED3D_LOCATION_TEXTURE_RGB)
{
@@ -3819,15 +4780,55 @@
@@ -3819,6 +4780,42 @@
width = surface->resource.width;
wined3d_resource_get_pitch(&surface->resource, &src_row_pitch, &src_slice_pitch);
-
- format = *texture->resource.format;
- if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE)))
- format = *wined3d_get_format(gl_info, conversion->dst_format);
-
- /* Don't use PBOs for converted surfaces. During PBO conversion we look at
- * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
- * getting called. */
- if ((format.convert || conversion) && surface->resource.buffer)
+#else /* STAGING_CSMT */
+ if ((surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->resource.map_binding))
+ == WINED3D_LOCATION_TEXTURE_RGB)
@ -6663,16 +6654,15 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
+ width = surface->resource.width;
+ src_pitch = wined3d_surface_get_pitch(surface);
+#endif /* STAGING_CSMT */
+
+ format = *texture->resource.format;
+ if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE)))
+ format = *wined3d_get_format(gl_info, conversion->dst_format);
+
+ /* Don't use PBOs for converted surfaces. During PBO conversion we look at
+ * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
+ * getting called. */
format = *texture->resource.format;
if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE)))
@@ -3827,7 +4824,11 @@
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
* WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
* getting called. */
+#if defined(STAGING_CSMT)
+ if ((format.convert || conversion) && surface->resource.buffer)
if ((format.convert || conversion) && surface->resource.buffer)
+#else /* STAGING_CSMT */
+ if ((format.convert || conversion) && surface->pbo)
+#endif /* STAGING_CSMT */
@ -7289,38 +7279,25 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return hr;
}
@@ -4888,6 +6166,7 @@
@@ -4888,7 +6166,11 @@
cpu_blit_blit_surface,
};
+#if defined(STAGING_CSMT)
void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+#else /* STAGING_CSMT */
+HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+#endif /* STAGING_CSMT */
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
@@ -4895,6 +6174,16 @@
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
struct wined3d_device *device = dst_surface->resource.device;
DWORD src_ds_flags, dst_ds_flags;
+#else /* STAGING_CSMT */
+HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
+ struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags,
+ const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
+{
+ struct wined3d_swapchain *src_swapchain, *dst_swapchain;
+ struct wined3d_device *device = dst_surface->resource.device;
+ DWORD src_ds_flags, dst_ds_flags;
+ RECT src_rect, dst_rect;
+#endif /* STAGING_CSMT */
BOOL scale, convert;
static const DWORD simple_blit = WINEDDBLT_ASYNC
@@ -4906,6 +6195,106 @@
{
@@ -4906,6 +6188,98 @@
| WINEDDBLT_DONOTWAIT
| WINEDDBLT_ALPHATEST;
+#if !defined(STAGING_CSMT)
+ TRACE("dst_surface %p, dst_rect_in %s, src_surface %p, src_rect_in %s, flags %#x, fx %p, filter %s.\n",
+ dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in),
+ TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
+ dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
+ flags, fx, debug_d3dtexturefiltertype(filter));
+ TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->resource.usage));
+
@ -7361,13 +7338,11 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
+ return WINEDDERR_SURFACEBUSY;
+ }
+
+ surface_get_rect(dst_surface, dst_rect_in, &dst_rect);
+
+ if (dst_rect.left >= dst_rect.right || dst_rect.top >= dst_rect.bottom
+ || dst_rect.left > dst_surface->resource.width || dst_rect.left < 0
+ || dst_rect.top > dst_surface->resource.height || dst_rect.top < 0
+ || dst_rect.right > dst_surface->resource.width || dst_rect.right < 0
+ || dst_rect.bottom > dst_surface->resource.height || dst_rect.bottom < 0)
+ if (dst_rect->left >= dst_rect->right || dst_rect->top >= dst_rect->bottom
+ || dst_rect->left > dst_surface->resource.width || dst_rect->left < 0
+ || dst_rect->top > dst_surface->resource.height || dst_rect->top < 0
+ || dst_rect->right > dst_surface->resource.width || dst_rect->right < 0
+ || dst_rect->bottom > dst_surface->resource.height || dst_rect->bottom < 0)
+ {
+ WARN("The application gave us a bad destination rectangle.\n");
+ return WINEDDERR_INVALIDRECT;
@ -7375,22 +7350,16 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
+
+ if (src_surface)
+ {
+ surface_get_rect(src_surface, src_rect_in, &src_rect);
+
+ if (src_rect.left >= src_rect.right || src_rect.top >= src_rect.bottom
+ || src_rect.left > src_surface->resource.width || src_rect.left < 0
+ || src_rect.top > src_surface->resource.height || src_rect.top < 0
+ || src_rect.right > src_surface->resource.width || src_rect.right < 0
+ || src_rect.bottom > src_surface->resource.height || src_rect.bottom < 0)
+ if (src_rect->left >= src_rect->right || src_rect->top >= src_rect->bottom
+ || src_rect->left > src_surface->resource.width || src_rect->left < 0
+ || src_rect->top > src_surface->resource.height || src_rect->top < 0
+ || src_rect->right > src_surface->resource.width || src_rect->right < 0
+ || src_rect->bottom > src_surface->resource.height || src_rect->bottom < 0)
+ {
+ WARN("Application gave us bad source rectangle for Blt.\n");
+ WARN("The application gave us a bad source rectangle.\n");
+ return WINEDDERR_INVALIDRECT;
+ }
+ }
+ else
+ {
+ memset(&src_rect, 0, sizeof(src_rect));
+ }
+
+ if (!fx || !(fx->dwDDFX))
+ flags &= ~WINEDDBLT_DDFX;
@ -7421,21 +7390,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (!device->d3d_initialized)
{
WARN("D3D not initialized, using fallback.\n");
@@ -4948,8 +6337,13 @@
}
scale = src_surface
+#if defined(STAGING_CSMT)
&& (src_rect->right - src_rect->left != dst_rect->right - dst_rect->left
|| src_rect->bottom - src_rect->top != dst_rect->bottom - dst_rect->top);
+#else /* STAGING_CSMT */
+ && (src_rect.right - src_rect.left != dst_rect.right - dst_rect.left
+ || src_rect.bottom - src_rect.top != dst_rect.bottom - dst_rect.top);
+#endif /* STAGING_CSMT */
convert = src_surface && src_surface->resource.format->id != dst_surface->resource.format->id;
dst_ds_flags = dst_surface->container->resource.format_flags
@@ -4969,6 +6363,7 @@
@@ -4969,6 +6343,7 @@
TRACE("Depth fill.\n");
if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth))
@ -7443,14 +7398,14 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return;
if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth)))
@@ -4979,6 +6374,24 @@
@@ -4979,6 +6354,24 @@
if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->container->resource.draw_binding,
src_rect, dst_surface, dst_surface->container->resource.draw_binding, dst_rect)))
return;
+#else /* STAGING_CSMT */
+ return WINED3DERR_INVALIDCALL;
+
+ if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, &dst_rect, depth)))
+ if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth)))
+ return WINED3D_OK;
+ }
+ else
@ -7462,13 +7417,13 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
+ }
+
+ if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->container->resource.draw_binding,
+ &src_rect, dst_surface, dst_surface->container->resource.draw_binding, &dst_rect)))
+ src_rect, dst_surface, dst_surface->container->resource.draw_binding, dst_rect)))
+ return WINED3D_OK;
+#endif /* STAGING_CSMT */
}
}
else
@@ -4987,8 +6400,13 @@
@@ -4987,8 +6380,13 @@
/* In principle this would apply to depth blits as well, but we don't
* implement those in the CPU blitter at the moment. */
@ -7482,21 +7437,19 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
if (scale)
TRACE("Not doing sysmem blit because of scaling.\n");
@@ -5009,8 +6427,13 @@
palette, fx->u5.dwFillColor, &color))
@@ -5010,7 +6408,11 @@
goto fallback;
+#if defined(STAGING_CSMT)
if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color)))
+#if defined(STAGING_CSMT)
return;
+#else /* STAGING_CSMT */
+ if (SUCCEEDED(surface_color_fill(dst_surface, &dst_rect, &color)))
+ return WINED3D_OK;
+#endif /* STAGING_CSMT */
}
else
{
@@ -5032,8 +6455,13 @@
@@ -5032,8 +6434,13 @@
{
blit_op = WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST;
}
@ -7510,26 +7463,17 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
/* Upload */
if (scale)
@@ -5042,6 +6470,7 @@
TRACE("Not doing upload because of format conversion.\n");
else
{
@@ -5049,11 +6456,18 @@
if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
{
struct wined3d_context *context = context_acquire(device, dst_surface);
+#if defined(STAGING_CSMT)
POINT dst_point = {dst_rect->left, dst_rect->top};
if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, src_rect)))
@@ -5054,6 +6483,19 @@
wined3d_resource_load_location(&dst_surface->resource, context,
dst_surface->container->resource.draw_binding);
context_release(context);
}
return;
+#else /* STAGING_CSMT */
+ POINT dst_point = {dst_rect.left, dst_rect.top};
+
+ if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, &src_rect)))
+ {
+ if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
+ {
+ struct wined3d_context *context = context_acquire(device, dst_surface);
+ surface_load_location(dst_surface, context, dst_surface->container->resource.draw_binding);
+ context_release(context);
+ }
@ -7538,48 +7482,49 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
}
}
@@ -5077,6 +6519,7 @@
@@ -5077,7 +6491,11 @@
wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0);
dst_swapchain->desc.swap_effect = swap_effect;
+#if defined(STAGING_CSMT)
return;
}
@@ -5285,6 +6728,54 @@
wined3d_surface_location_invalidated,
wined3d_surface_load_location,
};
+#else /* STAGING_CSMT */
+ return WINED3D_OK;
+ }
+
+ if (fbo_blit_supported(&device->adapter->gl_info, blit_op,
+ &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
+ &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format))
+ {
+ struct wined3d_context *context;
+ TRACE("Using FBO blit.\n");
+
+ context = context_acquire(device, NULL);
+ surface_blt_fbo(device, context, filter,
+ src_surface, src_surface->container->resource.draw_binding, &src_rect,
+ dst_surface, dst_surface->container->resource.draw_binding, &dst_rect);
+ context_release(context);
+
+#endif /* STAGING_CSMT */
}
if (fbo_blit_supported(&device->adapter->gl_info, blit_op,
@@ -5093,10 +6511,17 @@
dst_surface, dst_surface->container->resource.draw_binding, dst_rect);
context_release(context);
+#if defined(STAGING_CSMT)
wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding);
wined3d_resource_invalidate_location(&dst_surface->resource, ~dst_surface->container->resource.draw_binding);
return;
+#else /* STAGING_CSMT */
+ surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding);
+ surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding);
+
+ return WINED3D_OK;
+ }
+
+ blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op,
+ &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format,
+ &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format);
+ if (blitter)
+ {
+ blitter->blit_surface(device, blit_op, filter, src_surface,
+ &src_rect, dst_surface, &dst_rect, color_key);
+#endif /* STAGING_CSMT */
}
blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op,
@@ -5106,6 +6531,7 @@
{
blitter->blit_surface(device, blit_op, filter, src_surface,
src_rect, dst_surface, dst_rect, color_key);
+#if defined(STAGING_CSMT)
return;
}
}
@@ -5271,6 +6697,21 @@
wined3d_surface_location_invalidated,
wined3d_surface_load_location,
};
+#else /* STAGING_CSMT */
+ return WINED3D_OK;
+ }
+ }
@ -7587,21 +7532,17 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
+
+fallback:
+ /* Special cases for render targets. */
+ if (SUCCEEDED(surface_blt_special(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter)))
+ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter)))
+ return WINED3D_OK;
+
+cpu:
+
+ /* For the rest call the X11 surface implementation. For render targets
+ * this should be implemented OpenGL accelerated in surface_blt_special(),
+ * other blits are rather rare. */
+ return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter);
+ return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter);
+}
+#endif /* STAGING_CSMT */
static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,
const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags)
@@ -5346,7 +6837,11 @@
@@ -5332,7 +6773,11 @@
}
surface->container = container;
@ -7613,7 +7554,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
list_init(&surface->renderbuffers);
list_init(&surface->overlays);
@@ -5378,9 +6873,14 @@
@@ -5364,9 +6809,14 @@
if (surface->resource.map_binding == WINED3D_LOCATION_DIB)
{
wined3d_resource_free_sysmem(&surface->resource);
@ -7628,7 +7569,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
return hr;
@@ -5407,7 +6907,11 @@
@@ -5393,7 +6843,11 @@
if (FAILED(hr = surface_init(object, container, desc, target, level, layer, flags)))
{
WARN("Failed to initialize surface, returning %#x.\n", hr);
@ -8327,7 +8268,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
return hr;
}
@@ -1510,6 +1638,9 @@
@@ -1523,6 +1651,9 @@
if (FAILED(hr))
{
WARN("Failed to initialize texture, returning %#x.\n", hr);