wined3d-CSMT_Main: Use resource->format_flags instead of resource->format.flags where possible.

This commit is contained in:
Sebastian Lackner 2015-04-26 00:10:29 +02:00
parent b84a5e83cb
commit 55ce7ddfc3
7 changed files with 74 additions and 71 deletions

View File

@ -1,4 +1,4 @@
From a161dbd1575b744e34b6282b0c7a21cab0668407 Mon Sep 17 00:00:00 2001
From db0594c57b82e50612dab5008f8947aa6a15fd18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 19 Sep 2013 17:51:38 +0200
Subject: wined3d: Move most of volume_map to resource.c
@ -7,16 +7,16 @@ The CPU access check can be moved once surfaces don't have to lock for
sysmem blits. Surfaces and volume have different block alignment and
boundary check behaviours.
---
dlls/wined3d/resource.c | 114 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/resource.c | 115 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/volume.c | 101 +++---------------------------------
dlls/wined3d/wined3d_private.h | 3 ++
3 files changed, 123 insertions(+), 95 deletions(-)
3 files changed, 124 insertions(+), 95 deletions(-)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 8903353..b497955 100644
index 8903353..4ca8189 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -694,3 +694,117 @@ BOOL wined3d_resource_check_block_align(const struct wined3d_resource *resource,
@@ -694,3 +694,118 @@ BOOL wined3d_resource_check_block_align(const struct wined3d_resource *resource,
return TRUE;
}
@ -28,6 +28,7 @@ index 8903353..b497955 100644
+ struct wined3d_context *context = NULL;
+ BYTE *base_memory;
+ const struct wined3d_format *format = resource->format;
+ const unsigned int fmt_flags = resource->format_flags;
+
+ TRACE("resource %p, map_desc %p, box %p, flags %#x.\n",
+ resource, map_desc, box, flags);
@ -63,7 +64,7 @@ index 8903353..b497955 100644
+
+ TRACE("Base memory pointer %p.\n", base_memory);
+
+ if (format->flags & WINED3DFMT_FLAG_BROKEN_PITCH)
+ if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
+ {
+ map_desc->row_pitch = resource->width * format->byte_count;
+ map_desc->slice_pitch = map_desc->row_pitch * resource->height;
@ -83,7 +84,7 @@ index 8903353..b497955 100644
+ TRACE("Lock Box (%p) = l %u, t %u, r %u, b %u, fr %u, ba %u\n",
+ box, box->left, box->top, box->right, box->bottom, box->front, box->back);
+
+ if ((format->flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS)
+ if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS)
+ {
+ /* Compressed textures are block based, so calculate the offset of
+ * the block that contains the top-left pixel of the locked rectangle. */
@ -271,10 +272,10 @@ index 4d7b349..3a85103 100644
static ULONG volume_resource_incref(struct wined3d_resource *resource)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f504555..1d0d644 100644
index f51a7bf..de55416 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2168,12 +2168,15 @@ void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWO
@@ -2166,12 +2166,15 @@ void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWO
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_resource_load_location(struct wined3d_resource *resource,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From a88c75ba7db54b3c8f834b6534ebc5d4ae4733d9 Mon Sep 17 00:00:00 2001
From 8080f13758b622f549724df5d6f9932e8bf2531a 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.
@ -108,7 +108,7 @@ index 8087812..9531b2f 100644
{
struct wined3d_cs_block *block;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index a4a659b..329ec45 100644
index a4a659b..32fc27c 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -5000,14 +5000,13 @@ const struct blit_shader cpu_blit = {
@ -469,8 +469,8 @@ index a4a659b..329ec45 100644
+ return WINEDDERR_INVALIDRECT;
+ }
+
+ dst_ds_flags = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ src_ds_flags = src_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ dst_ds_flags = dst_surface->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ src_ds_flags = src_surface->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ if (src_ds_flags != dst_ds_flags)
+ {
+ WARN("Rejecting depth / stencil blit between incompatible formats.\n");
@ -517,10 +517,10 @@ index a4a659b..329ec45 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 7186b81..a00f5cc 100644
index 908b004..9292862 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2446,6 +2446,9 @@ void wined3d_surface_destroy(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
@@ -2444,6 +2444,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;
@ -530,7 +530,7 @@ index 7186b81..a00f5cc 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;
@@ -2595,6 +2598,7 @@ struct wined3d_cs
@@ -2593,6 +2596,7 @@ struct wined3d_cs
struct wined3d_device *device;
struct wined3d_state state;
HANDLE thread;
@ -538,7 +538,7 @@ index 7186b81..a00f5cc 100644
DWORD tls_idx;
struct wined3d_surface *onscreen_depth_stencil;
@@ -2673,6 +2677,10 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs,
@@ -2671,6 +2675,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;

View File

@ -1,4 +1,4 @@
From 4189bd1a023b867ae97450130cbff011128b87fd Mon Sep 17 00:00:00 2001
From 985ce3a1a356331769ecdcd81587fd0f5ae911c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 20 Aug 2014 14:14:23 +0200
Subject: wined3d: Put update_surface checks back in place
@ -12,10 +12,10 @@ yet because blits depend on them.
3 files changed, 68 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5242028..a4d1c53 100644
index 20651c2..1804546 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3731,6 +3731,13 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
@@ -3760,6 +3760,13 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
struct wined3d_surface *src_surface, const RECT *src_rect,
struct wined3d_surface *dst_surface, const POINT *dst_point)
{
@ -29,7 +29,7 @@ index 5242028..a4d1c53 100644
TRACE("device %p, src_surface %p, src_rect %s, dst_surface %p, dst_point %s.\n",
device, src_surface, wine_dbgstr_rect(src_rect),
dst_surface, wine_dbgstr_point(dst_point));
@@ -3742,6 +3749,65 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
@@ -3771,6 +3778,65 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
@ -79,14 +79,14 @@ index 5242028..a4d1c53 100644
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if ((src_format->flags & WINED3DFMT_FLAG_BLOCKS) && !surface_check_block_align(src_surface, src_rect))
+ if ((src_surface->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) && !surface_check_block_align(src_surface, src_rect))
+ {
+ WARN("Source rectangle not block-aligned.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ SetRect(&dst_rect, dst_point->x, dst_point->y, dst_point->x + update_w, dst_point->y + update_h);
+ if ((dst_format->flags & WINED3DFMT_FLAG_BLOCKS) && !surface_check_block_align(dst_surface, &dst_rect))
+ if ((dst_surface->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) && !surface_check_block_align(dst_surface, &dst_rect))
+ {
+ WARN("Destination rectangle not block-aligned.\n");
+ return WINED3DERR_INVALIDCALL;
@ -96,10 +96,10 @@ index 5242028..a4d1c53 100644
{
FIXME("Waiting for cs.\n");
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 8a833d5..7c47055 100644
index 32fc27c..cee8d33 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1420,7 +1420,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
@@ -1364,7 +1364,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
}
}
@ -109,10 +109,10 @@ index 8a833d5..7c47055 100644
struct wined3d_box box;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 342577c..5eec3c6 100644
index 9292862..7959e4d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2429,6 +2429,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
@@ -2447,6 +2447,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
void surface_blt_ugly(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) DECLSPEC_HIDDEN;
@ -121,5 +121,5 @@ index 342577c..5eec3c6 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;
--
2.2.1
2.3.5

View File

@ -1,4 +1,4 @@
From 7cebca953dd9d2a81646a5277ff700e94cf401da Mon Sep 17 00:00:00 2001
From f1d235ff5f7f1b7698666b322bcbe6def7799fbd 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.
@ -8,14 +8,14 @@ Subject: wined3d: Wait for the CS in GetDC.
1 file changed, 14 insertions(+)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index c47f78c..9dadb6d 100644
index cee8d33..b78a733 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2478,6 +2478,20 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
@@ -2559,6 +2559,20 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
TRACE("surface %p, dc %p.\n", surface, dc);
+ if (!(surface->resource.format->flags & WINED3DFMT_FLAG_GETDC))
+ if (!(surface->resource.format_flags & WINED3DFMT_FLAG_GETDC))
+ {
+ WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
+ return WINED3DERR_INVALIDCALL;
@ -33,5 +33,5 @@ index c47f78c..9dadb6d 100644
if (surface->flags & SFLAG_DCINUSE)
return WINEDDERR_DCALREADYCREATED;
--
2.1.3
2.3.5

View File

@ -1,20 +1,20 @@
From aebae1f8597794f2fab4b468f2573a8591f60615 Mon Sep 17 00:00:00 2001
From 872dc7c0c6fd6f54f1522bad4787fdd358eb69af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 26 Sep 2013 16:41:00 +0200
Subject: wined3d: send resource maps through the command stream
Slow version only. Good enough to dodge some Nvidia bugs in the ddraw tests.
---
dlls/wined3d/cs.c | 69 +++++++++++++++++++++++++++++++++++++
dlls/wined3d/resource.c | 77 ++++++++++++++++++++++++------------------
dlls/wined3d/cs.c | 69 ++++++++++++++++++++++++++++++++++++
dlls/wined3d/resource.c | 79 ++++++++++++++++++++++++------------------
dlls/wined3d/wined3d_private.h | 5 +++
3 files changed, 119 insertions(+), 32 deletions(-)
3 files changed, 120 insertions(+), 33 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 366a4d3..b691924 100644
index 25d92a1..f920107 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -75,6 +75,8 @@ enum wined3d_cs_op
@@ -76,6 +76,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_LIGHT_ENABLE,
WINED3D_CS_OP_BLT,
WINED3D_CS_OP_CLEAR_RTV,
@ -23,7 +23,7 @@ index 366a4d3..b691924 100644
WINED3D_CS_OP_STOP,
};
@@ -352,6 +354,20 @@ struct wined3d_cs_clear_rtv
@@ -362,6 +364,20 @@ struct wined3d_cs_clear_rtv
struct wined3d_color color;
};
@ -44,7 +44,7 @@ index 366a4d3..b691924 100644
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
@@ -1687,6 +1703,57 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -1800,6 +1816,57 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
cs->ops->submit(cs);
}
@ -102,7 +102,7 @@ index 366a4d3..b691924 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1728,6 +1795,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1842,6 +1909,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
/* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt,
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
@ -112,10 +112,10 @@ index 366a4d3..b691924 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index bf228d1..af60d51 100644
index 39b7c32..083fd70 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -683,31 +683,11 @@ BOOL wined3d_resource_check_block_align(const struct wined3d_resource *resource,
@@ -695,32 +695,11 @@ BOOL wined3d_resource_check_block_align(const struct wined3d_resource *resource,
return TRUE;
}
@ -127,6 +127,7 @@ index bf228d1..af60d51 100644
struct wined3d_context *context = NULL;
- BYTE *base_memory;
- const struct wined3d_format *format = resource->format;
- const unsigned int fmt_flags = resource->format_flags;
-
- TRACE("resource %p, map_desc %p, box %p, flags %#x.\n",
- resource, map_desc, box, flags);
@ -149,7 +150,7 @@ index bf228d1..af60d51 100644
if (device->d3d_initialized)
context = context_acquire(device, NULL);
@@ -715,9 +695,8 @@ HRESULT wined3d_resource_map(struct wined3d_resource *resource,
@@ -728,9 +707,8 @@ HRESULT wined3d_resource_map(struct wined3d_resource *resource,
if (!wined3d_resource_prepare_map_memory(resource, context))
{
WARN("Out of memory.\n");
@ -160,7 +161,7 @@ index bf228d1..af60d51 100644
}
if (flags & WINED3D_MAP_DISCARD)
@@ -725,11 +704,39 @@ HRESULT wined3d_resource_map(struct wined3d_resource *resource,
@@ -738,11 +716,40 @@ HRESULT wined3d_resource_map(struct wined3d_resource *resource,
else
wined3d_resource_load_location(resource, context, resource->map_binding);
@ -179,6 +180,7 @@ index bf228d1..af60d51 100644
+ struct wined3d_device *device = resource->device;
+ BYTE *base_memory;
+ const struct wined3d_format *format = resource->format;
+ const unsigned int fmt_flags = resource->format_flags;
+
+ TRACE("resource %p, map_desc %p, box %p, flags %#x.\n",
+ resource, map_desc, box, flags);
@ -200,8 +202,8 @@ index bf228d1..af60d51 100644
+
TRACE("Base memory pointer %p.\n", base_memory);
if (format->flags & WINED3DFMT_FLAG_BROKEN_PITCH)
@@ -781,10 +788,21 @@ HRESULT wined3d_resource_map(struct wined3d_resource *resource,
if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
@@ -794,10 +801,21 @@ HRESULT wined3d_resource_map(struct wined3d_resource *resource,
return WINED3D_OK;
}
@ -224,7 +226,7 @@ index bf228d1..af60d51 100644
TRACE("resource %p.\n", resource);
if (!resource->map_count)
@@ -793,12 +811,7 @@ HRESULT wined3d_resource_unmap(struct wined3d_resource *resource)
@@ -806,12 +824,7 @@ HRESULT wined3d_resource_unmap(struct wined3d_resource *resource)
return WINEDDERR_NOTLOCKED;
}
@ -239,10 +241,10 @@ index bf228d1..af60d51 100644
return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e554099..6ee0c24 100644
index 26fb1cf..d2bfc21 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2153,6 +2153,7 @@ void wined3d_resource_load_location(struct wined3d_resource *resource,
@@ -2193,6 +2193,7 @@ void wined3d_resource_load_location(struct wined3d_resource *resource,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
HRESULT wined3d_resource_map(struct wined3d_resource *resource, struct wined3d_map_desc *map_desc,
const struct wined3d_box *box, DWORD flags) DECLSPEC_HIDDEN;
@ -250,7 +252,7 @@ index e554099..6ee0c24 100644
BOOL wined3d_resource_prepare_map_memory(struct wined3d_resource *resource,
struct wined3d_context *context) DECLSPEC_HIDDEN;
BOOL wined3d_resource_prepare_system_memory(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
@@ -2160,6 +2161,7 @@ void wined3d_resource_release_map_ptr(const struct wined3d_resource *resource,
@@ -2200,6 +2201,7 @@ void wined3d_resource_release_map_ptr(const struct wined3d_resource *resource,
const struct wined3d_context *context) DECLSPEC_HIDDEN;
DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN;
HRESULT wined3d_resource_unmap(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
@ -258,7 +260,7 @@ index e554099..6ee0c24 100644
void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_resource_validate_location(struct wined3d_resource *resource, DWORD location) DECLSPEC_HIDDEN;
@@ -2640,6 +2642,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -2682,6 +2684,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view,
const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
@ -269,5 +271,5 @@ index e554099..6ee0c24 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.1.3
2.3.5

View File

@ -1,4 +1,4 @@
From eeb143600d8ab2c4ea0c43a14e1a7035d9dcf9c6 Mon Sep 17 00:00:00 2001
From 40629f10af9cb4501c9f0e73c1028b9ab9613cac 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.
@ -14,10 +14,10 @@ investigate atm.
3 files changed, 110 insertions(+), 48 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index b152a0d..44930c1 100644
index 943805f..5c43122 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -90,6 +90,8 @@ enum wined3d_cs_op
@@ -91,6 +91,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
WINED3D_CS_OP_DELETE_GL_CONTEXTS,
@ -26,7 +26,7 @@ index b152a0d..44930c1 100644
WINED3D_CS_OP_STOP,
};
@@ -533,6 +535,18 @@ struct wined3d_cs_delete_gl_contexts
@@ -543,6 +545,18 @@ struct wined3d_cs_delete_gl_contexts
struct wined3d_swapchain *swapchain;
};
@ -45,7 +45,7 @@ index b152a0d..44930c1 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2580,6 +2594,48 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3
@@ -2693,6 +2707,48 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3
cs->ops->finish(cs);
}
@ -94,7 +94,7 @@ index b152a0d..44930c1 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2648,6 +2704,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2762,6 +2818,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
/* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
/* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts,
@ -104,10 +104,10 @@ index b152a0d..44930c1 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 b1ae752..9aa26e3 100644
index 21dfd8e..02f7c66 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2622,48 +2622,23 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
@@ -2549,48 +2549,23 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
return wined3d_resource_map(&surface->resource, map_desc, rect ? &box : NULL, flags);
}
@ -120,7 +120,7 @@ index b1ae752..9aa26e3 100644
- TRACE("surface %p, dc %p.\n", surface, dc);
-
- if (!(surface->resource.format->flags & WINED3DFMT_FLAG_GETDC))
- if (!(surface->resource.format_flags & WINED3DFMT_FLAG_GETDC))
- {
- WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
- return WINED3DERR_INVALIDCALL;
@ -159,7 +159,7 @@ index b1ae752..9aa26e3 100644
}
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|| surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
@@ -2676,35 +2651,40 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
@@ -2603,35 +2578,40 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
if (context)
context_release(context);
@ -184,7 +184,7 @@ index b1ae752..9aa26e3 100644
+ TRACE("surface %p, dc %p.\n", surface, dc);
- if (surface->hDC != dc)
+ if (!(surface->resource.format->flags & WINED3DFMT_FLAG_GETDC))
+ if (!(surface->resource.format_flags & WINED3DFMT_FLAG_GETDC))
{
- WARN("Application tries to release invalid DC %p, surface DC is %p.\n",
- dc, surface->hDC);
@ -220,7 +220,7 @@ index b1ae752..9aa26e3 100644
&& surface->resource.map_binding != WINED3D_LOCATION_DIB))
{
/* The game Salammbo modifies the surface contents without mapping the surface between
@@ -2725,6 +2705,26 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
@@ -2652,6 +2632,26 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
if (context)
context_release(context);
}
@ -248,10 +248,10 @@ index b1ae752..9aa26e3 100644
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9e548bb..24c1ce8 100644
index 9711c2d..5ccff16 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2475,6 +2475,8 @@ void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect_
@@ -2493,6 +2493,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(struct wined3d_surface *surface, const RECT *rect) DECLSPEC_HIDDEN;
void wined3d_surface_cleanup_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
@ -260,7 +260,7 @@ index 9e548bb..24c1ce8 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;
@@ -2744,6 +2746,8 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
@@ -2769,6 +2771,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;
@ -270,5 +270,5 @@ index 9e548bb..24c1ce8 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.2.1
2.3.5

View File

@ -9726,7 +9726,7 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
void wined3d_resource_validate_location(struct wined3d_resource *resource, DWORD location)
{
@@ -949,3 +968,4 @@
@@ -950,3 +969,4 @@
wined3d_resource_invalidate_location(resource, ~resource->map_binding);
}