Rebase against 9bdab23bf7a57e92656782907ae2ac67ed292f0b.

This commit is contained in:
Sebastian Lackner 2016-02-04 02:56:45 +01:00
parent b8de48bb3a
commit 21ac67b551
9 changed files with 528 additions and 467 deletions

View File

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

View File

@ -1,4 +1,4 @@
From 718c45baa4a33a7756f49195dbe240a414534946 Mon Sep 17 00:00:00 2001
From 2c0a31e8b32070ac3de5ce8a5bcb9d07ff8ee539 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sat, 4 Jan 2014 01:02:15 +0100
Subject: wined3d: Remove surface_invalidate_location.
@ -8,9 +8,9 @@ Subject: wined3d: Remove surface_invalidate_location.
dlls/wined3d/context.c | 2 +-
dlls/wined3d/device.c | 4 ++--
dlls/wined3d/drawprim.c | 2 +-
dlls/wined3d/surface.c | 47 ++++++++++++++++-----------------------
dlls/wined3d/swapchain.c | 6 ++---
dlls/wined3d/texture.c | 6 ++---
dlls/wined3d/surface.c | 43 ++++++++++++++++-----------------------
dlls/wined3d/swapchain.c | 6 +++---
dlls/wined3d/texture.c | 10 ++++-----
dlls/wined3d/wined3d_private.h | 1 -
8 files changed, 29 insertions(+), 41 deletions(-)
@ -41,7 +41,7 @@ index 490c20f..9408cd9 100644
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7b3776b..d2de1eb 100644
index 8ff6802..0a5b48d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -399,7 +399,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
@ -76,7 +76,7 @@ index 75489db..9ba6ef7 100644
else
{
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 36ba9ea..ac44ce3 100644
index 048aa74..5482650 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -597,7 +597,7 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
@ -152,25 +152,7 @@ index 36ba9ea..ac44ce3 100644
switch (surface->resource.map_binding)
{
@@ -2771,7 +2774,7 @@ HRESULT wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
}
surface_load_location(surface, context, WINED3D_LOCATION_DIB);
- surface_invalidate_location(surface, ~WINED3D_LOCATION_DIB);
+ wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB);
if (context)
context_release(context);
@@ -2820,7 +2823,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
context = context_acquire(device, NULL);
surface_load_location(surface, context, surface->resource.map_binding);
- surface_invalidate_location(surface, WINED3D_LOCATION_DIB);
+ wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB);
if (context)
context_release(context);
}
@@ -3145,7 +3148,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
@@ -3053,7 +3056,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. */
wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB);
@ -179,7 +161,7 @@ index 36ba9ea..ac44ce3 100644
}
/* Uses the hardware to stretch and flip the image */
@@ -3213,7 +3216,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
@@ -3121,7 +3124,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
checkGLcall("glEnable(texture_target)");
/* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */
@ -188,7 +170,7 @@ index 36ba9ea..ac44ce3 100644
}
/* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag
@@ -3418,7 +3421,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
@@ -3326,7 +3329,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. */
wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB);
@ -197,7 +179,7 @@ index 36ba9ea..ac44ce3 100644
}
/* Front buffer coordinates are always full screen coordinates, but our GL
@@ -3895,18 +3898,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
@@ -3803,18 +3806,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
surface->ds_current_size.cy = surface->resource.height;
}
@ -216,7 +198,7 @@ index 36ba9ea..ac44ce3 100644
static DWORD resource_access_from_location(DWORD location)
{
switch (location)
@@ -4473,7 +4464,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
@@ -4381,7 +4372,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
(old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding);
@ -225,7 +207,7 @@ index 36ba9ea..ac44ce3 100644
}
const struct blit_shader ffp_blit = {
@@ -5450,7 +5441,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -5358,7 +5349,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
context_release(context);
wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding);
@ -234,7 +216,7 @@ index 36ba9ea..ac44ce3 100644
return WINED3D_OK;
}
@@ -5569,7 +5560,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
@@ -5477,7 +5468,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
{
wined3d_resource_free_sysmem(&surface->resource);
wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DIB);
@ -275,7 +257,7 @@ index a97d1f7..a054c05 100644
/* MSDN says we're only allowed a single fullscreen swapchain per device,
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 2fa78f4..c51883f 100644
index 535159a..da1bbbb 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -776,7 +776,7 @@ static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub
@ -298,12 +280,30 @@ index 2fa78f4..c51883f 100644
}
static void texture2d_sub_resource_validate_location(struct wined3d_resource *sub_resource, DWORD location)
@@ -1560,7 +1558,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
}
surface_load_location(surface, context, WINED3D_LOCATION_DIB);
- surface_invalidate_location(surface, ~WINED3D_LOCATION_DIB);
+ wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB);
if (context)
context_release(context);
@@ -1623,7 +1621,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
context = context_acquire(device, NULL);
surface_load_location(surface, context, surface->resource.map_binding);
- surface_invalidate_location(surface, WINED3D_LOCATION_DIB);
+ wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB);
if (context)
context_release(context);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 00e01fe..af7837d 100644
index 05fbac6..0c34527 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2511,7 +2511,6 @@ GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HID
HRESULT wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) DECLSPEC_HIDDEN;
@@ -2511,7 +2511,6 @@ HRESULT surface_create_dib_section(struct wined3d_surface *surface) DECLSPEC_HID
GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
-void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From e1e98fc97f883a0ed00d7475bc2131df7d46c224 Mon Sep 17 00:00:00 2001
From 23073dd21edfc9da7aea0cc40689f813da6e93f5 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.
@ -8,9 +8,9 @@ FIXME: Check if this patch is complete enough to make sense.
dlls/wined3d/context.c | 2 +-
dlls/wined3d/device.c | 4 +-
dlls/wined3d/drawprim.c | 2 +-
dlls/wined3d/surface.c | 113 +++++++++++++----------------------------
dlls/wined3d/surface.c | 109 +++++++++++++----------------------------
dlls/wined3d/swapchain.c | 8 +--
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/texture.c | 6 +--
dlls/wined3d/wined3d_private.h | 2 -
7 files changed, 45 insertions(+), 88 deletions(-)
@ -28,7 +28,7 @@ index 9408cd9..0d9de90 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 d34aa4e..5e02b97 100644
index 0a5b48d..ce31e25 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 d34aa4e..5e02b97 100644
else
wined3d_surface_prepare(rt, context, rt->container->resource.draw_binding);
}
@@ -4116,7 +4116,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4123,7 +4123,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 151dcd0..9987919 100644
index a799143..604a79c 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -735,7 +735,7 @@ static void surface_unmap(struct wined3d_surface *surface)
@ -99,7 +99,7 @@ index 151dcd0..9987919 100644
else
wined3d_surface_prepare(dst_surface, old_ctx, dst_location);
@@ -1148,7 +1148,7 @@ static void surface_unload(struct wined3d_resource *resource)
@@ -1156,7 +1156,7 @@ static void surface_unload(struct wined3d_resource *resource)
else
{
surface_prepare_map_memory(surface);
@ -108,7 +108,7 @@ index 151dcd0..9987919 100644
wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding);
}
@@ -1206,24 +1206,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour
@@ -1214,24 +1214,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour
wined3d_texture_set_dirty(surface->container);
}
@ -133,7 +133,7 @@ index 151dcd0..9987919 100644
static const struct wined3d_surface_ops surface_ops =
{
surface_private_setup,
@@ -1683,7 +1665,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
@@ -1691,7 +1673,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 151dcd0..9987919 100644
wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE);
surface_get_memory(src_surface, &data, src_surface->resource.locations);
@@ -1816,7 +1798,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte
@@ -1824,7 +1806,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte
}
TRACE("Reloading because surface is dirty.\n");
@ -151,7 +151,7 @@ index 151dcd0..9987919 100644
surface_evict_sysmem(surface);
}
@@ -2690,7 +2672,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
@@ -2666,7 +2648,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
if (surface->resource.device->d3d_initialized)
context = context_acquire(surface->resource.device, NULL);
@ -160,25 +160,7 @@ index 151dcd0..9987919 100644
if (context)
context_release(context);
}
@@ -2805,7 +2787,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
surface->resource.map_binding = WINED3D_LOCATION_DIB;
}
- surface_load_location(surface, context, WINED3D_LOCATION_DIB);
+ wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_DIB);
wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB);
if (context)
@@ -2854,7 +2836,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
if (device->d3d_initialized)
context = context_acquire(device, NULL);
- surface_load_location(surface, context, surface->resource.map_binding);
+ wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding);
wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB);
if (context)
context_release(context);
@@ -3491,8 +3473,8 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
@@ -3393,8 +3375,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 +171,7 @@ index 151dcd0..9987919 100644
wined3d_texture_load(src_surface->container, context, FALSE);
/* Activate the destination context, set it up for blitting */
@@ -3912,29 +3894,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
@@ -3814,29 +3796,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
surface->ds_current_size.cy = surface->resource.height;
}
@ -219,7 +201,7 @@ index 151dcd0..9987919 100644
static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD location)
{
struct wined3d_device *device = surface->resource.device;
@@ -3984,7 +3943,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
@@ -3886,7 +3845,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
}
if (surface->resource.locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
@ -228,7 +210,7 @@ index 151dcd0..9987919 100644
/* Download the surface to system memory. */
if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
@@ -4020,7 +3979,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
@@ -3922,7 +3881,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
}
surface_get_rect(surface, NULL, &r);
@ -237,7 +219,7 @@ index 151dcd0..9987919 100644
surface_blt_to_drawable(surface->resource.device, context,
WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r);
@@ -4093,7 +4052,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -3995,7 +3954,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 +228,7 @@ index 151dcd0..9987919 100644
}
}
else
@@ -4104,7 +4063,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -4006,7 +3965,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 +237,7 @@ index 151dcd0..9987919 100644
}
}
@@ -4113,7 +4072,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -4015,7 +3974,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 +246,7 @@ index 151dcd0..9987919 100644
}
wined3d_texture_prepare_texture(texture, context, srgb);
@@ -4139,7 +4098,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -4041,7 +4000,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
surface->resource.map_binding = WINED3D_LOCATION_SYSMEM;
surface_prepare_map_memory(surface);
@ -273,7 +255,7 @@ index 151dcd0..9987919 100644
surface_remove_pbo(surface, gl_info);
}
@@ -4214,9 +4173,11 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
@@ -4116,9 +4075,11 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
surface, src_location, &rect, surface, dst_location, &rect);
}
@ -287,7 +269,7 @@ index 151dcd0..9987919 100644
HRESULT hr;
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
@@ -4243,20 +4204,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
@@ -4145,20 +4106,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
}
}
@ -308,7 +290,7 @@ index 151dcd0..9987919 100644
if (!surface->resource.locations)
{
ERR("Surface %p does not have any up to date location.\n", surface);
@@ -5411,7 +5358,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5313,7 +5260,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
{
struct wined3d_context *context = context_acquire(device, dst_surface);
@ -318,7 +300,7 @@ index 151dcd0..9987919 100644
context_release(context);
}
return WINED3D_OK;
@@ -5481,6 +5429,17 @@ cpu:
@@ -5383,6 +5331,17 @@ cpu:
return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter);
}
@ -376,7 +358,7 @@ index 4009dac..346129e 100644
src_dc = front->hDC;
window = swapchain->win_handle;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 2c768a0..36c32e0 100644
index 49bc782..dd3a600 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
@ -388,11 +370,29 @@ index 2c768a0..36c32e0 100644
context_release(context);
wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding);
}
@@ -1565,7 +1565,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
surface->resource.map_binding = WINED3D_LOCATION_DIB;
}
- surface_load_location(surface, context, WINED3D_LOCATION_DIB);
+ wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_DIB);
wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB);
if (context)
@@ -1628,7 +1628,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
if (device->d3d_initialized)
context = context_acquire(device, NULL);
- surface_load_location(surface, context, surface->resource.map_binding);
+ wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding);
wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB);
if (context)
context_release(context);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0866451..f3c47ec 100644
index a62459c..afc8c4e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2494,8 +2494,6 @@ void surface_load_ds_location(struct wined3d_surface *surface,
@@ -2519,8 +2519,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;

View File

@ -1,15 +1,16 @@
From 2e105cc77b4f86b1dc044e3dc174a61df5d30a43 Mon Sep 17 00:00:00 2001
From 1c6393b228a4764d3b7383fea540948ba147e009 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 21 Jan 2014 13:25:48 +0100
Subject: wined3d: Remove surface->pbo.
---
dlls/wined3d/surface.c | 36 ++++++++++++++++++------------------
dlls/wined3d/surface.c | 34 +++++++++++++++++-----------------
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/wined3d_private.h | 2 --
2 files changed, 18 insertions(+), 20 deletions(-)
3 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 58d825c..4cdd104 100644
index 604a79c..75abc0a 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -46,7 +46,7 @@ static void surface_cleanup(struct wined3d_surface *surface)
@ -70,7 +71,7 @@ index 58d825c..4cdd104 100644
checkGLcall("glBindBuffer");
GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, surface->resource.size + 4,
@@ -735,7 +735,7 @@ static void surface_unmap(struct wined3d_surface *surface)
@@ -711,7 +711,7 @@ static void surface_unmap(struct wined3d_surface *surface)
context = context_acquire(device, NULL);
gl_info = context->gl_info;
@ -79,7 +80,7 @@ index 58d825c..4cdd104 100644
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("glUnmapBuffer");
@@ -1127,10 +1127,10 @@ HRESULT CDECL wined3d_surface_get_render_target_data(struct wined3d_surface *sur
@@ -1091,10 +1091,10 @@ static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, DW
/* Context activation is done by the caller. */
static void surface_remove_pbo(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
{
@ -93,7 +94,7 @@ index 58d825c..4cdd104 100644
wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_BUFFER);
}
@@ -1187,7 +1187,7 @@ static void surface_unload(struct wined3d_resource *resource)
@@ -1161,7 +1161,7 @@ static void surface_unload(struct wined3d_resource *resource)
}
/* Destroy PBOs, but load them into real sysmem before */
@ -102,7 +103,7 @@ index 58d825c..4cdd104 100644
surface_remove_pbo(surface, gl_info);
/* Destroy fbo render buffers. This is needed for implicit render targets, for
@@ -2753,7 +2753,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
@@ -2674,7 +2674,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
context = context_acquire(device, NULL);
gl_info = context->gl_info;
@ -111,16 +112,7 @@ index 58d825c..4cdd104 100644
base_memory = GL_EXTCALL(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_READ_WRITE));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("map PBO");
@@ -2844,7 +2844,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
}
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|| surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
- || surface->pbo))
+ || surface->resource.buffer_object))
surface->resource.map_binding = WINED3D_LOCATION_DIB;
}
@@ -4180,7 +4180,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -3990,7 +3990,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* 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. */
@ -129,11 +121,24 @@ index 58d825c..4cdd104 100644
{
TRACE("Removing the pbo attached to surface %p.\n", surface);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index dd3a600..d41b79e 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1561,7 +1561,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
}
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|| surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
- || surface->pbo))
+ || surface->resource.buffer_object))
surface->resource.map_binding = WINED3D_LOCATION_DIB;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f948f73..839dc7f 100644
index 3bbe506..7aba4a7 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2390,8 +2390,6 @@ struct wined3d_surface
@@ -2468,8 +2468,6 @@ struct wined3d_surface
UINT pow2Width;
UINT pow2Height;
@ -143,5 +148,5 @@ index f948f73..839dc7f 100644
GLuint rb_resolved;
GLenum texture_target;
--
2.5.1
2.7.0

