From 43a640f8fdfad80d279723d1d1f39319db861db7 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 26 Aug 2016 17:53:38 +0200 Subject: [PATCH] Rebase against 30cdd1fb8cea410cb9e363b16278528669e2c19a. --- ...gString-should-throw-the-exception-a.patch | 16 +- patches/patchinstall.sh | 5 +- ...introduce-a-multithreaded-command-st.patch | 125 ++--- ...14-wined3d-Give-the-cs-its-own-state.patch | 36 +- ...at-constant-updates-through-the-comm.patch | 26 +- ...a-glFinish-before-modifying-resource.patch | 50 +- ...ht-updates-through-the-command-strea.patch | 32 +- ...e-the-linked-lists-with-a-ringbuffer.patch | 131 ++--- ...Send-texture-preloads-through-the-CS.patch | 108 ----- ...-update_texture-calls-through-the-CS.patch | 24 +- ...ource-maps-and-unmaps-a-priority-com.patch | 14 +- ...ate_sub_resource-calls-through-the-c.patch | 18 +- ...changed-textures-through-the-command.patch | 32 +- ...ement-DISCARD-texture-maps-with-PBOs.patch | 28 +- ...t-DISCARD-resource-maps-with-heap-me.patch | 44 +- ...ned3d-Accelerate-DISCARD-buffer-maps.patch | 24 +- ...he-buffer-dirty-areas-through-the-CS.patch | 26 +- ...-buffer-resource.map_count-in-the-CS.patch | 14 +- ...-Send-buffer-preloads-through-the-CS.patch | 122 ----- ...eate-VBOs-through-the-command-stream.patch | 28 +- ...104-wined3d-Fence-preload-operations.patch | 71 --- ...dc-and-releasedc-through-the-command.patch | 31 +- ...e-the-initial-context-through-the-CS.patch | 28 +- ...ext_acquire-not-being-called-from-th.patch | 30 +- .../wined3d-CSMT_Main/9999-IfDefined.patch | 459 ++++++++---------- 25 files changed, 578 insertions(+), 944 deletions(-) delete mode 100644 patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch delete mode 100644 patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch delete mode 100644 patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch diff --git a/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch b/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch index e1a86103..38053165 100644 --- a/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch +++ b/patches/ntdll-Exception/0002-ntdll-OutputDebugString-should-throw-the-exception-a.patch @@ -1,4 +1,4 @@ -From bdc7f21350a4dd7bc639bc6be69243bb6dd5dbf5 Mon Sep 17 00:00:00 2001 +From d14f1523f3694d7bc2c7c79b6b7bd6f2a354bfb7 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 28 Sep 2014 23:39:51 +0200 Subject: ntdll: OutputDebugString should throw the exception a second time, if @@ -38,10 +38,10 @@ index a277f93..2fb9c73 100644 if (!mutex_inited) { diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c -index 3e22bed..3dab0bd 100644 +index 7462024..151b67a 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c -@@ -1903,7 +1903,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce +@@ -2063,7 +2063,7 @@ static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *Exce return EXCEPTION_CONTINUE_SEARCH; } @@ -50,7 +50,7 @@ index 3e22bed..3dab0bd 100644 { PVOID vectored_handler; -@@ -1919,7 +1919,6 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo) +@@ -2079,7 +2079,6 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo) outputdebugstring_exceptions = 0; OutputDebugStringA("Hello World"); @@ -58,7 +58,7 @@ index 3e22bed..3dab0bd 100644 ok(outputdebugstring_exceptions == numexc, "OutputDebugStringA generated %d exceptions, expected %d\n", outputdebugstring_exceptions, numexc); -@@ -2359,9 +2358,9 @@ START_TEST(exception) +@@ -2522,9 +2521,9 @@ START_TEST(exception) run_rtlraiseexception_test(EXCEPTION_BREAKPOINT); run_rtlraiseexception_test(EXCEPTION_INVALID_HANDLE); test_stage = 3; @@ -70,7 +70,7 @@ index 3e22bed..3dab0bd 100644 test_stage = 5; test_ripevent(0); test_stage = 6; -@@ -2390,7 +2389,7 @@ START_TEST(exception) +@@ -2553,7 +2552,7 @@ START_TEST(exception) test_exceptions(); test_rtlraiseexception(); test_debug_registers(); @@ -79,8 +79,8 @@ index 3e22bed..3dab0bd 100644 test_ripevent(1); test_debug_service(1); test_breakpoint(1); -@@ -2415,7 +2414,7 @@ START_TEST(exception) - "__C_specific_handler" ); +@@ -2586,7 +2585,7 @@ START_TEST(exception) + "_setjmp" ); test_debug_registers(); - test_outputdebugstring(1, FALSE); diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 33e3be26..755df8ec 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "839995d5e9afcbcdcd084eac3a8e6e48a2173eda" + echo "30cdd1fb8cea410cb9e363b16278528669e2c19a" } # Show version information @@ -7326,7 +7326,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then echo '+ { "Stefan Dösinger", "wined3d: Don'\''t poll queries that failed to start.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Remove restated queries from the poll list.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Put this into the query poll patch.", 1 },'; - echo '+ { "Stefan Dösinger", "wined3d: Send texture preloads through the CS.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Don'\''t access device state in clears.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Avoid destroying views in color and depth fills.", 1 },'; echo '+ { "Matteo Bruni", "wined3d: Avoid calling wined3d_surface_blt() from surface_upload_from_surface().", 1 },'; @@ -7354,7 +7353,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then echo '+ { "Stefan Dösinger", "wined3d: Accelerate READONLY buffer maps.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Access the buffer dirty areas through the CS.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Ignore buffer->resource.map_count in the CS.", 1 },'; - echo '+ { "Stefan Dösinger", "wined3d: Send buffer preloads through the CS.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Use glBufferSubData instead of glMapBufferRange.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Separate GL buffer discard control from ignoring MAP_DISCARD.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Create buffers before mapping them.", 1 },'; @@ -7367,7 +7365,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then echo '+ { "Stefan Dösinger", "wined3d: Use surface_blt_ugly in swapchain_gl_present.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Invoke surface_unload through the CS in wined3d_surface_update_desc.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Use an event to block the worker thread when it is idle.", 1 },'; - echo '+ { "Stefan Dösinger", "wined3d: Fence preload operations.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Set map_heap_memory = NULL when allocating a PBO.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Wait only for the buffer to be idle.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Put GL_APPLE_flush_buffer_range syncing back in place.", 1 },'; diff --git a/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch b/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch index b6b83ab5..bbf528b0 100644 --- a/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch +++ b/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch @@ -1,16 +1,16 @@ -From 086e024e36bde8a490e128bfe552129eb51396d5 Mon Sep 17 00:00:00 2001 +From 6e78f864b5f4c377f49483ea35859db2429917c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Oct 2013 14:31:56 +0200 Subject: wined3d: Hackily introduce a multithreaded command stream --- - dlls/wined3d/cs.c | 373 +++++++++++++++++++++++++++++++++++++---- + dlls/wined3d/cs.c | 377 +++++++++++++++++++++++++++++++++++++---- dlls/wined3d/wined3d_main.c | 9 + dlls/wined3d/wined3d_private.h | 18 ++ - 3 files changed, 369 insertions(+), 31 deletions(-) + 3 files changed, 372 insertions(+), 32 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index b9d7e87..2789726 100644 +index 0beb6c2..b25aab3 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -24,8 +24,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -33,9 +33,9 @@ index b9d7e87..2789726 100644 WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DRAW, -@@ -56,6 +67,18 @@ enum wined3d_cs_op - WINED3D_CS_OP_DESTROY_OBJECT, +@@ -57,6 +68,18 @@ enum wined3d_cs_op WINED3D_CS_OP_QUERY_ISSUE, + WINED3D_CS_OP_PRELOAD_RESOURCE, WINED3D_CS_OP_UNLOAD_RESOURCE, + WINED3D_CS_OP_STOP, +}; @@ -52,7 +52,7 @@ index b9d7e87..2789726 100644 }; struct wined3d_cs_present -@@ -282,7 +305,134 @@ struct wined3d_cs_unload_resource +@@ -289,7 +312,134 @@ struct wined3d_cs_unload_resource struct wined3d_resource *resource; }; @@ -188,7 +188,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -298,6 +448,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -305,6 +455,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) { wined3d_resource_release(&swapchain->back_buffers[i]->resource); } @@ -197,7 +197,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -323,13 +475,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -330,13 +482,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw cs->ops->submit(cs); } @@ -213,7 +213,7 @@ index b9d7e87..2789726 100644 device = cs->device; state = &device->state; -@@ -348,6 +501,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -355,6 +508,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) } if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) wined3d_resource_release(state->fb.depth_stencil->resource); @@ -222,7 +222,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -380,7 +535,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -387,7 +542,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * cs->ops->submit(cs); } @@ -231,7 +231,7 @@ index b9d7e87..2789726 100644 { struct wined3d_state *state = &cs->device->state; struct wined3d_shader_sampler_map_entry *entry; -@@ -439,6 +594,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -446,6 +601,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) wined3d_resource_release(view->resource); } } @@ -240,7 +240,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, -@@ -504,12 +661,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -511,12 +668,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i cs->ops->submit(cs); } @@ -256,7 +256,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -524,12 +683,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -531,12 +690,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query cs->ops->submit(cs); } @@ -272,7 +272,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -543,12 +704,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -550,12 +711,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi cs->ops->submit(cs); } @@ -288,7 +288,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -562,12 +725,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -569,12 +732,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) cs->ops->submit(cs); } @@ -304,7 +304,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -583,7 +748,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -590,7 +755,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v cs->ops->submit(cs); } @@ -313,7 +313,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_set_depth_stencil_view *op = data; struct wined3d_device *device = cs->device; -@@ -622,6 +787,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -629,6 +794,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -322,7 +322,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -635,12 +802,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -642,12 +809,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -338,7 +338,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -654,7 +823,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -661,7 +830,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -347,7 +347,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -672,6 +841,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -679,6 +848,8 @@ 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); @@ -356,7 +356,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -689,7 +860,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -696,7 +867,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -365,7 +365,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -699,6 +870,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -706,6 +877,8 @@ 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); @@ -374,7 +374,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -714,7 +887,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -721,7 +894,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i cs->ops->submit(cs); } @@ -383,7 +383,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -729,6 +902,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -736,6 +909,8 @@ 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); @@ -392,7 +392,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -745,7 +920,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -752,7 +927,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -401,7 +401,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -761,6 +936,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -768,6 +943,8 @@ 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); @@ -410,7 +410,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -777,7 +954,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -784,7 +961,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff cs->ops->submit(cs); } @@ -419,7 +419,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -791,6 +968,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -798,6 +975,7 @@ 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)); @@ -427,7 +427,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -807,7 +985,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -814,7 +992,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha cs->ops->submit(cs); } @@ -436,7 +436,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -884,6 +1062,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -891,6 +1069,8 @@ 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); @@ -445,7 +445,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -898,12 +1078,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -905,12 +1085,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -461,7 +461,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -920,12 +1102,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -927,12 +1109,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 cs->ops->submit(cs); } @@ -477,7 +477,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -942,13 +1126,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -949,13 +1133,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -494,7 +494,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -963,12 +1149,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -970,12 +1156,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -510,7 +510,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, -@@ -983,12 +1171,14 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -990,12 +1178,14 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -526,7 +526,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -1003,12 +1193,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1010,12 +1200,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render cs->ops->submit(cs); } @@ -542,7 +542,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1025,12 +1217,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1032,12 +1224,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, cs->ops->submit(cs); } @@ -558,7 +558,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1047,13 +1241,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1054,13 +1248,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, cs->ops->submit(cs); } @@ -575,7 +575,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1069,12 +1265,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1076,12 +1272,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform cs->ops->submit(cs); } @@ -591,7 +591,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -1089,7 +1287,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1096,7 +1294,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const cs->ops->submit(cs); } @@ -600,7 +600,7 @@ index b9d7e87..2789726 100644 { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1150,6 +1348,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1157,6 +1355,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -609,7 +609,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1172,12 +1372,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1179,12 +1379,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture cs->ops->submit(cs); } @@ -625,7 +625,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1191,7 +1393,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1198,7 +1400,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma cs->ops->submit(cs); } @@ -634,7 +634,7 @@ index b9d7e87..2789726 100644 { struct wined3d_adapter *adapter = cs->device->adapter; HRESULT hr; -@@ -1201,6 +1403,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +@@ -1208,6 +1410,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize CS state, hr %#x.\n", hr); @@ -643,7 +643,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1213,11 +1417,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1220,11 +1424,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) cs->ops->submit(cs); } @@ -658,7 +658,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) -@@ -1232,12 +1438,14 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1239,12 +1445,14 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void cs->ops->submit(cs); } @@ -674,7 +674,24 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) -@@ -1252,13 +1460,15 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1259,13 +1467,15 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu + cs->ops->submit(cs); + } + +-static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data) ++static UINT wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data) + { + const struct wined3d_cs_preload_resource *op = data; + struct wined3d_resource *resource = op->resource; + + resource->resource_ops->resource_preload(resource); + wined3d_resource_release(resource); ++ ++ return sizeof(*op); + } + + void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) +@@ -1281,13 +1491,15 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso cs->ops->submit(cs); } @@ -691,7 +708,7 @@ index b9d7e87..2789726 100644 } void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) -@@ -1274,8 +1484,9 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1303,8 +1515,9 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou cs->ops->submit(cs); } @@ -702,7 +719,7 @@ index b9d7e87..2789726 100644 /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, -@@ -1338,6 +1549,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = +@@ -1368,6 +1581,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = wined3d_cs_st_submit, }; @@ -761,7 +778,7 @@ index b9d7e87..2789726 100644 struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -1364,12 +1627,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1394,12 +1659,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) return NULL; } @@ -850,7 +867,7 @@ index 1dd6a8b..f573dcb 100644 if (appkey) RegCloseKey( appkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 54f3f93..be51bba 100644 +index eca8601..481f384 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -310,6 +310,7 @@ struct wined3d_settings @@ -861,7 +878,7 @@ index 54f3f93..be51bba 100644 }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -3029,6 +3030,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl +@@ -3033,6 +3034,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -880,7 +897,7 @@ index 54f3f93..be51bba 100644 struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); -@@ -3040,9 +3053,14 @@ struct wined3d_cs +@@ -3044,9 +3057,14 @@ struct wined3d_cs const struct wined3d_cs_ops *ops; struct wined3d_device *device; struct wined3d_state state; diff --git a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch index a39d8246..f8124903 100644 --- a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch +++ b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch @@ -1,4 +1,4 @@ -From c035e4e85a946c3da7299aa483d5e219bdbbcb1f Mon Sep 17 00:00:00 2001 +From eea4abcc9b804a74839b49364f0218402d2a6f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Oct 2013 15:30:26 +0200 Subject: wined3d: Give the cs its own state @@ -10,18 +10,18 @@ Subject: wined3d: Give the cs its own state 3 files changed, 81 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 187cb96..43ec54d 100644 +index 2aef776..be77b79 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -67,6 +67,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_DESTROY_OBJECT, +@@ -68,6 +68,7 @@ enum wined3d_cs_op WINED3D_CS_OP_QUERY_ISSUE, + WINED3D_CS_OP_PRELOAD_RESOURCE, WINED3D_CS_OP_UNLOAD_RESOURCE, + WINED3D_CS_OP_STATEBLOCK, WINED3D_CS_OP_STOP, }; -@@ -305,6 +306,12 @@ struct wined3d_cs_unload_resource +@@ -312,6 +313,12 @@ struct wined3d_cs_unload_resource struct wined3d_resource *resource; }; @@ -34,7 +34,7 @@ index 187cb96..43ec54d 100644 /* 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) { -@@ -485,7 +492,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -492,7 +499,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]); device = cs->device; @@ -43,7 +43,7 @@ index 187cb96..43ec54d 100644 wined3d_get_draw_rect(state, &draw_rect); device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, &cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags, -@@ -537,7 +544,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -544,7 +551,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { @@ -52,7 +52,7 @@ index 187cb96..43ec54d 100644 struct wined3d_shader_sampler_map_entry *entry; struct wined3d_shader_resource_view *view; const struct wined3d_cs_draw *op = data; -@@ -1074,6 +1081,55 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1081,6 +1088,55 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -108,15 +108,15 @@ index 187cb96..43ec54d 100644 cs->ops->submit(cs); } -@@ -1514,6 +1570,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, +@@ -1549,6 +1605,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, + /* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource, /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource, + /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock, }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -@@ -1603,7 +1660,7 @@ done: +@@ -1638,7 +1695,7 @@ done: struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -125,7 +125,7 @@ index 187cb96..43ec54d 100644 if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; -@@ -1611,8 +1668,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1646,8 +1703,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) { @@ -135,7 +135,7 @@ index 187cb96..43ec54d 100644 } cs->ops = &wined3d_cs_st_ops; -@@ -1621,17 +1677,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1656,17 +1712,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) cs->data_size = WINED3D_INITIAL_CS_SIZE; if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size))) { @@ -155,7 +155,7 @@ index 187cb96..43ec54d 100644 } if (wined3d_settings.cs_multithreaded) -@@ -1644,15 +1696,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1679,15 +1731,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL))) { ERR("Failed to create wined3d command stream thread.\n"); @@ -184,7 +184,7 @@ index 187cb96..43ec54d 100644 void wined3d_cs_destroy(struct wined3d_cs *cs) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 27b32e1..8ae932f 100644 +index ae8bfad..dda5a03 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3554,6 +3554,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT @@ -212,10 +212,10 @@ index 27b32e1..8ae932f 100644 start_idx, index_count, start_instance, instance_count, TRUE); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 4d5fc99..9055230 100644 +index 3af4f8f..2a45171 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3039,7 +3039,7 @@ struct wined3d_cs_block +@@ -3043,7 +3043,7 @@ struct wined3d_cs_block { struct list entry; UINT pos; @@ -224,7 +224,7 @@ index 4d5fc99..9055230 100644 }; struct wined3d_cs_ops -@@ -3083,6 +3083,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -3088,6 +3088,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch b/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch index 3eaa4a61..274a0f82 100644 --- a/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch +++ b/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch @@ -1,4 +1,4 @@ -From f3fea3385811f1aa0ce48a65f0b33f9b5aebc695 Mon Sep 17 00:00:00 2001 +From 1aa13f4e60130ae9ed48192ada3e6d5333543745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 20 Aug 2013 15:12:26 +0200 Subject: wined3d: Send float constant updates through the command stream @@ -10,11 +10,11 @@ Subject: wined3d: Send float constant updates through the command stream 3 files changed, 77 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 43ec54d..92c251c 100644 +index be77b79..020c1a3 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -68,6 +68,8 @@ enum wined3d_cs_op - WINED3D_CS_OP_QUERY_ISSUE, +@@ -69,6 +69,8 @@ enum wined3d_cs_op + WINED3D_CS_OP_PRELOAD_RESOURCE, WINED3D_CS_OP_UNLOAD_RESOURCE, WINED3D_CS_OP_STATEBLOCK, + WINED3D_CS_OP_SET_VS_CONSTS_F, @@ -22,7 +22,7 @@ index 43ec54d..92c251c 100644 WINED3D_CS_OP_STOP, }; -@@ -312,6 +314,14 @@ struct wined3d_cs_stateblock +@@ -319,6 +321,14 @@ struct wined3d_cs_stateblock struct wined3d_state state; }; @@ -37,7 +37,7 @@ index 43ec54d..92c251c 100644 /* 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) { -@@ -1096,11 +1106,9 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi +@@ -1103,11 +1113,9 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi memcpy(cs->state.vs_consts_b, op->state.vs_consts_b, sizeof(cs->state.vs_consts_b)); memcpy(cs->state.vs_consts_i, op->state.vs_consts_i, sizeof(cs->state.vs_consts_i)); @@ -49,7 +49,7 @@ index 43ec54d..92c251c 100644 memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights)); -@@ -1121,11 +1129,9 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win +@@ -1128,11 +1136,9 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win memcpy(op->state.vs_consts_b, state->vs_consts_b, sizeof(op->state.vs_consts_b)); memcpy(op->state.vs_consts_i, state->vs_consts_i, sizeof(op->state.vs_consts_i)); @@ -61,7 +61,7 @@ index 43ec54d..92c251c 100644 /* FIXME: This is not ideal. CS is still running synchronously, so this is ok. * It will go away soon anyway. */ -@@ -1227,6 +1233,65 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1234,6 +1240,65 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -127,8 +127,8 @@ index 43ec54d..92c251c 100644 static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_render_state *op = data; -@@ -1571,6 +1636,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, +@@ -1606,6 +1671,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource, /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource, /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock, + /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, @@ -137,7 +137,7 @@ index 43ec54d..92c251c 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 8ae932f..7006c62 100644 +index dda5a03..8da60ad 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2553,7 +2553,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, @@ -161,10 +161,10 @@ index 8ae932f..7006c62 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 9055230..ebdb49e 100644 +index 2a45171..ca58fec 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3083,6 +3083,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -3088,6 +3088,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0016-wined3d-Request-a-glFinish-before-modifying-resource.patch b/patches/wined3d-CSMT_Main/0016-wined3d-Request-a-glFinish-before-modifying-resource.patch index ba2d7356..cbfcaf39 100644 --- a/patches/wined3d-CSMT_Main/0016-wined3d-Request-a-glFinish-before-modifying-resource.patch +++ b/patches/wined3d-CSMT_Main/0016-wined3d-Request-a-glFinish-before-modifying-resource.patch @@ -1,19 +1,19 @@ -From 3f4145a66ef9173bf608b12c4e210ee0f0369436 Mon Sep 17 00:00:00 2001 +From b420f43ff0cb17ce349423ac26792ea5087052d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 4 Apr 2013 11:50:09 +0200 Subject: wined3d: Request a glFinish before modifying resources outside the cs --- - dlls/wined3d/buffer.c | 18 +++++++++++++++++- + dlls/wined3d/buffer.c | 8 ++++++++ dlls/wined3d/cs.c | 30 ++++++++++++++++++++++++++++++ dlls/wined3d/device.c | 27 +++++++++++++++++++++++++++ dlls/wined3d/surface.c | 7 +++++++ dlls/wined3d/texture.c | 14 ++++++++++++++ dlls/wined3d/wined3d_private.h | 1 + - 6 files changed, 96 insertions(+), 1 deletion(-) + 6 files changed, 87 insertions(+) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 9cc8ee0..85886bf 100644 +index 9cc8ee0..2cb5db5 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -939,9 +939,17 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN @@ -34,29 +34,11 @@ index 9cc8ee0..85886bf 100644 flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture * fill rate test seems to depend on this. When we map a buffer with -@@ -1222,8 +1230,16 @@ static ULONG buffer_resource_decref(struct wined3d_resource *resource) - static void buffer_resource_preload(struct wined3d_resource *resource) - { - struct wined3d_context *context; -+ struct wined3d_device *device = resource->device; - -- context = context_acquire(resource->device, NULL); -+ if (wined3d_settings.cs_multithreaded) -+ { -+ FIXME("Waiting for cs.\n"); -+ wined3d_cs_emit_glfinish(device->cs); -+ device->cs->ops->finish(device->cs); -+ } -+ -+ context = context_acquire(device, NULL); - buffer_internal_preload(buffer_from_resource(resource), context, NULL); - context_release(context); - } diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index bf1d3d7..3a066d2 100644 +index 020c1a3..69f60d6 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -70,6 +70,7 @@ enum wined3d_cs_op +@@ -71,6 +71,7 @@ enum wined3d_cs_op WINED3D_CS_OP_STATEBLOCK, WINED3D_CS_OP_SET_VS_CONSTS_F, WINED3D_CS_OP_SET_PS_CONSTS_F, @@ -64,7 +46,7 @@ index bf1d3d7..3a066d2 100644 WINED3D_CS_OP_STOP, }; -@@ -322,6 +323,11 @@ struct wined3d_cs_set_consts_f +@@ -329,6 +330,11 @@ struct wined3d_cs_set_consts_f struct wined3d_vec4 constants[1]; }; @@ -76,7 +58,7 @@ index bf1d3d7..3a066d2 100644 /* 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) { -@@ -1605,6 +1611,29 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1636,6 +1642,29 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou cs->ops->submit(cs); } @@ -106,7 +88,7 @@ index bf1d3d7..3a066d2 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -1641,6 +1670,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1673,6 +1702,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock, /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, /* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f, @@ -115,7 +97,7 @@ index bf1d3d7..3a066d2 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 6ad0a83..77fbb61 100644 +index 8da60ad..cf375ea 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2949,6 +2949,13 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO @@ -160,7 +142,7 @@ index 6ad0a83..77fbb61 100644 if (blit_op == WINED3D_BLIT_OP_COLOR_FILL) return blitter->color_fill(device, view, rect, color); else -@@ -4682,6 +4703,12 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4683,6 +4704,12 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -174,10 +156,10 @@ index 6ad0a83..77fbb61 100644 { ERR("Failed to get the first implicit swapchain.\n"); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index c63578a..5601804 100644 +index a2d2106..7618bf2 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -4208,6 +4208,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4210,6 +4210,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst flags &= ~WINED3D_BLT_DO_NOT_WAIT; } @@ -224,17 +206,17 @@ index 1e34cd7..e804ac2 100644 context = context_acquire(device, NULL); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 243cc29..234b33d 100644 +index ca58fec..7044b97 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3074,6 +3074,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, +@@ -3077,6 +3077,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN; +void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; + void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; - void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; -- 2.9.0 diff --git a/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch b/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch index e1731441..fe400e81 100644 --- a/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch +++ b/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch @@ -1,4 +1,4 @@ -From d72ba7f4c8842b750e822fe95d91274f0c5e6d51 Mon Sep 17 00:00:00 2001 +From 866ef0e0247fe28814e59268885ce97630750023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 10 Apr 2013 17:16:02 +0200 Subject: wined3d: Send light updates through the command stream @@ -10,18 +10,18 @@ Subject: wined3d: Send light updates through the command stream 3 files changed, 174 insertions(+), 64 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 2f422ba..d03dd1c 100644 +index 22e9bb8..2f3b33d 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -67,7 +67,6 @@ enum wined3d_cs_op - WINED3D_CS_OP_DESTROY_OBJECT, +@@ -68,7 +68,6 @@ enum wined3d_cs_op WINED3D_CS_OP_QUERY_ISSUE, + WINED3D_CS_OP_PRELOAD_RESOURCE, WINED3D_CS_OP_UNLOAD_RESOURCE, - WINED3D_CS_OP_STATEBLOCK, WINED3D_CS_OP_SET_VS_CONSTS_F, WINED3D_CS_OP_SET_VS_CONSTS_B, WINED3D_CS_OP_SET_VS_CONSTS_I, -@@ -77,6 +76,8 @@ enum wined3d_cs_op +@@ -78,6 +77,8 @@ enum wined3d_cs_op WINED3D_CS_OP_GLFINISH, WINED3D_CS_OP_SET_BASE_VERTEX_INDEX, WINED3D_CS_OP_SET_PRIMITIVE_TYPE, @@ -30,7 +30,7 @@ index 2f422ba..d03dd1c 100644 WINED3D_CS_OP_STOP, }; -@@ -315,12 +316,6 @@ struct wined3d_cs_unload_resource +@@ -322,12 +323,6 @@ struct wined3d_cs_unload_resource struct wined3d_resource *resource; }; @@ -43,7 +43,7 @@ index 2f422ba..d03dd1c 100644 struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -362,6 +357,19 @@ struct wined3d_cs_set_primitive_type +@@ -369,6 +364,19 @@ struct wined3d_cs_set_primitive_type GLenum gl_primitive_type; }; @@ -63,7 +63,7 @@ index 2f422ba..d03dd1c 100644 /* 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) { -@@ -1150,35 +1158,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1157,35 +1165,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -99,7 +99,7 @@ index 2f422ba..d03dd1c 100644 static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_shader_resource_view *op = data; -@@ -1826,6 +1805,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -1860,6 +1839,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ cs->ops->submit(cs); } @@ -252,15 +252,15 @@ index 2f422ba..d03dd1c 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -1859,7 +1984,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, +@@ -1894,7 +2019,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, + /* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource, /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource, - /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock, /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b, /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i, -@@ -1869,6 +1993,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1904,6 +2028,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, /* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index, /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type, @@ -270,7 +270,7 @@ index 2f422ba..d03dd1c 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index c0f8dc8..ee197af 100644 +index 9db2365..c7226ae 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1610,14 +1610,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, @@ -356,10 +356,10 @@ index c0f8dc8..ee197af 100644 start_idx, index_count, start_instance, instance_count, TRUE); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index ae13efb..4c57f7b 100644 +index c29a4a1..77d4ac3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3035,7 +3035,9 @@ struct wined3d_cs_block +@@ -3039,7 +3039,9 @@ struct wined3d_cs_block { struct list entry; UINT pos; @@ -370,7 +370,7 @@ index ae13efb..4c57f7b 100644 }; struct wined3d_cs_ops -@@ -3091,12 +3093,12 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, +@@ -3096,12 +3098,12 @@ 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_i(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch b/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch index 5b515013..4354ad11 100644 --- a/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch +++ b/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch @@ -1,15 +1,15 @@ -From 6494b85657fd270879356f5fcb81225f12acdd1c Mon Sep 17 00:00:00 2001 +From a636b8ad1d800fe7f288838c93e09a5c96358e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 4 Jul 2013 23:33:14 +0200 Subject: wined3d: Replace the linked lists with a ringbuffer --- - dlls/wined3d/cs.c | 371 ++++++++++++++++++----------------------- + dlls/wined3d/cs.c | 373 ++++++++++++++++++----------------------- dlls/wined3d/wined3d_private.h | 20 +-- - 2 files changed, 165 insertions(+), 226 deletions(-) + 2 files changed, 166 insertions(+), 227 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 23579c4..4ebb988 100644 +index 880cecc..d8cc7e0 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -22,20 +22,10 @@ @@ -35,7 +35,7 @@ index 23579c4..4ebb988 100644 WINED3D_CS_OP_FENCE, WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, -@@ -414,99 +404,30 @@ struct wined3d_cs_texture_unmap +@@ -421,99 +411,30 @@ struct wined3d_cs_texture_unmap unsigned int sub_resource_idx; }; @@ -149,7 +149,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_fence(struct wined3d_cs *cs, const void *data) -@@ -527,14 +448,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) +@@ -534,14 +455,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_FENCE; op->signalled = signalled; @@ -166,7 +166,7 @@ index 23579c4..4ebb988 100644 /* A busy wait should be fine, we're not supposed to have to wait very * long. */ -@@ -587,7 +508,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -594,7 +515,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw pending = InterlockedIncrement(&cs->pending_presents); @@ -175,7 +175,7 @@ index 23579c4..4ebb988 100644 /* D3D10 documentation suggests that Windows allows the game to run * 3 frames ahead of the GPU. Increasing this above 1 causes uneven -@@ -637,8 +558,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -644,8 +565,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_clear *op; unsigned int i; @@ -186,7 +186,7 @@ index 23579c4..4ebb988 100644 op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -658,7 +579,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -665,7 +586,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) wined3d_resource_acquire(state->fb.depth_stencil->resource); @@ -195,7 +195,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) -@@ -799,7 +720,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -806,7 +727,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } } @@ -204,7 +204,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data) -@@ -821,7 +742,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -828,7 +749,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query op->predicate = predicate; op->value = value; @@ -213,7 +213,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data) -@@ -842,7 +763,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -849,7 +770,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -222,7 +222,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data) -@@ -863,7 +784,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -870,7 +791,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -231,7 +231,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) -@@ -886,7 +807,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -893,7 +814,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v op->view_idx = view_idx; op->view = view; @@ -240,7 +240,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data) -@@ -940,7 +861,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -947,7 +868,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -249,7 +249,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data) -@@ -961,7 +882,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -968,7 +889,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -258,7 +258,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) -@@ -998,7 +919,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -1005,7 +926,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, op->offset = offset; op->stride = stride; @@ -267,7 +267,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) -@@ -1025,7 +946,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -1032,7 +953,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i op->frequency = frequency; op->flags = flags; @@ -276,7 +276,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) -@@ -1058,7 +979,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -1065,7 +986,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, op->buffer = buffer; op->offset = offset; @@ -285,7 +285,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) -@@ -1092,7 +1013,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -1099,7 +1020,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff op->format_id = format_id; op->offset = offset; @@ -294,7 +294,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) -@@ -1123,7 +1044,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -1130,7 +1051,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha op->cb_idx = cb_idx; op->buffer = buffer; @@ -303,7 +303,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) -@@ -1215,7 +1136,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1222,7 +1143,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -312,7 +312,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data) -@@ -1239,7 +1160,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1246,7 +1167,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 op->view_idx = view_idx; op->view = view; @@ -321,7 +321,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) -@@ -1263,7 +1184,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1270,7 +1191,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -330,7 +330,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) -@@ -1286,7 +1207,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1293,7 +1214,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type op->type = type; op->shader = shader; @@ -339,7 +339,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data) -@@ -1308,7 +1229,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1315,7 +1236,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state; @@ -348,7 +348,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_vs_consts_f(struct wined3d_cs *cs, const void *data) -@@ -1341,8 +1262,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1348,8 +1269,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) { struct wined3d_cs_set_consts_f *op; @@ -359,7 +359,7 @@ index 23579c4..4ebb988 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1367,7 +1289,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1374,7 +1296,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, op->count = count; memcpy(op->constants, constants, sizeof(op->constants[0]) * count); @@ -368,7 +368,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) -@@ -1389,8 +1311,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1396,8 +1318,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->state = state; op->value = value; @@ -379,7 +379,7 @@ index 23579c4..4ebb988 100644 static UINT wined3d_cs_exec_set_vs_consts_b(struct wined3d_cs *cs, const void *data) { -@@ -1420,8 +1342,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1427,8 +1349,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, const BOOL *constants, enum wined3d_shader_type type) { struct wined3d_cs_set_consts_b *op; @@ -390,7 +390,7 @@ index 23579c4..4ebb988 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1446,7 +1369,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1453,7 +1376,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, op->count = count; memcpy(op->constants, constants, sizeof(op->constants[0]) * count); @@ -399,7 +399,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_vs_consts_i(struct wined3d_cs *cs, const void *data) -@@ -1477,8 +1400,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1484,8 +1407,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, const struct wined3d_ivec4 *constants, enum wined3d_shader_type type) { struct wined3d_cs_set_consts_i *op; @@ -410,7 +410,7 @@ index 23579c4..4ebb988 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1503,7 +1427,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1510,7 +1434,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, op->count = count; memcpy(op->constants, constants, sizeof(op->constants[0]) * count); @@ -419,7 +419,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data) -@@ -1527,7 +1451,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1534,7 +1458,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, op->state = state; op->value = value; @@ -428,7 +428,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data) -@@ -1551,7 +1475,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1558,7 +1482,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, op->state = state; op->value = value; @@ -437,7 +437,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) -@@ -1575,7 +1499,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1582,7 +1506,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform op->state = state; op->matrix = *matrix; @@ -446,7 +446,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data) -@@ -1597,7 +1521,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1604,7 +1528,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const op->plane_idx = plane_idx; op->plane = *plane; @@ -455,7 +455,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) -@@ -1682,7 +1606,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1689,7 +1613,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -464,7 +464,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data) -@@ -1703,7 +1627,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1710,7 +1634,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -473,7 +473,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) -@@ -1727,7 +1651,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1734,7 +1658,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -482,7 +482,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) -@@ -1748,7 +1672,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1755,7 +1679,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void op->callback = callback; op->object = object; @@ -491,16 +491,25 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data) -@@ -1770,7 +1694,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1777,7 +1701,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu op->query = query; op->flags = flags; +- cs->ops->submit(cs); ++ cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data) +@@ -1801,7 +1725,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso + + wined3d_resource_acquire(resource); + - cs->ops->submit(cs); + cs->ops->submit(cs, sizeof(*op)); } static UINT wined3d_cs_exec_unload_resource(struct wined3d_cs *cs, const void *data) -@@ -1794,7 +1718,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1825,7 +1749,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou wined3d_resource_acquire(resource); @@ -509,7 +518,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data) -@@ -1820,7 +1744,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -1851,7 +1775,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_GLFINISH; @@ -518,7 +527,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_base_vertex_index(struct wined3d_cs *cs, const void *data) -@@ -1842,7 +1766,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, +@@ -1873,7 +1797,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, op->opcode = WINED3D_CS_OP_SET_BASE_VERTEX_INDEX; op->base_vertex_index = base_vertex_index; @@ -527,7 +536,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data) -@@ -1868,7 +1792,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -1899,7 +1823,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE; op->gl_primitive_type = primitive_type; @@ -536,7 +545,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) -@@ -1925,7 +1849,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light +@@ -1956,7 +1880,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light op->opcode = WINED3D_CS_OP_SET_LIGHT; op->light = *light; @@ -545,7 +554,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data) -@@ -2014,7 +1938,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab +@@ -2045,7 +1969,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab op->idx = idx; op->enable = enable; @@ -554,7 +563,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) -@@ -2046,7 +1970,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -2077,7 +2001,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf if (fx) op->fx = *fx; @@ -563,7 +572,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) -@@ -2079,7 +2003,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -2110,7 +2034,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge op->stencil = stencil; op->blitter = blitter; @@ -572,7 +581,7 @@ index 23579c4..4ebb988 100644 } static UINT wined3d_cs_exec_texture_map(struct wined3d_cs *cs, const void *data) -@@ -2104,12 +2028,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture +@@ -2135,12 +2059,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture op->flags = flags; op->mem = &ret; @@ -588,7 +597,7 @@ index 23579c4..4ebb988 100644 return ret; } -@@ -2132,11 +2058,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture +@@ -2163,11 +2089,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture op->texture = texture; op->sub_resource_idx = sub_resource_idx; @@ -603,7 +612,7 @@ index 23579c4..4ebb988 100644 /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, -@@ -2185,42 +2113,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2217,42 +2145,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, }; @@ -686,7 +695,7 @@ index 23579c4..4ebb988 100644 }; /* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -@@ -2232,9 +2177,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) +@@ -2264,9 +2209,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) op = wined3d_cs_mt_require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_STOP; @@ -726,7 +735,7 @@ index 23579c4..4ebb988 100644 void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) { -@@ -2258,31 +2232,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, +@@ -2290,31 +2264,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, static DWORD WINAPI wined3d_cs_run(void *thread_param) { struct wined3d_cs *cs = thread_param; @@ -773,7 +782,7 @@ index 23579c4..4ebb988 100644 } done: -@@ -2307,25 +2282,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2339,25 +2314,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) cs->ops = &wined3d_cs_st_ops; cs->device = device; @@ -799,7 +808,7 @@ index 23579c4..4ebb988 100644 if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL))) { ERR("Failed to create wined3d command stream thread.\n"); -@@ -2337,12 +2297,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2369,12 +2329,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) err: if (cs) @@ -812,7 +821,7 @@ index 23579c4..4ebb988 100644 HeapFree(GetProcessHeap(), 0, cs); return NULL; } -@@ -2361,17 +2316,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -2393,17 +2348,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) CloseHandle(cs->thread); if (ret != WAIT_OBJECT_0) ERR("Wait failed (%#x).\n", ret); @@ -831,7 +840,7 @@ index 23579c4..4ebb988 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index d9c33c6..c1150a6 100644 +index f3912a1..24c54b2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -31,6 +31,7 @@ @@ -842,7 +851,7 @@ index d9c33c6..c1150a6 100644 #include #include #include -@@ -3038,19 +3039,17 @@ struct wined3d_cs_list +@@ -3042,19 +3043,17 @@ struct wined3d_cs_list struct list blocks; }; @@ -867,7 +876,7 @@ index d9c33c6..c1150a6 100644 void (*finish)(struct wined3d_cs *cs); }; -@@ -3061,14 +3060,9 @@ struct wined3d_cs +@@ -3065,14 +3064,9 @@ struct wined3d_cs struct wined3d_state state; HANDLE thread; DWORD thread_id; diff --git a/patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch b/patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch deleted file mode 100644 index 4060b38f..00000000 --- a/patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 378cf53090eb9cd3f4ba691671913e1c9ba36872 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Thu, 1 Aug 2013 00:10:40 +0200 -Subject: wined3d: Send texture preloads through the CS - ---- - dlls/wined3d/cs.c | 32 ++++++++++++++++++++++++++++++++ - dlls/wined3d/texture.c | 7 ++----- - dlls/wined3d/wined3d_private.h | 1 + - 3 files changed, 35 insertions(+), 5 deletions(-) - -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index a36d205..b7c33ab 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -72,6 +72,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_CLEAR_RTV, - WINED3D_CS_OP_TEXTURE_MAP, - WINED3D_CS_OP_TEXTURE_UNMAP, -+ WINED3D_CS_OP_TEXTURE_PRELOAD, - WINED3D_CS_OP_STOP, - }; - -@@ -410,6 +411,12 @@ struct wined3d_cs_skip - DWORD size; - }; - -+struct wined3d_cs_texture_preload -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_texture *texture; -+}; -+ - static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) - { - LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2098,6 +2105,30 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_texture_preload(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_texture_preload *op = data; -+ struct wined3d_context *context; -+ struct wined3d_texture *texture = op->texture; -+ -+ context = context_acquire(cs->device, NULL); -+ wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB); -+ context_release(context); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) -+{ -+ struct wined3d_cs_texture_preload *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_TEXTURE_PRELOAD; -+ op->texture = texture; -+ -+ cs->ops->submit(cs, sizeof(*op)); -+} -+ - static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = - { - /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2148,6 +2179,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, - /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, - /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, -+ /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, - }; - - static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) -diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index b391afd..4c8856d 100644 ---- a/dlls/wined3d/texture.c -+++ b/dlls/wined3d/texture.c -@@ -1684,11 +1684,8 @@ static ULONG texture_resource_decref(struct wined3d_resource *resource) - static void texture_resource_preload(struct wined3d_resource *resource) - { - struct wined3d_texture *texture = texture_from_resource(resource); -- struct wined3d_context *context; -- -- context = context_acquire(resource->device, NULL); -- wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB); -- context_release(context); -+ const struct wined3d_device *device = texture->resource.device; -+ wined3d_cs_emit_texture_preload(device->cs, texture); - } - - static void wined3d_texture_unload(struct wined3d_resource *resource) -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 784a622..fc825a9 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3154,6 +3154,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, - void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; - void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture *texture, - unsigned int sub_resource_idx, DWORD flags) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; - void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, - unsigned int sub_resource_idx) DECLSPEC_HIDDEN; - void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; --- -2.9.0 - diff --git a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch index 48920714..1692df33 100644 --- a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch @@ -1,4 +1,4 @@ -From ac1a9cc75bab361113fd4cb1b3bcda0a9aadeb71 Mon Sep 17 00:00:00 2001 +From a7ae79e550f236f00a348b8cfdad719f69a0323c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 1 Aug 2013 00:33:48 +0200 Subject: wined3d: Send update_texture calls through the CS @@ -11,19 +11,19 @@ FIXME: This logic duplication is ugly. 3 files changed, 137 insertions(+), 82 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 908f416..84adcb4 100644 +index 87763b5..40d7c91 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -73,6 +73,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_CLEAR_RTV, WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, - WINED3D_CS_OP_TEXTURE_PRELOAD, + WINED3D_CS_OP_UPDATE_TEXTURE, WINED3D_CS_OP_STOP, }; -@@ -417,6 +418,12 @@ struct wined3d_cs_texture_preload - struct wined3d_texture *texture; +@@ -417,6 +418,12 @@ struct wined3d_cs_skip + DWORD size; }; +struct wined3d_cs_update_texture @@ -35,7 +35,7 @@ index 908f416..84adcb4 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2118,6 +2125,31 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu +@@ -2129,6 +2136,31 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture cs->ops->submit(cs, sizeof(*op)); } @@ -67,16 +67,16 @@ index 908f416..84adcb4 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2169,6 +2201,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2180,6 +2212,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, - /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, }; static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 58f1669..7255804 100644 +index ad2da77..aa6d796 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3567,34 +3567,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device @@ -319,10 +319,10 @@ index 58f1669..7255804 100644 HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index b904a7d..156cb71 100644 +index bd3bebf..7ba4fd3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2536,6 +2536,8 @@ void device_resource_add(struct wined3d_device *device, struct wined3d_resource +@@ -2539,6 +2539,8 @@ void device_resource_add(struct wined3d_device *device, struct wined3d_resource void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; @@ -331,7 +331,7 @@ index b904a7d..156cb71 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -3157,6 +3159,8 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu +@@ -3161,6 +3163,8 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; 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 3101a2b0..8dd5effe 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 15daab6805322dd6a81a83a4ee162703a23013b4 Mon Sep 17 00:00:00 2001 +From 7abb510db81a0a2b0d0bc5fe31897d624c5fedf0 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 42a0567..64533ef 100644 +index 647f1de..5375f04 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -2076,20 +2076,16 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture +@@ -2132,20 +2132,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 42a0567..64533ef 100644 return ret; } -@@ -2108,12 +2104,12 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture +@@ -2164,12 +2160,12 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture { struct wined3d_cs_texture_unmap *op; @@ -50,12 +50,12 @@ index 42a0567..64533ef 100644 + cs->ops->submit_prio(cs, sizeof(*op)); } - static UINT wined3d_cs_exec_texture_preload(struct wined3d_cs *cs, const void *data) + static UINT wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *data) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 3c739fa..5145de0 100644 +index 87a0ae5..a63647c 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1731,6 +1731,10 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1864,6 +1864,10 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); diff --git a/patches/wined3d-CSMT_Main/0070-wined3d-Send-update_sub_resource-calls-through-the-c.patch b/patches/wined3d-CSMT_Main/0070-wined3d-Send-update_sub_resource-calls-through-the-c.patch index be874edc..83ed41d0 100644 --- a/patches/wined3d-CSMT_Main/0070-wined3d-Send-update_sub_resource-calls-through-the-c.patch +++ b/patches/wined3d-CSMT_Main/0070-wined3d-Send-update_sub_resource-calls-through-the-c.patch @@ -1,4 +1,4 @@ -From a2672003445240c74f636792ceffd135bf2a06f3 Mon Sep 17 00:00:00 2001 +From 3831f30d2549855400978627d4912ea6b28e4333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 4 Sep 2015 15:22:49 +0200 Subject: wined3d: Send update_sub_resource calls through the command stream. @@ -10,12 +10,12 @@ Subject: wined3d: Send update_sub_resource calls through the command stream. 3 files changed, 105 insertions(+), 46 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index fcb4081..befc742 100644 +index 5375f04..6857e8c 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -74,6 +74,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, - WINED3D_CS_OP_TEXTURE_PRELOAD, WINED3D_CS_OP_UPDATE_TEXTURE, + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, WINED3D_CS_OP_STOP, @@ -37,7 +37,7 @@ index fcb4081..befc742 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2196,6 +2206,90 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur +@@ -2199,6 +2209,90 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur cs->ops->submit(cs, sizeof(*op)); } @@ -128,16 +128,16 @@ index fcb4081..befc742 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2248,6 +2342,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2251,6 +2345,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, - /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, }; static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 5aecf4e..f2f0d7b 100644 +index 2597aa2..a8403b6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4117,14 +4117,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str @@ -221,10 +221,10 @@ index 5aecf4e..f2f0d7b 100644 HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1571657..c0829a1 100644 +index c3f104e..9db3cf1 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3160,6 +3160,9 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu +@@ -3164,6 +3164,9 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0071-wined3d-Dirtify-changed-textures-through-the-command.patch b/patches/wined3d-CSMT_Main/0071-wined3d-Dirtify-changed-textures-through-the-command.patch index c299c8a3..0d1432c4 100644 --- a/patches/wined3d-CSMT_Main/0071-wined3d-Dirtify-changed-textures-through-the-command.patch +++ b/patches/wined3d-CSMT_Main/0071-wined3d-Dirtify-changed-textures-through-the-command.patch @@ -1,4 +1,4 @@ -From 004a1700d1b40a0127bf22de9ed706e1092a38c0 Mon Sep 17 00:00:00 2001 +From 661c601c3bb9c52f9a1d26f4df709586beb3b0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 24 Apr 2016 15:07:54 +0100 Subject: wined3d: Dirtify changed textures through the command stream. @@ -14,18 +14,18 @@ FIXME: The lost unmap_dirtify = FALSE is unfortunate. 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index fcc4504..efc05b8 100644 +index 6857e8c..609963a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -70,6 +70,7 @@ enum wined3d_cs_op +@@ -71,6 +71,7 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_LIGHT_ENABLE, WINED3D_CS_OP_BLT, WINED3D_CS_OP_CLEAR_RTV, + WINED3D_CS_OP_TEXTURE_CHANGED, WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, - WINED3D_CS_OP_TEXTURE_PRELOAD, -@@ -407,6 +408,13 @@ struct wined3d_cs_texture_unmap + WINED3D_CS_OP_UPDATE_TEXTURE, +@@ -413,6 +414,13 @@ struct wined3d_cs_texture_unmap unsigned int sub_resource_idx; }; @@ -39,7 +39,7 @@ index fcc4504..efc05b8 100644 struct wined3d_cs_skip { enum wined3d_cs_op opcode; -@@ -2100,6 +2108,28 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -2127,6 +2135,28 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge cs->ops->submit(cs, sizeof(*op)); } @@ -68,19 +68,19 @@ index fcc4504..efc05b8 100644 static UINT wined3d_cs_exec_texture_map(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_texture_map *op = data; -@@ -2338,6 +2368,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2342,6 +2372,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, + /* WINED3D_CS_OP_TEXTURE_CHANGED */ wined3d_cs_exec_texture_changed, /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, - /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index fa7488b..a676167 100644 +index a63647c..64f1c1a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1913,7 +1913,6 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1917,7 +1917,6 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx) { @@ -88,7 +88,7 @@ index fa7488b..a676167 100644 struct wined3d_context *context = NULL; struct wined3d_bo_address data; -@@ -1937,12 +1936,11 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in +@@ -1941,12 +1940,11 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in { FIXME("Depth / stencil buffer locking is not implemented.\n"); } @@ -105,7 +105,7 @@ index fa7488b..a676167 100644 } static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx) -@@ -1967,6 +1965,12 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1971,6 +1969,12 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso wined3d_cs_emit_texture_unmap(device->cs, texture, sub_resource_idx); @@ -119,10 +119,10 @@ index fa7488b..a676167 100644 if (!--resource->map_count && texture->update_map_binding) wined3d_texture_update_map_binding(texture); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index ba50966..540bc1d 100644 +index 9db3cf1..a8a590e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2777,6 +2777,8 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2781,6 +2781,8 @@ 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; @@ -131,7 +131,7 @@ index ba50966..540bc1d 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; -@@ -3154,6 +3156,8 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -3159,6 +3161,8 @@ 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; @@ -139,7 +139,7 @@ index ba50966..540bc1d 100644 + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD flags) DECLSPEC_HIDDEN; - void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; + void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, -- 2.9.0 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 98ae3e97..12b1f856 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 db8659a79fde86ef104d3972077eeac1d1659749 Mon Sep 17 00:00:00 2001 +From d5da431c7c24dac7ba5a9f14cb370d1e49efc16b 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 efc05b8..1f288e0 100644 +index 609963a..9790251 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -413,6 +413,7 @@ struct wined3d_cs_texture_changed +@@ -419,6 +419,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 efc05b8..1f288e0 100644 }; struct wined3d_cs_skip -@@ -2112,13 +2113,13 @@ static UINT wined3d_cs_exec_texture_changed(struct wined3d_cs *cs, const void *d +@@ -2139,13 +2140,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 efc05b8..1f288e0 100644 { struct wined3d_cs_texture_changed *op; -@@ -2126,6 +2127,7 @@ void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_textu +@@ -2153,6 +2154,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 efc05b8..1f288e0 100644 cs->ops->submit(cs, sizeof(*op)); } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 6eb36e2..df0cd21 100644 +index a290b54..b9b6c75 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1768,10 +1768,26 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -1772,10 +1772,26 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int if (flags & WINED3D_MAP_DISCARD) { @@ -78,7 +78,7 @@ index 6eb36e2..df0cd21 100644 wined3d_texture_validate_location(texture, sub_resource_idx, texture->resource.map_binding); } else -@@ -1867,11 +1883,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1871,11 +1887,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); @@ -95,7 +95,7 @@ index 6eb36e2..df0cd21 100644 base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); -@@ -1945,8 +1961,20 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in +@@ -1949,8 +1965,20 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in } } @@ -117,7 +117,7 @@ index 6eb36e2..df0cd21 100644 wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); } -@@ -1974,7 +2002,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1978,7 +2006,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso if (sub_resource->unmap_dirtify) { @@ -127,10 +127,10 @@ index 6eb36e2..df0cd21 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 396a753..7899487 100644 +index 83e7e98..112815c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2791,7 +2791,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2795,7 +2795,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 396a753..7899487 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; -@@ -3170,7 +3170,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, +@@ -3175,7 +3175,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_texture *texture, @@ -147,7 +147,7 @@ index 396a753..7899487 100644 + unsigned int sub_resource_idx, struct wined3d_gl_bo *swap_buffer) DECLSPEC_HIDDEN; void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD flags) DECLSPEC_HIDDEN; - void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; + void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, -- 2.9.0 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 ee3e6f2c..0bcff50f 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 490b534e7c3bb675d447aa86ddaa019c0eed28d8 Mon Sep 17 00:00:00 2001 +From 37186996496abcd7e33fd881dfb009a22ae2faf7 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 9a5d6c5..5b684cb 100644 +index 668e049..9d13d31 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -499,6 +499,7 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *c @@ -24,10 +24,10 @@ index 9a5d6c5..5b684cb 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 1f288e0..3fc1fce 100644 +index 9790251..ac7e774 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -414,6 +414,7 @@ struct wined3d_cs_texture_changed +@@ -420,6 +420,7 @@ struct wined3d_cs_texture_changed struct wined3d_texture *texture; unsigned int sub_resource_idx; struct wined3d_gl_bo *swap_buffer; @@ -35,7 +35,7 @@ index 1f288e0..3fc1fce 100644 }; struct wined3d_cs_skip -@@ -2113,13 +2114,13 @@ static UINT wined3d_cs_exec_texture_changed(struct wined3d_cs *cs, const void *d +@@ -2140,13 +2141,13 @@ static UINT wined3d_cs_exec_texture_changed(struct wined3d_cs *cs, const void *d { const struct wined3d_cs_texture_changed *op = data; @@ -51,7 +51,7 @@ index 1f288e0..3fc1fce 100644 { struct wined3d_cs_texture_changed *op; -@@ -2128,6 +2129,7 @@ void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_textu +@@ -2155,6 +2156,7 @@ void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_textu op->texture = texture; op->sub_resource_idx = sub_resource_idx; op->swap_buffer = swap_buffer; @@ -60,7 +60,7 @@ index 1f288e0..3fc1fce 100644 cs->ops->submit(cs, sizeof(*op)); } diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index 7f80957..1029f12 100644 +index 5690e42..b9d50d8 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 * @@ -79,7 +79,7 @@ index 7f80957..1029f12 100644 context_resource_released(resource->device, resource, resource->type); wined3d_resource_release(resource); } -@@ -342,7 +344,7 @@ BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) +@@ -347,7 +349,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 7f80957..1029f12 100644 return TRUE; } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index df0cd21..bf142b4 100644 +index b9b6c75..cb9c3ec 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 df0cd21..bf142b4 100644 data->addr += sub_resource->offset; data->buffer_object = 0; return; -@@ -1262,6 +1266,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1256,6 +1260,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } wined3d_resource_free_sysmem(&texture->resource); @@ -120,7 +120,7 @@ index df0cd21..bf142b4 100644 if ((texture->row_pitch = pitch)) texture->slice_pitch = height * pitch; -@@ -1456,6 +1461,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1450,6 +1455,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 df0cd21..bf142b4 100644 return TRUE; case WINED3D_LOCATION_USER_MEMORY: -@@ -1781,6 +1787,12 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -1785,6 +1791,12 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int ret = !!sub_resource->map_buffer; break; @@ -141,7 +141,7 @@ index df0cd21..bf142b4 100644 default: ret = wined3d_texture_prepare_location(texture, sub_resource_idx, context, texture->resource.map_binding); -@@ -1886,7 +1898,21 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1890,7 +1902,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"); @@ -164,7 +164,7 @@ index df0cd21..bf142b4 100644 wined3d_resource_wait_idle(&texture->resource); base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); -@@ -1962,7 +1988,7 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in +@@ -1966,7 +1992,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 df0cd21..bf142b4 100644 { struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; -@@ -1975,6 +2001,12 @@ void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_r +@@ -1979,6 +2005,12 @@ void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_r sub_resource->buffer = swap_buffer; } @@ -186,7 +186,7 @@ index df0cd21..bf142b4 100644 wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); } -@@ -2002,7 +2034,8 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -2006,7 +2038,8 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso if (sub_resource->unmap_dirtify) { @@ -196,7 +196,7 @@ index df0cd21..bf142b4 100644 sub_resource->unmap_dirtify = FALSE; } -@@ -2644,6 +2677,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2649,6 +2682,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,10 +205,10 @@ index df0cd21..bf142b4 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 7899487..c690d2c 100644 +index 112815c..9314cba 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2594,7 +2594,7 @@ struct wined3d_resource +@@ -2598,7 +2598,7 @@ struct wined3d_resource UINT depth; UINT size; DWORD priority; @@ -217,7 +217,7 @@ index 7899487..c690d2c 100644 struct list resource_list_entry; LONG access_count; -@@ -2791,7 +2791,8 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2795,7 +2795,8 @@ 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, @@ -227,7 +227,7 @@ index 7899487..c690d2c 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; -@@ -3170,7 +3171,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, +@@ -3175,7 +3176,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; void wined3d_cs_emit_texture_changed(struct wined3d_cs *cs, struct wined3d_texture *texture, @@ -236,7 +236,7 @@ index 7899487..c690d2c 100644 + void *swap_heap_memory) DECLSPEC_HIDDEN; void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD flags) DECLSPEC_HIDDEN; - void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; + void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, -- 2.9.0 diff --git a/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch b/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch index ba1ab737..cbb16f49 100644 --- a/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch +++ b/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch @@ -1,4 +1,4 @@ -From 2c66c9febb6c4f93bcc52d426d18005059fc76c8 Mon Sep 17 00:00:00 2001 +From 59f330a07534746e422a053c0caf931e9a926fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jul 2013 16:14:16 +0200 Subject: wined3d: Accelerate DISCARD buffer maps @@ -13,10 +13,10 @@ TODO3: Clean up the map_mem allocation mess. 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 8352972..76cc5f3 100644 +index c4b0eee..382d6f7 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1056,10 +1056,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1039,10 +1039,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN buffer->flags |= WINED3D_BUFFER_SYNC; } @@ -40,18 +40,18 @@ index 8352972..76cc5f3 100644 base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.map_heap_memory; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index b416a39..3d68c71 100644 +index ac7e774..923acfc 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -73,6 +73,7 @@ enum wined3d_cs_op +@@ -74,6 +74,7 @@ enum wined3d_cs_op WINED3D_CS_OP_TEXTURE_CHANGED, WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, + WINED3D_CS_OP_BUFFER_SWAP_MEM, - WINED3D_CS_OP_TEXTURE_PRELOAD, WINED3D_CS_OP_UPDATE_TEXTURE, WINED3D_CS_OP_UPDATE_SUB_RESOURCE, -@@ -417,6 +418,13 @@ struct wined3d_cs_texture_changed + WINED3D_CS_OP_STOP, +@@ -423,6 +424,13 @@ struct wined3d_cs_texture_changed void *swap_heap_memory; }; @@ -65,7 +65,7 @@ index b416a39..3d68c71 100644 struct wined3d_cs_skip { enum wined3d_cs_op opcode; -@@ -2324,6 +2332,34 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2327,6 +2335,34 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r cs->ops->finish(cs); } @@ -100,19 +100,19 @@ index b416a39..3d68c71 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2375,6 +2411,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2379,6 +2415,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_CHANGED */ wined3d_cs_exec_texture_changed, /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, + /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, - /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 7990862..6858059 100644 +index 9314cba..abfc720 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3102,6 +3102,8 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -3106,6 +3106,8 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf const RECT *dst_rect, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch b/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch index 59b47c41..1ebd733b 100644 --- a/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch @@ -1,4 +1,4 @@ -From a836152c841dc2929ada3eece3466a8b1741ef05 Mon Sep 17 00:00:00 2001 +From cc1374ebfaf017e31f54caf45bcfdb43f84b5fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jul 2013 17:05:12 +0200 Subject: wined3d: Access the buffer dirty areas through the CS @@ -27,7 +27,7 @@ be protected by locks. 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 3307fd4..d7ea6ee 100644 +index 9cfb9cc..78b8d8b 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -41,7 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -39,7 +39,7 @@ index 3307fd4..d7ea6ee 100644 { if (!offset && (!size || size == buffer->resource.size)) goto invalidate_all; -@@ -982,9 +982,9 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -965,9 +965,9 @@ 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) @@ -52,18 +52,18 @@ index 3307fd4..d7ea6ee 100644 if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) { diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 3d68c71..9e8539d 100644 +index 923acfc..bad0ba3 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -74,6 +74,7 @@ enum wined3d_cs_op +@@ -75,6 +75,7 @@ enum wined3d_cs_op WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, WINED3D_CS_OP_BUFFER_SWAP_MEM, + WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE, - WINED3D_CS_OP_TEXTURE_PRELOAD, WINED3D_CS_OP_UPDATE_TEXTURE, WINED3D_CS_OP_UPDATE_SUB_RESOURCE, -@@ -425,6 +426,13 @@ struct wined3d_cs_buffer_swap_mem + WINED3D_CS_OP_STOP, +@@ -431,6 +432,13 @@ struct wined3d_cs_buffer_swap_mem BYTE *mem; }; @@ -77,7 +77,7 @@ index 3d68c71..9e8539d 100644 struct wined3d_cs_skip { enum wined3d_cs_op opcode; -@@ -2360,6 +2368,28 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe +@@ -2363,6 +2371,28 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe cs->ops->submit(cs, sizeof(*op)); } @@ -106,19 +106,19 @@ index 3d68c71..9e8539d 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2412,6 +2442,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2416,6 +2446,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, + /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, - /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 6858059..f23efe7 100644 +index abfc720..4f249d6 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3102,6 +3102,8 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -3106,6 +3106,8 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf const RECT *dst_rect, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; @@ -127,7 +127,7 @@ index 6858059..f23efe7 100644 void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -3240,6 +3242,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ +@@ -3244,6 +3246,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0084-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch b/patches/wined3d-CSMT_Main/0084-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch index ea1f1a2f..b3ad7f25 100644 --- a/patches/wined3d-CSMT_Main/0084-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0084-wined3d-Ignore-buffer-resource.map_count-in-the-CS.patch @@ -1,4 +1,4 @@ -From 7c04fd95e744e6c5108828ee35e6074ed3e20bf9 Mon Sep 17 00:00:00 2001 +From baa97e78450e50c136330d533f284e1cdfdb8b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jul 2013 22:52:06 +0200 Subject: wined3d: Ignore buffer->resource.map_count in the CS @@ -14,7 +14,7 @@ incrementing map_count. 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index b154c24..6ea1e5e 100644 +index 78b8d8b..d754bc9 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -464,7 +464,8 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co @@ -40,9 +40,9 @@ index b154c24..6ea1e5e 100644 buffer_mark_used(buffer); if (!buffer->buffer_object) -@@ -1246,6 +1241,12 @@ static void buffer_resource_preload(struct wined3d_resource *resource) +@@ -1245,6 +1240,12 @@ static void buffer_resource_preload(struct wined3d_resource *resource) + { struct wined3d_context *context; - struct wined3d_device *device = resource->device; + if (resource->map_count) + { @@ -50,9 +50,9 @@ index b154c24..6ea1e5e 100644 + return; + } + - if (wined3d_settings.cs_multithreaded) - { - FIXME("Waiting for cs.\n"); + context = context_acquire(resource->device, NULL); + buffer_internal_preload(buffer_from_resource(resource), context, NULL); + context_release(context); -- 2.9.0 diff --git a/patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch b/patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch deleted file mode 100644 index c7eff01b..00000000 --- a/patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 9718a2a0fb3ca81fc32a5ffc97522ae448363a9d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Sun, 7 Jul 2013 12:02:59 +0200 -Subject: wined3d: Send buffer preloads through the CS - -Think about making this a fast command. Might help if the driver -supports async data transfer, but synchronization side effects, esp. wrt -the dirty area list, have to be considered. ---- - dlls/wined3d/buffer.c | 12 +----------- - dlls/wined3d/cs.c | 31 +++++++++++++++++++++++++++++++ - dlls/wined3d/wined3d_private.h | 1 + - 3 files changed, 33 insertions(+), 11 deletions(-) - -diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 6ea1e5e..2625d9d 100644 ---- a/dlls/wined3d/buffer.c -+++ b/dlls/wined3d/buffer.c -@@ -1238,7 +1238,6 @@ static ULONG buffer_resource_decref(struct wined3d_resource *resource) - - static void buffer_resource_preload(struct wined3d_resource *resource) - { -- struct wined3d_context *context; - struct wined3d_device *device = resource->device; - - if (resource->map_count) -@@ -1247,16 +1246,7 @@ static void buffer_resource_preload(struct wined3d_resource *resource) - return; - } - -- if (wined3d_settings.cs_multithreaded) -- { -- FIXME("Waiting for cs.\n"); -- wined3d_cs_emit_glfinish(device->cs); -- device->cs->ops->finish(device->cs); -- } -- -- context = context_acquire(device, NULL); -- buffer_internal_preload(buffer_from_resource(resource), context, NULL); -- context_release(context); -+ wined3d_cs_emit_buffer_preload(device->cs, buffer_from_resource(resource)); - } - - static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index aee2f60..f24a37d 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -75,6 +75,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_TEXTURE_UNMAP, - WINED3D_CS_OP_BUFFER_SWAP_MEM, - WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE, -+ WINED3D_CS_OP_BUFFER_PRELOAD, - WINED3D_CS_OP_TEXTURE_PRELOAD, - WINED3D_CS_OP_UPDATE_TEXTURE, - WINED3D_CS_OP_UPDATE_SUB_RESOURCE, -@@ -460,6 +461,12 @@ struct wined3d_cs_update_sub_resource - const void *data; - }; - -+struct wined3d_cs_buffer_preload -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_buffer *buffer; -+}; -+ - static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) - { - LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2393,6 +2400,29 @@ void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs, - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_buffer_preload(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_buffer_preload *op = data; -+ struct wined3d_context *context; -+ -+ context = context_acquire(cs->device, NULL); -+ buffer_internal_preload(op->buffer, context, NULL); -+ context_release(context); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) -+{ -+ struct wined3d_cs_buffer_preload *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_BUFFER_PRELOAD; -+ op->buffer = buffer; -+ -+ cs->ops->submit(cs, sizeof(*op)); -+} -+ - static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = - { - /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2446,6 +2476,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, - /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, - /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, -+ /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, - /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, - /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, - /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 14585d1..4c64b9a 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3105,6 +3105,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf - enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; - void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs, - struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; - void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffer *buffer, - BYTE *mem) DECLSPEC_HIDDEN; - void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, --- -2.9.0 - diff --git a/patches/wined3d-CSMT_Main/0093-wined3d-Create-VBOs-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0093-wined3d-Create-VBOs-through-the-command-stream.patch index 487dde28..155f9390 100644 --- a/patches/wined3d-CSMT_Main/0093-wined3d-Create-VBOs-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0093-wined3d-Create-VBOs-through-the-command-stream.patch @@ -1,4 +1,4 @@ -From 6e1451770f45f6e635f49956e5756d9e7c0f167b Mon Sep 17 00:00:00 2001 +From 70ac363172221646e6139f1f1ad6a8691f2ee2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 2 Oct 2013 21:47:08 +0200 Subject: wined3d: Create VBOs through the command stream. @@ -11,7 +11,7 @@ A stop-gap solution to make fglrx happier until buffers are updated. 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 47155ed..b69f8a3 100644 +index ff6c0ac..9765c4e 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -122,7 +122,7 @@ static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_g @@ -32,7 +32,7 @@ index 47155ed..b69f8a3 100644 This->buffer_object_usage = gl_usage; -@@ -936,9 +934,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -929,9 +927,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN * on buffer creation won't work either. */ if (!buffer->buffer_object && buffer->flags & WINED3D_BUFFER_USE_BO) { @@ -44,19 +44,19 @@ index 47155ed..b69f8a3 100644 flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 24e9a74..826d6ec 100644 +index 93beab0..391c6f1 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -79,6 +79,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_TEXTURE_PRELOAD, +@@ -78,6 +78,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE, WINED3D_CS_OP_UPDATE_TEXTURE, WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_CREATE_VBO, WINED3D_CS_OP_STOP, }; -@@ -467,6 +468,12 @@ struct wined3d_cs_buffer_preload - struct wined3d_buffer *buffer; +@@ -460,6 +461,12 @@ struct wined3d_cs_update_sub_resource + const void *data; }; +struct wined3d_cs_create_vbo @@ -68,7 +68,7 @@ index 24e9a74..826d6ec 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2425,6 +2432,30 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer +@@ -2398,6 +2405,30 @@ void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs, cs->ops->submit(cs, sizeof(*op)); } @@ -99,8 +99,8 @@ index 24e9a74..826d6ec 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2482,6 +2513,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, +@@ -2454,6 +2485,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, @@ -108,10 +108,10 @@ index 24e9a74..826d6ec 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 718afab..486f8d9 100644 +index a4e24aa..c93ce68 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3112,6 +3112,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -3115,6 +3115,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil, const struct blit_shader *blitter) DECLSPEC_HIDDEN; @@ -119,7 +119,7 @@ index 718afab..486f8d9 100644 void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, -@@ -3246,6 +3247,8 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, +@@ -3249,6 +3250,8 @@ 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; void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch b/patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch deleted file mode 100644 index 757a1977..00000000 --- a/patches/wined3d-CSMT_Main/0104-wined3d-Fence-preload-operations.patch +++ /dev/null @@ -1,71 +0,0 @@ -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. - -Otherwise texture data might get lost, thanks to surface/volume_evict_sysmem: - -1) preload(texture) -2) map(texture) - -> Loads sysmem / sets it with discard map. -3) unmap(texture) - -> enqueues a resource_changed operation -4) preload is executed. - -> Uploads data written in 3. Discards sysmem. Questionable if - DISCARD was passed, but without it, no harm done. - -> texture is only up to date location. -5) resource_changed executed. - -> Discards texture. - -And data is lost. This patch prevents that by stalling the map until the -PreLoad is done. - -What's left open is finding out why anyone (I'm looking at you EVE -online) preloads a texture right before mapping it... ---- - dlls/wined3d/cs.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 1b8cb90..1593157 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -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_release(&texture->resource); -+ - return sizeof(*op); - } - -@@ -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_acquire(&texture->resource); -+ - cs->ops->submit(cs, sizeof(*op)); - } - -@@ -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_release(&op->buffer->resource); -+ - return sizeof(*op); - } - -@@ -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_acquire(&buffer->resource); -+ - cs->ops->submit(cs, sizeof(*op)); - } - --- -2.8.0 - diff --git a/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch b/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch index d1d9210a..d5e6d7eb 100644 --- a/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch +++ b/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch @@ -1,4 +1,4 @@ -From 65fdec5a37a115c8c9a4c3b70d99fac6b243cf24 Mon Sep 17 00:00:00 2001 +From aeddfd65c5edc947405f6640b9465c8b8e640d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 16 Mar 2014 14:13:42 +0100 Subject: wined3d: Send getdc and releasedc through the command stream. @@ -11,10 +11,10 @@ Another hacky patch to avoid using GL outside the worker thread. 3 files changed, 113 insertions(+), 34 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index c011bf1..0089911 100644 +index 4570983..2958609 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -80,6 +80,8 @@ enum wined3d_cs_op +@@ -81,6 +81,8 @@ enum wined3d_cs_op WINED3D_CS_OP_UPDATE_TEXTURE, WINED3D_CS_OP_UPDATE_SUB_RESOURCE, WINED3D_CS_OP_CREATE_VBO, @@ -23,7 +23,7 @@ index c011bf1..0089911 100644 WINED3D_CS_OP_STOP, }; -@@ -474,6 +476,13 @@ struct wined3d_cs_create_vbo +@@ -481,6 +483,13 @@ struct wined3d_cs_create_vbo struct wined3d_buffer *buffer; }; @@ -37,7 +37,7 @@ index c011bf1..0089911 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2478,6 +2487,52 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu +@@ -2504,6 +2513,52 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu cs->ops->finish_prio(cs); } @@ -90,7 +90,7 @@ index c011bf1..0089911 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2536,6 +2591,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2563,6 +2618,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, @@ -100,10 +100,10 @@ index c011bf1..0089911 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index d69dfc1..a90391c 100644 +index f4d3363..f00c06a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -3057,13 +3057,39 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -3058,13 +3058,39 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -145,7 +145,7 @@ index d69dfc1..a90391c 100644 TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -3081,35 +3107,30 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3082,35 +3108,30 @@ 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; @@ -200,7 +200,7 @@ index d69dfc1..a90391c 100644 } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -3140,14 +3161,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3141,14 +3162,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -217,10 +217,10 @@ index d69dfc1..a90391c 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index d370367..a524314 100644 +index e976ffa..4ab138f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2702,6 +2702,7 @@ struct wined3d_texture +@@ -2706,6 +2706,7 @@ struct wined3d_texture DWORD flags; GLenum target; DWORD update_map_binding; @@ -228,7 +228,7 @@ index d370367..a524314 100644 GLuint rb_multisample; GLuint rb_resolved; -@@ -2795,6 +2796,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture, +@@ -2799,6 +2800,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture, void *swap_heap_memory) DECLSPEC_HIDDEN; BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; @@ -236,7 +236,7 @@ index d370367..a524314 100644 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; -@@ -2814,6 +2816,8 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -2818,6 +2820,8 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int DWORD flags) DECLSPEC_HIDDEN; void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -245,13 +245,14 @@ index d370367..a524314 100644 void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -@@ -3122,10 +3126,14 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, +@@ -3126,11 +3130,15 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN; +void wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; + void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0122-wined3d-Create-the-initial-context-through-the-CS.patch b/patches/wined3d-CSMT_Main/0122-wined3d-Create-the-initial-context-through-the-CS.patch index e252db1c..66ecb90a 100644 --- a/patches/wined3d-CSMT_Main/0122-wined3d-Create-the-initial-context-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0122-wined3d-Create-the-initial-context-through-the-CS.patch @@ -1,4 +1,4 @@ -From 261adc11a7e5c6a0445575f5d53213c7a08f31d7 Mon Sep 17 00:00:00 2001 +From 9015c6fda2f38e2552ee7056b7f97ad994d75310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 10 Oct 2013 16:43:19 +0200 Subject: wined3d: Create the initial context through the CS. @@ -11,10 +11,10 @@ Very hacky. 3 files changed, 103 insertions(+), 54 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 2aa43d6..dc5a878 100644 +index cf11c3c..230c04d 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -83,6 +83,7 @@ enum wined3d_cs_op +@@ -84,6 +84,7 @@ enum wined3d_cs_op WINED3D_CS_OP_GET_DC, WINED3D_CS_OP_RELEASE_DC, WINED3D_CS_OP_CREATE_DUMMY_TEXTURES, @@ -22,7 +22,7 @@ index 2aa43d6..dc5a878 100644 WINED3D_CS_OP_STOP, }; -@@ -489,6 +490,13 @@ struct wined3d_cs_create_dummy_textures +@@ -496,6 +497,13 @@ struct wined3d_cs_create_dummy_textures enum wined3d_cs_op opcode; }; @@ -36,7 +36,7 @@ index 2aa43d6..dc5a878 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2561,6 +2569,31 @@ void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) +@@ -2587,6 +2595,31 @@ void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) cs->ops->finish(cs); } @@ -68,7 +68,7 @@ index 2aa43d6..dc5a878 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2622,6 +2655,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2649,6 +2682,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, /* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures, @@ -77,7 +77,7 @@ index 2aa43d6..dc5a878 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index f238563..2356571 100644 +index 256f9db..eac171b 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -817,6 +817,69 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s @@ -170,7 +170,9 @@ index f238563..2356571 100644 - { - ERR("Failed to create the context array.\n"); - hr = E_OUTOFMEMORY; -- goto err; ++ hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); ++ if (FAILED(hr)) + goto err; - } - swapchain->num_contexts = 1; - @@ -198,9 +200,7 @@ index f238563..2356571 100644 - { - WARN("Failed to create context.\n"); - hr = WINED3DERR_NOTAVAILABLE; -+ hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); -+ if (FAILED(hr)) - goto err; +- goto err; - } - - if (wined3d_settings.offscreen_rendering_mode != ORM_FBO @@ -215,10 +215,10 @@ index f238563..2356571 100644 if (swapchain->desc.backbuffer_count > 0) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index b8b597d..afe7fe0 100644 +index a635118..f18858b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3122,6 +3122,8 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -3126,6 +3126,8 @@ 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_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN; @@ -227,7 +227,7 @@ index b8b597d..afe7fe0 100644 void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; -@@ -3362,6 +3364,8 @@ struct wined3d_swapchain +@@ -3367,6 +3369,8 @@ 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; diff --git a/patches/wined3d-CSMT_Main/0134-wined3d-Fix-context_acquire-not-being-called-from-th.patch b/patches/wined3d-CSMT_Main/0134-wined3d-Fix-context_acquire-not-being-called-from-th.patch index 99bed1f6..e87d8d45 100644 --- a/patches/wined3d-CSMT_Main/0134-wined3d-Fix-context_acquire-not-being-called-from-th.patch +++ b/patches/wined3d-CSMT_Main/0134-wined3d-Fix-context_acquire-not-being-called-from-th.patch @@ -1,4 +1,4 @@ -From 6fac21d0265b08214e7c229466514279c3297427 Mon Sep 17 00:00:00 2001 +From 1b283458b05894d2bb53a33bd5485178d641c973 Mon Sep 17 00:00:00 2001 From: Nils Kuhnhenn Date: Fri, 5 Aug 2016 20:28:46 +0200 Subject: wined3d: Fix context_acquire not being called from the command thread @@ -11,18 +11,18 @@ Subject: wined3d: Fix context_acquire not being called from the command thread 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index ddd5703..0b15565 100644 +index de3db6f..d4f527c 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -73,6 +73,7 @@ enum wined3d_cs_op +@@ -74,6 +74,7 @@ enum wined3d_cs_op WINED3D_CS_OP_TEXTURE_CHANGED, WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, + WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION, WINED3D_CS_OP_BUFFER_SWAP_MEM, WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE, - WINED3D_CS_OP_BUFFER_PRELOAD, -@@ -419,6 +420,13 @@ struct wined3d_cs_texture_unmap + WINED3D_CS_OP_UPDATE_TEXTURE, +@@ -424,6 +425,13 @@ struct wined3d_cs_texture_unmap unsigned int sub_resource_idx; }; @@ -36,7 +36,7 @@ index ddd5703..0b15565 100644 struct wined3d_cs_texture_changed { enum wined3d_cs_op opcode; -@@ -2274,6 +2282,47 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture +@@ -2294,6 +2302,47 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture cs->ops->submit_prio(cs, sizeof(*op)); } @@ -81,22 +81,22 @@ index ddd5703..0b15565 100644 + cs->ops->submit(cs, sizeof(*op)); +} + - static UINT wined3d_cs_exec_texture_preload(struct wined3d_cs *cs, const void *data) + static UINT wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *data) { - const struct wined3d_cs_texture_preload *op = data; -@@ -2723,6 +2772,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + const struct wined3d_cs_update_texture *op = data; +@@ -2689,6 +2738,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_CHANGED */ wined3d_cs_exec_texture_changed, /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, + /* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region, /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, - /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 9730148..b1fc1e5 100644 +index 5c80a38..df9229a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1551,7 +1551,6 @@ struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct win +@@ -1545,7 +1545,6 @@ struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct win HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, UINT layer, const struct wined3d_box *dirty_region) { @@ -104,7 +104,7 @@ index 9730148..b1fc1e5 100644 unsigned int sub_resource_idx; TRACE("texture %p, layer %u, dirty_region %s.\n", texture, layer, debug_box(dirty_region)); -@@ -1563,19 +1562,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1557,19 +1556,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, } sub_resource_idx = layer * texture->level_count; @@ -126,10 +126,10 @@ index 9730148..b1fc1e5 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 0822b2e..b930a6a 100644 +index db67853..d5cc991 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3201,6 +3201,8 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -3205,6 +3205,8 @@ 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; diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index c63a8157..7710e62f 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -410,31 +410,22 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, -@@ -1219,11 +1375,23 @@ static ULONG buffer_resource_decref(struct wined3d_resource *resource) - - static void buffer_resource_preload(struct wined3d_resource *resource) +@@ -1221,6 +1377,14 @@ static void buffer_resource_preload(struct wined3d_resource *resource) { -+#if !defined(STAGING_CSMT) struct wined3d_context *context; - context = context_acquire(resource->device, NULL); - buffer_internal_preload(buffer_from_resource(resource), context, NULL); - context_release(context); -+#else /* STAGING_CSMT */ -+ struct wined3d_device *device = resource->device; -+ ++#if defined(STAGING_CSMT) + if (resource->map_count) + { + WARN("Buffer is mapped, skipping preload.\n"); + return; + } + -+ wined3d_cs_emit_buffer_preload(device->cs, buffer_from_resource(resource)); +#endif /* STAGING_CSMT */ - } - - static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, -@@ -1303,6 +1471,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device + context = context_acquire(resource->device, NULL); + buffer_internal_preload(buffer_from_resource(resource), context, NULL); + context_release(context); +@@ -1303,6 +1467,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device return hr; } buffer->buffer_type_hint = bind_hint; @@ -444,7 +435,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory, buffer); -@@ -1338,6 +1509,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1338,6 +1505,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->flags |= WINED3D_BUFFER_USE_BO; } @@ -456,7 +447,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) { ERR("Out of memory.\n"); -@@ -1465,3 +1641,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, +@@ -1465,3 +1637,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, return WINED3D_OK; } @@ -653,9 +644,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DRAW, -@@ -56,6 +64,51 @@ enum wined3d_cs_op - WINED3D_CS_OP_DESTROY_OBJECT, +@@ -57,6 +65,49 @@ enum wined3d_cs_op WINED3D_CS_OP_QUERY_ISSUE, + WINED3D_CS_OP_PRELOAD_RESOURCE, WINED3D_CS_OP_UNLOAD_RESOURCE, +#if defined(STAGING_CSMT) + WINED3D_CS_OP_SET_VS_CONSTS_F, @@ -677,8 +668,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION, + WINED3D_CS_OP_BUFFER_SWAP_MEM, + WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE, -+ WINED3D_CS_OP_BUFFER_PRELOAD, -+ WINED3D_CS_OP_TEXTURE_PRELOAD, + WINED3D_CS_OP_UPDATE_TEXTURE, + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_CREATE_VBO, @@ -705,7 +694,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -282,7 +335,278 @@ struct wined3d_cs_unload_resource +@@ -289,7 +340,266 @@ struct wined3d_cs_unload_resource struct wined3d_resource *resource; }; @@ -842,12 +831,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + DWORD size; +}; + -+struct wined3d_cs_texture_preload -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_texture *texture; -+}; -+ +struct wined3d_cs_update_texture +{ + enum wined3d_cs_op opcode; @@ -863,12 +846,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + const void *data; +}; + -+struct wined3d_cs_buffer_preload -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_buffer *buffer; -+}; -+ +struct wined3d_cs_create_vbo +{ + enum wined3d_cs_op opcode; @@ -984,7 +961,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -291,13 +615,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -298,13 +608,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); @@ -1009,7 +986,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, -@@ -305,6 +640,9 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -312,6 +633,9 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw { struct wined3d_cs_present *op; unsigned int i; @@ -1019,7 +996,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_PRESENT; -@@ -320,34 +658,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -327,34 +651,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); } @@ -1095,7 +1072,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, -@@ -356,8 +735,13 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -363,8 +728,13 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_clear *op; unsigned int i; @@ -1109,7 +1086,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; -@@ -370,11 +754,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -377,11 +747,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1127,7 +1104,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_resource_acquire(state->fb->depth_stencil->resource); cs->ops->submit(cs); -@@ -383,12 +773,65 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -390,12 +766,65 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { struct wined3d_state *state = &cs->device->state; @@ -1193,7 +1170,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] && state->load_base_vertex_index != op->base_vertex_idx) { -@@ -413,11 +856,19 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -420,11 +849,19 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1213,7 +1190,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -439,6 +890,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -446,6 +883,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) wined3d_resource_release(view->resource); } } @@ -1224,7 +1201,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, -@@ -461,11 +916,25 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -468,11 +909,25 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i op->indexed = indexed; if (indexed) @@ -1240,17 +1217,17 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { if (state->streams[i].buffer) +#if !defined(STAGING_CSMT) -+ wined3d_resource_acquire(&state->streams[i].buffer->resource); + wined3d_resource_acquire(&state->streams[i].buffer->resource); +#else /* STAGING_CSMT */ + { - wined3d_resource_acquire(&state->streams[i].buffer->resource); ++ wined3d_resource_acquire(&state->streams[i].buffer->resource); + state->streams[i].buffer->ignore_discard = FALSE; + } +#endif /* STAGING_CSMT */ } for (i = 0; i < ARRAY_SIZE(state->textures); ++i) { -@@ -474,11 +943,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -481,11 +936,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) { @@ -1270,7 +1247,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -501,15 +978,26 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -508,15 +971,26 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } } @@ -1297,7 +1274,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -521,15 +1009,26 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -528,15 +1002,26 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query op->predicate = predicate; op->value = value; @@ -1324,7 +1301,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -540,15 +1039,26 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -547,15 +1032,26 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -1351,7 +1328,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -559,15 +1069,29 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -566,15 +1062,29 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -1381,7 +1358,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, -@@ -580,16 +1104,27 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -587,16 +1097,27 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v op->view_idx = view_idx; op->view = view; @@ -1409,7 +1386,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -597,15 +1132,26 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -604,15 +1125,26 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const || prev_surface->container->flags & WINED3D_TEXTURE_DISCARD)) { surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); @@ -1436,7 +1413,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -622,6 +1168,10 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -629,6 +1161,10 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1447,7 +1424,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -632,15 +1182,26 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -639,15 +1175,26 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -1474,7 +1451,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -651,10 +1212,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -658,10 +1205,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -1492,7 +1469,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; -@@ -672,6 +1240,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -679,6 +1233,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); @@ -1503,7 +1480,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, -@@ -686,10 +1258,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -693,10 +1251,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, op->offset = offset; op->stride = stride; @@ -1521,7 +1498,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; -@@ -699,6 +1278,10 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -706,6 +1271,10 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1532,7 +1509,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -711,10 +1294,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -718,10 +1287,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i op->frequency = frequency; op->flags = flags; @@ -1550,7 +1527,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; -@@ -729,6 +1319,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -736,6 +1312,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); @@ -1561,7 +1538,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, -@@ -742,10 +1336,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -749,10 +1329,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, op->buffer = buffer; op->offset = offset; @@ -1579,7 +1556,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; -@@ -761,6 +1362,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -768,6 +1355,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); @@ -1590,7 +1567,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, -@@ -774,10 +1379,17 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -781,10 +1372,17 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff op->format_id = format_id; op->offset = offset; @@ -1608,7 +1585,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; -@@ -791,6 +1403,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -798,6 +1396,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)); @@ -1618,7 +1595,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, -@@ -804,10 +1419,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -811,10 +1412,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha op->cb_idx = cb_idx; op->buffer = buffer; @@ -1636,7 +1613,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; -@@ -884,6 +1506,10 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -891,6 +1499,10 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1647,7 +1624,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -894,16 +1520,27 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -901,16 +1513,27 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -1675,7 +1652,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, -@@ -917,15 +1554,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -924,15 +1547,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 op->view_idx = view_idx; op->view = view; @@ -1702,7 +1679,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, -@@ -939,16 +1587,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -946,16 +1580,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -1711,13 +1688,14 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) +-{ +#else /* STAGING_CSMT */ + cs->ops->submit(cs, sizeof(*op)); +} + +static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) +#endif /* STAGING_CSMT */ - { ++{ const struct wined3d_cs_set_shader *op = data; cs->state.shader[op->type] = op->shader; @@ -1730,7 +1708,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -960,15 +1619,26 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -967,15 +1612,26 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type op->type = type; op->shader = shader; @@ -1757,7 +1735,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, -@@ -980,15 +1650,86 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -987,15 +1643,86 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state; @@ -1844,7 +1822,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -1000,6 +1741,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1007,6 +1734,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->state = state; op->value = value; @@ -1852,10 +1830,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -1009,6 +1751,135 @@ static void wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void +@@ -1038,6 +1766,159 @@ static void wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void - cs->state.texture_states[op->stage][op->state] = op->value; - device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); + cs->state.sampler_states[op->sampler_idx][op->state] = op->value; + device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); +#else /* STAGING_CSMT */ + cs->ops->submit(cs, sizeof(*op)); +} @@ -1984,38 +1962,35 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); + + return sizeof(*op); -+#endif /* STAGING_CSMT */ - } - - void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1022,15 +1893,26 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, - op->state = state; - op->value = value; - -+#if !defined(STAGING_CSMT) - cs->ops->submit(cs); - } - - static void wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data) -+#else /* STAGING_CSMT */ ++} ++ ++void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, ++ enum wined3d_texture_stage_state state, DWORD value) ++{ ++ struct wined3d_cs_set_texture_state *op; ++ ++ op = cs->ops->require_space(cs, sizeof(*op)); ++ op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE; ++ op->stage = stage; ++ op->state = state; ++ op->value = value; ++ + cs->ops->submit(cs, sizeof(*op)); +} + +static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data) -+#endif /* STAGING_CSMT */ - { - const struct wined3d_cs_set_sampler_state *op = data; - - cs->state.sampler_states[op->sampler_idx][op->state] = op->value; - device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); -+#if defined(STAGING_CSMT) ++{ ++ const struct wined3d_cs_set_sampler_state *op = data; ++ ++ cs->state.sampler_states[op->sampler_idx][op->state] = op->value; ++ device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); + + return sizeof(*op); +#endif /* STAGING_CSMT */ } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1044,16 +1926,27 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1051,16 +1932,27 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, op->state = state; op->value = value; @@ -2043,7 +2018,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, -@@ -1066,15 +1959,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1073,15 +1965,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform op->state = state; op->matrix = *matrix; @@ -2070,7 +2045,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -1086,10 +1990,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1093,10 +1996,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const op->plane_idx = plane_idx; op->plane = *plane; @@ -2088,7 +2063,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; -@@ -1150,6 +2061,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1157,6 +2067,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -2099,7 +2074,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, -@@ -1169,15 +2084,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1176,15 +2090,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -2126,7 +2101,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1188,17 +2114,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1195,17 +2120,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -2162,7 +2137,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1208,14 +2152,25 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1215,14 +2158,25 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -2188,7 +2163,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) -@@ -1227,15 +2182,57 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1234,15 +2188,57 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void op->callback = callback; op->object = object; @@ -2246,10 +2221,38 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) -@@ -1247,16 +2244,27 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1254,16 +2250,27 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu op->query = query; op->flags = flags; ++#if !defined(STAGING_CSMT) + cs->ops->submit(cs); + } + + static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ ++ cs->ops->submit(cs, sizeof(*op)); ++} ++ ++static UINT wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data) ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_preload_resource *op = data; + struct wined3d_resource *resource = op->resource; + + resource->resource_ops->resource_preload(resource); + wined3d_resource_release(resource); ++#if defined(STAGING_CSMT) ++ ++ return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) +@@ -1276,16 +2283,27 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso + + wined3d_resource_acquire(resource); + +#if !defined(STAGING_CSMT) cs->ops->submit(cs); } @@ -2274,7 +2277,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) -@@ -1269,6 +2277,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1298,6 +2316,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou wined3d_resource_acquire(resource); @@ -2282,7 +2285,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -1417,5 +2426,1230 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -1447,5 +2466,1174 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) state_cleanup(&cs->state); HeapFree(GetProcessHeap(), 0, cs->fb.render_targets); HeapFree(GetProcessHeap(), 0, cs->data); @@ -2706,34 +2709,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->ops->submit(cs, sizeof(*op)); +} + -+static UINT wined3d_cs_exec_texture_preload(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_texture_preload *op = data; -+ struct wined3d_context *context; -+ struct wined3d_texture *texture = op->texture; -+ -+ context = context_acquire(cs->device, NULL); -+ wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB); -+ context_release(context); -+ -+ wined3d_resource_release(&texture->resource); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) -+{ -+ struct wined3d_cs_texture_preload *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_TEXTURE_PRELOAD; -+ op->texture = texture; -+ -+ wined3d_resource_acquire(&texture->resource); -+ -+ cs->ops->submit(cs, sizeof(*op)); -+} -+ +static UINT wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_update_texture *op = data; @@ -2898,33 +2873,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->ops->submit(cs, sizeof(*op)); +} + -+static UINT wined3d_cs_exec_buffer_preload(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_buffer_preload *op = data; -+ struct wined3d_context *context; -+ -+ context = context_acquire(cs->device, NULL); -+ buffer_internal_preload(op->buffer, context, NULL); -+ context_release(context); -+ -+ wined3d_resource_release(&op->buffer->resource); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) -+{ -+ struct wined3d_cs_buffer_preload *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_BUFFER_PRELOAD; -+ op->buffer = buffer; -+ -+ wined3d_resource_acquire(&buffer->resource); -+ -+ cs->ops->submit(cs, sizeof(*op)); -+} -+ +static UINT wined3d_cs_exec_create_vbo(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_create_vbo *op = data; @@ -3138,6 +3086,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + /* 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, ++ /* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource, + /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource, + /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, + /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b, @@ -3158,8 +3107,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + /* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region, + /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, + /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, -+ /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, -+ /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, @@ -5750,7 +5697,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (texture->flags & WINED3D_TEXTURE_COND_NP2_EMULATED) { -@@ -1175,9 +1217,22 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1177,9 +1219,22 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P return WINED3DERR_INVALIDCALL; } @@ -5773,7 +5720,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c context = context_acquire(dst_texture->resource.device, NULL); gl_info = context->gl_info; -@@ -1192,7 +1247,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1194,7 +1249,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE); wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &data, @@ -5785,7 +5732,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_get_pitch(src_texture, src_surface->texture_level, &src_row_pitch, &src_slice_pitch); wined3d_surface_upload_data(dst_surface, gl_info, src_format, src_rect, -@@ -1693,11 +1752,22 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1695,11 +1754,22 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr { unsigned int texture_level = sub_resource_idx % src_texture->level_count; const struct wined3d_format *src_format = src_texture->resource.format; @@ -5808,7 +5755,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!(conv = find_converter(src_format->id, dst_format->id)) && (!device->d3d_initialized || !is_identity_fixup(src_format->color_fixup) || src_format->convert -@@ -1727,6 +1797,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1729,6 +1799,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr return NULL; } @@ -5816,7 +5763,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c memset(&src_map, 0, sizeof(src_map)); if (FAILED(wined3d_resource_map(&src_texture->resource, sub_resource_idx, &src_map, NULL, WINED3D_MAP_READONLY))) -@@ -1751,10 +1822,51 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1753,10 +1824,51 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr conv->convert(src_map.data, dst_map.data, src_map.row_pitch, dst_map.row_pitch, desc.width, desc.height); wined3d_resource_unmap(&dst_texture->resource, 0); @@ -5868,7 +5815,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c RECT src_rect = {0, 0, desc.width, desc.height}; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; -@@ -1767,16 +1879,40 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1769,16 +1881,40 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr wined3d_texture_prepare_texture(dst_texture, context, FALSE); wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE); wined3d_surface_upload_data(dst_texture->sub_resources[0].u.surface, gl_info, src_format, @@ -5909,7 +5856,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } static HRESULT _Blt_ColorFill(BYTE *buf, unsigned int width, unsigned int height, -@@ -1854,7 +1990,11 @@ static void read_from_framebuffer(struct wined3d_surface *surface, +@@ -1856,7 +1992,11 @@ static void read_from_framebuffer(struct wined3d_surface *surface, BOOL srcIsUpsideDown; struct wined3d_bo_address data; @@ -5921,7 +5868,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c restore_rt = context_get_rt_surface(old_ctx); if (restore_rt != surface) -@@ -2381,7 +2521,13 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -2383,7 +2523,13 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st checkGLcall("glDeleteTextures(1, &backup)"); } @@ -5935,7 +5882,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); -@@ -2446,9 +2592,15 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, +@@ -2448,9 +2594,15 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, gl_info = context->gl_info; @@ -5951,7 +5898,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_load(src_texture, context, FALSE); /* Activate the destination context, set it up for blitting */ -@@ -2491,8 +2643,16 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, +@@ -2493,8 +2645,16 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, /* Leave the opengl state valid for blitting */ device->blitter->unset_shader(context->gl_info); @@ -5968,7 +5915,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ if (restore_rt) -@@ -2503,8 +2663,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2505,8 +2665,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st { struct wined3d_resource *resource = &s->container->resource; struct wined3d_device *device = resource->device; @@ -5981,7 +5928,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct blit_shader *blitter; HRESULT hr; -@@ -2515,6 +2679,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2517,6 +2681,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st return WINED3DERR_INVALIDCALL; } @@ -5989,7 +5936,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c view_desc.format_id = resource->format->id; view_desc.u.texture.level_idx = s->texture_level; view_desc.u.texture.layer_idx = s->texture_layer; -@@ -2528,6 +2693,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2530,6 +2695,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st hr = blitter->color_fill(device, view, rect, color); wined3d_rendertarget_view_decref(view); @@ -6009,7 +5956,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2538,7 +2716,11 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -2540,7 +2718,11 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE { struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; @@ -6021,7 +5968,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_texture *src_texture; -@@ -2839,7 +3021,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win +@@ -2841,7 +3023,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -6035,7 +5982,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ } else if (location == WINED3D_LOCATION_DRAWABLE) -@@ -2856,7 +3044,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win +@@ -2858,7 +3046,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -6049,7 +5996,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ } else -@@ -2865,6 +3059,7 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win +@@ -2867,6 +3061,7 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win } } @@ -6057,7 +6004,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static DWORD resource_access_from_location(DWORD location) { switch (location) -@@ -2926,6 +3121,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD +@@ -2928,6 +3123,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD memcpy(dst.addr, src.addr, sub_resource->size); } @@ -6065,7 +6012,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Context activation is done by the caller. */ static void surface_load_sysmem(struct wined3d_surface *surface, struct wined3d_context *context, DWORD dst_location) -@@ -2938,12 +3134,14 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -2940,12 +3136,14 @@ static void surface_load_sysmem(struct wined3d_surface *surface, wined3d_texture_prepare_location(texture, sub_resource_idx, context, dst_location); sub_resource = &texture->sub_resources[sub_resource_idx]; @@ -6080,7 +6027,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED)) wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB); -@@ -3092,7 +3290,11 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3094,7 +3292,11 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, /* Don't use PBOs for converted surfaces. During PBO conversion we look at * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is * getting called. */ @@ -6092,7 +6039,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -3100,7 +3302,11 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3102,7 +3304,11 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, wined3d_texture_set_map_binding(texture, WINED3D_LOCATION_SYSMEM); } @@ -6104,7 +6051,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (format.convert) { /* This code is entered for texture formats which need a fixup. */ -@@ -3183,16 +3389,23 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi +@@ -3185,16 +3391,23 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi } /* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */ @@ -6128,7 +6075,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_w = wined3d_texture_get_level_width(texture, surface->texture_level); surface_h = wined3d_texture_get_level_height(texture, surface->texture_level); -@@ -3227,6 +3440,9 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3229,6 +3442,9 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED); return surface_load_location(surface, context, location); } @@ -6138,7 +6085,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { -@@ -3239,7 +3455,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3241,7 +3457,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", wined3d_debug_location(sub_resource->locations), wined3d_debug_location(location)); @@ -6150,7 +6097,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } switch (location) -@@ -3252,7 +3472,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3254,7 +3474,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_DRAWABLE: if (FAILED(hr = surface_load_drawable(surface, context))) @@ -6162,7 +6109,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -3264,7 +3488,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3266,7 +3490,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_TEXTURE_SRGB: if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) @@ -6174,7 +6121,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; default: -@@ -3273,6 +3501,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3275,6 +3503,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co } done: @@ -6182,7 +6129,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_validate_location(texture, sub_resource_idx, location); if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) -@@ -3282,6 +3511,9 @@ done: +@@ -3284,6 +3513,9 @@ done: } return WINED3D_OK; @@ -6192,7 +6139,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } -@@ -3613,16 +3845,41 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3615,16 +3847,41 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int const BYTE *sbuf; BYTE *dbuf; int x, y; @@ -6234,7 +6181,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_map = dst_map; src_format = dst_texture->resource.format; dst_format = src_format; -@@ -3647,7 +3904,20 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3649,7 +3906,20 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int src_texture = converted_texture; src_sub_resource_idx = 0; } @@ -6255,7 +6202,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format = src_texture->resource.format; src_fmt_flags = src_texture->resource.format_flags; } -@@ -3657,7 +3927,17 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3659,7 +3929,17 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int src_fmt_flags = dst_fmt_flags; } @@ -6273,7 +6220,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } bpp = dst_format->byte_count; -@@ -3671,12 +3951,18 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3673,12 +3953,18 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int sbase = (BYTE *)src_map.data + ((src_box->top / src_format->block_height) * src_map.row_pitch) + ((src_box->left / src_format->block_width) * src_format->block_byte_count); @@ -6292,7 +6239,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS) { -@@ -4069,16 +4355,42 @@ do { \ +@@ -4071,16 +4357,42 @@ do { \ } } @@ -6335,7 +6282,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -4123,7 +4435,11 @@ const struct blit_shader cpu_blit = { +@@ -4125,7 +4437,11 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -6347,7 +6294,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -4133,9 +4449,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4135,9 +4451,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; struct wined3d_swapchain *src_swapchain, *dst_swapchain; @@ -6362,7 +6309,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c DWORD src_ds_flags, dst_ds_flags; BOOL scale, convert; -@@ -4148,6 +4469,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4150,6 +4471,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -6370,7 +6317,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter)); -@@ -4165,10 +4487,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4167,10 +4489,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fx->src_color_key.color_space_high_value); } @@ -6383,7 +6330,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (dst_texture->sub_resources[dst_sub_resource_idx].map_count -@@ -4226,6 +4550,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4228,6 +4552,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (!once++) FIXME("Can't handle WINED3D_BLT_DO_NOT_WAIT flag.\n"); flags &= ~WINED3D_BLT_DO_NOT_WAIT; @@ -6399,7 +6346,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (!device->d3d_initialized) -@@ -4250,11 +4583,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4252,11 +4585,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -6413,7 +6360,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -4290,13 +4625,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4292,13 +4627,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst TRACE("Depth fill.\n"); if (!surface_convert_depth_to_float(dst_surface, fx->fill_color, &depth)) @@ -6435,7 +6382,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_ds_flags != dst_ds_flags) { WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -@@ -4306,6 +4649,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4308,6 +4651,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) return WINED3D_OK; @@ -6447,7 +6394,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -4341,7 +4689,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4343,7 +4691,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -6459,7 +6406,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4384,7 +4736,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4386,7 +4738,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst context, dst_texture->resource.draw_binding); context_release(context); } @@ -6471,7 +6418,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4408,7 +4764,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4410,7 +4766,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -6483,7 +6430,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4429,7 +4789,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4431,7 +4791,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding); @@ -6495,7 +6442,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4439,7 +4803,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4441,7 +4805,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst { blitter->blit_surface(device, blit_op, filter, src_surface, src_rect, dst_surface, dst_rect, color_key); @@ -6507,7 +6454,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4447,9 +4815,156 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4449,9 +4817,156 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fallback: /* Special cases for render targets. */ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) @@ -7404,24 +7351,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } /* Context activation is done by the caller. */ -@@ -1575,11 +1858,16 @@ static ULONG texture_resource_decref(struct wined3d_resource *resource) - static void texture_resource_preload(struct wined3d_resource *resource) - { - struct wined3d_texture *texture = texture_from_resource(resource); -+#if !defined(STAGING_CSMT) - struct wined3d_context *context; - - context = context_acquire(resource->device, NULL); - wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB); - context_release(context); -+#else /* STAGING_CSMT */ -+ const struct wined3d_device *device = texture->resource.device; -+ wined3d_cs_emit_texture_preload(device->cs, texture); -+#endif /* STAGING_CSMT */ - } - - static void wined3d_texture_unload(struct wined3d_resource *resource) -@@ -1616,8 +1904,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1616,8 +1899,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -7435,7 +7365,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -1642,6 +1935,89 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1642,6 +1930,89 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_unload_gl_texture(texture); } @@ -7525,7 +7455,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) { -@@ -1649,6 +2025,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1649,6 +2020,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour struct wined3d_texture_sub_resource *sub_resource; struct wined3d_device *device = resource->device; unsigned int fmt_flags = resource->format_flags; @@ -7533,7 +7463,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c const struct wined3d_gl_info *gl_info = NULL; struct wined3d_context *context = NULL; struct wined3d_texture *texture; -@@ -1656,6 +2033,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1656,6 +2028,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour unsigned int texture_level; BYTE *base_memory; BOOL ret; @@ -7545,7 +7475,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", resource, sub_resource_idx, map_desc, debug_box(box), flags); -@@ -1702,14 +2084,20 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1702,14 +2079,20 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); @@ -7566,7 +7496,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("WINED3D_MAP_DISCARD flag passed, marking %s as up to date.\n", wined3d_debug_location(texture->resource.map_binding)); if ((ret = wined3d_texture_prepare_location(texture, sub_resource_idx, -@@ -1740,6 +2128,24 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1740,6 +2123,24 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour if (context) context_release(context); @@ -7591,7 +7521,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) { -@@ -1775,6 +2181,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1775,6 +2176,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour } } @@ -7599,7 +7529,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (texture->swapchain && texture->swapchain->front_buffer == texture) { RECT *r = &texture->swapchain->front_buffer_update; -@@ -1786,6 +2193,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1786,6 +2188,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour TRACE("Mapped front buffer %s.\n", wine_dbgstr_rect(r)); } @@ -7607,7 +7537,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c ++resource->map_count; ++sub_resource->map_count; -@@ -1795,14 +2203,71 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1795,14 +2198,71 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour return WINED3D_OK; } @@ -7679,7 +7609,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); -@@ -1818,6 +2283,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1818,6 +2278,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso return WINEDDERR_NOTLOCKED; } @@ -7687,7 +7617,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) { context = context_acquire(device, NULL); -@@ -1838,6 +2304,15 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1838,6 +2299,15 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso else if (resource->format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) { FIXME("Depth / stencil buffer locking is not implemented.\n"); @@ -7703,7 +7633,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } --sub_resource->map_count; -@@ -2070,11 +2545,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2070,11 +2540,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -7727,7 +7657,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } } } -@@ -2211,7 +2698,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2211,7 +2693,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in struct wined3d_context *context, DWORD location) { struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; @@ -7737,7 +7667,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int row_pitch, slice_pitch; TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n", -@@ -2219,6 +2708,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2219,6 +2703,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations)); @@ -7745,7 +7675,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((sub_resource->locations & location) == location) { TRACE("Location(s) already up to date.\n"); -@@ -2232,9 +2722,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2232,9 +2717,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7757,7 +7687,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_DISCARDED) { TRACE("Volume previously discarded, nothing to do.\n"); -@@ -2243,6 +2735,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2243,6 +2730,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in goto done; } @@ -7765,7 +7695,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c switch (location) { case WINED3D_LOCATION_TEXTURE_RGB: -@@ -2258,7 +2751,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2258,7 +2746,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -7777,7 +7707,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); -@@ -2304,7 +2801,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2304,7 +2796,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -7789,7 +7719,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -2327,7 +2828,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2327,7 +2823,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7799,7 +7729,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_validate_location(texture, sub_resource_idx, location); return TRUE; -@@ -2502,6 +3005,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2502,6 +3000,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); @@ -7809,7 +7739,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->resource.map_binding = WINED3D_LOCATION_BUFFER; } -@@ -2858,13 +3364,47 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -2858,13 +3359,47 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -7857,7 +7787,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); -@@ -2882,6 +3422,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -2882,6 +3417,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; @@ -7865,7 +7795,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) context = context_acquire(device, NULL); -@@ -2904,6 +3445,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -2904,6 +3440,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i TRACE("Returning dc %p.\n", *dc); return hr; @@ -7898,7 +7828,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) -@@ -2934,6 +3501,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -2934,6 +3496,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -7906,7 +7836,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D)) wined3d_surface_destroy_dc(surface); -@@ -2942,6 +3510,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -2942,6 +3505,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign wined3d_texture_update_map_binding(texture); if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; @@ -7919,7 +7849,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -4527,7 +4527,11 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w +@@ -4530,7 +4530,11 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -7931,7 +7861,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE; float z_scale = zenable ? 2.0f : 0.0f; float z_offset = zenable ? -1.0f : 0.0f; -@@ -5324,7 +5328,11 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d +@@ -5327,7 +5331,11 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d break; } } @@ -8315,7 +8245,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; -@@ -3018,53 +3162,150 @@ enum wined3d_push_constants +@@ -3018,54 +3162,150 @@ enum wined3d_push_constants WINED3D_PUSH_CONSTANTS_PS_I, WINED3D_PUSH_CONSTANTS_VS_B, WINED3D_PUSH_CONSTANTS_PS_B, @@ -8397,7 +8327,6 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h + enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; +void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs, + struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; +void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffer *buffer, + BYTE *mem) DECLSPEC_HIDDEN; void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, @@ -8421,6 +8350,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; +void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ + void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; @@ -8466,7 +8396,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, -@@ -3094,6 +3335,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -3095,6 +3335,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; @@ -8474,7 +8404,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, -@@ -3101,6 +3343,25 @@ static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d +@@ -3102,6 +3343,24 @@ static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d { cs->ops->push_constants(cs, p, start_idx, count, constants); } @@ -8486,7 +8416,6 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h + void *swap_heap_memory) DECLSPEC_HIDDEN; +void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture *texture, + unsigned int sub_resource_idx, DWORD flags) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; +void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; +void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -8500,7 +8429,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 */ -@@ -3127,6 +3388,9 @@ struct wined3d_buffer +@@ -3128,6 +3387,9 @@ struct wined3d_buffer GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -8510,7 +8439,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3151,11 +3415,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co +@@ -3152,11 +3414,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -8530,7 +8459,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3217,7 +3489,12 @@ struct wined3d_unordered_access_view +@@ -3218,7 +3488,12 @@ struct wined3d_unordered_access_view struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -8543,7 +8472,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3254,6 +3531,10 @@ struct wined3d_swapchain +@@ -3255,6 +3530,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;