wined3d-CSMT_Main: Read format flags from container where possible.

This commit is contained in:
Sebastian Lackner 2015-06-13 18:32:47 +02:00
parent 6c70ccd388
commit 53b165e070
5 changed files with 48 additions and 48 deletions

View File

@ -1,4 +1,4 @@
From fd7f91b6778e7afc1ee6334ccf7d5f9224030945 Mon Sep 17 00:00:00 2001
From 3783cc16737b9ebebc9b00d90e981207843bc01e 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,10 +108,10 @@ index 77bb485..b5b5ece 100644
{
struct wined3d_cs_block *block;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 8464ff1..59a92bf 100644
index 0c25884..8883c9c 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -5000,14 +5000,13 @@ const struct blit_shader cpu_blit = {
@@ -5003,14 +5003,13 @@ const struct blit_shader cpu_blit = {
cpu_blit_blit_surface,
};
@ -128,7 +128,7 @@ index 8464ff1..59a92bf 100644
BOOL scale, convert;
static const DWORD simple_blit = WINEDDBLT_ASYNC
@@ -5018,111 +5017,6 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5021,111 +5020,6 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
| WINEDDBLT_DEPTHFILL
| WINEDDBLT_DONOTWAIT;
@ -240,7 +240,7 @@ index 8464ff1..59a92bf 100644
if (!device->d3d_initialized)
{
WARN("D3D not initialized, using fallback.\n");
@@ -5165,8 +5059,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5168,8 +5062,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
}
scale = src_surface
@ -251,7 +251,7 @@ index 8464ff1..59a92bf 100644
convert = src_surface && src_surface->resource.format->id != dst_surface->resource.format->id;
dst_ds_flags = dst_surface->container->resource.format_flags
@@ -5186,22 +5080,16 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5189,22 +5083,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))
@ -279,7 +279,7 @@ index 8464ff1..59a92bf 100644
}
}
else
@@ -5232,8 +5120,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5235,8 +5123,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
palette, fx->u5.dwFillColor, &color))
goto fallback;
@ -290,7 +290,7 @@ index 8464ff1..59a92bf 100644
}
else
{
@@ -5261,9 +5149,9 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5264,9 +5152,9 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
TRACE("Not doing upload because of format conversion.\n");
else
{
@ -302,7 +302,7 @@ index 8464ff1..59a92bf 100644
{
if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
{
@@ -5272,7 +5160,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5275,7 +5163,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
dst_surface->container->resource.draw_binding);
context_release(context);
}
@ -311,7 +311,7 @@ index 8464ff1..59a92bf 100644
}
}
}
@@ -5296,50 +5184,191 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
@@ -5299,50 +5187,191 @@ 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;
@ -469,8 +469,8 @@ index 8464ff1..59a92bf 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->container->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ src_ds_flags = src_surface->container->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 8464ff1..59a92bf 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 85307b7..90c217a 100644
index ff3d49b..9fc2181 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2460,6 +2460,9 @@ void wined3d_surface_destroy(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
@@ -2463,6 +2463,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 85307b7..90c217a 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;
@@ -2609,6 +2612,7 @@ struct wined3d_cs
@@ -2612,6 +2615,7 @@ struct wined3d_cs
struct wined3d_device *device;
struct wined3d_state state;
HANDLE thread;
@ -538,7 +538,7 @@ index 85307b7..90c217a 100644
DWORD tls_idx;
struct wined3d_surface *onscreen_depth_stencil;
@@ -2687,6 +2691,10 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs,
@@ -2690,6 +2694,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 985ce3a1a356331769ecdcd81587fd0f5ae911c9 Mon Sep 17 00:00:00 2001
From b642658723b5728d3ea2384f6f40680436bcdeb0 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 20651c2..1804546 100644
index 65a34a5..71be9eb 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3760,6 +3760,13 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
@@ -3788,6 +3788,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 20651c2..1804546 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));
@@ -3771,6 +3778,65 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
@@ -3799,6 +3806,65 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
@ -79,14 +79,14 @@ index 20651c2..1804546 100644
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if ((src_surface->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) && !surface_check_block_align(src_surface, src_rect))
+ if ((src_surface->container->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_surface->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) && !surface_check_block_align(dst_surface, &dst_rect))
+ if ((dst_surface->container->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 20651c2..1804546 100644
{
FIXME("Waiting for cs.\n");
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 32fc27c..cee8d33 100644
index 8883c9c..676200d 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1364,7 +1364,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
@@ -1366,7 +1366,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
}
}
@ -109,10 +109,10 @@ index 32fc27c..cee8d33 100644
struct wined3d_box box;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9292862..7959e4d 100644
index 9fc2181..5828bd3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2447,6 +2447,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
@@ -2466,6 +2466,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 9292862..7959e4d 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.3.5
2.4.2

View File

@ -1,4 +1,4 @@
From f1d235ff5f7f1b7698666b322bcbe6def7799fbd Mon Sep 17 00:00:00 2001
From 045f2277ef36b36927912fd153e251bc60ba290c 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,16 +8,16 @@ 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 cee8d33..b78a733 100644
index 676200d..4d68292 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2559,6 +2559,20 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
@@ -2561,6 +2561,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->container->resource.format_flags & WINED3DFMT_FLAG_GETDC))
+ {
+ WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
+ WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->container->resource.format->id));
+ return WINED3DERR_INVALIDCALL;
+ }
+
@ -33,5 +33,5 @@ index cee8d33..b78a733 100644
if (surface->flags & SFLAG_DCINUSE)
return WINEDDERR_DCALREADYCREATED;
--
2.3.5
2.4.2