View File

@ -1,4 +1,4 @@
From 202b76ec8661edf0a2301af36c1f9e39af59a70c Mon Sep 17 00:00:00 2001
From e331bfd377b81bc93649d5a7f744929f6b6009bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 19 Sep 2013 18:00:23 +0200
Subject: wined3d: Use resource_map for surface_map.
@ -23,7 +23,7 @@ index 9b5445d..ba0e1c9 100644
if (device->d3d_initialized)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 14417ea..f5db7d6 100644
index fbebca5..0eb56d5 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2365,28 +2365,18 @@ do { \
@ -169,7 +169,7 @@ index 14417ea..f5db7d6 100644
+ return wined3d_resource_map(&surface->resource, map_desc, box, flags);
}
HRESULT wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
static void read_from_framebuffer(struct wined3d_surface *surface,
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 5180b56..f59ff5912 100644
--- a/dlls/wined3d/volume.c

View File

@ -1,19 +1,19 @@
From 6abbf0a97d9e72b5f599f48c5a591a0d2917eee6 Mon Sep 17 00:00:00 2001
From d7b34fde19f7788ee528276df9231e9658b2adbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 26 Sep 2013 16:40:34 +0200
Subject: wined3d: Wait for the CS in GetDC.
---
dlls/wined3d/surface.c | 14 ++++++++++++++
dlls/wined3d/texture.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index bef62bb..3653626 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2548,6 +2548,20 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index efb134b..fddbe93 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1552,6 +1552,20 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
TRACE("surface %p, dc %p.\n", surface, dc);
surface = surface_from_resource(sub_resource);
+ if (!(surface->container->resource.format_flags & WINED3DFMT_FLAG_GETDC))
+ {
@ -33,5 +33,5 @@ index bef62bb..3653626 100644
if (surface->flags & SFLAG_DCINUSE)
return WINEDDERR_DCALREADYCREATED;
--
2.5.1
2.7.0

View File

@ -1,4 +1,4 @@
From 08092b494b98ca7ca22998b5afb4adcd6172a0fc Mon Sep 17 00:00:00 2001
From c9ba533914088eba32bfa04e4318c1b18b20388e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 30 Aug 2013 17:00:35 +0200
Subject: wined3d: Wrap GL BOs in a structure
@ -8,16 +8,17 @@ them for DISCARD maps.
---
dlls/wined3d/device.c | 53 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/resource.c | 34 +++++++++++----------------
dlls/wined3d/surface.c | 6 ++---
dlls/wined3d/surface.c | 4 ++--
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/volume.c | 6 ++---
dlls/wined3d/wined3d_private.h | 15 +++++++++++-
5 files changed, 86 insertions(+), 28 deletions(-)
6 files changed, 86 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index eb0c0ba..d0fcba2 100644
index 46058ef..4325e65 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5139,3 +5139,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5254,3 +5254,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -75,10 +76,10 @@ index eb0c0ba..d0fcba2 100644
+ wined3d_device_destroy_bo(device, context, bo);
+}
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 49ef6b9..37a2644 100644
index 3b9c609..611bfa3 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -226,12 +226,10 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
@@ -236,12 +236,10 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
void wined3d_resource_free_bo(struct wined3d_resource *resource)
{
struct wined3d_context *context = context_acquire(resource->device, NULL);
@ -94,7 +95,7 @@ index 49ef6b9..37a2644 100644
context_release(context);
}
@@ -247,7 +245,7 @@ void resource_cleanup(struct wined3d_resource *resource)
@@ -257,7 +255,7 @@ void resource_cleanup(struct wined3d_resource *resource)
adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size);
}
@ -103,7 +104,7 @@ index 49ef6b9..37a2644 100644
wined3d_resource_free_bo(resource);
wined3d_resource_free_sysmem(resource);
@@ -260,7 +258,7 @@ void resource_unload(struct wined3d_resource *resource)
@@ -270,7 +268,7 @@ void resource_unload(struct wined3d_resource *resource)
if (resource->map_count)
ERR("Resource %p is being unloaded while mapped.\n", resource);
@ -112,7 +113,7 @@ index 49ef6b9..37a2644 100644
wined3d_resource_free_bo(resource);
context_resource_unloaded(resource->device,
@@ -511,7 +509,7 @@ void wined3d_resource_get_memory(const struct wined3d_resource *resource,
@@ -537,7 +535,7 @@ void wined3d_resource_get_memory(const struct wined3d_resource *resource,
{
if (location & WINED3D_LOCATION_BUFFER)
{
@ -121,7 +122,7 @@ index 49ef6b9..37a2644 100644
data->addr = NULL;
return;
}
@@ -620,7 +618,7 @@ BYTE *wined3d_resource_get_map_ptr(const struct wined3d_resource *resource,
@@ -646,7 +644,7 @@ BYTE *wined3d_resource_get_map_ptr(const struct wined3d_resource *resource,
{
case WINED3D_LOCATION_BUFFER:
gl_info = context->gl_info;
@ -130,7 +131,7 @@ index 49ef6b9..37a2644 100644
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
{
@@ -663,7 +661,7 @@ void wined3d_resource_release_map_ptr(const struct wined3d_resource *resource,
@@ -689,7 +687,7 @@ void wined3d_resource_release_map_ptr(const struct wined3d_resource *resource,
{
case WINED3D_LOCATION_BUFFER:
gl_info = context->gl_info;
@ -139,7 +140,7 @@ index 49ef6b9..37a2644 100644
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Unmap GL buffer");
@@ -681,20 +679,14 @@ void wined3d_resource_release_map_ptr(const struct wined3d_resource *resource,
@@ -707,20 +705,14 @@ void wined3d_resource_release_map_ptr(const struct wined3d_resource *resource,
}
/* Context activation is done by the caller. */
@ -166,7 +167,7 @@ index 49ef6b9..37a2644 100644
BOOL wined3d_resource_prepare_system_memory(struct wined3d_resource *resource)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 025e85e1..fc1fc45 100644
index 40f4dab..3816f35 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -48,7 +48,7 @@ static void surface_cleanup(struct wined3d_surface *surface)
@ -178,16 +179,7 @@ index 025e85e1..fc1fc45 100644
|| surface->rb_resolved || !list_empty(&surface->renderbuffers))
{
struct wined3d_renderbuffer_entry *entry, *entry2;
@@ -2586,7 +2586,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
}
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|| surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
- || surface->resource.buffer_object))
+ || surface->resource.buffer))
surface->resource.map_binding = WINED3D_LOCATION_DIB;
}
@@ -3905,7 +3905,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -3701,7 +3701,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* 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. */
@ -196,11 +188,24 @@ index 025e85e1..fc1fc45 100644
{
TRACE("Removing the pbo attached to surface %p.\n", surface);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 12796198..0fcc436 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1586,7 +1586,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
}
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|| surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
- || surface->resource.buffer_object))
+ || surface->resource.buffer))
surface->resource.map_binding = WINED3D_LOCATION_DIB;
}
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index b79f44e..ea9a047 100644
index 807e626..d93a0bd 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -218,7 +218,7 @@ static void wined3d_volume_load_location(struct wined3d_resource *resource,
@@ -216,7 +216,7 @@ static void wined3d_volume_load_location(struct wined3d_resource *resource,
}
else if (volume->resource.locations & WINED3D_LOCATION_BUFFER)
{
@ -209,7 +214,7 @@ index b79f44e..ea9a047 100644
wined3d_texture_bind_and_dirtify(volume->container, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_volume_upload_data(volume, context, &data);
@@ -269,12 +269,12 @@ static void wined3d_volume_load_location(struct wined3d_resource *resource,
@@ -267,12 +267,12 @@ static void wined3d_volume_load_location(struct wined3d_resource *resource,
break;
case WINED3D_LOCATION_BUFFER:
@ -225,10 +230,10 @@ index b79f44e..ea9a047 100644
if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(volume->container, context, FALSE);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8a25420..9eb038e 100644
index 877dd1e..67301c8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2048,6 +2048,14 @@ struct wined3d_state
@@ -2120,6 +2120,14 @@ struct wined3d_state
DWORD render_states[WINEHIGHEST_RENDER_STATE + 1];
};
@ -243,7 +248,7 @@ index 8a25420..9eb038e 100644
#define WINED3D_UNMAPPED_STAGE ~0U
/* Multithreaded flag. Removed from the public header to signal that
@@ -2154,6 +2162,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
@@ -2229,6 +2237,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN;
void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN;
@ -255,7 +260,7 @@ index 8a25420..9eb038e 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2199,7 +2212,7 @@ struct wined3d_resource
@@ -2277,7 +2290,7 @@ struct wined3d_resource
DWORD priority;
void *heap_memory, *user_memory, *bitmap_data;
UINT custom_row_pitch, custom_slice_pitch;
@ -265,5 +270,5 @@ index 8a25420..9eb038e 100644
DWORD locations;
LONG access_fence;
--
2.5.1
2.7.0

View File

@ -1,4 +1,4 @@
From 01a9df15d682d90b75fc71facc1544488978ed83 Mon Sep 17 00:00:00 2001
From f51b464c3100bfdea3de7e6dde646f97e09fccb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 16 Mar 2014 14:13:42 +0100
Subject: wined3d: Send getdc and releasedc through the command stream.
@ -8,10 +8,11 @@ activation bug I just regret that I didn't describe more verbously
earlier. I forgot what it was about exactly and can't be bothered to
investigate atm.
---
dlls/wined3d/cs.c | 58 ++++++++++++++++++++++++++
dlls/wined3d/surface.c | 93 +++++++++++++++++++++---------------------
dlls/wined3d/wined3d_private.h | 4 ++
3 files changed, 109 insertions(+), 46 deletions(-)
dlls/wined3d/cs.c | 58 ++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 56 +++++++++++++++++++++++++++++++++++++++
dlls/wined3d/texture.c | 60 +++---------------------------------------
dlls/wined3d/wined3d_private.h | 4 +++
4 files changed, 121 insertions(+), 57 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 0aab83b..c135ece 100644
@ -104,28 +105,91 @@ index 0aab83b..c135ece 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 47320b8..457d3aa 100644
index 822f36f..d70e310 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2456,36 +2456,12 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
@@ -2456,6 +2456,62 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
return wined3d_resource_map(&surface->resource, map_desc, box, flags);
}
-HRESULT wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
+void wined3d_surface_getdc_cs(struct wined3d_surface *surface)
+{
+ HRESULT hr;
+ struct wined3d_device *device = surface->resource.device;
+ struct wined3d_context *context = NULL;
+
+ if (device->d3d_initialized)
+ context = context_acquire(device, NULL);
+
+ /* Create a DIB section if there isn't a dc yet. */
+ if (!surface->hDC)
+ {
+ if (FAILED(hr = surface_create_dib_section(surface)))
+ {
+ if (context)
+ context_release(context);
+ return;
+ }
+ if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
+ || surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
+ || surface->resource.buffer))
+ surface->resource.map_binding = WINED3D_LOCATION_DIB;
+ }
+
+ wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_DIB);
+ wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB);
+
+ if (context)
+ context_release(context);
+}
+
+void wined3d_surface_releasedc_cs(struct wined3d_surface *surface)
+{
+ if (surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY || (surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
+ && surface->resource.map_binding != WINED3D_LOCATION_DIB))
+ {
+ /* The game Salammbo modifies the surface contents without mapping the surface between
+ * a GetDC/ReleaseDC operation and flipping the surface. If the DIB remains the active
+ * copy and is copied to the screen, this update, which draws the mouse pointer, is lost.
+ * Do not only copy the DIB to the map location, but also make sure the map location is
+ * copied back to the DIB in the next getdc call.
+ *
+ * The same consideration applies to user memory surfaces. */
+ struct wined3d_device *device = surface->resource.device;
+ struct wined3d_context *context = NULL;
+
+ if (device->d3d_initialized)
+ context = context_acquire(device, NULL);
+
+ wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding);
+ wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB);
+ if (context)
+ context_release(context);
+ }
+}
+
static void read_from_framebuffer(struct wined3d_surface *surface,
struct wined3d_context *old_ctx, DWORD dst_location)
{
HRESULT hr;
struct wined3d_device *device = surface->resource.device;
struct wined3d_context *context = NULL;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index d17a6e1..a9dbf42 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1561,10 +1561,8 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
{
struct wined3d_device *device = texture->resource.device;
- struct wined3d_context *context = NULL;
struct wined3d_resource *sub_resource;
struct wined3d_surface *surface;
- HRESULT hr;
TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc);
@@ -1585,14 +1583,6 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
return WINED3DERR_INVALIDCALL;
}
- TRACE("surface %p, dc %p.\n", surface, dc);
-
- if (!(surface->container->resource.format_flags & WINED3DFMT_FLAG_GETDC))
- {
- WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
- return WINED3DERR_INVALIDCALL;
- }
-
- if (wined3d_settings.cs_multithreaded)
- {
- struct wined3d_device *device = surface->resource.device;
@ -134,119 +198,88 @@ index 47320b8..457d3aa 100644
- device->cs->ops->finish(device->cs);
- }
-
- /* Give more detailed info for ddraw. */
- if (surface->flags & SFLAG_DCINUSE)
- return WINEDDERR_DCALREADYCREATED;
-
- /* Can't GetDC if the surface is locked. */
- if (surface->resource.map_count)
- return WINED3DERR_INVALIDCALL;
-
if (device->d3d_initialized)
context = context_acquire(surface->resource.device, NULL);
/* Give more detailed info for ddraw. */
if (surface->flags & SFLAG_DCINUSE)
return WINEDDERR_DCALREADYCREATED;
@@ -1601,43 +1591,18 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
if (surface->resource.map_count)
return WINED3DERR_INVALIDCALL;
@@ -2496,7 +2472,7 @@ HRESULT wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
{
if (context)
context_release(context);
- if (device->d3d_initialized)
- context = context_acquire(device, NULL);
-
- /* Create a DIB section if there isn't a dc yet. */
- if (!surface->hDC)
- {
- if (FAILED(hr = surface_create_dib_section(surface)))
- {
- if (context)
- context_release(context);
- return WINED3DERR_INVALIDCALL;
+ return;
}
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|| surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
@@ -2509,35 +2485,40 @@ HRESULT wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
- }
- if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
- || surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
- || surface->resource.buffer))
- surface->resource.map_binding = WINED3D_LOCATION_DIB;
- }
-
- wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_DIB);
- wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB);
-
- if (context)
- context_release(context);
-
surface->flags |= SFLAG_DCINUSE;
surface->resource.map_count++;
-
+ wined3d_cs_emit_getdc(device->cs, surface);
*dc = surface->hDC;
TRACE("Returning dc %p.\n", *dc);
if (context)
context_release(context);
-
- surface->flags |= SFLAG_DCINUSE;
- surface->resource.map_count++;
-
- *dc = surface->hDC;
- TRACE("Returning dc %p.\n", *dc);
-
- return WINED3D_OK;
+ return *dc ? WINED3D_OK : WINED3DERR_INVALIDCALL;
}
-HRESULT wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
+HRESULT wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
{
- TRACE("surface %p, dc %p.\n", surface, dc);
+ struct wined3d_device *device = surface->resource.device;
struct wined3d_device *device = texture->resource.device;
- struct wined3d_context *context = NULL;
struct wined3d_resource *sub_resource;
struct wined3d_surface *surface;
- if (!(surface->flags & SFLAG_DCINUSE))
- return WINEDDERR_NODC;
+ TRACE("surface %p, dc %p.\n", surface, dc);
- if (surface->hDC != dc)
+ if (!(surface->container->resource.format_flags & WINED3DFMT_FLAG_GETDC))
{
- WARN("Application tries to release invalid DC %p, surface DC is %p.\n",
- dc, surface->hDC);
- return WINEDDERR_NODC;
+ WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
+ return WINED3DERR_INVALIDCALL;
}
- surface->resource.map_count--;
- surface->flags &= ~SFLAG_DCINUSE;
+ /* Give more detailed info for ddraw. */
+ if (surface->flags & SFLAG_DCINUSE)
+ return WINEDDERR_DCALREADYCREATED;
+
+ /* Can't GetDC if the surface is locked. */
+ if (surface->resource.map_count)
+ return WINED3DERR_INVALIDCALL;
+
+ surface->flags |= SFLAG_DCINUSE;
+ surface->resource.map_count++;
+ wined3d_cs_emit_getdc(device->cs, surface);
+ *dc = surface->hDC;
+ TRACE("Returning dc %p.\n", *dc);
+
+ return *dc ? WINED3D_OK : WINED3DERR_INVALIDCALL;
+}
@@ -1667,26 +1632,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
surface->resource.map_count--;
surface->flags &= ~SFLAG_DCINUSE;
- if (surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
- || (surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
+void wined3d_surface_releasedc_cs(struct wined3d_surface *surface)
+{
+ if (surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY || (surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
&& surface->resource.map_binding != WINED3D_LOCATION_DIB))
{
/* The game Salammbo modifies the surface contents without mapping the surface between
@@ -2558,6 +2539,26 @@ HRESULT wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
if (context)
context_release(context);
}
+}
+
+HRESULT wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
+{
+ TRACE("surface %p, dc %p.\n", surface, dc);
+
+ if (!(surface->flags & SFLAG_DCINUSE))
+ return WINEDDERR_NODC;
+
+ if (surface->hDC != dc)
+ {
+ WARN("Application tries to release invalid DC %p, surface DC is %p.\n",
+ dc, surface->hDC);
+ return WINEDDERR_NODC;
+ }
+
+ surface->resource.map_count--;
+ surface->flags &= ~SFLAG_DCINUSE;
+
+ wined3d_cs_emit_releasedc(surface->resource.device->cs, surface);
- && surface->resource.map_binding != WINED3D_LOCATION_DIB))
- {
- /* The game Salammbo modifies the surface contents without mapping the surface between
- * a GetDC/ReleaseDC operation and flipping the surface. If the DIB remains the active
- * copy and is copied to the screen, this update, which draws the mouse pointer, is lost.
- * Do not only copy the DIB to the map location, but also make sure the map location is
- * copied back to the DIB in the next getdc call.
- *
- * The same consideration applies to user memory surfaces. */
-
- if (device->d3d_initialized)
- context = context_acquire(device, NULL);
-
- wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding);
- wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB);
- if (context)
- context_release(context);
- }
+ wined3d_cs_emit_releasedc(device->cs, surface);
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 94b8112..f1d32a7 100644
index 5bb6a21..0e0e3fe 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2624,6 +2624,8 @@ void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect_
@@ -2623,6 +2623,8 @@ void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect_
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
BOOL surface_check_block_align_rect(struct wined3d_surface *surface, const RECT *rect) DECLSPEC_HIDDEN;
void wined3d_surface_cleanup_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
@ -255,7 +288,7 @@ index 94b8112..f1d32a7 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;
@@ -2896,6 +2898,8 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
@@ -2895,6 +2897,8 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;

File diff suppressed because it is too large Load Diff