diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 73fe94aa..741f55f6 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "38f3d59ed694afba7913b4992d13cb044a09126c" + echo "cc9c18a46d1ce7e2834bae0fa65a6ed7904820dd" } # Show version information @@ -7400,10 +7400,7 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then patch_apply wined3d-CSMT_Main/0088-wined3d-Create-buffers-before-mapping-them.patch patch_apply wined3d-CSMT_Main/0090-wined3d-Remove-another-glFinish.patch patch_apply wined3d-CSMT_Main/0093-wined3d-Create-VBOs-through-the-command-stream.patch - patch_apply wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch - patch_apply wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch patch_apply wined3d-CSMT_Main/0096-Swapchain-waits.patch - patch_apply wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch patch_apply wined3d-CSMT_Main/0098-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch patch_apply wined3d-CSMT_Main/0099-wined3d-Unload-resources-through-the-CS-in-device_re.patch patch_apply wined3d-CSMT_Main/0100-wined3d-Don-t-glFinish-after-a-depth-buffer-blit.patch @@ -7529,10 +7526,7 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then echo '+ { "Stefan Dösinger", "wined3d: Create buffers before mapping them.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Remove another glFinish.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Create VBOs through the command stream.", 1 },'; - echo '+ { "Stefan Dösinger", "wined3d: Clean up resource data through the CS.", 1 },'; - echo '+ { "Stefan Dösinger", "wined3d: Clean up buffer resource data through the CS.", 1 },'; echo '+ { "Stefan Dösinger", "Swapchain waits.", 1 },'; - echo '+ { "Stefan Dösinger", "wined3d: Clean up textures through the command stream.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Unload resources through the CS in uninit_3d.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Unload resources through the CS in device_reset.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Don'\''t glFinish after a depth buffer blit.", 1 },'; diff --git a/patches/wined3d-CSMT_Main/0012-wined3d-Wait-for-the-cs-before-destroying-objects.patch b/patches/wined3d-CSMT_Main/0012-wined3d-Wait-for-the-cs-before-destroying-objects.patch index 640c68a0..3693585c 100644 --- a/patches/wined3d-CSMT_Main/0012-wined3d-Wait-for-the-cs-before-destroying-objects.patch +++ b/patches/wined3d-CSMT_Main/0012-wined3d-Wait-for-the-cs-before-destroying-objects.patch @@ -1,4 +1,4 @@ -From 46b7d05ee6b1ff14469c78be3f2b9c1fd0192996 Mon Sep 17 00:00:00 2001 +From 6dab3b97a20b3b51219c2158309a303cd98898cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 3 Apr 2013 18:01:34 +0200 Subject: wined3d: Wait for the cs before destroying objects @@ -13,23 +13,6 @@ the CS. dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 15 insertions(+) -diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index edecdbe..66e13cb 100644 ---- a/dlls/wined3d/buffer.c -+++ b/dlls/wined3d/buffer.c -@@ -565,6 +565,12 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) - - if (!refcount) - { -+ if (wined3d_settings.cs_multithreaded) -+ { -+ FIXME("Waiting for cs.\n"); -+ buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); -+ } -+ - if (buffer->buffer_object) - { - context = context_acquire(buffer->resource.device, NULL); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 3bcbf19..185def9 100644 --- a/dlls/wined3d/cs.c @@ -49,28 +32,11 @@ index 3bcbf19..185def9 100644 }; /* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index cdb7636..ecabc60 100644 ---- a/dlls/wined3d/texture.c -+++ b/dlls/wined3d/texture.c -@@ -479,6 +479,12 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) - - TRACE("texture %p.\n", texture); - -+ if (wined3d_settings.cs_multithreaded) -+ { -+ FIXME("Waiting for cs.\n"); -+ texture->resource.device->cs->ops->finish(texture->resource.device->cs); -+ } -+ - for (i = 0; i < sub_count; ++i) - { - if (!(buffer_object = texture->sub_resources[i].buffer_object)) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1b6077d..dfb3cca 100644 +index cedb36d..e88f172 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2969,6 +2969,7 @@ struct wined3d_cs_ops +@@ -2981,6 +2981,7 @@ struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); void (*submit)(struct wined3d_cs *cs); diff --git a/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch b/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch index bc9eed3e..1c64ba36 100644 --- a/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch +++ b/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch @@ -1,19 +1,18 @@ -From 7af03f1c752ad8e933f75f73841f3deeeeb5ebdb Mon Sep 17 00:00:00 2001 +From 1eb816c58ca5ed8999d8914e2c5dee650e0bb2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 20 Aug 2014 18:01:36 +0200 Subject: wined3d: Introduce resource fencing. FIXME: The buffer part doesn't really make sense without dynamic buffer maps. --- - dlls/wined3d/cs.c | 19 +++++++++++++++++++ - dlls/wined3d/wined3d_private.h | 16 ++++++++++++++++ - 2 files changed, 35 insertions(+) + dlls/wined3d/cs.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 766dbad..0f8a03f 100644 +index f33cfa8..f196f72 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -553,6 +553,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -554,6 +554,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) struct wined3d_state *state = &cs->state; const struct wined3d_cs_draw *op = data; const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; @@ -21,22 +20,22 @@ index 766dbad..0f8a03f 100644 if (op->indexed && !gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) { -@@ -578,6 +579,14 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -579,6 +580,14 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx, op->index_count, op->start_instance, op->instance_count, op->indexed); + if (op->indexed) -+ wined3d_resource_dec_fence(&cs->state.index_buffer->resource); ++ wined3d_resource_release(&cs->state.index_buffer->resource); + for (i = 0; i < sizeof(cs->state.streams) / sizeof(*cs->state.streams); i++) + { + if (cs->state.streams[i].buffer) -+ wined3d_resource_dec_fence(&cs->state.streams[i].buffer->resource); ++ wined3d_resource_release(&cs->state.streams[i].buffer->resource); + } + return sizeof(*op); } -@@ -585,6 +594,8 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -586,6 +595,8 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) { struct wined3d_cs_draw *op; @@ -45,55 +44,21 @@ index 766dbad..0f8a03f 100644 op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_DRAW; -@@ -595,6 +606,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -596,6 +607,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i op->instance_count = instance_count; op->indexed = indexed; + if (indexed) -+ wined3d_resource_inc_fence(&state->index_buffer->resource); ++ wined3d_resource_acquire(&state->index_buffer->resource); + for (i = 0; i < sizeof(state->streams) / sizeof(*state->streams); i++) + { + if (state->streams[i].buffer) -+ wined3d_resource_inc_fence(&state->streams[i].buffer->resource); ++ wined3d_resource_acquire(&state->streams[i].buffer->resource); + } + cs->ops->submit(cs, sizeof(*op)); } -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c9e467b..a70d88f 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -2468,6 +2468,7 @@ struct wined3d_resource - DWORD priority; - void *heap_memory; - struct list resource_list_entry; -+ LONG access_fence; - - void *parent; - const struct wined3d_parent_ops *parent_ops; -@@ -2500,6 +2501,21 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_H - 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; - -+static inline void wined3d_resource_inc_fence(struct wined3d_resource *resource) -+{ -+ InterlockedIncrement(&resource->access_fence); -+} -+ -+static inline void wined3d_resource_dec_fence(struct wined3d_resource *resource) -+{ -+ InterlockedDecrement(&resource->access_fence); -+} -+ -+static inline void wined3d_resource_wait_fence(struct wined3d_resource *resource) -+{ -+ while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); -+} -+ - /* Tests show that the start address of resources is 32 byte aligned */ - #define RESOURCE_ALIGNMENT 16 - -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0060-wined3d-Fence-update_texture-calls.patch b/patches/wined3d-CSMT_Main/0060-wined3d-Fence-update_texture-calls.patch index c6808010..30a2a557 100644 --- a/patches/wined3d-CSMT_Main/0060-wined3d-Fence-update_texture-calls.patch +++ b/patches/wined3d-CSMT_Main/0060-wined3d-Fence-update_texture-calls.patch @@ -1,4 +1,4 @@ -From c83ea283c1bb0d04bdfb2b5bc49f054b392b79e5 Mon Sep 17 00:00:00 2001 +From 3f09055fac1731ff05bc260ee2f6215ba40bb2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 30 Aug 2013 10:41:42 +0200 Subject: wined3d: Fence update_texture calls @@ -9,38 +9,38 @@ Subject: wined3d: Fence update_texture calls 2 files changed, 8 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 3991111..34f1444 100644 +index f196f72..ff559de 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -1962,6 +1962,9 @@ static UINT wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da +@@ -1971,6 +1971,9 @@ static UINT wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da device_exec_update_texture(context, op->src, op->dst); context_release(context); -+ wined3d_resource_dec_fence(&op->src->resource); -+ wined3d_resource_dec_fence(&op->dst->resource); ++ wined3d_resource_release(&op->src->resource); ++ wined3d_resource_release(&op->dst->resource); + return sizeof(*op); } -@@ -1975,6 +1978,9 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur +@@ -1984,6 +1987,9 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur op->src = src; op->dst = dst; -+ wined3d_resource_inc_fence(&op->src->resource); -+ wined3d_resource_inc_fence(&op->dst->resource); ++ wined3d_resource_acquire(&op->src->resource); ++ wined3d_resource_acquire(&op->dst->resource); + cs->ops->submit(cs, sizeof(*op)); } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index fac20c9..541e3c2 100644 +index 98d1177..13e8a26 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1691,6 +1691,8 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1765,6 +1765,8 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); -+ wined3d_resource_wait_fence(&texture->resource); ++ wined3d_resource_wait_idle(&texture->resource); + base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); diff --git a/patches/wined3d-CSMT_Main/0062-wined3d-Fence-texture-reads-in-draws.patch b/patches/wined3d-CSMT_Main/0062-wined3d-Fence-texture-reads-in-draws.patch index f5c60aff..65b9c7f8 100644 --- a/patches/wined3d-CSMT_Main/0062-wined3d-Fence-texture-reads-in-draws.patch +++ b/patches/wined3d-CSMT_Main/0062-wined3d-Fence-texture-reads-in-draws.patch @@ -1,4 +1,4 @@ -From 9eeb22d9a97118d07e92f47d8aeae1d795c5d40b Mon Sep 17 00:00:00 2001 +From 3fc3a3051fe8fc5ec3c06432b00754c8ec81158d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 30 Aug 2013 22:42:33 +0200 Subject: wined3d: Fence texture reads in draws @@ -21,29 +21,29 @@ sRGB_decode isn't. 1 file changed, 10 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 34f1444..f4bfbd1 100644 +index ff559de..ffd5d72 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -573,6 +573,11 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -587,6 +587,11 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) if (cs->state.streams[i].buffer) - wined3d_resource_dec_fence(&cs->state.streams[i].buffer->resource); + wined3d_resource_release(&cs->state.streams[i].buffer->resource); } + for (i = 0; i < sizeof(cs->state.textures) / sizeof(*cs->state.textures); i++) + { + if (cs->state.textures[i]) -+ wined3d_resource_dec_fence(&cs->state.textures[i]->resource); ++ wined3d_resource_release(&cs->state.textures[i]->resource); + } return sizeof(*op); } -@@ -599,6 +604,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun +@@ -614,6 +619,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i if (state->streams[i].buffer) - wined3d_resource_inc_fence(&state->streams[i].buffer->resource); + wined3d_resource_acquire(&state->streams[i].buffer->resource); } + for (i = 0; i < sizeof(state->textures) / sizeof(*state->textures); i++) + { + if (state->textures[i]) -+ wined3d_resource_inc_fence(&state->textures[i]->resource); ++ wined3d_resource_acquire(&state->textures[i]->resource); + } cs->ops->submit(cs, sizeof(*op)); diff --git a/patches/wined3d-CSMT_Main/0063-wined3d-Fence-render-targets-and-depth-stencils.patch b/patches/wined3d-CSMT_Main/0063-wined3d-Fence-render-targets-and-depth-stencils.patch index 18c8039c..daa27d1a 100644 --- a/patches/wined3d-CSMT_Main/0063-wined3d-Fence-render-targets-and-depth-stencils.patch +++ b/patches/wined3d-CSMT_Main/0063-wined3d-Fence-render-targets-and-depth-stencils.patch @@ -1,4 +1,4 @@ -From 8c882adc2b2b5858126a6d07e0dd2e04fbe986de Mon Sep 17 00:00:00 2001 +From fa13f4317b9d869fd8a3847926bf5f2edc40b479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 16:55:58 +0200 Subject: wined3d: Fence render targets and depth stencils @@ -8,10 +8,10 @@ Subject: wined3d: Fence render targets and depth stencils 1 file changed, 38 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 5adc3f8..8a79516 100644 +index ffd5d72..329cdce 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -548,6 +548,30 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -549,6 +549,30 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * cs->ops->submit(cs, size); } @@ -42,31 +42,31 @@ index 5adc3f8..8a79516 100644 static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { struct wined3d_state *state = &cs->state; -@@ -591,6 +615,13 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -592,6 +616,13 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) if (cs->state.textures[i]) - wined3d_resource_dec_fence(&cs->state.textures[i]->resource); + wined3d_resource_release(&cs->state.textures[i]->resource); } + for (i = 0; i < gl_info->limits.buffers; i++) + { + if (cs->state.fb.render_targets[i] && wined3d_cs_colorwrite_enabled(&cs->state, i)) -+ wined3d_resource_dec_fence(cs->state.fb.render_targets[i]->resource); ++ wined3d_resource_release(cs->state.fb.render_targets[i]->resource); + } + if (cs->state.fb.depth_stencil && wined3d_cs_depth_stencil_enabled(&cs->state)) -+ wined3d_resource_dec_fence(cs->state.fb.depth_stencil->resource); ++ wined3d_resource_release(cs->state.fb.depth_stencil->resource); return sizeof(*op); } -@@ -623,6 +654,13 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -624,6 +655,13 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i if (state->textures[i]) - wined3d_resource_inc_fence(&state->textures[i]->resource); + wined3d_resource_acquire(&state->textures[i]->resource); } + for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++) + { + if (state->fb.render_targets[i] && wined3d_cs_colorwrite_enabled(state, i)) -+ wined3d_resource_inc_fence(state->fb.render_targets[i]->resource); ++ wined3d_resource_acquire(state->fb.render_targets[i]->resource); + } + if (state->fb.depth_stencil && wined3d_cs_depth_stencil_enabled(state)) -+ wined3d_resource_inc_fence(state->fb.depth_stencil->resource); ++ wined3d_resource_acquire(state->fb.depth_stencil->resource); cs->ops->submit(cs, sizeof(*op)); } diff --git a/patches/wined3d-CSMT_Main/0064-wined3d-Fence-blit-operations.patch b/patches/wined3d-CSMT_Main/0064-wined3d-Fence-blit-operations.patch index 85fcdc3a..9a9f5f4f 100644 --- a/patches/wined3d-CSMT_Main/0064-wined3d-Fence-blit-operations.patch +++ b/patches/wined3d-CSMT_Main/0064-wined3d-Fence-blit-operations.patch @@ -1,4 +1,4 @@ -From 26566a78da3e11952e265a4999d55279c595162a Mon Sep 17 00:00:00 2001 +From 67a6d3fc2dff7be59c88fdbb9bc4199f20b691b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 16:57:01 +0200 Subject: wined3d: Fence blit operations. @@ -8,27 +8,27 @@ Subject: wined3d: Fence blit operations. 1 file changed, 8 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 98072e2..f34a642 100644 +index 329cdce..68c104e 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -1792,6 +1792,10 @@ static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) +@@ -1824,6 +1824,10 @@ static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) op->src_surface, &op->src_rect, op->flags, &op->fx, op->filter); -+ wined3d_resource_dec_fence(&op->dst_surface->container->resource); ++ wined3d_resource_release(&op->dst_surface->container->resource); + if (op->src_surface && op->src_surface != op->dst_surface) -+ wined3d_resource_dec_fence(&op->src_surface->container->resource); ++ wined3d_resource_release(&op->src_surface->container->resource); + return sizeof(*op); } -@@ -1813,6 +1817,10 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -1845,6 +1849,10 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf if (fx) op->fx = *fx; -+ wined3d_resource_inc_fence(&dst_surface->container->resource); ++ wined3d_resource_acquire(&dst_surface->container->resource); + if (src_surface && src_surface != dst_surface) -+ wined3d_resource_inc_fence(&src_surface->container->resource); ++ wined3d_resource_acquire(&src_surface->container->resource); + cs->ops->submit(cs, sizeof(*op)); } diff --git a/patches/wined3d-CSMT_Main/0065-wined3d-Fence-color_fill-operations.patch b/patches/wined3d-CSMT_Main/0065-wined3d-Fence-color_fill-operations.patch index fc7de705..bd742ff6 100644 --- a/patches/wined3d-CSMT_Main/0065-wined3d-Fence-color_fill-operations.patch +++ b/patches/wined3d-CSMT_Main/0065-wined3d-Fence-color_fill-operations.patch @@ -1,4 +1,4 @@ -From 440209519eb18ae97a46fd5ee046d3d93f2dd99a Mon Sep 17 00:00:00 2001 +From e7897ceec2a6eb091a1877df85471037bae120b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 16:58:13 +0200 Subject: wined3d: Fence color_fill operations. @@ -8,23 +8,23 @@ Subject: wined3d: Fence color_fill operations. 1 file changed, 4 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index f34a642..77afbe5 100644 +index 68c104e..af10384 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -1834,6 +1834,8 @@ static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) +@@ -1866,6 +1866,8 @@ static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) else op->blitter->depth_fill(device, op->view, &op->rect, op->flags, op->depth, op->stencil); -+ wined3d_resource_dec_fence(op->view->resource); ++ wined3d_resource_release(op->view->resource); + return sizeof(*op); } -@@ -1854,6 +1856,8 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -1886,6 +1888,8 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge op->stencil = stencil; op->blitter = blitter; -+ wined3d_resource_inc_fence(view->resource); ++ wined3d_resource_acquire(view->resource); + cs->ops->submit(cs, sizeof(*op)); } diff --git a/patches/wined3d-CSMT_Main/0066-wined3d-Fence-clear-calls.patch b/patches/wined3d-CSMT_Main/0066-wined3d-Fence-clear-calls.patch index 87bdbf29..476c1e02 100644 --- a/patches/wined3d-CSMT_Main/0066-wined3d-Fence-clear-calls.patch +++ b/patches/wined3d-CSMT_Main/0066-wined3d-Fence-clear-calls.patch @@ -1,4 +1,4 @@ -From c927f5ec0f74ffda987c7ac713baf2d1020b31ac Mon Sep 17 00:00:00 2001 +From cccdf39d6f6cc952455a999d466fe868b4640d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 17:04:47 +0200 Subject: wined3d: Fence clear calls. @@ -8,10 +8,10 @@ Subject: wined3d: Fence clear calls. 1 file changed, 26 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 77afbe5..9330327 100644 +index af10384..60ae4a3 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -516,6 +516,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -522,6 +522,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) struct wined3d_device *device; RECT draw_rect; size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]); @@ -19,7 +19,7 @@ index 77afbe5..9330327 100644 device = cs->device; wined3d_get_draw_rect(&cs->state, &draw_rect); -@@ -523,6 +524,17 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -529,6 +530,17 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) &cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags, &op->color, op->depth, op->stencil); @@ -28,16 +28,16 @@ index 77afbe5..9330327 100644 + for (i = 0; i < device->adapter->gl_info.limits.buffers; i++) + { + if (cs->state.fb.render_targets[i]) -+ wined3d_resource_dec_fence(cs->state.fb.render_targets[i]->resource); ++ wined3d_resource_release(cs->state.fb.render_targets[i]->resource); + } + } + if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) -+ wined3d_resource_dec_fence(cs->state.fb.depth_stencil->resource); ++ wined3d_resource_release(cs->state.fb.depth_stencil->resource); + return size; } -@@ -531,6 +543,9 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -537,6 +549,9 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { struct wined3d_cs_clear *op; size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]); @@ -47,7 +47,7 @@ index 77afbe5..9330327 100644 op = cs->ops->require_space(cs, size); op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; -@@ -540,6 +555,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -546,6 +561,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * op->rect_count = rect_count; memcpy(op->rects, rects, sizeof(*rects) * rect_count); @@ -56,11 +56,11 @@ index 77afbe5..9330327 100644 + for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++) + { + if (state->fb.render_targets[i]) -+ wined3d_resource_inc_fence(state->fb.render_targets[i]->resource); ++ wined3d_resource_acquire(state->fb.render_targets[i]->resource); + } + } + if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) -+ wined3d_resource_inc_fence(state->fb.depth_stencil->resource); ++ wined3d_resource_acquire(state->fb.depth_stencil->resource); + cs->ops->submit(cs, size); } diff --git a/patches/wined3d-CSMT_Main/0067-wined3d-Fence-present-calls.patch b/patches/wined3d-CSMT_Main/0067-wined3d-Fence-present-calls.patch index 649694ab..7fb8888e 100644 --- a/patches/wined3d-CSMT_Main/0067-wined3d-Fence-present-calls.patch +++ b/patches/wined3d-CSMT_Main/0067-wined3d-Fence-present-calls.patch @@ -1,4 +1,4 @@ -From 854a8836679c80071b74977c0c28b566daa9e1bf Mon Sep 17 00:00:00 2001 +From 5231563b7294c2c8d00cd28be3c7a6974af9de0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 17:55:35 +0200 Subject: wined3d: Fence present calls. @@ -8,10 +8,10 @@ Subject: wined3d: Fence present calls. 1 file changed, 10 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 9330327..9d017e0 100644 +index 60ae4a3..139d0c2 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -476,6 +476,7 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -482,6 +482,7 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; @@ -19,18 +19,18 @@ index 9330327..9d017e0 100644 swapchain = op->swapchain; wined3d_swapchain_set_window(swapchain, op->dst_window_override); -@@ -485,6 +486,10 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -491,6 +492,10 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) InterlockedDecrement(&cs->pending_presents); -+ wined3d_resource_dec_fence(&swapchain->front_buffer->resource); ++ wined3d_resource_release(&swapchain->front_buffer->resource); + for (i = 0; i < swapchain->desc.backbuffer_count; i++) -+ wined3d_resource_dec_fence(&swapchain->back_buffers[i]->resource); ++ wined3d_resource_release(&swapchain->back_buffers[i]->resource); + return sizeof(*op); } -@@ -493,6 +498,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -499,6 +504,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw { struct wined3d_cs_present *op; LONG pending; @@ -38,13 +38,13 @@ index 9330327..9d017e0 100644 op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_PRESENT; -@@ -502,6 +508,10 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -508,6 +514,10 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw op->dst_rect = *dst_rect; op->flags = flags; -+ wined3d_resource_inc_fence(&swapchain->front_buffer->resource); ++ wined3d_resource_acquire(&swapchain->front_buffer->resource); + for (i = 0; i < swapchain->desc.backbuffer_count; i++) -+ wined3d_resource_inc_fence(&swapchain->back_buffers[i]->resource); ++ wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); + pending = InterlockedIncrement(&cs->pending_presents); diff --git a/patches/wined3d-CSMT_Main/0069-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch b/patches/wined3d-CSMT_Main/0069-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch index 96ae065e..b2fecd0e 100644 --- a/patches/wined3d-CSMT_Main/0069-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch +++ b/patches/wined3d-CSMT_Main/0069-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch @@ -1,4 +1,4 @@ -From ba4847164d9db1bd92f8853e46414c7320e026b6 Mon Sep 17 00:00:00 2001 +From 0a4289bbeaf2981f822c11efeb4322ae7d4a14fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 17:58:25 +0200 Subject: wined3d: Make resource maps and unmaps a priority command. @@ -9,10 +9,10 @@ Subject: wined3d: Make resource maps and unmaps a priority command. 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 9d017e0..5ec5fc5 100644 +index 139d0c2..1b2378b 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -1912,20 +1912,16 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture +@@ -1944,20 +1944,16 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture struct wined3d_cs_texture_map *op; void *ret; @@ -36,7 +36,7 @@ index 9d017e0..5ec5fc5 100644 return ret; } -@@ -1944,12 +1940,12 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture +@@ -1976,12 +1972,12 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture { struct wined3d_cs_texture_unmap *op; @@ -52,10 +52,10 @@ index 9d017e0..5ec5fc5 100644 static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 165330e..82f7aa0 100644 +index f918797..7b5e344 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1691,6 +1691,10 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1765,6 +1765,10 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); @@ -63,7 +63,7 @@ index 165330e..82f7aa0 100644 + { + FIXME("Dynamic resource map is inefficient\n"); + } - wined3d_resource_wait_fence(&texture->resource); + wined3d_resource_wait_idle(&texture->resource); base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); -- diff --git a/patches/wined3d-CSMT_Main/0074-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch b/patches/wined3d-CSMT_Main/0074-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch index 5ffc12aa..0a86e962 100644 --- a/patches/wined3d-CSMT_Main/0074-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch +++ b/patches/wined3d-CSMT_Main/0074-wined3d-Implement-DISCARD-texture-maps-with-PBOs.patch @@ -1,4 +1,4 @@ -From b1c886fedd3ccfca93fe0b33f62ddf7bea7b7c56 Mon Sep 17 00:00:00 2001 +From 70af66f5937a43b642abf38920ef206a9348d45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 19:06:41 +0200 Subject: wined3d: Implement DISCARD texture maps with PBOs. @@ -10,10 +10,10 @@ Subject: wined3d: Implement DISCARD texture maps with PBOs. 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index ee83438..94298af 100644 +index 75dd990..d30c449 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -381,6 +381,7 @@ struct wined3d_cs_texture_changed +@@ -393,6 +393,7 @@ struct wined3d_cs_texture_changed enum wined3d_cs_op opcode; struct wined3d_texture *texture; unsigned int sub_resource_idx; @@ -21,7 +21,7 @@ index ee83438..94298af 100644 }; struct wined3d_cs_skip -@@ -1919,13 +1920,13 @@ static UINT wined3d_cs_exec_texture_changed(struct wined3d_cs *cs, const void *d +@@ -1951,13 +1952,13 @@ static UINT wined3d_cs_exec_texture_changed(struct wined3d_cs *cs, const void *d { const struct wined3d_cs_texture_changed *op = data; @@ -37,7 +37,7 @@ index ee83438..94298af 100644 { struct wined3d_cs_texture_changed *op; -@@ -1933,6 +1934,7 @@ void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_textu +@@ -1965,6 +1966,7 @@ void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_textu op->opcode = WINED3D_CS_OP_TEXTURE_CHANGED; op->texture = texture; op->sub_resource_idx = sub_resource_idx; @@ -46,10 +46,10 @@ index ee83438..94298af 100644 cs->ops->submit(cs, sizeof(*op)); } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index ad4e93f..2cc4014 100644 +index ab7127b..43bcb51 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1599,10 +1599,26 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -1673,10 +1673,26 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int if (flags & WINED3D_MAP_DISCARD) { @@ -78,7 +78,7 @@ index ad4e93f..2cc4014 100644 wined3d_texture_validate_location(texture, sub_resource_idx, texture->resource.map_binding); } else -@@ -1698,11 +1714,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1772,11 +1788,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); @@ -86,16 +86,16 @@ index ad4e93f..2cc4014 100644 - { - FIXME("Dynamic resource map is inefficient\n"); - } -- wined3d_resource_wait_fence(&texture->resource); +- wined3d_resource_wait_idle(&texture->resource); + if (flags & WINED3D_MAP_NOOVERWRITE) + FIXME("WINED3D_MAP_NOOVERWRITE is not implemented yet.\n"); + + if (!(flags & WINED3D_MAP_DISCARD) || texture->resource.map_binding != WINED3D_LOCATION_BUFFER) -+ wined3d_resource_wait_fence(&texture->resource); ++ wined3d_resource_wait_idle(&texture->resource); base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); -@@ -1776,8 +1792,20 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in +@@ -1850,8 +1866,20 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in } } @@ -117,7 +117,7 @@ index ad4e93f..2cc4014 100644 wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); } -@@ -1805,7 +1833,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1879,7 +1907,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso if (sub_resource->unmap_dirtify) { @@ -127,10 +127,10 @@ index ad4e93f..2cc4014 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 611b8b0..4d6721d 100644 +index 4fd8892..e3b6ff8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2626,7 +2626,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2733,7 +2733,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture, void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_changed(struct wined3d_texture *texture, @@ -139,7 +139,7 @@ index 611b8b0..4d6721d 100644 BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; -@@ -3014,7 +3014,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -3118,7 +3118,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil, const struct blit_shader *blitter) DECLSPEC_HIDDEN; void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_texture *texture, diff --git a/patches/wined3d-CSMT_Main/0075-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch b/patches/wined3d-CSMT_Main/0075-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch index 603a4ab4..a50e0c80 100644 --- a/patches/wined3d-CSMT_Main/0075-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch +++ b/patches/wined3d-CSMT_Main/0075-wined3d-Implement-DISCARD-resource-maps-with-heap-me.patch @@ -1,4 +1,4 @@ -From 10d588d723446311832d7b4a6ccf37ba85003a18 Mon Sep 17 00:00:00 2001 +From bd07c044ca2439da5464de6f88f4e001e13a0dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 27 Sep 2013 19:24:21 +0200 Subject: wined3d: Implement DISCARD resource maps with heap memory. @@ -12,7 +12,7 @@ Subject: wined3d: Implement DISCARD resource maps with heap memory. 5 files changed, 51 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 92a0cab..bd1a2c2 100644 +index 314415c..a841f6b 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -496,6 +496,7 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *c @@ -24,7 +24,7 @@ index 92a0cab..bd1a2c2 100644 buffer_bind(buffer, context); GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size, buffer->resource.heap_memory)); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 595520a..640a5f8 100644 +index d30c449..2325138 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -394,6 +394,7 @@ struct wined3d_cs_texture_changed @@ -60,7 +60,7 @@ index 595520a..640a5f8 100644 cs->ops->submit(cs, sizeof(*op)); } diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index e10921a..75a3dd5 100644 +index 7f80957..1029f12 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -213,6 +213,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * @@ -77,9 +77,9 @@ index e10921a..75a3dd5 100644 wined3d_resource_free_sysmem(resource); + resource->map_heap_memory = NULL; context_resource_released(resource->device, resource, resource->type); + wined3d_resource_release(resource); } - -@@ -340,7 +342,7 @@ BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) +@@ -342,7 +344,7 @@ BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1; *p = mem; @@ -89,7 +89,7 @@ index e10921a..75a3dd5 100644 return TRUE; } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index de2d135..d810267 100644 +index 43bcb51..15d27a5 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -104,6 +104,7 @@ static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture) @@ -112,7 +112,7 @@ index de2d135..d810267 100644 data->addr += sub_resource->offset; data->buffer_object = 0; return; -@@ -1105,6 +1109,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1137,6 +1141,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } wined3d_resource_free_sysmem(&texture->resource); @@ -120,7 +120,7 @@ index de2d135..d810267 100644 if ((texture->row_pitch = pitch)) texture->slice_pitch = height * pitch; -@@ -1299,6 +1304,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1331,6 +1336,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned ERR("Failed to allocate system memory.\n"); return FALSE; } @@ -128,7 +128,7 @@ index de2d135..d810267 100644 return TRUE; case WINED3D_LOCATION_USER_MEMORY: -@@ -1656,6 +1662,12 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -1686,6 +1692,12 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int ret = !!sub_resource->map_buffer; break; @@ -141,7 +141,7 @@ index de2d135..d810267 100644 default: ret = wined3d_texture_prepare_location(texture, sub_resource_idx, context, texture->resource.map_binding); -@@ -1761,7 +1773,21 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1791,7 +1803,21 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour if (flags & WINED3D_MAP_NOOVERWRITE) FIXME("WINED3D_MAP_NOOVERWRITE is not implemented yet.\n"); @@ -157,14 +157,14 @@ index de2d135..d810267 100644 + default: + FIXME("Implement discard maps with %s map binding.\n", + wined3d_debug_location(texture->resource.map_binding)); -+ wined3d_resource_wait_fence(&texture->resource); ++ wined3d_resource_wait_idle(&texture->resource); + } + } + else - wined3d_resource_wait_fence(&texture->resource); + wined3d_resource_wait_idle(&texture->resource); base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); -@@ -1837,7 +1863,7 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in +@@ -1867,7 +1893,7 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in } void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_resource_idx, @@ -173,7 +173,7 @@ index de2d135..d810267 100644 { struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; -@@ -1850,6 +1876,12 @@ void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_r +@@ -1880,6 +1906,12 @@ void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_r sub_resource->buffer = swap_buffer; } @@ -186,7 +186,7 @@ index de2d135..d810267 100644 wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); } -@@ -1877,7 +1909,8 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1907,7 +1939,8 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso if (sub_resource->unmap_dirtify) { @@ -196,7 +196,7 @@ index de2d135..d810267 100644 sub_resource->unmap_dirtify = FALSE; } -@@ -2332,6 +2365,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2348,6 +2381,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (wined3d_texture_use_pbo(texture, gl_info)) { wined3d_resource_free_sysmem(&texture->resource); @@ -205,7 +205,7 @@ index de2d135..d810267 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1b125d5..50c0854 100644 +index e3b6ff8..de30dd4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2536,7 +2536,7 @@ struct wined3d_resource @@ -215,7 +215,7 @@ index 1b125d5..50c0854 100644 - void *heap_memory; + void *heap_memory, *map_heap_memory; struct list resource_list_entry; - LONG access_fence; + LONG access_count; @@ -2733,7 +2733,8 @@ void wined3d_texture_bind(struct wined3d_texture *texture, void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, diff --git a/patches/wined3d-CSMT_Main/0087-wined3d-Separate-GL-buffer-discard-control-from-igno.patch b/patches/wined3d-CSMT_Main/0087-wined3d-Separate-GL-buffer-discard-control-from-igno.patch index eeaeb375..8cd7c29e 100644 --- a/patches/wined3d-CSMT_Main/0087-wined3d-Separate-GL-buffer-discard-control-from-igno.patch +++ b/patches/wined3d-CSMT_Main/0087-wined3d-Separate-GL-buffer-discard-control-from-igno.patch @@ -1,4 +1,4 @@ -From 6dea1a91cc8a00d2c8e24e3511fefe017d76d9c7 Mon Sep 17 00:00:00 2001 +From 95ab414f54e4b6b157593c001a7bf047f74566a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 30 Jul 2013 22:17:10 +0200 Subject: wined3d: Separate GL buffer discard control from ignoring @@ -18,7 +18,7 @@ There are some problems left: 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index ff5ecd0..1602ff1 100644 +index e3659b2..f939c57 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -30,7 +30,7 @@ index ff5ecd0..1602ff1 100644 #define WINED3D_BUFFER_SYNC 0x10 /* There has been at least one synchronized map since the last preload. */ #define WINED3D_BUFFER_APPLESYNC 0x20 /* Using sync as in GL_APPLE_flush_buffer_range. */ -@@ -920,7 +920,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -931,7 +931,7 @@ 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. */ @@ -39,7 +39,7 @@ index ff5ecd0..1602ff1 100644 flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; -@@ -1001,10 +1001,15 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1009,10 +1009,15 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN context_release(context); } } @@ -59,7 +59,7 @@ index ff5ecd0..1602ff1 100644 buffer->flags |= WINED3D_BUFFER_SYNC; } -@@ -1013,6 +1018,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1021,6 +1026,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN BOOL swvp = device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING; if (flags & WINED3D_MAP_DISCARD && !swvp) { @@ -67,7 +67,7 @@ index ff5ecd0..1602ff1 100644 wined3d_resource_allocate_sysmem(&buffer->resource); wined3d_cs_emit_buffer_swap_mem(device->cs, buffer, buffer->resource.map_heap_memory); } -@@ -1449,3 +1455,10 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, +@@ -1459,3 +1465,10 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, return WINED3D_OK; } @@ -79,28 +79,28 @@ index ff5ecd0..1602ff1 100644 + buffer->flags |= WINED3D_BUFFER_DISCARD; +} diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 688d933a..0c735bf 100644 +index 9044495..4833fda 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -711,11 +711,17 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun +@@ -723,11 +723,17 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i op->indexed = indexed; if (indexed) + { - wined3d_resource_inc_fence(&state->index_buffer->resource); + wined3d_resource_acquire(&state->index_buffer->resource); + state->index_buffer->ignore_discard = FALSE; + } for (i = 0; i < sizeof(state->streams) / sizeof(*state->streams); i++) { if (state->streams[i].buffer) + { - wined3d_resource_inc_fence(&state->streams[i].buffer->resource); + wined3d_resource_acquire(&state->streams[i].buffer->resource); + state->streams[i].buffer->ignore_discard = FALSE; + } } for (i = 0; i < sizeof(state->textures) / sizeof(*state->textures); i++) { -@@ -2255,8 +2261,7 @@ static UINT wined3d_cs_exec_buffer_swap_mem(struct wined3d_cs *cs, const void *d +@@ -2270,8 +2276,7 @@ static UINT wined3d_cs_exec_buffer_swap_mem(struct wined3d_cs *cs, const void *d const struct wined3d_cs_buffer_swap_mem *op = data; struct wined3d_buffer *buffer = op->buffer; @@ -111,10 +111,10 @@ index 688d933a..0c735bf 100644 if (!buffer->buffer_object && buffer->resource.bind_count) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index d13e8db..451b941 100644 +index 748546f..2d8a2e6 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3121,6 +3121,7 @@ struct wined3d_buffer +@@ -3200,6 +3200,7 @@ struct wined3d_buffer GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -122,7 +122,7 @@ index d13e8db..451b941 100644 void *map_ptr; struct wined3d_map_range *maps; -@@ -3150,6 +3151,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ +@@ -3229,6 +3230,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN; void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch b/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch deleted file mode 100644 index ac7e686b..00000000 --- a/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch +++ /dev/null @@ -1,58 +0,0 @@ -From f63385f0d8260f11819bad1b075af20c98bb3bd4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Wed, 2 Oct 2013 22:38:51 +0200 -Subject: wined3d: Clean up resource data through the CS. - ---- - dlls/wined3d/buffer.c | 7 +++++++ - dlls/wined3d/texture.c | 2 ++ - 2 files changed, 9 insertions(+) - -diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 86395c4..90a707c 100644 ---- a/dlls/wined3d/buffer.c -+++ b/dlls/wined3d/buffer.c -@@ -586,6 +586,9 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) - } - - resource_cleanup(&buffer->resource); -+ if (wined3d_settings.cs_multithreaded) -+ buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); -+ - buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); - HeapFree(GetProcessHeap(), 0, buffer->maps); - HeapFree(GetProcessHeap(), 0, buffer); -@@ -1355,6 +1358,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device - ERR("Out of memory.\n"); - buffer_unload(&buffer->resource); - resource_cleanup(&buffer->resource); -+ if (wined3d_settings.cs_multithreaded) -+ buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); - return E_OUTOFMEMORY; - } - buffer->maps_size = 1; -@@ -1365,6 +1370,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device - buffer_unload(&buffer->resource); - resource_cleanup(&buffer->resource); - HeapFree(GetProcessHeap(), 0, buffer->maps); -+ if (wined3d_settings.cs_multithreaded) -+ buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); - return hr; - } - -diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index d810267..53dfea6 100644 ---- a/dlls/wined3d/texture.c -+++ b/dlls/wined3d/texture.c -@@ -521,6 +521,8 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) - texture->texture_ops->texture_cleanup_sub_resources(texture); - wined3d_texture_unload_gl_texture(texture); - resource_cleanup(&texture->resource); -+ if (wined3d_settings.cs_multithreaded) -+ texture->resource.device->cs->ops->finish(texture->resource.device->cs); - } - - void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) --- -2.8.0 - diff --git a/patches/wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch b/patches/wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch deleted file mode 100644 index 7d746757..00000000 --- a/patches/wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 21d28bbc7a9c79e5b99241f729130c0a1480212a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Wed, 2 Oct 2013 22:50:08 +0200 -Subject: wined3d: Clean up buffer resource data through the CS. - ---- - dlls/wined3d/buffer.c | 40 +++++++++++++++++++++------------------- - 1 file changed, 21 insertions(+), 19 deletions(-) - -diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 90a707c..ce25f69 100644 ---- a/dlls/wined3d/buffer.c -+++ b/dlls/wined3d/buffer.c -@@ -561,37 +561,39 @@ static void wined3d_buffer_drop_bo(struct wined3d_buffer *buffer) - device_invalidate_state(device, STATE_STREAMSRC); - } - -+static void wined3d_buffer_destroy_object(void *object) -+{ -+ struct wined3d_buffer *buffer = object; -+ struct wined3d_context *context; -+ struct wined3d_device *device = buffer->resource.device; -+ -+ if (buffer->buffer_object) -+ { -+ context = context_acquire(device, NULL); -+ delete_gl_buffer(buffer, context->gl_info); -+ context_release(context); -+ -+ HeapFree(GetProcessHeap(), 0, buffer->conversion_map); -+ } -+ -+ HeapFree(GetProcessHeap(), 0, buffer->maps); -+ HeapFree(GetProcessHeap(), 0, buffer); -+} -+ - ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) - { - ULONG refcount = InterlockedDecrement(&buffer->resource.ref); -- struct wined3d_context *context; - - TRACE("%p decreasing refcount to %u.\n", buffer, refcount); - - if (!refcount) - { -- if (wined3d_settings.cs_multithreaded) -- { -- FIXME("Waiting for cs.\n"); -- buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); -- } -- -- if (buffer->buffer_object) -- { -- context = context_acquire(buffer->resource.device, NULL); -- delete_gl_buffer(buffer, context->gl_info); -- context_release(context); -- -- HeapFree(GetProcessHeap(), 0, buffer->conversion_map); -- } -+ struct wined3d_device *device = buffer->resource.device; - - resource_cleanup(&buffer->resource); -- if (wined3d_settings.cs_multithreaded) -- buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); - - buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); -- HeapFree(GetProcessHeap(), 0, buffer->maps); -- HeapFree(GetProcessHeap(), 0, buffer); -+ wined3d_cs_emit_destroy_object(device->cs, wined3d_buffer_destroy_object, buffer); - } - - return refcount; --- -2.8.0 - diff --git a/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch deleted file mode 100644 index 20c5b8e5..00000000 --- a/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch +++ /dev/null @@ -1,315 +0,0 @@ -From 70d900c4a460e27e5b6da3de623df8fffa0b9b68 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Sat, 7 May 2016 13:02:33 +0100 -Subject: wined3d: Clean up textures through the command stream. - -FIXME: This HeapFree stuff when creation fails is ugly. ---- - dlls/wined3d/texture.c | 82 +++++++++++++++++++++++++++----------------------- - 1 file changed, 44 insertions(+), 38 deletions(-) - -diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 53dfea6..18e71ff 100644 ---- a/dlls/wined3d/texture.c -+++ b/dlls/wined3d/texture.c -@@ -479,8 +479,9 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) - resource_unload(&texture->resource); - } - --static void wined3d_texture_cleanup(struct wined3d_texture *texture) -+static void wined3d_texture_destroy_object(void *object) - { -+ struct wined3d_texture *texture = object; - unsigned int sub_count = texture->level_count * texture->layer_count; - struct wined3d_device *device = texture->resource.device; - struct wined3d_context *context = NULL; -@@ -489,12 +490,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) - - TRACE("texture %p.\n", texture); - -- if (wined3d_settings.cs_multithreaded) -- { -- FIXME("Waiting for cs.\n"); -- texture->resource.device->cs->ops->finish(texture->resource.device->cs); -- } -- - for (i = 0; i < sub_count; ++i) - { - if (texture->sub_resources[i].buffer != texture->sub_resources[i].map_buffer) -@@ -506,7 +501,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) - - TRACE("Deleting buffer object %u.\n", buffer->name); - -- /* We may not be able to get a context in wined3d_texture_cleanup() in -+ /* We may not be able to get a context in wined3d_texture_destroy_object() in - * general, but if a buffer object was previously created we can. */ - if (!context) - context = context_acquire(device, NULL); -@@ -520,9 +515,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) - - texture->texture_ops->texture_cleanup_sub_resources(texture); - wined3d_texture_unload_gl_texture(texture); -- resource_cleanup(&texture->resource); -- if (wined3d_settings.cs_multithreaded) -- texture->resource.device->cs->ops->finish(texture->resource.device->cs); -+ HeapFree(GetProcessHeap(), 0, texture); - } - - void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) -@@ -816,6 +809,23 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) - return refcount; - } - -+static void wined3d_texture_cleanup_main(struct wined3d_texture *texture) -+{ -+ struct wined3d_device *device = texture->resource.device; -+ unsigned int sub_count = texture->level_count * texture->layer_count; -+ struct wined3d_texture_sub_resource *sub_resource; -+ unsigned int i; -+ -+ for (i = 0; i < sub_count; ++i) { -+ sub_resource = &texture->sub_resources[i]; -+ if (sub_resource->parent_ops && sub_resource->parent) -+ sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent); -+ } -+ -+ resource_cleanup(&texture->resource); -+ wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture); -+} -+ - ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) - { - ULONG refcount; -@@ -830,9 +840,8 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) - - if (!refcount) - { -- wined3d_texture_cleanup(texture); - texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent); -- HeapFree(GetProcessHeap(), 0, texture); -+ wined3d_texture_cleanup_main(texture); - } - - return refcount; -@@ -1546,8 +1555,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture) - list_remove(&overlay->overlay_entry); - overlay->overlay_dest = NULL; - } -- -- sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent); - } - if (context) - context_release(context); -@@ -1947,6 +1954,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - && !gl_info->supported[EXT_TEXTURE_ARRAY]) - { - WARN("OpenGL implementation does not support array textures.\n"); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - -@@ -1955,6 +1963,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (WINED3DFMT_UNKNOWN >= desc->format) - { - WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - -@@ -1977,6 +1986,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (desc->pool != WINED3D_POOL_SCRATCH) - { - WARN("Attempted to create a mipmapped/cube/array NPOT texture without unconditional NPOT support.\n"); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - -@@ -1994,6 +2004,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - { - FIXME("Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n", - desc->width, desc->height); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_NOTAVAILABLE; - } - -@@ -2025,6 +2036,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (desc->pool == WINED3D_POOL_DEFAULT || desc->pool == WINED3D_POOL_MANAGED) - { - WARN("Dimensions (%ux%u) exceed the maximum texture size.\n", pow2_width, pow2_height); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_NOTAVAILABLE; - } - -@@ -2038,12 +2050,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) - { - WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - - if (level_count != 1) - { - WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n"); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - } -@@ -2052,6 +2066,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - flags, device, parent, parent_ops, &texture_resource_ops))) - { - WARN("Failed to initialize texture, returning %#x.\n", hr); -+ HeapFree(GetProcessHeap(), 0, texture); - return hr; - } - -@@ -2093,7 +2108,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (level_count > ~(SIZE_T)0 / layer_count - || !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces)))) - { -- wined3d_texture_cleanup(texture); -+ wined3d_texture_cleanup_main(texture); - return E_OUTOFMEMORY; - } - -@@ -2136,7 +2151,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - texture, idx, &sub_resource->parent, &sub_resource->parent_ops))) - { - WARN("Failed to create surface parent, hr %#x.\n", hr); -- wined3d_texture_cleanup(texture); -+ wined3d_texture_cleanup_main(texture); - return hr; - } - -@@ -2147,7 +2162,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D)) - && FAILED(hr = wined3d_surface_create_dc(surface))) - { -- wined3d_texture_cleanup(texture); -+ wined3d_texture_cleanup_main(texture); - return hr; - } - } -@@ -2215,21 +2230,6 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi - - static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture) - { -- unsigned int sub_count = texture->level_count * texture->layer_count; -- struct wined3d_texture_sub_resource *sub_resource; -- struct wined3d_volume *volume; -- unsigned int i; -- -- for (i = 0; i < sub_count; ++i) -- { -- sub_resource = &texture->sub_resources[i]; -- if ((volume = sub_resource->u.volume)) -- { -- TRACE("volume %p.\n", volume); -- -- sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent); -- } -- } - HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume); - } - -@@ -2283,6 +2283,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - if (layer_count != 1) - { - ERR("Invalid layer count for volume texture.\n"); -+ HeapFree(GetProcessHeap(), 0, texture); - return E_INVALIDARG; - } - -@@ -2291,12 +2292,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - if (WINED3DFMT_UNKNOWN >= desc->format) - { - WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - - if (!gl_info->supported[EXT_TEXTURE3D]) - { - WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - -@@ -2306,12 +2309,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) - { - WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - - if (level_count != 1) - { - WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - } -@@ -2320,6 +2325,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - || desc->pool == WINED3D_POOL_SCRATCH)) - { - WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool)); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - -@@ -2346,6 +2352,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - { - WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", - desc->width, desc->height, desc->depth); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - } -@@ -2355,6 +2362,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - 0, device, parent, parent_ops, &texture_resource_ops))) - { - WARN("Failed to initialize texture, returning %#x.\n", hr); -+ HeapFree(GetProcessHeap(), 0, texture); - return hr; - } - -@@ -2373,7 +2381,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - - if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes)))) - { -- wined3d_texture_cleanup(texture); -+ wined3d_texture_cleanup_main(texture); - return E_OUTOFMEMORY; - } - -@@ -2395,7 +2403,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - texture, i, &sub_resource->parent, &sub_resource->parent_ops))) - { - WARN("Failed to create volume parent, hr %#x.\n", hr); -- wined3d_texture_cleanup(texture); -+ wined3d_texture_cleanup_main(texture); - return hr; - } - -@@ -2692,7 +2700,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct - if (FAILED(hr)) - { - WARN("Failed to initialize texture, returning %#x.\n", hr); -- HeapFree(GetProcessHeap(), 0, object); - return hr; - } - -@@ -2700,8 +2707,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct - * in this case. */ - if (data && FAILED(hr = wined3d_texture_upload_data(object, data))) - { -- wined3d_texture_cleanup(object); -- HeapFree(GetProcessHeap(), 0, object); -+ wined3d_texture_cleanup_main(object); - return hr; - } - --- -2.8.0 - diff --git a/patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch b/patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch index a153457b..757a1977 100644 --- a/patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch +++ b/patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch @@ -1,4 +1,4 @@ -From 40d19156ee555d3efed58f5b36bc9e370003c02f Mon Sep 17 00:00:00 2001 +From cc220792b08daaa61bd558028e07ef872483cd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 24 Oct 2013 22:38:26 +0200 Subject: wined3d: Fence preload operations. @@ -27,41 +27,41 @@ online) preloads a texture right before mapping it... 1 file changed, 8 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index e7e8a22..1af5827 100644 +index 1b8cb90..1593157 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -2159,6 +2159,8 @@ static UINT wined3d_cs_exec_texture_preload(struct wined3d_cs *cs, const void *d +@@ -2126,6 +2126,8 @@ static UINT wined3d_cs_exec_texture_preload(struct wined3d_cs *cs, const void *d wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB); context_release(context); -+ wined3d_resource_dec_fence(&texture->resource); ++ wined3d_resource_release(&texture->resource); + return sizeof(*op); } -@@ -2170,6 +2172,8 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu +@@ -2137,6 +2139,8 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu op->opcode = WINED3D_CS_OP_TEXTURE_PRELOAD; op->texture = texture; -+ wined3d_resource_inc_fence(&texture->resource); ++ wined3d_resource_acquire(&texture->resource); + cs->ops->submit(cs, sizeof(*op)); } -@@ -2375,6 +2379,8 @@ static UINT wined3d_cs_exec_buffer_preload(struct wined3d_cs *cs, const void *da +@@ -2342,6 +2346,8 @@ static UINT wined3d_cs_exec_buffer_preload(struct wined3d_cs *cs, const void *da buffer_internal_preload(op->buffer, context, NULL); context_release(context); -+ wined3d_resource_dec_fence(&op->buffer->resource); ++ wined3d_resource_release(&op->buffer->resource); + return sizeof(*op); } -@@ -2386,6 +2392,8 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer +@@ -2353,6 +2359,8 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer op->opcode = WINED3D_CS_OP_BUFFER_PRELOAD; op->buffer = buffer; -+ wined3d_resource_inc_fence(&buffer->resource); ++ wined3d_resource_acquire(&buffer->resource); + cs->ops->submit(cs, sizeof(*op)); } diff --git a/patches/wined3d-CSMT_Main/0106-wined3d-Wait-only-for-the-buffer-to-be-idle.patch b/patches/wined3d-CSMT_Main/0106-wined3d-Wait-only-for-the-buffer-to-be-idle.patch index a88ec288..5f50909b 100644 --- a/patches/wined3d-CSMT_Main/0106-wined3d-Wait-only-for-the-buffer-to-be-idle.patch +++ b/patches/wined3d-CSMT_Main/0106-wined3d-Wait-only-for-the-buffer-to-be-idle.patch @@ -1,4 +1,4 @@ -From b1349ec4fb7eba7b699d5d519f7fcdc0218db8b2 Mon Sep 17 00:00:00 2001 +From 9d42514d2eb64b4e60838d3ac37c6fe54496912b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 22 Aug 2014 15:52:50 +0200 Subject: wined3d: Wait only for the buffer to be idle. @@ -9,16 +9,16 @@ This got lost somewhere during the patch reordering. 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index c4d9740..5eb8659 100644 +index 666479a..c9d0477 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1057,8 +1057,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1045,8 +1045,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN } else if(!(flags & (WINED3D_MAP_NOOVERWRITE | WINED3D_MAP_READONLY))) { - FIXME("waiting for cs, flags 0x%04x.\n", flags); - device->cs->ops->finish(device->cs); -+ wined3d_resource_wait_fence(&buffer->resource); ++ wined3d_resource_wait_idle(&buffer->resource); } } diff --git a/patches/wined3d-CSMT_Main/0109-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch b/patches/wined3d-CSMT_Main/0109-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch index f8306d70..5ed8a280 100644 --- a/patches/wined3d-CSMT_Main/0109-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch +++ b/patches/wined3d-CSMT_Main/0109-wined3d-Put-GL_APPLE_flush_buffer_range-syncing-back.patch @@ -1,4 +1,4 @@ -From c3698fef626f57c8e8dfc973551901086cde355e Mon Sep 17 00:00:00 2001 +From a52c3441a2f5956f5e841f56dbe189a6f91c1852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 29 Aug 2014 18:52:22 +0200 Subject: wined3d: Put GL_APPLE_flush_buffer_range syncing back in place. @@ -8,10 +8,10 @@ Subject: wined3d: Put GL_APPLE_flush_buffer_range syncing back in place. 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 5eb8659..e4fcb73 100644 +index c9d0477..5b18a36 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -681,6 +681,12 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined +@@ -686,6 +686,12 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined GL_EXTCALL(glBufferData(This->buffer_type_hint, This->resource.size, NULL, GL_STREAM_DRAW)); checkGLcall("glBufferData"); } @@ -24,7 +24,7 @@ index 5eb8659..e4fcb73 100644 while (This->modified_areas) { -@@ -1041,9 +1047,9 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1029,9 +1035,9 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN buffer->flags |= WINED3D_BUFFER_DISCARD; buffer->ignore_discard = TRUE; } @@ -36,10 +36,10 @@ index 5eb8659..e4fcb73 100644 } if (wined3d_settings.cs_multithreaded && count == 1) -@@ -1058,6 +1064,10 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1046,6 +1052,10 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN else if(!(flags & (WINED3D_MAP_NOOVERWRITE | WINED3D_MAP_READONLY))) { - wined3d_resource_wait_fence(&buffer->resource); + wined3d_resource_wait_idle(&buffer->resource); + /* Writing to the (otherwise worker thread controlled) + * flags field is OK here since the wait_fence call made + * sure the buffer is idle. */ diff --git a/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch b/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch index 3edd6f21..ab1f5b2a 100644 --- a/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch +++ b/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch @@ -1,30 +1,42 @@ -From 025efa13f043ec294bea8f5efac0c39782d4f774 Mon Sep 17 00:00:00 2001 +From f893866b12daa27f420b50ed001fae189151020c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 3 Sep 2014 20:20:39 +0200 Subject: wined3d: Wait for the resource to be idle when destroying user memory surfaces. --- - dlls/wined3d/texture.c | 6 ++++++ - 1 file changed, 6 insertions(+) + dlls/wined3d/texture.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index c075b3c..2f57373 100644 +index cecdfcd..d20322d 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -822,6 +822,12 @@ static void wined3d_texture_cleanup_main(struct wined3d_texture *texture) - sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent); - } - -+ /* Wait for the CS to finish operations on this texture when user memory was in use. -+ * The application is allowed to free the memory after texture / surface destruction -+ * returns. */ +@@ -828,6 +828,10 @@ 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); ++ + if (texture->resource.map_binding == WINED3D_LOCATION_USER_MEMORY) -+ wined3d_resource_wait_fence(&texture->resource); ++ wined3d_resource_wait_idle(&texture->resource); + resource_cleanup(&texture->resource); - wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture); - } + wined3d_resource_wait_idle(&texture->resource); + wined3d_texture_cleanup(texture); +@@ -855,6 +859,13 @@ 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); ++ ++ /* Wait for the CS to finish operations on this texture when user memory was in use. ++ * The application is allowed to free the memory after texture / surface destruction ++ * returns. */ ++ if (texture->resource.map_binding == WINED3D_LOCATION_USER_MEMORY) ++ wined3d_resource_wait_idle(&texture->resource); ++ + resource_cleanup(&texture->resource); + wined3d_cs_emit_destroy_object(texture->resource.device->cs, wined3d_texture_destroy_object, texture); + } -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0111-wined3d-Don-t-sync-on-redundant-discard-calls.patch b/patches/wined3d-CSMT_Main/0111-wined3d-Don-t-sync-on-redundant-discard-calls.patch index 663412d2..327799da 100644 --- a/patches/wined3d-CSMT_Main/0111-wined3d-Don-t-sync-on-redundant-discard-calls.patch +++ b/patches/wined3d-CSMT_Main/0111-wined3d-Don-t-sync-on-redundant-discard-calls.patch @@ -1,4 +1,4 @@ -From e4821778be958e4747f2b45002b19b4f2b4efa19 Mon Sep 17 00:00:00 2001 +From e8b88c5d57a48fcd909f94bdffdc2df24b0d9307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 8 Sep 2014 14:53:57 +0200 Subject: wined3d: Don't sync on redundant discard calls. @@ -8,17 +8,17 @@ Subject: wined3d: Don't sync on redundant discard calls. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index e4fcb73..6b01a0a 100644 +index 5b18a36..b53ec9b 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1061,7 +1061,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1049,7 +1049,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN wined3d_resource_allocate_sysmem(&buffer->resource); wined3d_cs_emit_buffer_swap_mem(device->cs, buffer, buffer->resource.map_heap_memory); } - else if(!(flags & (WINED3D_MAP_NOOVERWRITE | WINED3D_MAP_READONLY))) + else if(!(flags & (WINED3D_MAP_NOOVERWRITE | WINED3D_MAP_READONLY)) && !buffer->ignore_discard) { - wined3d_resource_wait_fence(&buffer->resource); + wined3d_resource_wait_idle(&buffer->resource); /* Writing to the (otherwise worker thread controlled) -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0114-wined3d-Only-discard-buffers-that-are-in-use.patch b/patches/wined3d-CSMT_Main/0114-wined3d-Only-discard-buffers-that-are-in-use.patch index 6b878358..6478d950 100644 --- a/patches/wined3d-CSMT_Main/0114-wined3d-Only-discard-buffers-that-are-in-use.patch +++ b/patches/wined3d-CSMT_Main/0114-wined3d-Only-discard-buffers-that-are-in-use.patch @@ -1,4 +1,4 @@ -From 9d85621f58aec2c3e6b5da5ea412d434d0132aa6 Mon Sep 17 00:00:00 2001 +From 9c0006a6708a8b5aa7f0f202f7bca4a483385313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 16 Jan 2015 19:19:05 +0100 Subject: wined3d: Only discard buffers that are in use. @@ -9,17 +9,17 @@ No need to mess around with memory if it is idle. 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 6df5554..1d785c5 100644 +index ab64f66..1375561 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1063,9 +1063,12 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1051,9 +1051,12 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN BOOL swvp = device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING; if (flags & WINED3D_MAP_DISCARD && !swvp) { - buffer->ignore_discard = TRUE; - wined3d_resource_allocate_sysmem(&buffer->resource); - wined3d_cs_emit_buffer_swap_mem(device->cs, buffer, buffer->resource.map_heap_memory); -+ if (buffer->resource.access_fence) ++ if (buffer->resource.access_count) + { + buffer->ignore_discard = TRUE; + wined3d_resource_allocate_sysmem(&buffer->resource); diff --git a/patches/wined3d-CSMT_Main/0130-wined3d-Create-initial-DCs-through-the-CS.patch b/patches/wined3d-CSMT_Main/0130-wined3d-Create-initial-DCs-through-the-CS.patch index 6ee73900..5d2c0c6f 100644 --- a/patches/wined3d-CSMT_Main/0130-wined3d-Create-initial-DCs-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0130-wined3d-Create-initial-DCs-through-the-CS.patch @@ -1,4 +1,4 @@ -From 30c2a0ff87ec71e48c3f2358708dac4ff3ab4cda Mon Sep 17 00:00:00 2001 +From 64a1d858b61ca163234d2c387fb26555b6843257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 7 May 2016 22:31:28 +0100 Subject: wined3d: Create initial DCs through the CS. @@ -10,7 +10,7 @@ Subject: wined3d: Create initial DCs through the CS. 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index d6e116f..794e8d9 100644 +index 0db879f..0258510 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -3539,6 +3539,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str @@ -24,10 +24,10 @@ index d6e116f..794e8d9 100644 current_context = NULL; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index d59ffb7..5a86b7c 100644 +index acf2ae0..b5ccf07 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -2877,6 +2877,9 @@ static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t s +@@ -2666,6 +2666,9 @@ static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t s struct wined3d_cs_queue *queue = prio ? &cs->prio_queue : &cs->queue; size_t queue_size = sizeof(queue->data) / sizeof(*queue->data); @@ -37,7 +37,7 @@ index d59ffb7..5a86b7c 100644 if (queue_size - size < queue->head) { struct wined3d_cs_skip *skip; -@@ -2949,18 +2952,6 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) +@@ -2738,18 +2741,6 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) static void wined3d_cs_mt_finish(struct wined3d_cs *cs) { BOOL fence; @@ -57,10 +57,10 @@ index d59ffb7..5a86b7c 100644 /* A busy wait should be fine, we're not supposed to have to wait very diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 9be152d..0f0bdf2 100644 +index 42f0ba7..372559a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1110,7 +1110,11 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1205,7 +1205,11 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT wined3d_texture_invalidate_location(texture, 0, ~valid_location); if (create_dib) @@ -73,7 +73,7 @@ index 9be152d..0f0bdf2 100644 return WINED3D_OK; } -@@ -2130,11 +2134,15 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2188,11 +2192,15 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -81,12 +81,12 @@ index 9be152d..0f0bdf2 100644 - && FAILED(hr = wined3d_surface_create_dc(surface))) + if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D)) { -- wined3d_texture_cleanup_main(texture); +- wined3d_texture_cleanup_sync(texture); - return hr; + HDC dc; + if (FAILED(hr = wined3d_texture_get_dc(texture, idx, &dc))) + { -+ wined3d_texture_cleanup_main(texture); ++ wined3d_texture_cleanup_sync(texture); + return hr; + } + wined3d_texture_release_dc(texture, idx, dc); diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index c5d0f73b..04c09810 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -194,46 +194,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_bind(buffer, context); GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size, buffer->resource.heap_memory)); -@@ -561,6 +583,7 @@ static void wined3d_buffer_drop_bo(struct wined3d_buffer *buffer) - device_invalidate_state(device, STATE_STREAMSRC); - } - -+#if defined(STAGING_CSMT) - static void wined3d_buffer_destroy_object(void *object) - { - struct wined3d_buffer *buffer = object; -@@ -594,6 +617,30 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) - - buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); - wined3d_cs_emit_destroy_object(device->cs, wined3d_buffer_destroy_object, buffer); -+#else /* STAGING_CSMT */ -+ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) -+{ -+ ULONG refcount = InterlockedDecrement(&buffer->resource.ref); -+ struct wined3d_context *context; -+ -+ TRACE("%p decreasing refcount to %u.\n", buffer, refcount); -+ -+ if (!refcount) -+ { -+ if (buffer->buffer_object) -+ { -+ context = context_acquire(buffer->resource.device, NULL); -+ delete_gl_buffer(buffer, context->gl_info); -+ context_release(context); -+ -+ HeapFree(GetProcessHeap(), 0, buffer->conversion_map); -+ } -+ -+ resource_cleanup(&buffer->resource); -+ buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); -+ HeapFree(GetProcessHeap(), 0, buffer->maps); -+ HeapFree(GetProcessHeap(), 0, buffer); -+#endif /* STAGING_CSMT */ - } - - return refcount; -@@ -678,6 +725,7 @@ drop_query: +@@ -674,6 +696,7 @@ drop_query: /* The caller provides a GL context */ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags) { @@ -241,7 +202,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c UINT start = 0, len = 0; /* This potentially invalidates the element array buffer binding, but the -@@ -701,6 +749,45 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined +@@ -697,6 +720,45 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)); checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)"); This->flags &= ~WINED3D_BUFFER_APPLESYNC; @@ -287,7 +248,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } while (This->modified_areas) -@@ -709,12 +796,33 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined +@@ -705,12 +767,33 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined start = This->maps[This->modified_areas].offset; len = This->maps[This->modified_areas].size; @@ -321,7 +282,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD); } -@@ -733,6 +841,14 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte +@@ -729,6 +812,14 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte TRACE("buffer %p.\n", buffer); @@ -336,7 +297,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_mark_used(buffer); if (!buffer->buffer_object) -@@ -908,6 +1024,7 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte +@@ -904,6 +995,7 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) { @@ -344,7 +305,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c struct wined3d_device *device = buffer->resource.device; if (buffer->resource.map_count) -@@ -917,6 +1034,12 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) +@@ -913,6 +1005,12 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) } wined3d_cs_emit_buffer_preload(device->cs, buffer); @@ -357,7 +318,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer) -@@ -930,6 +1053,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -926,6 +1024,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN { LONG count; BYTE *base; @@ -365,7 +326,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c struct wined3d_device *device = buffer->resource.device; struct wined3d_context *context; -@@ -953,6 +1077,10 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -949,6 +1048,10 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN { wined3d_cs_emit_create_vbo(device->cs, buffer); } @@ -376,7 +337,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture -@@ -961,7 +1089,11 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -957,7 +1060,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. */ @@ -388,7 +349,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; -@@ -972,6 +1104,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -968,6 +1075,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN * being uploaded in that case. Two such applications are Port Royale * and Darkstar One. */ if (flags & WINED3D_MAP_DISCARD) @@ -396,7 +357,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, 0, 0); else if (!(flags & WINED3D_MAP_READONLY)) wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, offset, size); -@@ -989,6 +1122,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -985,6 +1093,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN wined3d_cs_emit_glfinish(device->cs); device->cs->ops->finish(device->cs); } @@ -416,7 +377,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -1034,6 +1180,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1030,6 +1151,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN buffer_get_sysmem(buffer, context); } TRACE("New pointer is %p.\n", buffer->resource.heap_memory); @@ -424,7 +385,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } context_release(context); } -@@ -1073,6 +1220,21 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1069,6 +1191,21 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.map_heap_memory; @@ -446,7 +407,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); -@@ -1135,6 +1297,7 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) +@@ -1131,6 +1268,7 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) } GL_EXTCALL(glUnmapBuffer(buffer->buffer_type_hint)); @@ -454,7 +415,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (wined3d_settings.cs_multithreaded) gl_info->gl_ops.gl.p_glFinish(); else if (wined3d_settings.strict_draw_ordering) -@@ -1143,6 +1306,18 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) +@@ -1139,6 +1277,18 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) buffer_clear_dirty_areas(buffer); buffer->map_ptr = NULL; @@ -473,7 +434,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } } -@@ -1335,7 +1510,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1331,7 +1481,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device return hr; } buffer->buffer_type_hint = bind_hint; @@ -483,7 +444,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); -@@ -1371,6 +1548,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1367,9 +1519,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->flags |= WINED3D_BUFFER_USE_BO; } @@ -491,32 +452,11 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (wined3d_settings.cs_multithreaded) buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER; -@@ -1381,6 +1559,13 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device - resource_cleanup(&buffer->resource); - if (wined3d_settings.cs_multithreaded) - buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); -+#else /* STAGING_CSMT */ -+ if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) -+ { -+ ERR("Out of memory.\n"); -+ buffer_unload(&buffer->resource); -+ resource_cleanup(&buffer->resource); +#endif /* STAGING_CSMT */ - return E_OUTOFMEMORY; - } - buffer->maps_size = 1; -@@ -1391,8 +1576,10 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device - buffer_unload(&buffer->resource); - resource_cleanup(&buffer->resource); - HeapFree(GetProcessHeap(), 0, buffer->maps); -+#if defined(STAGING_CSMT) - if (wined3d_settings.cs_multithreaded) - buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -1503,6 +1690,7 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, + if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) + { + ERR("Out of memory.\n"); +@@ -1497,6 +1651,7 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, return WINED3D_OK; } @@ -524,7 +464,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) { -@@ -1510,3 +1698,4 @@ void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) +@@ -1504,3 +1659,4 @@ void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) buffer->resource.heap_memory = mem; buffer->flags |= WINED3D_BUFFER_DISCARD; } @@ -790,9 +730,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->flags = flags; +#if defined(STAGING_CSMT) - wined3d_resource_inc_fence(&swapchain->front_buffer->resource); + wined3d_resource_acquire(&swapchain->front_buffer->resource); for (i = 0; i < swapchain->desc.backbuffer_count; i++) - wined3d_resource_inc_fence(&swapchain->back_buffers[i]->resource); + wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); @@ -671,6 +699,30 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * unsigned int i; @@ -855,7 +795,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +#if defined(STAGING_CSMT) if (op->indexed) - wined3d_resource_dec_fence(&cs->state.index_buffer->resource); + wined3d_resource_release(&cs->state.index_buffer->resource); @@ -777,6 +840,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i struct wined3d_cs_draw *op; unsigned int i; @@ -878,7 +818,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +#if defined(STAGING_CSMT) if (indexed) { - wined3d_resource_inc_fence(&state->index_buffer->resource); + wined3d_resource_acquire(&state->index_buffer->resource); @@ -824,6 +896,17 @@ static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *d cs->state.predicate_value = op->value; @@ -3757,9 +3697,9 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c resource->map_heap_memory = NULL; +#endif /* STAGING_CSMT */ context_resource_released(resource->device, resource, resource->type); + wined3d_resource_release(resource); } - -@@ -342,7 +346,11 @@ BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) +@@ -344,7 +348,11 @@ BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1; *p = mem; @@ -5583,24 +5523,19 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) -@@ -479,6 +515,7 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) - resource_unload(&texture->resource); - } - +@@ -502,6 +538,7 @@ 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; +#if defined(STAGING_CSMT) - static void wined3d_texture_destroy_object(void *object) - { - struct wined3d_texture *texture = object; -@@ -516,6 +553,42 @@ static void wined3d_texture_destroy_object(void *object) - texture->texture_ops->texture_cleanup_sub_resources(texture); - wined3d_texture_unload_gl_texture(texture); - HeapFree(GetProcessHeap(), 0, texture); + struct wined3d_gl_bo *buffer; + unsigned int i; + +@@ -526,6 +563,30 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) + wined3d_device_release_bo(device, buffer, context); + texture->sub_resources[i].buffer = NULL; + texture->sub_resources[i].map_buffer = NULL; +#else /* STAGING_CSMT */ -+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; + const struct wined3d_gl_info *gl_info; + GLuint buffer_object; + unsigned int i; @@ -5623,49 +5558,40 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c + } + + GL_EXTCALL(glDeleteBuffers(1, &buffer_object)); -+ } -+ if (context) -+ context_release(context); -+ -+ texture->texture_ops->texture_cleanup_sub_resources(texture); -+ wined3d_texture_unload_gl_texture(texture); -+ resource_cleanup(&texture->resource); -+#endif /* STAGING_CSMT */ - } - - void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) -@@ -809,6 +882,7 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) - return refcount; - } - -+#if defined(STAGING_CSMT) - static void wined3d_texture_cleanup_main(struct wined3d_texture *texture) - { - struct wined3d_device *device = texture->resource.device; -@@ -832,6 +906,7 @@ static void wined3d_texture_cleanup_main(struct wined3d_texture *texture) - wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture); - } - -+#endif /* STAGING_CSMT */ - ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) - { - ULONG refcount; -@@ -846,8 +921,14 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) - - if (!refcount) - { -+#if defined(STAGING_CSMT) - texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent); - wined3d_texture_cleanup_main(texture); -+#else /* STAGING_CSMT */ -+ wined3d_texture_cleanup(texture); -+ texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent); -+ HeapFree(GetProcessHeap(), 0, texture); +#endif /* STAGING_CSMT */ } + if (context) + context_release(context); +@@ -828,10 +889,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); ++#if defined(STAGING_CSMT) - return refcount; -@@ -897,7 +978,11 @@ void wined3d_texture_load(struct wined3d_texture *texture, + if (texture->resource.map_binding == WINED3D_LOCATION_USER_MEMORY) + wined3d_resource_wait_idle(&texture->resource); + ++#endif /* STAGING_CSMT */ + resource_cleanup(&texture->resource); + wined3d_resource_wait_idle(&texture->resource); + wined3d_texture_cleanup(texture); +@@ -859,6 +922,7 @@ 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); ++#if defined(STAGING_CSMT) + + /* Wait for the CS to finish operations on this texture when user memory was in use. + * The application is allowed to free the memory after texture / surface destruction +@@ -866,6 +930,7 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) + if (texture->resource.map_binding == WINED3D_LOCATION_USER_MEMORY) + wined3d_resource_wait_idle(&texture->resource); + ++#endif /* STAGING_CSMT */ + resource_cleanup(&texture->resource); + wined3d_cs_emit_destroy_object(texture->resource.device->cs, wined3d_texture_destroy_object, texture); + } +@@ -917,7 +982,11 @@ void wined3d_texture_load(struct wined3d_texture *texture, TRACE("Reloading because of color key value change.\n"); for (i = 0; i < sub_count; i++) { @@ -5677,7 +5603,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); else wined3d_texture_invalidate_location(texture, i, ~texture->resource.map_binding); -@@ -915,7 +1000,11 @@ void wined3d_texture_load(struct wined3d_texture *texture, +@@ -935,7 +1004,11 @@ void wined3d_texture_load(struct wined3d_texture *texture, /* Reload the surfaces if the texture is marked dirty. */ for (i = 0; i < sub_count; ++i) { @@ -5689,7 +5615,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB)) ERR("Failed to load location (srgb %#x).\n", srgb); } -@@ -924,8 +1013,15 @@ void wined3d_texture_load(struct wined3d_texture *texture, +@@ -944,8 +1017,15 @@ void wined3d_texture_load(struct wined3d_texture *texture, void CDECL wined3d_texture_preload(struct wined3d_texture *texture) { @@ -5705,7 +5631,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) -@@ -988,6 +1084,7 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) +@@ -1008,6 +1088,7 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) if (texture->lod != lod) { @@ -5713,7 +5639,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (wined3d_settings.cs_multithreaded) { struct wined3d_device *device = texture->resource.device; -@@ -995,6 +1092,7 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) +@@ -1015,6 +1096,7 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) device->cs->ops->finish(device->cs); } @@ -5721,7 +5647,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->lod = lod; texture->texture_rgb.base_level = ~0u; -@@ -1115,10 +1213,14 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1135,10 +1217,14 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } if (device->d3d_initialized) @@ -5736,7 +5662,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c sub_resource = &texture->sub_resources[0]; surface = sub_resource->u.surface; -@@ -1129,7 +1231,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1149,7 +1235,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } wined3d_resource_free_sysmem(&texture->resource); @@ -5746,7 +5672,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((texture->row_pitch = pitch)) texture->slice_pitch = height * pitch; -@@ -1186,6 +1290,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1206,6 +1294,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT wined3d_texture_invalidate_location(texture, 0, ~valid_location); if (create_dib) @@ -5754,7 +5680,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { HDC dc; wined3d_texture_get_dc(texture, 0, &dc); -@@ -1219,6 +1324,31 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur +@@ -1239,6 +1328,31 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur * message. Freeing the actual memory and setting the read pointer to 0 is * the task of the worker thread. */ texture->resource.map_heap_memory = NULL; @@ -5786,7 +5712,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_force_reload(struct wined3d_texture *texture) -@@ -1336,7 +1466,9 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1356,7 +1470,9 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned ERR("Failed to allocate system memory.\n"); return FALSE; } @@ -5796,7 +5722,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_USER_MEMORY: -@@ -1345,7 +1477,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1365,7 +1481,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned return TRUE; case WINED3D_LOCATION_BUFFER: @@ -5808,7 +5734,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1416,7 +1552,11 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1436,7 +1556,11 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); context = context_acquire(texture->resource.device, NULL); @@ -5820,7 +5746,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c context, texture->resource.map_binding)) { ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); -@@ -1462,7 +1602,9 @@ static HRESULT wined3d_texture_upload_data(struct wined3d_texture *texture, +@@ -1482,7 +1606,9 @@ static HRESULT wined3d_texture_upload_data(struct wined3d_texture *texture, return WINED3D_OK; } @@ -5830,7 +5756,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_sub_resource_data *data) { -@@ -1485,8 +1627,12 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int +@@ -1505,8 +1631,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) { @@ -5843,18 +5769,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } /* Context activation is done by the caller. */ -@@ -1576,6 +1722,10 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture) - list_remove(&overlay->overlay_entry); - overlay->overlay_dest = NULL; - } -+#if !defined(STAGING_CSMT) -+ -+ sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent); -+#endif /* STAGING_CSMT */ - } - if (context) - context_release(context); -@@ -1624,7 +1774,11 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1644,7 +1774,11 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[i]; if (resource->pool != WINED3D_POOL_DEFAULT @@ -5866,7 +5781,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { wined3d_texture_invalidate_location(texture, i, ~resource->map_binding); } -@@ -1639,8 +1793,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1659,8 +1793,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -5880,7 +5795,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -1665,6 +1824,7 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1685,6 +1824,7 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_unload_gl_texture(texture); } @@ -5888,7 +5803,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD flags) { struct wined3d_device *device = texture->resource.device; -@@ -1746,6 +1906,7 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -1766,6 +1906,7 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int return data; } @@ -5896,27 +5811,27 @@ 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) { -@@ -1753,9 +1914,19 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1773,9 +1914,19 @@ 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; +#if defined(STAGING_CSMT) - struct wined3d_texture *texture; - unsigned int texture_level; - BYTE *base_memory; ++ struct wined3d_texture *texture; ++ unsigned int texture_level; ++ BYTE *base_memory; +#else /* STAGING_CSMT */ + const struct wined3d_gl_info *gl_info = NULL; + struct wined3d_context *context = NULL; -+ struct wined3d_texture *texture; + struct wined3d_texture *texture; + struct wined3d_bo_address data; -+ unsigned int texture_level; -+ BYTE *base_memory; + unsigned int texture_level; + BYTE *base_memory; + BOOL ret; +#endif /* STAGING_CSMT */ 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); -@@ -1802,6 +1973,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1822,6 +1973,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); @@ -5924,8 +5839,8 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (flags & WINED3D_MAP_NOOVERWRITE) FIXME("WINED3D_MAP_NOOVERWRITE is not implemented yet.\n"); -@@ -1823,6 +1995,47 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour - wined3d_resource_wait_fence(&texture->resource); +@@ -1843,6 +1995,47 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour + wined3d_resource_wait_idle(&texture->resource); base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); +#else /* STAGING_CSMT */ @@ -5972,7 +5887,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) { -@@ -1858,6 +2071,19 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1878,6 +2071,19 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour } } @@ -5992,7 +5907,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c ++resource->map_count; ++sub_resource->map_count; -@@ -1867,6 +2093,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1887,6 +2093,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour return WINED3D_OK; } @@ -6000,7 +5915,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx) { struct wined3d_context *context = NULL; -@@ -1922,6 +2149,16 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1942,6 +2149,16 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso struct wined3d_texture_sub_resource *sub_resource; struct wined3d_texture *texture; struct wined3d_device *device = resource->device; @@ -6017,7 +5932,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); -@@ -1937,6 +2174,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1957,6 +2174,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso return WINEDDERR_NOTLOCKED; } @@ -6025,7 +5940,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_texture_unmap(device->cs, texture, sub_resource_idx); if (sub_resource->unmap_dirtify) -@@ -1944,6 +2182,28 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1964,6 +2182,28 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso wined3d_cs_emit_texture_changed(device->cs, texture, sub_resource_idx, sub_resource->map_buffer, resource->map_heap_memory); sub_resource->unmap_dirtify = FALSE; @@ -6054,114 +5969,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } --sub_resource->map_count; -@@ -1977,7 +2237,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - && !gl_info->supported[EXT_TEXTURE_ARRAY]) - { - WARN("OpenGL implementation does not support array textures.\n"); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - -@@ -1986,7 +2248,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (WINED3DFMT_UNKNOWN >= desc->format) - { - WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - -@@ -2009,7 +2273,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (desc->pool != WINED3D_POOL_SCRATCH) - { - WARN("Attempted to create a mipmapped/cube/array NPOT texture without unconditional NPOT support.\n"); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - -@@ -2027,7 +2293,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - { - FIXME("Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n", - desc->width, desc->height); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_NOTAVAILABLE; - } - -@@ -2059,7 +2327,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (desc->pool == WINED3D_POOL_DEFAULT || desc->pool == WINED3D_POOL_MANAGED) - { - WARN("Dimensions (%ux%u) exceed the maximum texture size.\n", pow2_width, pow2_height); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_NOTAVAILABLE; - } - -@@ -2073,6 +2343,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) - { - WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } -@@ -2081,6 +2352,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - { - WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n"); - HeapFree(GetProcessHeap(), 0, texture); -+#else /* STAGING_CSMT */ -+ return WINED3DERR_INVALIDCALL; -+ } -+ -+ if (level_count != 1) -+ { -+ WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n"); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - } -@@ -2089,7 +2368,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - flags, device, parent, parent_ops, &texture_resource_ops))) - { - WARN("Failed to initialize texture, returning %#x.\n", hr); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -2131,7 +2412,11 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - if (level_count > ~(SIZE_T)0 / layer_count - || !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces)))) - { -+#if defined(STAGING_CSMT) - wined3d_texture_cleanup_main(texture); -+#else /* STAGING_CSMT */ -+ wined3d_texture_cleanup(texture); -+#endif /* STAGING_CSMT */ - return E_OUTOFMEMORY; - } - -@@ -2174,7 +2459,11 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - texture, idx, &sub_resource->parent, &sub_resource->parent_ops))) - { - WARN("Failed to create surface parent, hr %#x.\n", hr); -+#if defined(STAGING_CSMT) - wined3d_texture_cleanup_main(texture); -+#else /* STAGING_CSMT */ -+ wined3d_texture_cleanup(texture); -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -2182,6 +2471,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2195,6 +2435,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -6169,7 +5977,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D)) { HDC dc; -@@ -2191,6 +2481,13 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2204,6 +2445,13 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 return hr; } wined3d_texture_release_dc(texture, idx, dc); @@ -6177,13 +5985,13 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c + if (((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D)) + && FAILED(hr = wined3d_surface_create_dc(surface))) + { -+ wined3d_texture_cleanup(texture); ++ wined3d_texture_cleanup_sync(texture); + return hr; +#endif /* STAGING_CSMT */ } } } -@@ -2198,7 +2495,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2211,7 +2459,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 return WINED3D_OK; } @@ -6193,175 +6001,17 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_sub_resource_data *data) { -@@ -2257,6 +2556,23 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi - - static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture) - { -+#if !defined(STAGING_CSMT) -+ unsigned int sub_count = texture->level_count * texture->layer_count; -+ struct wined3d_texture_sub_resource *sub_resource; -+ struct wined3d_volume *volume; -+ unsigned int i; -+ -+ for (i = 0; i < sub_count; ++i) -+ { -+ sub_resource = &texture->sub_resources[i]; -+ if ((volume = sub_resource->u.volume)) -+ { -+ TRACE("volume %p.\n", volume); -+ -+ sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent); -+ } -+ } -+#endif /* STAGING_CSMT */ - HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume); - } - -@@ -2310,7 +2626,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - if (layer_count != 1) - { - ERR("Invalid layer count for volume texture.\n"); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return E_INVALIDARG; - } - -@@ -2319,6 +2637,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - if (WINED3DFMT_UNKNOWN >= desc->format) - { - WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } -@@ -2327,6 +2646,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - { - WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); - HeapFree(GetProcessHeap(), 0, texture); -+#else /* STAGING_CSMT */ -+ return WINED3DERR_INVALIDCALL; -+ } -+ -+ if (!gl_info->supported[EXT_TEXTURE3D]) -+ { -+ WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - -@@ -2336,6 +2663,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) - { - WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } -@@ -2344,6 +2672,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - { - WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); - HeapFree(GetProcessHeap(), 0, texture); -+#else /* STAGING_CSMT */ -+ return WINED3DERR_INVALIDCALL; -+ } -+ -+ if (level_count != 1) -+ { -+ WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - } -@@ -2352,7 +2688,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - || desc->pool == WINED3D_POOL_SCRATCH)) - { - WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool)); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - -@@ -2379,7 +2717,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - { - WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", - desc->width, desc->height, desc->depth); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return WINED3DERR_INVALIDCALL; - } - } -@@ -2389,7 +2729,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - 0, device, parent, parent_ops, &texture_resource_ops))) - { - WARN("Failed to initialize texture, returning %#x.\n", hr); -+#if defined(STAGING_CSMT) - HeapFree(GetProcessHeap(), 0, texture); -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -2402,6 +2744,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2407,7 +2657,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); +#if defined(STAGING_CSMT) texture->resource.map_heap_memory = NULL; ++#endif /* STAGING_CSMT */ texture->resource.map_binding = WINED3D_LOCATION_BUFFER; } -@@ -2409,6 +2752,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes)))) - { - wined3d_texture_cleanup_main(texture); -+#else /* STAGING_CSMT */ -+ texture->resource.map_binding = WINED3D_LOCATION_BUFFER; -+ } -+ -+ if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes)))) -+ { -+ wined3d_texture_cleanup(texture); -+#endif /* STAGING_CSMT */ - return E_OUTOFMEMORY; - } -@@ -2430,7 +2781,11 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - texture, i, &sub_resource->parent, &sub_resource->parent_ops))) - { - WARN("Failed to create volume parent, hr %#x.\n", hr); -+#if defined(STAGING_CSMT) - wined3d_texture_cleanup_main(texture); -+#else /* STAGING_CSMT */ -+ wined3d_texture_cleanup(texture); -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -2727,6 +3082,9 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct - if (FAILED(hr)) - { - WARN("Failed to initialize texture, returning %#x.\n", hr); -+#if !defined(STAGING_CSMT) -+ HeapFree(GetProcessHeap(), 0, object); -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -2734,7 +3092,12 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct - * in this case. */ - if (data && FAILED(hr = wined3d_texture_upload_data(object, data))) - { -+#if defined(STAGING_CSMT) - wined3d_texture_cleanup_main(object); -+#else /* STAGING_CSMT */ -+ wined3d_texture_cleanup(object); -+ HeapFree(GetProcessHeap(), 0, object); -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -2744,6 +3107,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -2752,6 +3004,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -6369,7 +6019,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) { struct wined3d_device *device = texture->resource.device; -@@ -2777,6 +3141,15 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -2785,6 +3038,15 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i struct wined3d_device *device = texture->resource.device; struct wined3d_texture_sub_resource *sub_resource; struct wined3d_surface *surface; @@ -6385,7 +6035,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); -@@ -2794,6 +3167,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -2802,6 +3064,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; @@ -6393,7 +6043,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_get_dc(device->cs, texture, sub_resource_idx); if (FAILED(texture->dc_hr)) return texture->dc_hr; -@@ -2818,6 +3192,30 @@ void wined3d_texture_release_dc_cs(struct wined3d_texture *texture, unsigned int +@@ -2826,6 +3089,30 @@ void wined3d_texture_release_dc_cs(struct wined3d_texture *texture, unsigned int wined3d_texture_update_map_binding(texture); if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; @@ -6424,7 +6074,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) -@@ -2848,6 +3246,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -2856,6 +3143,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -6432,7 +6082,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx); return WINED3D_OK; -@@ -2981,4 +3380,16 @@ BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int +@@ -2989,4 +3277,16 @@ BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int } } return ret; @@ -6783,38 +6433,19 @@ 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) { -@@ -2538,9 +2589,14 @@ struct wined3d_resource +@@ -2538,7 +2589,11 @@ struct wined3d_resource UINT depth; UINT size; DWORD priority; +#if defined(STAGING_CSMT) void *heap_memory, *map_heap_memory; - struct list resource_list_entry; - LONG access_fence; +#else /* STAGING_CSMT */ + void *heap_memory; -+ struct list resource_list_entry; +#endif /* STAGING_CSMT */ + struct list resource_list_entry; + LONG access_count; - void *parent; - const struct wined3d_parent_ops *parent_ops; -@@ -2573,6 +2629,7 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_H - 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; - -+#if defined(STAGING_CSMT) - static inline void wined3d_resource_inc_fence(struct wined3d_resource *resource) - { - InterlockedIncrement(&resource->access_fence); -@@ -2588,6 +2645,7 @@ static inline void wined3d_resource_wait_fence(struct wined3d_resource *resource - while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); - } - -+#endif /* STAGING_CSMT */ - /* Tests show that the start address of resources is 32 byte aligned */ - #define RESOURCE_ALIGNMENT 16 - -@@ -2645,7 +2703,9 @@ struct wined3d_texture +@@ -2645,7 +2700,9 @@ struct wined3d_texture DWORD flags; GLenum target; DWORD update_map_binding; @@ -6824,7 +6455,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; -@@ -2683,8 +2743,12 @@ struct wined3d_texture +@@ -2683,8 +2740,12 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -6837,7 +6468,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2735,6 +2799,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2735,6 +2796,7 @@ 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; @@ -6845,7 +6476,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_gl_bo *swap_buffer, void *swap_heap_memory) DECLSPEC_HIDDEN; -@@ -2744,6 +2809,13 @@ void wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub +@@ -2744,6 +2806,13 @@ void wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN; @@ -6859,7 +6490,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, -@@ -2754,6 +2826,7 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size +@@ -2754,6 +2823,7 @@ 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; @@ -6867,7 +6498,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location); void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, -@@ -2769,6 +2842,15 @@ void wined3d_texture_unmap_bo_address(const struct wined3d_bo_address *data, +@@ -2769,6 +2839,15 @@ void wined3d_texture_unmap_bo_address(const struct wined3d_bo_address *data, const struct wined3d_gl_info *gl_info, GLenum binding) DECLSPEC_HIDDEN; void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; @@ -6883,7 +6514,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; -@@ -2886,7 +2968,11 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru +@@ -2886,7 +2965,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; @@ -6895,7 +6526,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, -@@ -2897,9 +2983,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -2897,9 +2980,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; @@ -6907,7 +6538,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; -@@ -2914,10 +3002,12 @@ struct wined3d_sampler +@@ -2914,10 +2999,12 @@ struct wined3d_sampler GLuint name; }; @@ -6920,7 +6551,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; -@@ -3013,6 +3103,7 @@ struct wined3d_stateblock +@@ -3013,6 +3100,7 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -6928,7 +6559,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -3063,6 +3154,44 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HID +@@ -3063,6 +3151,44 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HID void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; @@ -6973,7 +6604,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; -@@ -3113,6 +3242,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -3113,6 +3239,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; @@ -6981,7 +6612,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, -@@ -3168,6 +3298,14 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, +@@ -3168,6 +3295,14 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -6996,7 +6627,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3182,8 +3320,12 @@ enum query_state { +@@ -3182,8 +3317,12 @@ enum query_state { struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -7009,7 +6640,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -3197,9 +3339,11 @@ struct wined3d_query +@@ -3197,9 +3336,11 @@ struct wined3d_query enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -7021,7 +6652,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 -@@ -3227,7 +3371,9 @@ struct wined3d_buffer +@@ -3227,7 +3368,9 @@ struct wined3d_buffer GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -7031,7 +6662,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3252,6 +3398,7 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co +@@ -3252,6 +3395,7 @@ 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; @@ -7039,7 +6670,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, -@@ -3260,6 +3407,13 @@ void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offs +@@ -3260,6 +3404,13 @@ void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offs void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -7053,7 +6684,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3321,8 +3475,12 @@ struct wined3d_unordered_access_view +@@ -3321,8 +3472,12 @@ struct wined3d_unordered_access_view struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -7066,7 +6697,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3358,8 +3516,10 @@ struct wined3d_swapchain +@@ -3358,8 +3513,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;