diff --git a/patches/ddraw-Device_Caps/0003-ddraw-Set-ddsOldCaps-correctly-in-ddraw7_GetCaps.patch b/patches/ddraw-Device_Caps/0003-ddraw-Set-ddsOldCaps-correctly-in-ddraw7_GetCaps.patch index f280ed61..659e32e5 100644 --- a/patches/ddraw-Device_Caps/0003-ddraw-Set-ddsOldCaps-correctly-in-ddraw7_GetCaps.patch +++ b/patches/ddraw-Device_Caps/0003-ddraw-Set-ddsOldCaps-correctly-in-ddraw7_GetCaps.patch @@ -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?= 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) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index fb327b4a..a2ea6e12 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -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 },'; diff --git a/patches/wined3d-CSMT_Main/0001-Revert-wined3d-Sanitise-resource-map-flags-in-wined3.patch b/patches/wined3d-CSMT_Main/0001-Revert-wined3d-Sanitise-resource-map-flags-in-wined3.patch new file mode 100644 index 00000000..509cece9 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0001-Revert-wined3d-Sanitise-resource-map-flags-in-wined3.patch @@ -0,0 +1,146 @@ +From 32f4bb5c9ced812f0ff4544ae7f887dfb5a50c39 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0002-Revert-wined3d-Send-resource-unmaps-through-the-comm.patch b/patches/wined3d-CSMT_Main/0002-Revert-wined3d-Send-resource-unmaps-through-the-comm.patch new file mode 100644 index 00000000..78fb5008 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0002-Revert-wined3d-Send-resource-unmaps-through-the-comm.patch @@ -0,0 +1,107 @@ +From 1ec1c07173483456777e2d36cea321198ba1af98 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0003-Revert-wined3d-Send-resource-maps-through-the-comman.patch b/patches/wined3d-CSMT_Main/0003-Revert-wined3d-Send-resource-maps-through-the-comman.patch new file mode 100644 index 00000000..29eee5ef --- /dev/null +++ b/patches/wined3d-CSMT_Main/0003-Revert-wined3d-Send-resource-maps-through-the-comman.patch @@ -0,0 +1,115 @@ +From e97cbe81aff14980505c000e09e5bc29fb0aa0a2 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +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 + diff --git a/patches/wined3d-CSMT_Main/0000-Revert-wined3d-Send-shader-constant-updates-through-.patch b/patches/wined3d-CSMT_Main/0004-Revert-wined3d-Send-shader-constant-updates-through-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0000-Revert-wined3d-Send-shader-constant-updates-through-.patch rename to patches/wined3d-CSMT_Main/0004-Revert-wined3d-Send-shader-constant-updates-through-.patch diff --git a/patches/wined3d-CSMT_Main/0001-wined3d-Make-surface_load_location-return-nothing.patch b/patches/wined3d-CSMT_Main/0005-wined3d-Make-surface_load_location-return-nothing.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0001-wined3d-Make-surface_load_location-return-nothing.patch rename to patches/wined3d-CSMT_Main/0005-wined3d-Make-surface_load_location-return-nothing.patch diff --git a/patches/wined3d-CSMT_Main/0003-wined3d-Call-texture_load_location-instead-of-surfac.patch b/patches/wined3d-CSMT_Main/0006-wined3d-Call-texture_load_location-instead-of-surfac.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0003-wined3d-Call-texture_load_location-instead-of-surfac.patch rename to patches/wined3d-CSMT_Main/0006-wined3d-Call-texture_load_location-instead-of-surfac.patch diff --git a/patches/wined3d-CSMT_Main/0004-wined3d-Share-surface-and-volume-system-memory-loadi.patch b/patches/wined3d-CSMT_Main/0007-wined3d-Share-surface-and-volume-system-memory-loadi.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0004-wined3d-Share-surface-and-volume-system-memory-loadi.patch rename to patches/wined3d-CSMT_Main/0007-wined3d-Share-surface-and-volume-system-memory-loadi.patch diff --git a/patches/wined3d-CSMT_Main/0006-wined3d-Don-t-call-the-public-map-function-in-surfac.patch b/patches/wined3d-CSMT_Main/0008-wined3d-Don-t-call-the-public-map-function-in-surfac.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0006-wined3d-Don-t-call-the-public-map-function-in-surfac.patch rename to patches/wined3d-CSMT_Main/0008-wined3d-Don-t-call-the-public-map-function-in-surfac.patch diff --git a/patches/wined3d-CSMT_Main/0007-wined3d-Don-t-call-the-public-map-function-in-surfac.patch b/patches/wined3d-CSMT_Main/0009-wined3d-Don-t-call-the-public-map-function-in-surfac.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0007-wined3d-Don-t-call-the-public-map-function-in-surfac.patch rename to patches/wined3d-CSMT_Main/0009-wined3d-Don-t-call-the-public-map-function-in-surfac.patch diff --git a/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0010-wined3d-Move-the-framebuffer-into-wined3d_state.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch rename to patches/wined3d-CSMT_Main/0010-wined3d-Move-the-framebuffer-into-wined3d_state.patch diff --git a/patches/wined3d-CSMT_Main/0009-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch b/patches/wined3d-CSMT_Main/0011-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0009-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch rename to patches/wined3d-CSMT_Main/0011-wined3d-Preload-buffers-if-streamsrc-is-not-dirty.patch diff --git a/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch b/patches/wined3d-CSMT_Main/0012-wined3d-Hackily-introduce-a-multithreaded-command-st.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch rename to patches/wined3d-CSMT_Main/0012-wined3d-Hackily-introduce-a-multithreaded-command-st.patch diff --git a/patches/wined3d-CSMT_Main/0011-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch b/patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0011-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch rename to patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-resource-updates-to-finish-when-usi.patch diff --git a/patches/wined3d-CSMT_Main/0012-wined3d-Wait-for-the-cs-before-destroying-objects.patch b/patches/wined3d-CSMT_Main/0014-wined3d-Wait-for-the-cs-before-destroying-objects.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0012-wined3d-Wait-for-the-cs-before-destroying-objects.patch rename to patches/wined3d-CSMT_Main/0014-wined3d-Wait-for-the-cs-before-destroying-objects.patch diff --git a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch b/patches/wined3d-CSMT_Main/0015-wined3d-Give-the-cs-its-own-state.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch rename to patches/wined3d-CSMT_Main/0015-wined3d-Give-the-cs-its-own-state.patch diff --git a/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch b/patches/wined3d-CSMT_Main/0016-wined3d-Send-float-constant-updates-through-the-comm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch rename to patches/wined3d-CSMT_Main/0016-wined3d-Send-float-constant-updates-through-the-comm.patch diff --git a/patches/wined3d-CSMT_Main/0016-wined3d-Request-a-glFinish-before-modifying-resource.patch b/patches/wined3d-CSMT_Main/0017-wined3d-Request-a-glFinish-before-modifying-resource.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0016-wined3d-Request-a-glFinish-before-modifying-resource.patch rename to patches/wined3d-CSMT_Main/0017-wined3d-Request-a-glFinish-before-modifying-resource.patch diff --git a/patches/wined3d-CSMT_Main/0017-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch b/patches/wined3d-CSMT_Main/0018-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0017-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch rename to patches/wined3d-CSMT_Main/0018-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch diff --git a/patches/wined3d-CSMT_Main/0018-wined3d-Don-t-call-glFinish-after-clears.patch b/patches/wined3d-CSMT_Main/0019-wined3d-Don-t-call-glFinish-after-clears.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0018-wined3d-Don-t-call-glFinish-after-clears.patch rename to patches/wined3d-CSMT_Main/0019-wined3d-Don-t-call-glFinish-after-clears.patch diff --git a/patches/wined3d-CSMT_Main/0019-wined3d-Don-t-call-glFinish-after-draws.patch b/patches/wined3d-CSMT_Main/0020-wined3d-Don-t-call-glFinish-after-draws.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0019-wined3d-Don-t-call-glFinish-after-draws.patch rename to patches/wined3d-CSMT_Main/0020-wined3d-Don-t-call-glFinish-after-draws.patch diff --git a/patches/wined3d-CSMT_Main/0020-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch b/patches/wined3d-CSMT_Main/0021-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0020-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch rename to patches/wined3d-CSMT_Main/0021-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch diff --git a/patches/wined3d-CSMT_Main/0021-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch b/patches/wined3d-CSMT_Main/0022-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0021-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch rename to patches/wined3d-CSMT_Main/0022-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch diff --git a/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch b/patches/wined3d-CSMT_Main/0023-wined3d-Send-base-vertex-index-updates-through-the-c.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch rename to patches/wined3d-CSMT_Main/0023-wined3d-Send-base-vertex-index-updates-through-the-c.patch diff --git a/patches/wined3d-CSMT_Main/0023-wined3d-Send-primitive-type-updates-through-the-comm.patch b/patches/wined3d-CSMT_Main/0024-wined3d-Send-primitive-type-updates-through-the-comm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0023-wined3d-Send-primitive-type-updates-through-the-comm.patch rename to patches/wined3d-CSMT_Main/0024-wined3d-Send-primitive-type-updates-through-the-comm.patch diff --git a/patches/wined3d-CSMT_Main/0024-wined3d-Send-bool-constant-updates-through-the-comma.patch b/patches/wined3d-CSMT_Main/0025-wined3d-Send-bool-constant-updates-through-the-comma.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0024-wined3d-Send-bool-constant-updates-through-the-comma.patch rename to patches/wined3d-CSMT_Main/0025-wined3d-Send-bool-constant-updates-through-the-comma.patch diff --git a/patches/wined3d-CSMT_Main/0025-wined3d-Send-int-constant-updates-through-the-comman.patch b/patches/wined3d-CSMT_Main/0026-wined3d-Send-int-constant-updates-through-the-comman.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0025-wined3d-Send-int-constant-updates-through-the-comman.patch rename to patches/wined3d-CSMT_Main/0026-wined3d-Send-int-constant-updates-through-the-comman.patch diff --git a/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch b/patches/wined3d-CSMT_Main/0027-wined3d-Send-light-updates-through-the-command-strea.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch rename to patches/wined3d-CSMT_Main/0027-wined3d-Send-light-updates-through-the-command-strea.patch diff --git a/patches/wined3d-CSMT_Main/0027-wined3d-Prevent-the-command-stream-from-running-ahea.patch b/patches/wined3d-CSMT_Main/0028-wined3d-Prevent-the-command-stream-from-running-ahea.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0027-wined3d-Prevent-the-command-stream-from-running-ahea.patch rename to patches/wined3d-CSMT_Main/0028-wined3d-Prevent-the-command-stream-from-running-ahea.patch diff --git a/patches/wined3d-CSMT_Main/0028-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch b/patches/wined3d-CSMT_Main/0029-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0028-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch rename to patches/wined3d-CSMT_Main/0029-wined3d-Wait-for-the-cs-to-finish-before-destroying-.patch diff --git a/patches/wined3d-CSMT_Main/0029-wined3d-Run-the-cs-asynchronously.patch b/patches/wined3d-CSMT_Main/0030-wined3d-Run-the-cs-asynchronously.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0029-wined3d-Run-the-cs-asynchronously.patch rename to patches/wined3d-CSMT_Main/0030-wined3d-Run-the-cs-asynchronously.patch diff --git a/patches/wined3d-CSMT_Main/0030-wined3d-Send-blits-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0031-wined3d-Send-blits-through-the-command-stream.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0030-wined3d-Send-blits-through-the-command-stream.patch rename to patches/wined3d-CSMT_Main/0031-wined3d-Send-blits-through-the-command-stream.patch diff --git a/patches/wined3d-CSMT_Main/0031-wined3d-Hack-to-reject-unsupported-color-fills.patch b/patches/wined3d-CSMT_Main/0032-wined3d-Hack-to-reject-unsupported-color-fills.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0031-wined3d-Hack-to-reject-unsupported-color-fills.patch rename to patches/wined3d-CSMT_Main/0032-wined3d-Hack-to-reject-unsupported-color-fills.patch diff --git a/patches/wined3d-CSMT_Main/0032-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch b/patches/wined3d-CSMT_Main/0033-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0032-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch rename to patches/wined3d-CSMT_Main/0033-wined3d-Restore-some-wined3d_device_copy_sub_resourc.patch diff --git a/patches/wined3d-CSMT_Main/0033-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch b/patches/wined3d-CSMT_Main/0034-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0033-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch rename to patches/wined3d-CSMT_Main/0034-wined3d-Don-t-force-strict-draw-ordering-for-multith.patch diff --git a/patches/wined3d-CSMT_Main/0034-wined3d-Send-render-target-view-clears-through-the-c.patch b/patches/wined3d-CSMT_Main/0035-wined3d-Send-render-target-view-clears-through-the-c.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0034-wined3d-Send-render-target-view-clears-through-the-c.patch rename to patches/wined3d-CSMT_Main/0035-wined3d-Send-render-target-view-clears-through-the-c.patch diff --git a/patches/wined3d-CSMT_Main/0035-wined3d-send-texture-maps-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0036-wined3d-send-texture-maps-through-the-command-stream.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0035-wined3d-send-texture-maps-through-the-command-stream.patch rename to patches/wined3d-CSMT_Main/0036-wined3d-send-texture-maps-through-the-command-stream.patch diff --git a/patches/wined3d-CSMT_Main/0036-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch b/patches/wined3d-CSMT_Main/0037-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0036-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch rename to patches/wined3d-CSMT_Main/0037-wined3d-Get-rid-of-the-end_scene-flush-and-finish.patch diff --git a/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch b/patches/wined3d-CSMT_Main/0038-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch rename to patches/wined3d-CSMT_Main/0038-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch diff --git a/patches/wined3d-CSMT_Main/0038-wined3d-Don-t-preload-buffers-on-unmap.patch b/patches/wined3d-CSMT_Main/0039-wined3d-Don-t-preload-buffers-on-unmap.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0038-wined3d-Don-t-preload-buffers-on-unmap.patch rename to patches/wined3d-CSMT_Main/0039-wined3d-Don-t-preload-buffers-on-unmap.patch diff --git a/patches/wined3d-CSMT_Main/0039-wined3d-Don-t-call-glFinish-before-swapping.patch b/patches/wined3d-CSMT_Main/0040-wined3d-Don-t-call-glFinish-before-swapping.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0039-wined3d-Don-t-call-glFinish-before-swapping.patch rename to patches/wined3d-CSMT_Main/0040-wined3d-Don-t-call-glFinish-before-swapping.patch diff --git a/patches/wined3d-CSMT_Main/0047-wined3d-Don-t-poll-queries-that-failed-to-start.patch b/patches/wined3d-CSMT_Main/0045-wined3d-Don-t-poll-queries-that-failed-to-start.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0047-wined3d-Don-t-poll-queries-that-failed-to-start.patch rename to patches/wined3d-CSMT_Main/0045-wined3d-Don-t-poll-queries-that-failed-to-start.patch diff --git a/patches/wined3d-CSMT_Main/0048-wined3d-Remove-restated-queries-from-the-poll-list.patch b/patches/wined3d-CSMT_Main/0046-wined3d-Remove-restated-queries-from-the-poll-list.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0048-wined3d-Remove-restated-queries-from-the-poll-list.patch rename to patches/wined3d-CSMT_Main/0046-wined3d-Remove-restated-queries-from-the-poll-list.patch diff --git a/patches/wined3d-CSMT_Main/0050-wined3d-Put-this-into-the-query-poll-patch.patch b/patches/wined3d-CSMT_Main/0047-wined3d-Put-this-into-the-query-poll-patch.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0050-wined3d-Put-this-into-the-query-poll-patch.patch rename to patches/wined3d-CSMT_Main/0047-wined3d-Put-this-into-the-query-poll-patch.patch diff --git a/patches/wined3d-CSMT_Main/0052-wined3d-Don-t-access-device-state-in-clears.patch b/patches/wined3d-CSMT_Main/0048-wined3d-Don-t-access-device-state-in-clears.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0052-wined3d-Don-t-access-device-state-in-clears.patch rename to patches/wined3d-CSMT_Main/0048-wined3d-Don-t-access-device-state-in-clears.patch diff --git a/patches/wined3d-CSMT_Main/0053-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch b/patches/wined3d-CSMT_Main/0049-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0053-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch rename to patches/wined3d-CSMT_Main/0049-wined3d-Avoid-destroying-views-in-color-and-depth-fi.patch diff --git a/patches/wined3d-CSMT_Main/0054-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch b/patches/wined3d-CSMT_Main/0050-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0054-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch rename to patches/wined3d-CSMT_Main/0050-wined3d-Avoid-calling-wined3d_surface_blt-from-surfa.patch diff --git a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0051-wined3d-Send-update_texture-calls-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0051-wined3d-Send-update_texture-calls-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0056-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch b/patches/wined3d-CSMT_Main/0052-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0056-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch rename to patches/wined3d-CSMT_Main/0052-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch diff --git a/patches/wined3d-CSMT_Main/0057-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch b/patches/wined3d-CSMT_Main/0053-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0057-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch rename to patches/wined3d-CSMT_Main/0053-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch diff --git a/patches/wined3d-CSMT_Main/0060-wined3d-Fence-update_texture-calls.patch b/patches/wined3d-CSMT_Main/0054-wined3d-Fence-update_texture-calls.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0060-wined3d-Fence-update_texture-calls.patch rename to patches/wined3d-CSMT_Main/0054-wined3d-Fence-update_texture-calls.patch diff --git a/patches/wined3d-CSMT_Main/0061-wined3d-Dirtify-resources-on-unmap.patch b/patches/wined3d-CSMT_Main/0055-wined3d-Dirtify-resources-on-unmap.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0061-wined3d-Dirtify-resources-on-unmap.patch rename to patches/wined3d-CSMT_Main/0055-wined3d-Dirtify-resources-on-unmap.patch diff --git a/patches/wined3d-CSMT_Main/0063-wined3d-Fence-render-targets-and-depth-stencils.patch b/patches/wined3d-CSMT_Main/0056-wined3d-Fence-render-targets-and-depth-stencils.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0063-wined3d-Fence-render-targets-and-depth-stencils.patch rename to patches/wined3d-CSMT_Main/0056-wined3d-Fence-render-targets-and-depth-stencils.patch diff --git a/patches/wined3d-CSMT_Main/0064-wined3d-Fence-blit-operations.patch b/patches/wined3d-CSMT_Main/0057-wined3d-Fence-blit-operations.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0064-wined3d-Fence-blit-operations.patch rename to patches/wined3d-CSMT_Main/0057-wined3d-Fence-blit-operations.patch diff --git a/patches/wined3d-CSMT_Main/0065-wined3d-Fence-color_fill-operations.patch b/patches/wined3d-CSMT_Main/0058-wined3d-Fence-color_fill-operations.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0065-wined3d-Fence-color_fill-operations.patch rename to patches/wined3d-CSMT_Main/0058-wined3d-Fence-color_fill-operations.patch diff --git a/patches/wined3d-CSMT_Main/0069-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch b/patches/wined3d-CSMT_Main/0059-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0069-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch rename to patches/wined3d-CSMT_Main/0059-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch diff --git a/patches/wined3d-CSMT_Main/0070-wined3d-Send-update_sub_resource-calls-through-the-c.patch b/patches/wined3d-CSMT_Main/0060-wined3d-Send-update_sub_resource-calls-through-the-c.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0070-wined3d-Send-update_sub_resource-calls-through-the-c.patch rename to patches/wined3d-CSMT_Main/0060-wined3d-Send-update_sub_resource-calls-through-the-c.patch diff --git a/patches/wined3d-CSMT_Main/0071-wined3d-Dirtify-changed-textures-through-the-command.patch b/patches/wined3d-CSMT_Main/0061-wined3d-Dirtify-changed-textures-through-the-command.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0071-wined3d-Dirtify-changed-textures-through-the-command.patch rename to patches/wined3d-CSMT_Main/0061-wined3d-Dirtify-changed-textures-through-the-command.patch diff --git a/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch b/patches/wined3d-CSMT_Main/0062-wined3d-Wrap-GL-BOs-in-a-structure.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch rename to patches/wined3d-CSMT_Main/0062-wined3d-Wrap-GL-BOs-in-a-structure.patch diff --git a/patches/wined3d-CSMT_Main/0073-wined3d-Separate-resource-map-and-draw-buffers.patch b/patches/wined3d-CSMT_Main/0063-wined3d-Separate-resource-map-and-draw-buffers.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0073-wined3d-Separate-resource-map-and-draw-buffers.patch rename to patches/wined3d-CSMT_Main/0063-wined3d-Separate-resource-map-and-draw-buffers.patch diff --git a/patches/wined3d-CSMT_Main/0074-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch b/patches/wined3d-CSMT_Main/0064-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0074-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch rename to patches/wined3d-CSMT_Main/0064-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch diff --git a/patches/wined3d-CSMT_Main/0075-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch b/patches/wined3d-CSMT_Main/0065-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0075-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch rename to patches/wined3d-CSMT_Main/0065-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch diff --git a/patches/wined3d-CSMT_Main/0076-wined3d-Unset-some-objects-in-state_init_default.patch b/patches/wined3d-CSMT_Main/0066-wined3d-Unset-some-objects-in-state_init_default.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0076-wined3d-Unset-some-objects-in-state_init_default.patch rename to patches/wined3d-CSMT_Main/0066-wined3d-Unset-some-objects-in-state_init_default.patch diff --git a/patches/wined3d-CSMT_Main/0077-wined3d-Don-t-request-the-frontbuffer-to-create-dumm.patch b/patches/wined3d-CSMT_Main/0067-wined3d-Don-t-request-the-frontbuffer-to-create-dumm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0077-wined3d-Don-t-request-the-frontbuffer-to-create-dumm.patch rename to patches/wined3d-CSMT_Main/0067-wined3d-Don-t-request-the-frontbuffer-to-create-dumm.patch diff --git a/patches/wined3d-CSMT_Main/0078-wined3d-Use-double-buffered-buffers-for-multithreade.patch b/patches/wined3d-CSMT_Main/0068-wined3d-Use-double-buffered-buffers-for-multithreade.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0078-wined3d-Use-double-buffered-buffers-for-multithreade.patch rename to patches/wined3d-CSMT_Main/0068-wined3d-Use-double-buffered-buffers-for-multithreade.patch diff --git a/patches/wined3d-CSMT_Main/0079-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch b/patches/wined3d-CSMT_Main/0069-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0079-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch rename to patches/wined3d-CSMT_Main/0069-wined3d-Don-t-synchronize-NOOVERWRITE-buffer-maps.patch diff --git a/patches/wined3d-CSMT_Main/0080-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch b/patches/wined3d-CSMT_Main/0070-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0080-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch rename to patches/wined3d-CSMT_Main/0070-wined3d-Separate-buffer-map-write-and-draw-read-memo.patch diff --git a/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch b/patches/wined3d-CSMT_Main/0071-wined3d-Accelerate-DISCARD-buffer-maps.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch rename to patches/wined3d-CSMT_Main/0071-wined3d-Accelerate-DISCARD-buffer-maps.patch diff --git a/patches/wined3d-CSMT_Main/0082-wined3d-Accelerate-READONLY-buffer-maps.patch b/patches/wined3d-CSMT_Main/0072-wined3d-Accelerate-READONLY-buffer-maps.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0082-wined3d-Accelerate-READONLY-buffer-maps.patch rename to patches/wined3d-CSMT_Main/0072-wined3d-Accelerate-READONLY-buffer-maps.patch diff --git a/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch b/patches/wined3d-CSMT_Main/0073-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0073-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0084-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch b/patches/wined3d-CSMT_Main/0074-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0084-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch rename to patches/wined3d-CSMT_Main/0074-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0086-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch b/patches/wined3d-CSMT_Main/0075-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0086-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch rename to patches/wined3d-CSMT_Main/0075-wined3d-Use-glBufferSubData-instead-of-glMapBufferRa.patch diff --git a/patches/wined3d-CSMT_Main/0087-wined3d-Separate-GL-buffer-discard-control-from-igno.patch b/patches/wined3d-CSMT_Main/0076-wined3d-Separate-GL-buffer-discard-control-from-igno.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0087-wined3d-Separate-GL-buffer-discard-control-from-igno.patch rename to patches/wined3d-CSMT_Main/0076-wined3d-Separate-GL-buffer-discard-control-from-igno.patch diff --git a/patches/wined3d-CSMT_Main/0088-wined3d-Create-buffers-before-mapping-them.patch b/patches/wined3d-CSMT_Main/0077-wined3d-Create-buffers-before-mapping-them.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0088-wined3d-Create-buffers-before-mapping-them.patch rename to patches/wined3d-CSMT_Main/0077-wined3d-Create-buffers-before-mapping-them.patch diff --git a/patches/wined3d-CSMT_Main/0090-wined3d-Remove-another-glFinish.patch b/patches/wined3d-CSMT_Main/0078-wined3d-Remove-another-glFinish.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0090-wined3d-Remove-another-glFinish.patch rename to patches/wined3d-CSMT_Main/0078-wined3d-Remove-another-glFinish.patch diff --git a/patches/wined3d-CSMT_Main/0093-wined3d-Create-VBOs-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0079-wined3d-Create-VBOs-through-the-command-stream.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0093-wined3d-Create-VBOs-through-the-command-stream.patch rename to patches/wined3d-CSMT_Main/0079-wined3d-Create-VBOs-through-the-command-stream.patch diff --git a/patches/wined3d-CSMT_Main/0096-Swapchain-waits.patch b/patches/wined3d-CSMT_Main/0080-Swapchain-waits.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0096-Swapchain-waits.patch rename to patches/wined3d-CSMT_Main/0080-Swapchain-waits.patch diff --git a/patches/wined3d-CSMT_Main/0098-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch b/patches/wined3d-CSMT_Main/0081-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0098-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch rename to patches/wined3d-CSMT_Main/0081-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch diff --git a/patches/wined3d-CSMT_Main/0099-wined3d-Unload-resources-through-the-CS-in-device_re.patch b/patches/wined3d-CSMT_Main/0082-wined3d-Unload-resources-through-the-CS-in-device_re.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0099-wined3d-Unload-resources-through-the-CS-in-device_re.patch rename to patches/wined3d-CSMT_Main/0082-wined3d-Unload-resources-through-the-CS-in-device_re.patch diff --git a/patches/wined3d-CSMT_Main/0100-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch b/patches/wined3d-CSMT_Main/0083-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0100-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch rename to patches/wined3d-CSMT_Main/0083-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch diff --git a/patches/wined3d-CSMT_Main/0101-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch b/patches/wined3d-CSMT_Main/0084-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0101-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch rename to patches/wined3d-CSMT_Main/0084-wined3d-Use-surface_blt_ugly-in-swapchain_gl_present.patch diff --git a/patches/wined3d-CSMT_Main/0102-wined3d-Invoke-surface_unload-through-the-CS-in-wine.patch b/patches/wined3d-CSMT_Main/0085-wined3d-Invoke-surface_unload-through-the-CS-in-wine.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0102-wined3d-Invoke-surface_unload-through-the-CS-in-wine.patch rename to patches/wined3d-CSMT_Main/0085-wined3d-Invoke-surface_unload-through-the-CS-in-wine.patch diff --git a/patches/wined3d-CSMT_Main/0103-wined3d-Use-an-event-to-block-the-worker-thread-when.patch b/patches/wined3d-CSMT_Main/0086-wined3d-Use-an-event-to-block-the-worker-thread-when.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0103-wined3d-Use-an-event-to-block-the-worker-thread-when.patch rename to patches/wined3d-CSMT_Main/0086-wined3d-Use-an-event-to-block-the-worker-thread-when.patch diff --git a/patches/wined3d-CSMT_Main/0105-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch b/patches/wined3d-CSMT_Main/0087-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0105-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch rename to patches/wined3d-CSMT_Main/0087-wined3d-Set-map_heap_memory-NULL-when-allocating-a-P.patch diff --git a/patches/wined3d-CSMT_Main/0106-wined3d-Wait-only-for-the-buffer-to-be-idle.patch b/patches/wined3d-CSMT_Main/0088-wined3d-Wait-only-for-the-buffer-to-be-idle.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0106-wined3d-Wait-only-for-the-buffer-to-be-idle.patch rename to patches/wined3d-CSMT_Main/0088-wined3d-Wait-only-for-the-buffer-to-be-idle.patch diff --git a/patches/wined3d-CSMT_Main/0109-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch b/patches/wined3d-CSMT_Main/0089-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0109-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch rename to patches/wined3d-CSMT_Main/0089-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch diff --git a/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch b/patches/wined3d-CSMT_Main/0090-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch rename to patches/wined3d-CSMT_Main/0090-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch diff --git a/patches/wined3d-CSMT_Main/0111-wined3d-Don-t-sync-on-redundant-discard-calls.patch b/patches/wined3d-CSMT_Main/0091-wined3d-Don-t-sync-on-redundant-discard-calls.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0111-wined3d-Don-t-sync-on-redundant-discard-calls.patch rename to patches/wined3d-CSMT_Main/0091-wined3d-Don-t-sync-on-redundant-discard-calls.patch diff --git a/patches/wined3d-CSMT_Main/0112-wined3d-Don-t-discard-new-buffers.patch b/patches/wined3d-CSMT_Main/0092-wined3d-Don-t-discard-new-buffers.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0112-wined3d-Don-t-discard-new-buffers.patch rename to patches/wined3d-CSMT_Main/0092-wined3d-Don-t-discard-new-buffers.patch diff --git a/patches/wined3d-CSMT_Main/0113-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch b/patches/wined3d-CSMT_Main/0093-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0113-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch rename to patches/wined3d-CSMT_Main/0093-wined3d-Don-t-try-to-sync-VBOs-manually-on-OSX-with-.patch diff --git a/patches/wined3d-CSMT_Main/0114-wined3d-Only-discard-buffers-that-are-in-use.patch b/patches/wined3d-CSMT_Main/0094-wined3d-Only-discard-buffers-that-are-in-use.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0114-wined3d-Only-discard-buffers-that-are-in-use.patch rename to patches/wined3d-CSMT_Main/0094-wined3d-Only-discard-buffers-that-are-in-use.patch diff --git a/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch b/patches/wined3d-CSMT_Main/0095-wined3d-Send-getdc-and-releasedc-through-the-command.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch rename to patches/wined3d-CSMT_Main/0095-wined3d-Send-getdc-and-releasedc-through-the-command.patch diff --git a/patches/wined3d-CSMT_Main/0118-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch b/patches/wined3d-CSMT_Main/0096-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0118-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch rename to patches/wined3d-CSMT_Main/0096-wined3d-Ignore-WINED3D_MAP_NO_DIRTY_UPDATE-in-resour.patch diff --git a/patches/wined3d-CSMT_Main/0121-wined3d-Create-dummy-textures-through-the-CS.patch b/patches/wined3d-CSMT_Main/0097-wined3d-Create-dummy-textures-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0121-wined3d-Create-dummy-textures-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0097-wined3d-Create-dummy-textures-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0122-wined3d-Create-the-initial-context-through-the-CS.patch b/patches/wined3d-CSMT_Main/0098-wined3d-Create-the-initial-context-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0122-wined3d-Create-the-initial-context-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0098-wined3d-Create-the-initial-context-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0123-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch b/patches/wined3d-CSMT_Main/0099-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0123-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch rename to patches/wined3d-CSMT_Main/0099-wined3d-Recreate-ctx-and-dummy-textures-through-the-.patch diff --git a/patches/wined3d-CSMT_Main/0124-wined3d-Call-create_default_sampler-from-create_dumm.patch b/patches/wined3d-CSMT_Main/0100-wined3d-Call-create_default_sampler-from-create_dumm.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0124-wined3d-Call-create_default_sampler-from-create_dumm.patch rename to patches/wined3d-CSMT_Main/0100-wined3d-Call-create_default_sampler-from-create_dumm.patch diff --git a/patches/wined3d-CSMT_Main/0125-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch b/patches/wined3d-CSMT_Main/0101-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0125-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch rename to patches/wined3d-CSMT_Main/0101-wined3d-Delete-GL-contexts-through-the-CS-in-reset.patch diff --git a/patches/wined3d-CSMT_Main/0126-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch b/patches/wined3d-CSMT_Main/0102-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0126-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch rename to patches/wined3d-CSMT_Main/0102-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch diff --git a/patches/wined3d-CSMT_Main/0127-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch b/patches/wined3d-CSMT_Main/0103-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0127-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch rename to patches/wined3d-CSMT_Main/0103-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch diff --git a/patches/wined3d-CSMT_Main/0128-wined3d-Do-the-sampler-GL-init-through-the-CS.patch b/patches/wined3d-CSMT_Main/0104-wined3d-Do-the-sampler-GL-init-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0128-wined3d-Do-the-sampler-GL-init-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0104-wined3d-Do-the-sampler-GL-init-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0130-wined3d-Create-initial-DCs-through-the-CS.patch b/patches/wined3d-CSMT_Main/0105-wined3d-Create-initial-DCs-through-the-CS.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0130-wined3d-Create-initial-DCs-through-the-CS.patch rename to patches/wined3d-CSMT_Main/0105-wined3d-Create-initial-DCs-through-the-CS.patch diff --git a/patches/wined3d-CSMT_Main/0131-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch b/patches/wined3d-CSMT_Main/0106-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0131-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch rename to patches/wined3d-CSMT_Main/0106-wined3d-Assign-a-read-buffer-when-discarding-a-new-t.patch diff --git a/patches/wined3d-CSMT_Main/0132-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch b/patches/wined3d-CSMT_Main/0107-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0132-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch rename to patches/wined3d-CSMT_Main/0107-wined3d-Do-not-query-available-GPU-memory-on-main-th.patch diff --git a/patches/wined3d-CSMT_Main/0133-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch b/patches/wined3d-CSMT_Main/0108-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0133-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch rename to patches/wined3d-CSMT_Main/0108-wined3d-Fix-incorrect-return-value-in-wined3d_cs_exe.patch diff --git a/patches/wined3d-CSMT_Main/0134-wined3d-Fix-context_acquire-not-being-called-from-th.patch b/patches/wined3d-CSMT_Main/0109-wined3d-Fix-context_acquire-not-being-called-from-th.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0134-wined3d-Fix-context_acquire-not-being-called-from-th.patch rename to patches/wined3d-CSMT_Main/0109-wined3d-Fix-context_acquire-not-being-called-from-th.patch diff --git a/patches/wined3d-CSMT_Main/0135-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch b/patches/wined3d-CSMT_Main/0110-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch similarity index 100% rename from patches/wined3d-CSMT_Main/0135-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch rename to patches/wined3d-CSMT_Main/0110-wined3d-Do-not-signal-CS-event-when-we-manage-to-uns.patch diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index ba608301..c9609dfb 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -66,7 +66,7 @@ diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader shader_arb_ps_local_constants(compiled, context, state, rt_height); } -@@ -7999,8 +8023,16 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_ +@@ -7983,8 +8007,16 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_ /* Leave the opengl state valid for blitting */ arbfp_blit_unset(context->gl_info); @@ -243,7 +243,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_mark_used(buffer); if (!buffer->buffer_object) -@@ -939,9 +1001,34 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -939,9 +1001,14 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI { LONG count; BYTE *base; @@ -254,7 +254,15 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c TRACE("buffer %p, offset %u, size %u, data %p, flags %#x.\n", buffer, offset, size, data, flags); -+#if defined(STAGING_CSMT) ++#if !defined(STAGING_CSMT) + /* 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 +@@ -949,6 +1016,35 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI + * the buffer is currently in use, while the proprietary NVIDIA driver + * appears to do this unconditionally. */ + if (buffer->flags & WINED3D_BUFFER_DISCARD) ++#else /* STAGING_CSMT */ + /* FIXME: There is a race condition with the same code in + * buffer_internal_preload and buffer_get_memory. + * @@ -274,23 +282,19 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c + wined3d_cs_emit_create_vbo(device->cs, buffer); + } + -+#endif /* STAGING_CSMT */ - 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 -@@ -949,7 +1036,11 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN - * previous contents of the buffer. The r600g driver only does this when - * the buffer is currently in use, while the proprietary NVIDIA driver - * appears to do this unconditionally. */ -+#if !defined(STAGING_CSMT) - if (buffer->flags & WINED3D_BUFFER_DISCARD) -+#else /* STAGING_CSMT */ ++ 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 ++ * previous contents of the buffer. The r600g driver only does this when ++ * the buffer is currently in use, while the proprietary NVIDIA driver ++ * appears to do this unconditionally. */ + if (buffer->ignore_discard) +#endif /* STAGING_CSMT */ flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; -@@ -960,17 +1051,34 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -959,17 +1055,34 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI * being uploaded in that case. Two such applications are Port Royale * and Darkstar One. */ if (flags & WINED3D_MAP_DISCARD) @@ -325,7 +329,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -1016,11 +1124,14 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1015,11 +1128,14 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI buffer_get_sysmem(buffer, context); } TRACE("New pointer is %p.\n", buffer->resource.heap_memory); @@ -340,7 +344,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (flags & WINED3D_MAP_DISCARD) buffer->flags |= WINED3D_BUFFER_DISCARD; -@@ -1029,6 +1140,43 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1028,6 +1144,43 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.heap_memory; @@ -384,7 +388,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c *data = base + offset; TRACE("Returning memory at %p (base %p, offset %u).\n", *data, base, offset); -@@ -1091,17 +1239,25 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) +@@ -1090,17 +1243,25 @@ static void wined3d_buffer_unmap(struct wined3d_buffer *buffer) } GL_EXTCALL(glUnmapBuffer(buffer->buffer_type_hint)); @@ -410,7 +414,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, -@@ -1221,6 +1377,14 @@ static void buffer_resource_preload(struct wined3d_resource *resource) +@@ -1220,6 +1381,14 @@ static void buffer_resource_preload(struct wined3d_resource *resource) { struct wined3d_context *context; @@ -425,7 +429,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c context = context_acquire(resource->device, NULL); buffer_internal_preload(buffer_from_resource(resource), context, NULL); context_release(context); -@@ -1303,6 +1467,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1302,6 +1471,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device return hr; } buffer->buffer_type_hint = bind_hint; @@ -435,7 +439,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory, buffer); -@@ -1338,6 +1505,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1337,6 +1509,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->flags |= WINED3D_BUFFER_USE_BO; } @@ -447,7 +451,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) { ERR("Out of memory.\n"); -@@ -1465,3 +1637,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, +@@ -1464,3 +1641,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, return WINED3D_OK; } @@ -644,11 +648,14 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DRAW, -@@ -57,6 +65,49 @@ enum wined3d_cs_op +@@ -57,8 +65,52 @@ enum wined3d_cs_op WINED3D_CS_OP_QUERY_ISSUE, WINED3D_CS_OP_PRELOAD_RESOURCE, WINED3D_CS_OP_UNLOAD_RESOURCE, -+#if defined(STAGING_CSMT) ++#if !defined(STAGING_CSMT) + WINED3D_CS_OP_MAP, + WINED3D_CS_OP_UNMAP, ++#else /* STAGING_CSMT */ + WINED3D_CS_OP_SET_VS_CONSTS_F, + WINED3D_CS_OP_SET_VS_CONSTS_B, + WINED3D_CS_OP_SET_VS_CONSTS_I, @@ -694,12 +701,18 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -289,7 +340,266 @@ struct wined3d_cs_unload_resource +@@ -291,6 +343,7 @@ struct wined3d_cs_unload_resource struct wined3d_resource *resource; }; +#if !defined(STAGING_CSMT) - static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) + struct wined3d_cs_map + { + enum wined3d_cs_op opcode; +@@ -303,14 +356,272 @@ struct wined3d_cs_map + }; + + struct wined3d_cs_unmap +#else /* STAGING_CSMT */ +struct wined3d_cs_set_consts_f +{ @@ -838,9 +851,17 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +}; + +struct wined3d_cs_update_sub_resource -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_resource *resource; ++#endif /* STAGING_CSMT */ + { + enum wined3d_cs_op opcode; + struct wined3d_resource *resource; ++#if !defined(STAGING_CSMT) + unsigned int sub_resource_idx; + HRESULT *hr; + }; + + static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + unsigned int sub_resource_idx, row_pitch, depth_pitch; + const struct wined3d_box *box; + const void *data; @@ -961,7 +982,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -298,13 +608,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -319,13 +630,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) swapchain = op->swapchain; wined3d_swapchain_set_window(swapchain, op->dst_window_override); @@ -986,7 +1007,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -312,6 +633,9 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -333,6 +655,9 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw { struct wined3d_cs_present *op; unsigned int i; @@ -996,7 +1017,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_PRESENT; -@@ -327,34 +651,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -348,34 +673,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); } @@ -1072,7 +1093,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -363,8 +728,13 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -384,8 +750,13 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_clear *op; unsigned int i; @@ -1086,7 +1107,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -377,11 +747,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -398,11 +769,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1104,7 +1125,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_resource_acquire(state->fb->depth_stencil->resource); cs->ops->submit(cs); -@@ -390,12 +766,65 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -411,12 +788,65 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { struct wined3d_state *state = &cs->device->state; @@ -1170,7 +1191,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] && state->load_base_vertex_index != op->base_vertex_idx) { -@@ -420,11 +849,19 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -441,11 +871,19 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1190,7 +1211,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -446,6 +883,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -467,6 +905,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) wined3d_resource_release(view->resource); } } @@ -1201,15 +1222,15 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, -@@ -468,11 +909,25 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -489,11 +931,25 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i op->indexed = indexed; if (indexed) +#if !defined(STAGING_CSMT) -+ wined3d_resource_acquire(&state->index_buffer->resource); + wined3d_resource_acquire(&state->index_buffer->resource); +#else /* STAGING_CSMT */ + { - wined3d_resource_acquire(&state->index_buffer->resource); ++ wined3d_resource_acquire(&state->index_buffer->resource); + state->index_buffer->ignore_discard = FALSE; + } +#endif /* STAGING_CSMT */ @@ -1217,17 +1238,17 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { if (state->streams[i].buffer) +#if !defined(STAGING_CSMT) - wined3d_resource_acquire(&state->streams[i].buffer->resource); ++ wined3d_resource_acquire(&state->streams[i].buffer->resource); +#else /* STAGING_CSMT */ + { -+ wined3d_resource_acquire(&state->streams[i].buffer->resource); + wined3d_resource_acquire(&state->streams[i].buffer->resource); + state->streams[i].buffer->ignore_discard = FALSE; + } +#endif /* STAGING_CSMT */ } for (i = 0; i < ARRAY_SIZE(state->textures); ++i) { -@@ -481,11 +936,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -502,11 +958,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1247,7 +1268,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -508,15 +971,26 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -529,15 +993,26 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } } @@ -1274,7 +1295,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -528,15 +1002,26 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -549,15 +1024,26 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query op->predicate = predicate; op->value = value; @@ -1301,7 +1322,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -547,15 +1032,26 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -568,15 +1054,26 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -1328,7 +1349,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -566,15 +1062,29 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -587,15 +1084,29 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -1358,7 +1379,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -587,16 +1097,27 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -608,16 +1119,27 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v op->view_idx = view_idx; op->view = view; @@ -1386,7 +1407,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -604,15 +1125,26 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -625,15 +1147,26 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const || prev_surface->container->flags & WINED3D_TEXTURE_DISCARD)) { surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); @@ -1413,7 +1434,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -629,6 +1161,10 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -650,6 +1183,10 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1424,7 +1445,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -639,15 +1175,26 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -660,15 +1197,26 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -1451,7 +1472,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -658,10 +1205,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -679,10 +1227,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -1469,7 +1490,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -679,6 +1233,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -700,6 +1255,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1480,7 +1501,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -693,10 +1251,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -714,10 +1273,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, op->offset = offset; op->stride = stride; @@ -1498,7 +1519,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -706,6 +1271,10 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -727,6 +1293,10 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1509,7 +1530,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -718,10 +1287,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -739,10 +1309,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i op->frequency = frequency; op->flags = flags; @@ -1527,7 +1548,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -736,6 +1312,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -757,6 +1334,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -1538,7 +1559,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -749,10 +1329,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -770,10 +1351,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, op->buffer = buffer; op->offset = offset; @@ -1556,7 +1577,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -768,6 +1355,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -789,6 +1377,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -1567,7 +1588,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -781,10 +1372,17 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -802,10 +1394,17 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff op->format_id = format_id; op->offset = offset; @@ -1585,7 +1606,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -798,6 +1396,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -819,6 +1418,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -1595,7 +1616,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -811,10 +1412,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -832,10 +1434,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha op->cb_idx = cb_idx; op->buffer = buffer; @@ -1613,7 +1634,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -891,6 +1499,10 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -912,6 +1521,10 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1624,7 +1645,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -901,16 +1513,27 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -922,16 +1535,27 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -1652,7 +1673,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -924,15 +1547,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -945,15 +1569,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 op->view_idx = view_idx; op->view = view; @@ -1661,13 +1682,14 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) +-{ +#else /* STAGING_CSMT */ + cs->ops->submit(cs, sizeof(*op)); +} + +static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) +#endif /* STAGING_CSMT */ - { ++{ const struct wined3d_cs_set_sampler *op = data; cs->state.sampler[op->type][op->sampler_idx] = op->sampler; @@ -1679,7 +1701,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -946,16 +1580,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -967,16 +1602,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -1688,14 +1710,13 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) --{ +#else /* STAGING_CSMT */ + cs->ops->submit(cs, sizeof(*op)); +} + +static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) +#endif /* STAGING_CSMT */ -+{ + { const struct wined3d_cs_set_shader *op = data; cs->state.shader[op->type] = op->shader; @@ -1708,7 +1729,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -967,15 +1612,26 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -988,15 +1634,26 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type op->type = type; op->shader = shader; @@ -1735,7 +1756,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, -@@ -987,15 +1643,86 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1008,6 +1665,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state; @@ -1743,7 +1764,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } - static void wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) +@@ -1069,19 +1727,275 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE; + op->sampler_idx = sampler_idx; +#else /* STAGING_CSMT */ + cs->ops->submit(cs, sizeof(*op)); +} @@ -1809,20 +1833,22 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +} + +static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) -+#endif /* STAGING_CSMT */ - { - const struct wined3d_cs_set_render_state *op = data; - - cs->state.render_states[op->state] = op->value; - device_invalidate_state(cs->device, STATE_RENDER(op->state)); -+#if defined(STAGING_CSMT) ++{ ++ const struct wined3d_cs_set_render_state *op = data; ++ ++ cs->state.render_states[op->state] = op->value; ++ device_invalidate_state(cs->device, STATE_RENDER(op->state)); + + return sizeof(*op); ++} ++ ++void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) ++{ ++ struct wined3d_cs_set_render_state *op; ++ ++ op = cs->ops->require_space(cs, sizeof(*op)); ++ op->opcode = WINED3D_CS_OP_SET_RENDER_STATE; +#endif /* STAGING_CSMT */ - } - - void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -1007,6 +1734,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->state = state; op->value = value; @@ -1830,10 +1856,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -1038,6 +1766,159 @@ static void wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void - - cs->state.sampler_states[op->sampler_idx][op->state] = op->value; - device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); + static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) +#else /* STAGING_CSMT */ + cs->ops->submit(cs, sizeof(*op)); +} @@ -1986,20 +2009,19 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); + + return sizeof(*op); -+#endif /* STAGING_CSMT */ - } - - void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1051,16 +1932,27 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, - op->state = state; - op->value = value; - -+#if !defined(STAGING_CSMT) - cs->ops->submit(cs); - } - - static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) -+#else /* STAGING_CSMT */ ++} ++ ++void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, ++ enum wined3d_sampler_state state, DWORD value) ++{ ++ struct wined3d_cs_set_sampler_state *op; ++ ++ op = cs->ops->require_space(cs, sizeof(*op)); ++ op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE; ++ op->sampler_idx = sampler_idx; ++ op->state = state; ++ op->value = value; ++ + cs->ops->submit(cs, sizeof(*op)); +} + @@ -2018,7 +2040,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1073,15 +1965,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1094,15 +2008,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform op->state = state; op->matrix = *matrix; @@ -2045,7 +2067,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -1093,10 +1996,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1114,10 +2039,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const op->plane_idx = plane_idx; op->plane = *plane; @@ -2063,7 +2085,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1157,6 +2067,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1178,6 +2110,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -2074,7 +2096,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1176,15 +2090,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1197,15 +2133,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -2101,7 +2123,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1195,17 +2120,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1216,17 +2163,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -2137,7 +2159,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1215,14 +2158,25 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1236,14 +2201,25 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -2163,7 +2185,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) -@@ -1234,15 +2188,57 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1255,15 +2231,57 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void op->callback = callback; op->object = object; @@ -2221,7 +2243,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) -@@ -1254,16 +2250,27 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1275,16 +2293,27 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu op->query = query; op->flags = flags; @@ -2249,7 +2271,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) -@@ -1276,16 +2283,27 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso +@@ -1297,16 +2326,27 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso wined3d_resource_acquire(resource); @@ -2277,7 +2299,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) -@@ -1298,6 +2316,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1319,6 +2359,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou wined3d_resource_acquire(resource); @@ -2285,7 +2307,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -1447,5 +2466,1174 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -1523,5 +2564,1174 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) state_cleanup(&cs->state); HeapFree(GetProcessHeap(), 0, cs->fb.render_targets); HeapFree(GetProcessHeap(), 0, cs->data); @@ -4772,7 +4794,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5232,8 +5795,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5224,8 +5787,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -4790,7 +4812,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state = &device->state; if (!(device->cs = wined3d_cs_create(device))) -@@ -5327,3 +5899,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5319,3 +5891,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -5181,7 +5203,47 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c context_resource_released(resource->device, resource, resource->type); wined3d_resource_release(resource); } -@@ -348,7 +354,11 @@ BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) +@@ -315,6 +321,7 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st + desc->size = resource->size; + } + ++#if !defined(STAGING_CSMT) + 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. +@@ -348,22 +355,31 @@ static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource * + return flags; + } + ++#endif /* STAGING_CSMT */ + 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); + ++#if !defined(STAGING_CSMT) + flags = wined3d_resource_sanitise_map_flags(resource, flags); + + return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags); ++#else /* STAGING_CSMT */ ++ return resource->resource_ops->resource_sub_resource_map(resource, sub_resource_idx, map_desc, box, flags); ++#endif /* STAGING_CSMT */ + } + + HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx) + { + TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx); + ++#if !defined(STAGING_CSMT) + return wined3d_cs_unmap(resource->device->cs, resource, sub_resource_idx); ++#else /* STAGING_CSMT */ ++ return resource->resource_ops->resource_sub_resource_unmap(resource, sub_resource_idx); ++#endif /* STAGING_CSMT */ + } + + void CDECL wined3d_resource_preload(struct wined3d_resource *resource) +@@ -383,7 +399,11 @@ BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1; *p = mem; @@ -5193,6 +5255,48 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c return TRUE; } +@@ -399,6 +419,41 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) + resource->heap_memory = NULL; + } + ++#if defined(STAGING_CSMT) ++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; ++} ++ ++#endif /* STAGING_CSMT */ + GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) + { + GLbitfield ret = 0; diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c @@ -7061,7 +7165,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c data->addr += sub_resource->offset; data->buffer_object = 0; return; -@@ -337,6 +489,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc +@@ -339,6 +491,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc /* Context activation is done by the caller. */ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture, @@ -7069,7 +7173,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info) { GLuint *buffer_object; -@@ -349,6 +502,24 @@ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture +@@ -351,6 +504,24 @@ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture TRACE("Deleted buffer object %u for texture %p, sub-resource %u.\n", *buffer_object, texture, sub_resource_idx); @@ -7094,7 +7198,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) -@@ -368,7 +539,11 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) +@@ -370,7 +541,11 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) && !wined3d_texture_load_location(texture, i, context, map_binding)) ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding)); if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER) @@ -7106,7 +7210,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) -@@ -525,28 +700,51 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -527,28 +702,51 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) unsigned int sub_count = texture->level_count * texture->layer_count; struct wined3d_device *device = texture->resource.device; struct wined3d_context *context = NULL; @@ -7158,7 +7262,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) context_release(context); -@@ -849,6 +1047,12 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) +@@ -851,6 +1049,12 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) static void wined3d_texture_cleanup_sync(struct wined3d_texture *texture) { wined3d_texture_sub_resources_destroyed(texture); @@ -7171,7 +7275,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c resource_cleanup(&texture->resource); wined3d_resource_wait_idle(&texture->resource); wined3d_texture_cleanup(texture); -@@ -876,6 +1080,15 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) +@@ -878,6 +1082,15 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) { wined3d_texture_sub_resources_destroyed(texture); texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent); @@ -7187,7 +7291,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c resource_cleanup(&texture->resource); wined3d_cs_emit_destroy_object(texture->resource.device->cs, wined3d_texture_destroy_object, texture); } -@@ -1012,7 +1225,17 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) +@@ -1014,7 +1227,17 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) if (texture->lod != lod) { @@ -7205,22 +7309,22 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->lod = lod; texture->texture_rgb.base_level = ~0u; -@@ -1139,7 +1362,14 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1141,7 +1364,14 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } if (device->d3d_initialized) +#if !defined(STAGING_CSMT) - wined3d_cs_emit_unload_resource(device->cs, &texture->resource); ++ wined3d_cs_emit_unload_resource(device->cs, &texture->resource); +#else /* STAGING_CSMT */ + { -+ wined3d_cs_emit_unload_resource(device->cs, &texture->resource); + wined3d_cs_emit_unload_resource(device->cs, &texture->resource); + device->cs->ops->finish(device->cs); + } +#endif /* STAGING_CSMT */ sub_resource = &texture->sub_resources[0]; surface = sub_resource->u.surface; -@@ -1150,6 +1380,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1152,6 +1382,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } wined3d_resource_free_sysmem(&texture->resource); @@ -7230,7 +7334,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((texture->row_pitch = pitch)) texture->slice_pitch = height * pitch; -@@ -1206,18 +1439,31 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1208,18 +1441,31 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT wined3d_texture_invalidate_location(texture, 0, ~valid_location); if (create_dib) @@ -7262,7 +7366,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->buffer_object) return; -@@ -1229,6 +1475,25 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur +@@ -1231,6 +1477,25 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur TRACE("Created buffer object %u for texture %p, sub-resource %u.\n", sub_resource->buffer_object, texture, sub_resource_idx); @@ -7288,7 +7392,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_force_reload(struct wined3d_texture *texture) -@@ -1346,6 +1611,9 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1348,6 +1613,9 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned ERR("Failed to allocate system memory.\n"); return FALSE; } @@ -7298,7 +7402,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_USER_MEMORY: -@@ -1354,7 +1622,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1356,7 +1624,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned return TRUE; case WINED3D_LOCATION_BUFFER: @@ -7310,7 +7414,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1409,7 +1681,9 @@ struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct win +@@ -1411,7 +1683,9 @@ struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct win HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, UINT layer, const struct wined3d_box *dirty_region) { @@ -7320,7 +7424,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int sub_resource_idx; TRACE("texture %p, layer %u, dirty_region %s.\n", texture, layer, debug_box(dirty_region)); -@@ -1421,6 +1695,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1423,6 +1697,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, } sub_resource_idx = layer * texture->level_count; @@ -7328,7 +7432,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (dirty_region) WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); -@@ -1434,6 +1709,9 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1436,6 +1711,9 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); context_release(context); @@ -7338,7 +7442,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3D_OK; } -@@ -1610,7 +1888,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1612,7 +1890,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in struct wined3d_context *context, DWORD location) { struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; @@ -7348,7 +7452,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int row_pitch, slice_pitch; TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n", -@@ -1618,6 +1898,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1620,6 +1900,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations)); @@ -7356,7 +7460,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((sub_resource->locations & location) == location) { TRACE("Location(s) already up to date.\n"); -@@ -1631,9 +1912,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1633,9 +1914,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7368,7 +7472,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_DISCARDED) { TRACE("1d texture previously discarded, nothing to do.\n"); -@@ -1642,6 +1925,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1644,6 +1927,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in goto done; } @@ -7376,7 +7480,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c switch (location) { case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1656,7 +1940,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1658,7 +1942,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -7388,7 +7492,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); texture1d_upload_data(texture, sub_resource_idx, context, &data, row_pitch, slice_pitch); -@@ -1701,7 +1989,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1703,7 +1991,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -7400,7 +7504,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -1724,7 +2016,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1726,7 +2018,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7410,7 +7514,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_validate_location(texture, sub_resource_idx, location); return TRUE; -@@ -1819,7 +2113,12 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int +@@ -1821,7 +2115,12 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) { @@ -7423,7 +7527,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } /* Context activation is done by the caller. */ -@@ -1982,8 +2281,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1984,8 +2283,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -7437,7 +7541,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -2008,6 +2312,89 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -2010,6 +2314,89 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_unload_gl_texture(texture); } @@ -7527,7 +7631,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) { -@@ -2015,6 +2402,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -2017,6 +2404,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour struct wined3d_texture_sub_resource *sub_resource; struct wined3d_device *device = resource->device; unsigned int fmt_flags = resource->format_flags; @@ -7535,7 +7639,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c const struct wined3d_gl_info *gl_info = NULL; struct wined3d_context *context = NULL; struct wined3d_texture *texture; -@@ -2022,6 +2410,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -2024,6 +2412,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour unsigned int texture_level; BYTE *base_memory; BOOL ret; @@ -7547,9 +7651,9 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c 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); -@@ -2068,14 +2461,20 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour - - flags = wined3d_resource_sanitize_map_flags(resource, flags); +@@ -2068,14 +2461,22 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour + return WINED3DERR_INVALIDCALL; + } +#if !defined(STAGING_CSMT) if (device->d3d_initialized) @@ -7558,6 +7662,8 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c gl_info = context->gl_info; } +#else /* STAGING_CSMT */ ++ flags = wined3d_resource_sanitize_map_flags(resource, flags); ++ + if (flags & WINED3D_MAP_NOOVERWRITE) + FIXME("WINED3D_MAP_NOOVERWRITE is not implemented yet.\n"); +#endif /* STAGING_CSMT */ @@ -7568,7 +7674,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("WINED3D_MAP_DISCARD flag passed, marking %s as up to date.\n", wined3d_debug_location(texture->resource.map_binding)); if ((ret = wined3d_texture_prepare_location(texture, sub_resource_idx, -@@ -2106,6 +2505,24 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -2106,6 +2507,24 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour if (context) context_release(context); @@ -7593,7 +7699,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) { -@@ -2141,6 +2558,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -2141,6 +2560,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour } } @@ -7601,7 +7707,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (texture->swapchain && texture->swapchain->front_buffer == texture) { RECT *r = &texture->swapchain->front_buffer_update; -@@ -2152,6 +2570,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -2152,6 +2572,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour TRACE("Mapped front buffer %s.\n", wine_dbgstr_rect(r)); } @@ -7609,7 +7715,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c ++resource->map_count; ++sub_resource->map_count; -@@ -2161,14 +2580,71 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -2161,14 +2582,71 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour return WINED3D_OK; } @@ -7681,7 +7787,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx); -@@ -2184,6 +2660,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -2184,6 +2662,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso return WINEDDERR_NOTLOCKED; } @@ -7689,7 +7795,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) { context = context_acquire(device, NULL); -@@ -2204,6 +2681,15 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -2204,6 +2683,15 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso else if (resource->format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) { FIXME("Depth / stencil buffer locking is not implemented.\n"); @@ -7705,7 +7811,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } --sub_resource->map_count; -@@ -2567,11 +3053,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2567,11 +3055,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -7729,7 +7835,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } } } -@@ -2708,7 +3206,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2708,7 +3208,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in struct wined3d_context *context, DWORD location) { struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; @@ -7739,7 +7845,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int row_pitch, slice_pitch; TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n", -@@ -2716,6 +3216,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2716,6 +3218,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations)); @@ -7747,7 +7853,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((sub_resource->locations & location) == location) { TRACE("Location(s) already up to date.\n"); -@@ -2729,9 +3230,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2729,9 +3232,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7759,7 +7865,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_DISCARDED) { TRACE("Volume previously discarded, nothing to do.\n"); -@@ -2740,6 +3243,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2740,6 +3245,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in goto done; } @@ -7767,7 +7873,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c switch (location) { case WINED3D_LOCATION_TEXTURE_RGB: -@@ -2755,7 +3259,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2755,7 +3261,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -7779,7 +7885,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); -@@ -2801,7 +3309,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2801,7 +3311,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -7791,7 +7897,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -2824,7 +3336,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2824,7 +3338,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7801,7 +7907,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_validate_location(texture, sub_resource_idx, location); return TRUE; -@@ -2988,6 +3502,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2988,6 +3504,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (wined3d_texture_use_pbo(texture, gl_info)) { wined3d_resource_free_sysmem(&texture->resource); @@ -7811,7 +7917,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->resource.map_binding = WINED3D_LOCATION_BUFFER; } -@@ -3348,13 +3865,47 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -3348,13 +3867,47 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -7859,7 +7965,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -3372,6 +3923,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3379,6 +3932,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) return WINED3DERR_INVALIDCALL; @@ -7867,7 +7973,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) context = context_acquire(device, NULL); -@@ -3394,6 +3946,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3401,6 +3955,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i TRACE("Returning dc %p.\n", *dc); return hr; @@ -7900,7 +8006,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -3424,6 +4002,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3431,6 +4011,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -7908,7 +8014,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D)) wined3d_surface_destroy_dc(surface); -@@ -3432,6 +4011,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3439,6 +4020,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign wined3d_texture_update_map_binding(texture); if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; @@ -7992,7 +8098,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #include #include #include -@@ -310,6 +313,9 @@ struct wined3d_settings +@@ -306,6 +309,9 @@ struct wined3d_settings unsigned int max_sm_ps; unsigned int max_sm_cs; BOOL no_3d; @@ -8002,7 +8108,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -1380,7 +1386,11 @@ enum wined3d_query_state +@@ -1376,7 +1382,11 @@ enum wined3d_query_state struct wined3d_query_ops { BOOL (*query_poll)(struct wined3d_query *query); @@ -8014,7 +8120,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -1394,6 +1404,10 @@ struct wined3d_query +@@ -1390,6 +1400,10 @@ struct wined3d_query const void *data; DWORD data_size; const struct wined3d_query_ops *query_ops; @@ -8025,7 +8131,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; union wined3d_gl_query_object -@@ -1435,6 +1449,9 @@ struct wined3d_occlusion_query +@@ -1431,6 +1445,9 @@ struct wined3d_occlusion_query GLuint id; struct wined3d_context *context; DWORD samples; @@ -8035,7 +8141,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_timestamp_query -@@ -1450,6 +1467,38 @@ struct wined3d_timestamp_query +@@ -1446,6 +1463,38 @@ struct wined3d_timestamp_query void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; @@ -8074,7 +8180,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context { const struct wined3d_gl_info *gl_info; -@@ -1464,6 +1513,9 @@ struct wined3d_context +@@ -1460,6 +1509,9 @@ struct wined3d_context DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -8084,7 +8190,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_swapchain *swapchain; struct -@@ -1572,12 +1624,14 @@ struct wined3d_context +@@ -1568,12 +1620,14 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; @@ -8099,7 +8205,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -1716,7 +1770,11 @@ void context_alloc_event_query(struct wined3d_context *context, +@@ -1712,7 +1766,11 @@ void context_alloc_event_query(struct wined3d_context *context, void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN; void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN; @@ -8111,7 +8217,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN; BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2356,7 +2414,11 @@ struct wined3d_stream_state +@@ -2353,7 +2411,11 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -8123,7 +8229,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2403,6 +2465,16 @@ struct wined3d_state +@@ -2400,6 +2462,16 @@ struct wined3d_state struct wined3d_rasterizer_state *rasterizer_state; }; @@ -8140,7 +8246,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #define WINED3D_UNMAPPED_STAGE ~0U /* Multithreaded flag. Removed from the public header to signal that -@@ -2455,16 +2527,21 @@ struct wined3d_device +@@ -2452,16 +2524,21 @@ struct wined3d_device struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -8162,7 +8268,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; -@@ -2513,9 +2590,23 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2510,9 +2587,23 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -8186,7 +8292,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2560,7 +2651,11 @@ struct wined3d_resource +@@ -2557,7 +2648,11 @@ struct wined3d_resource UINT depth; UINT size; DWORD priority; @@ -8198,7 +8304,17 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct list resource_list_entry; LONG access_count; -@@ -2668,6 +2763,9 @@ struct wined3d_texture +@@ -2604,6 +2699,9 @@ 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; ++#if defined(STAGING_CSMT) ++DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN; ++#endif /* STAGING_CSMT */ + void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN; + + /* Tests show that the start address of resources is 32 byte aligned */ +@@ -2665,6 +2763,9 @@ struct wined3d_texture DWORD flags; GLenum target; DWORD update_map_binding; @@ -8208,7 +8324,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; -@@ -2704,7 +2802,12 @@ struct wined3d_texture +@@ -2701,7 +2802,12 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -8221,7 +8337,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2755,11 +2858,23 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2752,11 +2858,23 @@ void wined3d_texture_bind(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -8245,7 +8361,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_texture_invalidate_location(struct wined3d_texture *texture, -@@ -2772,13 +2887,26 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size +@@ -2769,13 +2887,26 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; @@ -8272,7 +8388,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch) DECLSPEC_HIDDEN; -@@ -2887,7 +3015,11 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru +@@ -2884,7 +3015,11 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -8284,7 +8400,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, -@@ -2898,6 +3030,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -2895,6 +3030,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P 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; @@ -8296,7 +8412,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h 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; -@@ -2912,6 +3049,12 @@ struct wined3d_sampler +@@ -2909,6 +3049,12 @@ struct wined3d_sampler GLuint name; }; @@ -8309,7 +8425,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -3007,6 +3150,7 @@ struct wined3d_stateblock +@@ -3004,6 +3150,7 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -8317,7 +8433,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; -@@ -3020,54 +3164,150 @@ enum wined3d_push_constants +@@ -3017,54 +3164,150 @@ enum wined3d_push_constants WINED3D_PUSH_CONSTANTS_PS_I, WINED3D_PUSH_CONSTANTS_VS_B, WINED3D_PUSH_CONSTANTS_PS_B, @@ -8468,15 +8584,15 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, struct wined3d_rasterizer_state *rasterizer_state) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, -@@ -3097,6 +3337,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -3094,6 +3337,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform 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; +#if !defined(STAGING_CSMT) void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; - - static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, -@@ -3104,6 +3345,24 @@ static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d + 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; +@@ -3105,6 +3349,24 @@ static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d { cs->ops->push_constants(cs, p, start_idx, count, constants); } @@ -8501,7 +8617,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ -@@ -3130,6 +3389,9 @@ struct wined3d_buffer +@@ -3131,6 +3393,9 @@ struct wined3d_buffer GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -8511,7 +8627,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3154,11 +3416,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co +@@ -3155,11 +3420,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -8531,7 +8647,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3220,7 +3490,12 @@ struct wined3d_unordered_access_view +@@ -3221,7 +3494,12 @@ struct wined3d_unordered_access_view struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -8544,7 +8660,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3257,6 +3532,10 @@ struct wined3d_swapchain +@@ -3258,6 +3536,10 @@ struct wined3d_swapchain void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;