diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index bb019d95..74ec06fe 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -8493,6 +8493,8 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Do not immediately submit stateblock updates.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Get rid of TLS for command stream.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Clean up cs lists on shutdown.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "wined3d: Use a separate lock for each CS list.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Don'\''t crash in context_release when device was not fully created.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/wined3d-CSMT_Main/0052-wined3d-Use-a-separate-lock-for-each-CS-list.patch b/patches/wined3d-CSMT_Main/0052-wined3d-Use-a-separate-lock-for-each-CS-list.patch new file mode 100644 index 00000000..b4a8abd2 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0052-wined3d-Use-a-separate-lock-for-each-CS-list.patch @@ -0,0 +1,96 @@ +From 2f24beca349dd4f2aa5a408e2da5d09e6425583d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Thu, 9 Feb 2017 21:11:25 +0100 +Subject: wined3d: Use a separate lock for each CS list. + +--- + dlls/wined3d/cs.c | 26 +++++++++++--------------- + dlls/wined3d/wined3d_private.h | 1 + + 2 files changed, 12 insertions(+), 15 deletions(-) + +diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +index f68bbd55663..09936328cf4 100644 +--- a/dlls/wined3d/cs.c ++++ b/dlls/wined3d/cs.c +@@ -25,16 +25,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); + + #define WINED3D_INITIAL_CS_SIZE 4096 + +-static CRITICAL_SECTION wined3d_cs_list_mutex; +-static CRITICAL_SECTION_DEBUG wined3d_cs_list_mutex_debug = +-{ +- 0, 0, &wined3d_cs_list_mutex, +- {&wined3d_cs_list_mutex_debug.ProcessLocksList, +- &wined3d_cs_list_mutex_debug.ProcessLocksList}, +- 0, 0, {(DWORD_PTR)(__FILE__ ": wined3d_cs_list_mutex")} +-}; +-static CRITICAL_SECTION wined3d_cs_list_mutex = {&wined3d_cs_list_mutex_debug, -1, 0, 0, 0, 0}; +- + enum wined3d_cs_op + { + WINED3D_CS_OP_SYNC, +@@ -539,9 +529,9 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs); + /* FIXME: The list synchronization probably isn't particularly fast. */ + static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block) + { +- EnterCriticalSection(&wined3d_cs_list_mutex); ++ EnterCriticalSection(&list->lock); + list_add_tail(&list->blocks, &block->entry); +- LeaveCriticalSection(&wined3d_cs_list_mutex); ++ LeaveCriticalSection(&list->lock); + InterlockedIncrement(&list->count); + } + +@@ -550,14 +540,14 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list * + struct list *head; + + if (!list->count) return NULL; +- EnterCriticalSection(&wined3d_cs_list_mutex); ++ EnterCriticalSection(&list->lock); + if (!(head = list_head(&list->blocks))) + { +- LeaveCriticalSection(&wined3d_cs_list_mutex); ++ LeaveCriticalSection(&list->lock); + return NULL; + } + list_remove(head); +- LeaveCriticalSection(&wined3d_cs_list_mutex); ++ LeaveCriticalSection(&list->lock); + InterlockedDecrement(&list->count); + + return LIST_ENTRY(head, struct wined3d_cs_block, entry); +@@ -610,6 +600,9 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_block(struct wined3d_cs *cs) + + static void wined3d_cs_list_init(struct wined3d_cs_list *list) + { ++ InitializeCriticalSection(&list->lock); ++ list->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": wined3d_cs_list_lock"); ++ + list_init(&list->blocks); + } + +@@ -622,6 +615,9 @@ static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list) + list_remove(&block->entry); + HeapFree(GetProcessHeap(), 0, block); + } ++ ++ list->lock.DebugInfo->Spare[0] = 0; ++ DeleteCriticalSection(&list->lock); + } + + static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, struct wined3d_cs_list *list) +diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +index e6b0d363cdd..d4f05b204fd 100644 +--- a/dlls/wined3d/wined3d_private.h ++++ b/dlls/wined3d/wined3d_private.h +@@ -3207,6 +3207,7 @@ enum wined3d_push_constants + + struct wined3d_cs_list + { ++ CRITICAL_SECTION lock; + struct list blocks; + LONG count; + }; +-- +2.11.0 + diff --git a/patches/wined3d-CSMT_Main/0053-wined3d-Don-t-crash-in-context_release-when-device-w.patch b/patches/wined3d-CSMT_Main/0053-wined3d-Don-t-crash-in-context_release-when-device-w.patch new file mode 100644 index 00000000..c4e8e621 --- /dev/null +++ b/patches/wined3d-CSMT_Main/0053-wined3d-Don-t-crash-in-context_release-when-device-w.patch @@ -0,0 +1,30 @@ +From 9c3420b9d0fd92a9421e0b15177d4fb8b5a55601 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Fri, 10 Feb 2017 20:31:21 +0100 +Subject: wined3d: Don't crash in context_release when device was not fully + created. + +--- + dlls/wined3d/context.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c +index 1979a36d875..be5194daaf0 100644 +--- a/dlls/wined3d/context.c ++++ b/dlls/wined3d/context.c +@@ -1353,8 +1353,11 @@ void context_release(struct wined3d_context *context) + WARN("Context %p is not the current context.\n", context); + } + +- if (wined3d_settings.cs_multithreaded && context->device->cs->thread_id != GetCurrentThreadId()) ++ if (wined3d_settings.cs_multithreaded && context->device && ++ context->device->cs->thread_id != GetCurrentThreadId()) ++ { + context->gl_info->gl_ops.gl.p_glFinish(); ++ } + + if (!--context->level) + { +-- +2.11.0 + diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 8afed4ab..fdee660a 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -53,19 +53,22 @@ diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1353,6 +1353,11 @@ void context_release(struct wined3d_context *context) +@@ -1353,6 +1353,14 @@ void context_release(struct wined3d_context *context) WARN("Context %p is not the current context.\n", context); } +#if defined(STAGING_CSMT) -+ if (wined3d_settings.cs_multithreaded && context->device->cs->thread_id != GetCurrentThreadId()) ++ if (wined3d_settings.cs_multithreaded && context->device && ++ context->device->cs->thread_id != GetCurrentThreadId()) ++ { + context->gl_info->gl_ops.gl.p_glFinish(); ++ } + +#endif /* STAGING_CSMT */ if (!--context->level) { if (context_restore_pixel_format(context)) -@@ -1723,6 +1728,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1723,6 +1731,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } @@ -79,7 +82,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -2044,6 +2056,9 @@ out: +@@ -2044,6 +2059,9 @@ out: if (hdc) wined3d_release_dc(swapchain->win_handle, hdc); device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -89,7 +92,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -2091,6 +2106,9 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont +@@ -2091,6 +2109,9 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); HeapFree(GetProcessHeap(), 0, context->fbo_key); @@ -99,7 +102,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2640,7 +2658,11 @@ static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarge +@@ -2640,7 +2661,11 @@ static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarge } /* Context activation is done by the caller. */ @@ -111,7 +114,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c UINT rt_count, const struct wined3d_fb_state *fb) { struct wined3d_rendertarget_view **rts = fb->render_targets; -@@ -2649,7 +2671,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2649,7 +2674,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win DWORD rt_mask = 0, *cur_mask; UINT i; @@ -123,7 +126,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c || rt_count != gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2694,6 +2720,10 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2694,6 +2723,10 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win rt_mask = context_generate_rt_mask_no_fbo(context, rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL); } @@ -134,7 +137,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2733,7 +2763,12 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2733,7 +2766,12 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST); if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB]) { @@ -147,7 +150,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); -@@ -2750,7 +2785,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2750,7 +2788,11 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { @@ -159,7 +162,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2780,7 +2819,11 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2780,7 +2822,11 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { DWORD rt_mask = find_draw_buffers_mask(context, state); @@ -171,7 +174,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -3069,6 +3112,10 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d +@@ -3069,6 +3115,10 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -182,7 +185,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum) -@@ -3503,7 +3550,11 @@ BOOL context_apply_draw_state(struct wined3d_context *context, +@@ -3503,7 +3553,11 @@ BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) { const struct StateEntry *state_table = context->state_table; @@ -194,7 +197,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i; WORD map; -@@ -3705,6 +3756,15 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str +@@ -3705,6 +3759,15 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str TRACE("device %p, target %p.\n", device, target); @@ -213,7 +216,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -18,14 +18,33 @@ +@@ -18,6 +18,9 @@ #include "config.h" #include "wine/port.h" @@ -223,31 +226,17 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); +@@ -26,6 +29,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); - #define WINED3D_INITIAL_CS_SIZE 4096 - -+#if !defined(STAGING_CSMT) enum wined3d_cs_op { -+#else /* STAGING_CSMT */ -+static CRITICAL_SECTION wined3d_cs_list_mutex; -+static CRITICAL_SECTION_DEBUG wined3d_cs_list_mutex_debug = -+{ -+ 0, 0, &wined3d_cs_list_mutex, -+ {&wined3d_cs_list_mutex_debug.ProcessLocksList, -+ &wined3d_cs_list_mutex_debug.ProcessLocksList}, -+ 0, 0, {(DWORD_PTR)(__FILE__ ": wined3d_cs_list_mutex")} -+}; -+static CRITICAL_SECTION wined3d_cs_list_mutex = {&wined3d_cs_list_mutex_debug, -1, 0, 0, 0, 0}; -+ -+enum wined3d_cs_op -+{ ++#if defined(STAGING_CSMT) + WINED3D_CS_OP_SYNC, +#endif /* STAGING_CSMT */ WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DISPATCH, -@@ -57,10 +76,37 @@ enum wined3d_cs_op +@@ -57,10 +63,37 @@ enum wined3d_cs_op WINED3D_CS_OP_RESET_STATE, WINED3D_CS_OP_DESTROY_OBJECT, WINED3D_CS_OP_QUERY_ISSUE, @@ -285,7 +274,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -297,6 +343,16 @@ struct wined3d_cs_query_issue +@@ -297,6 +330,16 @@ struct wined3d_cs_query_issue DWORD flags; }; @@ -302,7 +291,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs_preload_resource { enum wined3d_cs_op opcode; -@@ -328,7 +384,299 @@ struct wined3d_cs_unmap +@@ -328,7 +371,305 @@ struct wined3d_cs_unmap HRESULT *hr; }; @@ -477,9 +466,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +/* FIXME: The list synchronization probably isn't particularly fast. */ +static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block) +{ -+ EnterCriticalSection(&wined3d_cs_list_mutex); ++ EnterCriticalSection(&list->lock); + list_add_tail(&list->blocks, &block->entry); -+ LeaveCriticalSection(&wined3d_cs_list_mutex); ++ LeaveCriticalSection(&list->lock); + InterlockedIncrement(&list->count); +} + @@ -488,14 +477,14 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + struct list *head; + + if (!list->count) return NULL; -+ EnterCriticalSection(&wined3d_cs_list_mutex); ++ EnterCriticalSection(&list->lock); + if (!(head = list_head(&list->blocks))) + { -+ LeaveCriticalSection(&wined3d_cs_list_mutex); ++ LeaveCriticalSection(&list->lock); + return NULL; + } + list_remove(head); -+ LeaveCriticalSection(&wined3d_cs_list_mutex); ++ LeaveCriticalSection(&list->lock); + InterlockedDecrement(&list->count); + + return LIST_ENTRY(head, struct wined3d_cs_block, entry); @@ -548,6 +537,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + +static void wined3d_cs_list_init(struct wined3d_cs_list *list) +{ ++ InitializeCriticalSection(&list->lock); ++ list->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": wined3d_cs_list_lock"); ++ + list_init(&list->blocks); +} + @@ -560,6 +552,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + list_remove(&block->entry); + HeapFree(GetProcessHeap(), 0, block); + } ++ ++ list->lock.DebugInfo->Spare[0] = 0; ++ DeleteCriticalSection(&list->lock); +} + +static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, struct wined3d_cs_list *list) @@ -602,7 +597,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -337,13 +685,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -337,13 +678,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) swapchain = op->swapchain; wined3d_swapchain_set_window(swapchain, op->dst_window_override); @@ -627,7 +622,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -351,8 +710,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -351,8 +703,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw { struct wined3d_cs_present *op; unsigned int i; @@ -642,7 +637,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_PRESENT; op->dst_window_override = dst_window_override; op->swapchain = swapchain; -@@ -366,34 +731,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -366,34 +724,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); } @@ -718,7 +713,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -403,7 +809,11 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -403,7 +802,11 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * struct wined3d_cs_clear *op; unsigned int i; @@ -730,7 +725,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -416,12 +826,21 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -416,12 +819,21 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -752,7 +747,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -532,9 +951,15 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad +@@ -532,9 +944,15 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad } } @@ -768,7 +763,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c const struct wined3d_cs_dispatch *op = data; dispatch_compute(cs->device, state, -@@ -543,6 +968,10 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) +@@ -543,6 +961,10 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) release_shader_resources(state, 1u << WINED3D_SHADER_TYPE_COMPUTE); release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_COMPUTE], state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]); @@ -779,7 +774,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, -@@ -551,7 +980,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -551,7 +973,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_dispatch *op; @@ -791,7 +786,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DISPATCH; op->group_count_x = group_count_x; op->group_count_y = group_count_y; -@@ -564,9 +997,15 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -564,9 +990,15 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -807,7 +802,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c const struct wined3d_cs_draw *op = data; unsigned int i; -@@ -594,14 +1033,26 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -594,14 +1026,26 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -834,7 +829,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, -@@ -611,7 +1062,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -611,7 +1055,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i struct wined3d_cs_draw *op; unsigned int i; @@ -846,7 +841,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DRAW; op->base_vertex_idx = base_vertex_idx; op->start_idx = start_idx; -@@ -634,11 +1089,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -634,11 +1082,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -866,7 +861,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); -@@ -646,38 +1109,61 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -646,38 +1102,61 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i cs->ops->submit(cs); } @@ -928,7 +923,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; -@@ -686,17 +1172,30 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -686,17 +1165,30 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi } static void wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data) @@ -959,7 +954,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; -@@ -705,11 +1204,26 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -705,11 +1197,26 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) } static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) @@ -986,7 +981,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -717,21 +1231,35 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -717,21 +1224,35 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v { struct wined3d_cs_set_rendertarget_view *op; @@ -1022,7 +1017,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -743,7 +1271,11 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -743,7 +1264,11 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } } @@ -1034,7 +1029,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -760,12 +1292,17 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -760,12 +1285,17 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1052,7 +1047,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; -@@ -774,17 +1311,30 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -774,17 +1304,30 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 } static void wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data) @@ -1083,7 +1078,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; -@@ -793,6 +1343,14 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -793,6 +1336,14 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 } static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) @@ -1098,7 +1093,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -810,6 +1368,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -810,6 +1361,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1109,7 +1104,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -817,17 +1379,27 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -817,17 +1372,27 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_source *op; @@ -1137,7 +1132,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -837,22 +1409,36 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -837,22 +1402,36 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1174,7 +1169,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -867,6 +1453,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -867,6 +1446,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -1185,7 +1180,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -874,16 +1464,26 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -874,16 +1457,26 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_output *op; @@ -1212,7 +1207,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -899,6 +1499,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -899,6 +1492,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -1223,7 +1218,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -906,16 +1510,26 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -906,16 +1503,26 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff { struct wined3d_cs_set_index_buffer *op; @@ -1250,7 +1245,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -929,6 +1543,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -929,6 +1536,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -1260,7 +1255,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -936,16 +1553,26 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -936,16 +1546,26 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha { struct wined3d_cs_set_constant_buffer *op; @@ -1287,7 +1282,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -1022,27 +1649,45 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -1022,27 +1642,45 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1333,7 +1328,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1050,16 +1695,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1050,16 +1688,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 { struct wined3d_cs_set_shader_resource_view *op; @@ -1360,7 +1355,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_unordered_access_view *op = data; struct wined3d_unordered_access_view *prev; -@@ -1073,6 +1728,10 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con +@@ -1073,6 +1721,10 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con InterlockedDecrement(&prev->resource->bind_count); device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING(op->pipeline)); @@ -1371,7 +1366,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline, -@@ -1080,21 +1739,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -1080,21 +1732,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined { struct wined3d_cs_set_unordered_access_view *op; @@ -1407,7 +1402,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1102,16 +1775,26 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1102,16 +1768,26 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type { struct wined3d_cs_set_sampler *op; @@ -1434,7 +1429,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_shader *op = data; -@@ -1119,26 +1802,44 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) +@@ -1119,26 +1795,44 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) device_invalidate_state(cs->device, STATE_SHADER(op->type)); if (op->type != WINED3D_SHADER_TYPE_COMPUTE) device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); @@ -1479,7 +1474,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, -@@ -1146,6 +1847,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1146,6 +1840,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, { struct wined3d_cs_set_rasterizer_state *op; @@ -1487,7 +1482,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state; -@@ -1154,31 +1856,57 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1154,31 +1849,57 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, } static void wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) @@ -1545,7 +1540,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1186,21 +1914,35 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1186,21 +1907,35 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, { struct wined3d_cs_set_texture_state *op; @@ -1581,7 +1576,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1208,22 +1950,36 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1208,22 +1943,36 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, { struct wined3d_cs_set_sampler_state *op; @@ -1618,7 +1613,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1231,35 +1987,59 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1231,35 +1980,59 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform { struct wined3d_cs_set_transform *op; @@ -1678,7 +1673,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1320,6 +2100,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1320,6 +2093,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -1689,7 +1684,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1327,7 +2111,11 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1327,7 +2104,11 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture { struct wined3d_cs_set_color_key *op; @@ -1701,7 +1696,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_SET_COLOR_KEY; op->texture = texture; op->flags = flags; -@@ -1338,22 +2126,33 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1338,22 +2119,33 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture } else op->set = 0; @@ -1735,7 +1730,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; -@@ -1364,17 +2163,37 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1364,17 +2156,37 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) { struct wined3d_adapter *adapter = cs->device->adapter; @@ -1773,7 +1768,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; -@@ -1382,17 +2201,32 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1382,17 +2194,32 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) } static void wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) @@ -1806,7 +1801,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DESTROY_OBJECT; op->callback = callback; op->object = object; -@@ -1400,40 +2234,96 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1400,40 +2227,96 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void cs->ops->submit(cs); } @@ -1903,7 +1898,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE; op->resource = resource; -@@ -1442,20 +2332,32 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso +@@ -1442,20 +2325,32 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso cs->ops->submit(cs); } @@ -1936,7 +1931,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE; op->resource = resource; -@@ -1464,13 +2366,21 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1464,13 +2359,21 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou cs->ops->submit(cs); } @@ -1958,7 +1953,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, -@@ -1479,7 +2389,11 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1479,7 +2382,11 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, struct wined3d_cs_map *op; HRESULT hr; @@ -1970,7 +1965,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_MAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -1488,17 +2402,29 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1488,17 +2395,29 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, op->flags = flags; op->hr = &hr; @@ -2000,7 +1995,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx) -@@ -1506,19 +2432,805 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc +@@ -1506,19 +2425,805 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc struct wined3d_cs_unmap *op; HRESULT hr; @@ -2015,13 +2010,13 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->hr = &hr; +#if !defined(STAGING_CSMT) -+ cs->ops->submit(cs); + cs->ops->submit(cs); +#else /* STAGING_CSMT */ + cs->ops->submit_and_wait(cs); -+ -+ return hr; -+} -+ + + return hr; + } + +static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_finish *op = data; @@ -2309,7 +2304,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + if (src_surface && src_surface != dst_surface) + wined3d_resource_acquire(&src_surface->container->resource); + - cs->ops->submit(cs); ++ cs->ops->submit(cs); +} + +static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) @@ -2498,10 +2493,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->ops->submit_and_wait(cs); +#endif /* STAGING_CSMT */ - - return hr; - } - ++ ++ return hr; ++} ++ +#if !defined(STAGING_CSMT) static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { @@ -2806,7 +2801,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, /* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch, -@@ -1550,13 +3262,43 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1550,13 +3255,43 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, @@ -2850,7 +2845,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { if (size > cs->data_size) { -@@ -1580,6 +3322,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) +@@ -1580,6 +3315,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) wined3d_cs_op_handlers[opcode](cs, cs->data); } @@ -2858,7 +2853,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants) { -@@ -1620,15 +3363,161 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus +@@ -1620,15 +3356,161 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus for (i = 0, context_count = device->context_count; i < context_count; ++i) { device->contexts[i]->constant_update_mask |= push_constant_info[p].mask; @@ -3020,7 +3015,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { -@@ -1638,34 +3527,97 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1638,34 +3520,97 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; @@ -6366,13 +6361,14 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); -@@ -3165,34 +3274,128 @@ struct wined3d_cs_ops +@@ -3165,34 +3274,129 @@ struct wined3d_cs_ops void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants); }; +#else /* STAGING_CSMT */ +struct wined3d_cs_list +{ ++ CRITICAL_SECTION lock; + struct list blocks; + LONG count; +}; @@ -6495,7 +6491,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -3203,9 +3406,17 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, +@@ -3203,9 +3407,17 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset) DECLSPEC_HIDDEN; @@ -6513,7 +6509,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, struct wined3d_rasterizer_state *rasterizer_state) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, -@@ -3237,17 +3448,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -3237,17 +3449,35 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined 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; @@ -6549,7 +6545,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ -@@ -3348,6 +3577,14 @@ struct wined3d_gl_view +@@ -3348,6 +3578,14 @@ struct wined3d_gl_view GLuint name; }; @@ -6564,7 +6560,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -3383,7 +3620,12 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_ +@@ -3383,7 +3621,12 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_ struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -6577,7 +6573,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3420,6 +3662,10 @@ struct wined3d_swapchain +@@ -3420,6 +3663,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;