View File

@ -1,4 +1,4 @@
From 40629f10af9cb4501c9f0e73c1028b9ab9613cac Mon Sep 17 00:00:00 2001
From a46bfa2015c98651461fb18e2e37d21046d89e2b 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,7 +14,7 @@ investigate atm.
3 files changed, 110 insertions(+), 48 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 943805f..5c43122 100644
index 90a8efb..8bd3cd9 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -91,6 +91,8 @@ enum wined3d_cs_op
@ -104,10 +104,10 @@ index 943805f..5c43122 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 21dfd8e..02f7c66 100644
index 9a4edd5..e1ceeb3 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2549,48 +2549,23 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
@@ -2551,48 +2551,23 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
return wined3d_resource_map(&surface->resource, map_desc, rect ? &box : NULL, flags);
}
@ -120,9 +120,9 @@ index 21dfd8e..02f7c66 100644
- TRACE("surface %p, dc %p.\n", surface, dc);
-
- if (!(surface->resource.format_flags & WINED3DFMT_FLAG_GETDC))
- if (!(surface->container->resource.format_flags & WINED3DFMT_FLAG_GETDC))
- {
- WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
- WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->container->resource.format->id));
- return WINED3DERR_INVALIDCALL;
- }
-
@ -159,7 +159,7 @@ index 21dfd8e..02f7c66 100644
}
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|| surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
@@ -2603,35 +2578,40 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
@@ -2605,35 +2580,40 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
if (context)
context_release(context);
@ -184,12 +184,12 @@ index 21dfd8e..02f7c66 100644
+ TRACE("surface %p, dc %p.\n", surface, dc);
- if (surface->hDC != dc)
+ if (!(surface->resource.format_flags & WINED3DFMT_FLAG_GETDC))
+ 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));
+ WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->container->resource.format->id));
+ return WINED3DERR_INVALIDCALL;
}
@ -220,7 +220,7 @@ index 21dfd8e..02f7c66 100644
&& surface->resource.map_binding != WINED3D_LOCATION_DIB))
{
/* The game Salammbo modifies the surface contents without mapping the surface between
@@ -2652,6 +2632,26 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
@@ -2654,6 +2634,26 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
if (context)
context_release(context);
}
@ -248,10 +248,10 @@ index 21dfd8e..02f7c66 100644
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9711c2d..5ccff16 100644
index 5865cad..b5a3611 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2493,6 +2493,8 @@ void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect_
@@ -2512,6 +2512,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 9711c2d..5ccff16 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;
@@ -2769,6 +2771,8 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
@@ -2788,6 +2790,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 9711c2d..5ccff16 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.3.5
2.4.2

View File

@ -7281,7 +7281,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
surface->lockedRect = *rect;
@@ -2607,20 +3122,119 @@
WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->container->resource.format->id));
return WINED3DERR_INVALIDCALL;
}
+#else /* STAGING_CSMT */