Rebase against 7baaab5b53011c3a593e1ff32538c9ca706db212.

FIXME: Use CS resource map/unmap mechanism instead of separate opcodes.
This commit is contained in:
Sebastian Lackner 2016-09-03 06:06:06 +02:00
parent d28e0d12bb
commit ad962f7d64
109 changed files with 699 additions and 212 deletions

View File

@ -1,4 +1,4 @@
From 85594497f9133133454a8008a93c7695a3e6ea83 Mon Sep 17 00:00:00 2001
From 445d3b9a3148598de7ff907429076d1551c419ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 4 Mar 2016 22:22:42 +0100
Subject: ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
@ -25,10 +25,10 @@ index e50edb4..bac9b8a 100644
if(DriverCaps)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index e8194b3..26556e9 100644
index 1271022..de6697e 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -9503,6 +9503,31 @@ static void test_transform_vertices(void)
@@ -9612,6 +9612,31 @@ static void test_transform_vertices(void)
DestroyWindow(window);
}
@ -60,17 +60,17 @@ index e8194b3..26556e9 100644
START_TEST(ddraw1)
{
IDirectDraw *ddraw;
@@ -9586,4 +9611,5 @@ START_TEST(ddraw1)
@@ -9695,4 +9720,5 @@ START_TEST(ddraw1)
test_blt();
test_getdc();
test_transform_vertices();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 171f669..79f4c97 100644
index bf012e4..b55eed8 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -10453,6 +10453,31 @@ static void test_edge_antialiasing_blending(void)
@@ -10949,6 +10949,31 @@ static void test_transform_vertices(void)
DestroyWindow(window);
}
@ -102,17 +102,17 @@ index 171f669..79f4c97 100644
START_TEST(ddraw2)
{
IDirectDraw2 *ddraw;
@@ -10544,4 +10569,5 @@ START_TEST(ddraw2)
test_getdc();
@@ -11041,4 +11066,5 @@ START_TEST(ddraw2)
test_draw_primitive();
test_edge_antialiasing_blending();
test_transform_vertices();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 988a82f..c1e0457 100644
index 9ac7a63..7b4bd3c 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -11785,6 +11785,31 @@ static void test_edge_antialiasing_blending(void)
@@ -12246,6 +12246,31 @@ static void test_transform_vertices(void)
DestroyWindow(window);
}
@ -144,14 +144,14 @@ index 988a82f..c1e0457 100644
START_TEST(ddraw4)
{
IDirectDraw4 *ddraw;
@@ -11884,4 +11909,5 @@ START_TEST(ddraw4)
test_getdc();
@@ -12346,4 +12371,5 @@ START_TEST(ddraw4)
test_draw_primitive();
test_edge_antialiasing_blending();
test_transform_vertices();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 56f8107..7c8467a 100644
index d6dffc8..eafa93b 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -12104,6 +12104,31 @@ static void test_edge_antialiasing_blending(void)

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "225c43b8124aaeb4c2e307379ab98036db1a38b3"
echo "7baaab5b53011c3a593e1ff32538c9ca706db212"
}
# Show version information
@ -7476,6 +7476,9 @@ fi
if test "$enable_wined3d_CSMT_Main" -eq 1; then
patch_apply wined3d-CSMT_Main/9999-IfDefined.patch
(
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Sanitise resource map flags in wined3d_resource_map().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Send resource unmaps through the command stream.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Send resource maps through the command stream.\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"wined3d: Send shader constant updates through the command stream.\".", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Make surface_load_location return nothing.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Call texture_load_location instead of surface_load_location.", 1 },';

View File

@ -0,0 +1,146 @@
From 32f4bb5c9ced812f0ff4544ae7f887dfb5a50c39 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 3 Sep 2016 02:31:26 +0200
Subject: Revert "wined3d: Sanitise resource map flags in
wined3d_resource_map()."
This reverts commit 8232f371d82fb1068416e1f6c9bde792f12e137c.
---
dlls/wined3d/buffer.c | 1 +
dlls/wined3d/resource.c | 68 ++++++++++++++++++++----------------------
dlls/wined3d/texture.c | 2 ++
dlls/wined3d/wined3d_private.h | 1 +
4 files changed, 37 insertions(+), 35 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 7dc33c7..fdecb04 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -942,6 +942,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
TRACE("buffer %p, offset %u, size %u, data %p, flags %#x.\n", buffer, offset, size, data, flags);
+ flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags);
/* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture
* fill rate test seems to depend on this. When we map a buffer with
* GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index ab64de0..b3e2747 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -315,47 +315,12 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st
desc->size = resource->size;
}
-static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *resource, DWORD flags)
-{
- /* Not all flags make sense together, but Windows never returns an error.
- * Catch the cases that could cause issues. */
- if (flags & WINED3D_MAP_READONLY)
- {
- if (flags & WINED3D_MAP_DISCARD)
- {
- WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
- return 0;
- }
- if (flags & WINED3D_MAP_NOOVERWRITE)
- {
- WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.\n");
- return 0;
- }
- }
- else if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
- == (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
- {
- WARN("WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, ignoring.\n");
- return 0;
- }
- else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)
- && !(resource->usage & WINED3DUSAGE_DYNAMIC))
- {
- WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
- return 0;
- }
-
- return flags;
-}
-
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
{
TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
resource, sub_resource_idx, map_desc, debug_box(box), flags);
- flags = wined3d_resource_sanitise_map_flags(resource, flags);
-
return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
}
@@ -399,6 +364,39 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
resource->heap_memory = NULL;
}
+DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags)
+{
+ /* Not all flags make sense together, but Windows never returns an error.
+ * Catch the cases that could cause issues. */
+ if (flags & WINED3D_MAP_READONLY)
+ {
+ if (flags & WINED3D_MAP_DISCARD)
+ {
+ WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
+ return 0;
+ }
+ if (flags & WINED3D_MAP_NOOVERWRITE)
+ {
+ WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.\n");
+ return 0;
+ }
+ }
+ else if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
+ == (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
+ {
+ WARN("WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, ignoring.\n");
+ return 0;
+ }
+ else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)
+ && !(resource->usage & WINED3DUSAGE_DYNAMIC))
+ {
+ WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
+ return 0;
+ }
+
+ return flags;
+}
+
GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
{
GLbitfield ret = 0;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 2844d3e..9b2df5c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2068,6 +2068,8 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return WINED3DERR_INVALIDCALL;
}
+ flags = wined3d_resource_sanitize_map_flags(resource, flags);
+
if (device->d3d_initialized)
{
context = context_acquire(device, NULL);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 35e8398..bedda9b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2604,6 +2604,7 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HI
GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
+DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
/* Tests show that the start address of resources is 32 byte aligned */
--
2.9.0

View File

@ -0,0 +1,107 @@
From 1ec1c07173483456777e2d36cea321198ba1af98 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 3 Sep 2016 02:31:43 +0200
Subject: Revert "wined3d: Send resource unmaps through the command stream."
This reverts commit 66e54fd682f494265b6059d2f04d766ec085f149.
---
dlls/wined3d/cs.c | 34 ----------------------------------
dlls/wined3d/resource.c | 2 +-
dlls/wined3d/wined3d_private.h | 2 --
3 files changed, 1 insertion(+), 37 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 7af0b81..d86213b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -58,7 +58,6 @@ enum wined3d_cs_op
WINED3D_CS_OP_PRELOAD_RESOURCE,
WINED3D_CS_OP_UNLOAD_RESOURCE,
WINED3D_CS_OP_MAP,
- WINED3D_CS_OP_UNMAP,
};
struct wined3d_cs_present
@@ -302,14 +301,6 @@ struct wined3d_cs_map
HRESULT *hr;
};
-struct wined3d_cs_unmap
-{
- enum wined3d_cs_op opcode;
- struct wined3d_resource *resource;
- unsigned int sub_resource_idx;
- HRESULT *hr;
-};
-
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@@ -1351,30 +1342,6 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
return hr;
}
-static void wined3d_cs_exec_unmap(struct wined3d_cs *cs, const void *data)
-{
- const struct wined3d_cs_unmap *op = data;
- struct wined3d_resource *resource = op->resource;
-
- *op->hr = resource->resource_ops->resource_sub_resource_unmap(resource, op->sub_resource_idx);
-}
-
-HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx)
-{
- struct wined3d_cs_unmap *op;
- HRESULT hr;
-
- op = cs->ops->require_space(cs, sizeof(*op));
- op->opcode = WINED3D_CS_OP_UNMAP;
- op->resource = resource;
- op->sub_resource_idx = sub_resource_idx;
- op->hr = &hr;
-
- cs->ops->submit(cs);
-
- return hr;
-}
-
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
@@ -1409,7 +1376,6 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
/* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
- /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
};
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 b3e2747..927e875 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -328,7 +328,7 @@ HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned
{
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
- return wined3d_cs_unmap(resource->device->cs, resource, sub_resource_idx);
+ return resource->resource_ops->resource_sub_resource_unmap(resource, sub_resource_idx);
}
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bedda9b..ad0578b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3098,8 +3098,6 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN;
-HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
- unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants)
--
2.9.0

View File

@ -0,0 +1,115 @@
From e97cbe81aff14980505c000e09e5bc29fb0aa0a2 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 3 Sep 2016 02:31:55 +0200
Subject: Revert "wined3d: Send resource maps through the command stream."
This reverts commit 9f85b5f867ed5ba6fe04be54774de1dc10ff2619.
---
dlls/wined3d/cs.c | 42 ------------------------------------------
dlls/wined3d/resource.c | 2 +-
dlls/wined3d/wined3d_private.h | 2 --
3 files changed, 1 insertion(+), 45 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index d86213b..05487e4 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -57,7 +57,6 @@ enum wined3d_cs_op
WINED3D_CS_OP_QUERY_ISSUE,
WINED3D_CS_OP_PRELOAD_RESOURCE,
WINED3D_CS_OP_UNLOAD_RESOURCE,
- WINED3D_CS_OP_MAP,
};
struct wined3d_cs_present
@@ -290,17 +289,6 @@ struct wined3d_cs_unload_resource
struct wined3d_resource *resource;
};
-struct wined3d_cs_map
-{
- enum wined3d_cs_op opcode;
- struct wined3d_resource *resource;
- unsigned int sub_resource_idx;
- struct wined3d_map_desc *map_desc;
- const struct wined3d_box *box;
- DWORD flags;
- HRESULT *hr;
-};
-
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@@ -1313,35 +1301,6 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
cs->ops->submit(cs);
}
-static void wined3d_cs_exec_map(struct wined3d_cs *cs, const void *data)
-{
- const struct wined3d_cs_map *op = data;
- struct wined3d_resource *resource = op->resource;
-
- *op->hr = resource->resource_ops->resource_sub_resource_map(resource,
- op->sub_resource_idx, op->map_desc, op->box, op->flags);
-}
-
-HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
- struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags)
-{
- struct wined3d_cs_map *op;
- HRESULT hr;
-
- op = cs->ops->require_space(cs, sizeof(*op));
- op->opcode = WINED3D_CS_OP_MAP;
- op->resource = resource;
- op->sub_resource_idx = sub_resource_idx;
- op->map_desc = map_desc;
- op->box = box;
- op->flags = flags;
- op->hr = &hr;
-
- cs->ops->submit(cs);
-
- return hr;
-}
-
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
@@ -1375,7 +1334,6 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
/* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
- /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
};
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 927e875..c220205 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -321,7 +321,7 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
resource, sub_resource_idx, map_desc, debug_box(box), flags);
- return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
+ return resource->resource_ops->resource_sub_resource_map(resource, sub_resource_idx, map_desc, box, flags);
}
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ad0578b..936c3e5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3096,8 +3096,6 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
-HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
- struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN;
static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants)
--
2.9.0

Some files were not shown because too many files have changed in this diff Show More