diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index d76e8231..7f2cebbb 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "4afc7470fb630035c911a1bf1d48f66bf16c230c" + echo "7fe9858988eabf377ab5e2c64d92f973574b1ae8" } # Show version information 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 60e5bfcf..40b595cf 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 26cdea81d5126f3a38d33d1e4c12a7852a1f6bb1 Mon Sep 17 00:00:00 2001 +From 1ba3d1dcdb9ee4a1d33a333fdac6cd9f4e86443c 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 | 357 +++++++++++++++++++++++++++++++++++++---- - dlls/wined3d/wined3d_main.c | 9 ++ - dlls/wined3d/wined3d_private.h | 18 +++ - 3 files changed, 357 insertions(+), 27 deletions(-) + dlls/wined3d/cs.c | 361 +++++++++++++++++++++++++++++++++++++---- + dlls/wined3d/wined3d_main.c | 9 + + dlls/wined3d/wined3d_private.h | 18 ++ + 3 files changed, 360 insertions(+), 28 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 0224cc6..5e0c537 100644 +index a83459c..3bcbf19 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -24,8 +24,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -33,10 +33,10 @@ index 0224cc6..5e0c537 100644 WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DRAW, -@@ -52,6 +63,18 @@ enum wined3d_cs_op - WINED3D_CS_OP_SET_COLOR_KEY, +@@ -53,6 +64,18 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_RESET_STATE, + WINED3D_CS_OP_DESTROY_OBJECT, + WINED3D_CS_OP_STOP, +}; + @@ -52,8 +52,8 @@ index 0224cc6..5e0c537 100644 }; struct wined3d_cs_present -@@ -252,7 +275,134 @@ struct wined3d_cs_reset_state - enum wined3d_cs_op opcode; +@@ -260,7 +283,134 @@ struct wined3d_cs_destroy_object + void *object; }; -static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) @@ -188,7 +188,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -261,6 +411,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -269,6 +419,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) wined3d_swapchain_set_window(swapchain, op->dst_window_override); swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags); @@ -197,7 +197,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -279,17 +431,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -287,17 +439,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw cs->ops->submit(cs); } @@ -219,7 +219,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -309,7 +464,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -317,7 +472,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * cs->ops->submit(cs); } @@ -228,7 +228,7 @@ index 0224cc6..5e0c537 100644 { struct wined3d_state *state = &cs->device->state; const struct wined3d_cs_draw *op = data; -@@ -323,6 +478,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -331,6 +486,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx, op->index_count, op->start_instance, op->instance_count, op->indexed); @@ -237,7 +237,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, -@@ -342,12 +499,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -350,12 +507,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i cs->ops->submit(cs); } @@ -253,7 +253,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -362,12 +521,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -370,12 +529,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query cs->ops->submit(cs); } @@ -269,7 +269,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -381,12 +542,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -389,12 +550,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi cs->ops->submit(cs); } @@ -285,7 +285,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -400,12 +563,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -408,12 +571,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) cs->ops->submit(cs); } @@ -301,7 +301,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -421,7 +586,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -429,7 +594,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v cs->ops->submit(cs); } @@ -310,7 +310,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_set_depth_stencil_view *op = data; struct wined3d_device *device = cs->device; -@@ -460,6 +625,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -468,6 +633,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -319,7 +319,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -473,12 +640,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -481,12 +648,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -335,7 +335,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -492,7 +661,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -500,7 +669,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -344,7 +344,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -510,6 +679,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -518,6 +687,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); @@ -353,7 +353,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -527,7 +698,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -535,7 +706,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -362,7 +362,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -537,6 +708,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -545,6 +716,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); @@ -371,7 +371,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -552,7 +725,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -560,7 +733,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i cs->ops->submit(cs); } @@ -380,7 +380,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -567,6 +740,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -575,6 +748,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); @@ -389,7 +389,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -583,7 +758,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -591,7 +766,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -398,7 +398,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -599,6 +774,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -607,6 +782,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); @@ -407,7 +407,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -615,7 +792,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -623,7 +800,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff cs->ops->submit(cs); } @@ -416,7 +416,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -629,6 +806,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -637,6 +814,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)); @@ -424,7 +424,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -645,7 +823,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -653,7 +831,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha cs->ops->submit(cs); } @@ -433,7 +433,7 @@ index 0224cc6..5e0c537 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; -@@ -722,6 +900,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -730,6 +908,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); @@ -442,7 +442,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -736,12 +916,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -744,12 +924,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -458,7 +458,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -758,12 +940,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -766,12 +948,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 cs->ops->submit(cs); } @@ -474,7 +474,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -780,13 +964,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -788,13 +972,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -491,7 +491,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -801,12 +987,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -809,12 +995,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -507,7 +507,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -821,12 +1009,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -829,12 +1017,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render cs->ops->submit(cs); } @@ -523,7 +523,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -843,12 +1033,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -851,12 +1041,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, cs->ops->submit(cs); } @@ -539,7 +539,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -865,13 +1057,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -873,13 +1065,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, cs->ops->submit(cs); } @@ -556,7 +556,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -887,12 +1081,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -895,12 +1089,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform cs->ops->submit(cs); } @@ -572,7 +572,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -907,7 +1103,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -915,7 +1111,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const cs->ops->submit(cs); } @@ -581,7 +581,7 @@ index 0224cc6..5e0c537 100644 { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -968,6 +1164,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -976,6 +1172,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -590,7 +590,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -990,12 +1188,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -998,12 +1196,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture cs->ops->submit(cs); } @@ -606,7 +606,7 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1009,7 +1209,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1017,7 +1217,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma cs->ops->submit(cs); } @@ -615,7 +615,7 @@ index 0224cc6..5e0c537 100644 { struct wined3d_adapter *adapter = cs->device->adapter; HRESULT hr; -@@ -1019,6 +1219,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +@@ -1027,6 +1227,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); @@ -624,7 +624,22 @@ index 0224cc6..5e0c537 100644 } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1031,8 +1233,9 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1039,11 +1241,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) + cs->ops->submit(cs); + } + +-static void wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) ++static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) + { + const struct wined3d_cs_destroy_object *op = data; + + op->callback(op->object); ++ ++ return sizeof(*op); + } + + void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) +@@ -1058,8 +1262,9 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void cs->ops->submit(cs); } @@ -635,7 +650,7 @@ index 0224cc6..5e0c537 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, -@@ -1091,6 +1294,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = +@@ -1119,6 +1324,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = wined3d_cs_st_submit, }; @@ -694,7 +709,7 @@ index 0224cc6..5e0c537 100644 struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -1117,12 +1372,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1145,12 +1402,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) return NULL; } @@ -783,7 +798,7 @@ index 434d32e..beeb9fa 100644 if (appkey) RegCloseKey( appkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 427a119..84405f2 100644 +index 7bb86d6..d37f30e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -309,6 +309,7 @@ struct wined3d_settings diff --git a/patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-the-CS-before-destroying-views.patch b/patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-the-CS-before-destroying-views.patch index 6b10b373..28f98e42 100644 --- a/patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-the-CS-before-destroying-views.patch +++ b/patches/wined3d-CSMT_Main/0013-wined3d-Wait-for-the-CS-before-destroying-views.patch @@ -1,22 +1,20 @@ -From 2dd5269b65ca49e2fb0b1d569e9a72366cb5da41 Mon Sep 17 00:00:00 2001 +From 2172828bc75b410e54530ced4d11bbf8aaf41ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 24 Apr 2016 13:51:03 +0100 Subject: wined3d: Wait for the CS before destroying views. --- - dlls/wined3d/view.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) + dlls/wined3d/view.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index 1604443..adc6b2c 100644 +index e9e62d1..b4bc771 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c -@@ -41,6 +41,14 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v - - if (!refcount) +@@ -48,6 +48,12 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v { -+ struct wined3d_device *device = view->resource->device; -+ + struct wined3d_device *device = view->resource->device; + + if (wined3d_settings.cs_multithreaded) + { + FIXME("Waiting for cs.\n"); @@ -26,25 +24,15 @@ index 1604443..adc6b2c 100644 /* Call wined3d_object_destroyed() before releasing the resource, * since releasing the resource may end up destroying the parent. */ view->parent_ops->wined3d_object_destroyed(view->parent); -@@ -185,6 +193,14 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v - - if (!refcount) +@@ -230,6 +236,12 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v { -+ struct wined3d_device *device = view->resource->device; -+ + struct wined3d_device *device = view->resource->device; + + if (wined3d_settings.cs_multithreaded) + { + FIXME("Waiting for cs.\n"); + device->cs->ops->finish(device->cs); + } -+ - if (view->object) - { - const struct wined3d_gl_info *gl_info; -@@ -196,6 +212,7 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v - checkGLcall("glDeleteTextures"); - context_release(context); - } + /* Call wined3d_object_destroyed() before releasing the resource, * since releasing the resource may end up destroying the parent. */ 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 d68d886a..c9f49f0b 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 570923096c7d723b11def8056265f42e188434e7 Mon Sep 17 00:00:00 2001 +From d9d7cda0f5c3aae336843cceddecb3464db7e4f2 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,19 +10,19 @@ 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 ccde86b..1ce55c6 100644 +index 185def9..b128af1 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -63,6 +63,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_SET_COLOR_KEY, +@@ -64,6 +64,7 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_RESET_STATE, + WINED3D_CS_OP_DESTROY_OBJECT, + WINED3D_CS_OP_STATEBLOCK, WINED3D_CS_OP_STOP, }; -@@ -275,6 +276,12 @@ struct wined3d_cs_reset_state - enum wined3d_cs_op opcode; +@@ -283,6 +284,12 @@ struct wined3d_cs_destroy_object + void *object; }; +struct wined3d_cs_stateblock @@ -34,7 +34,7 @@ index ccde86b..1ce55c6 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) { -@@ -439,7 +446,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -447,7 +454,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 ccde86b..1ce55c6 100644 device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, &cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags, &op->color, op->depth, op->stencil); -@@ -466,7 +473,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -474,7 +481,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 ccde86b..1ce55c6 100644 const struct wined3d_cs_draw *op = data; if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] -@@ -912,6 +919,55 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -920,6 +927,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 ccde86b..1ce55c6 100644 cs->ops->submit(cs); } -@@ -1262,6 +1318,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, +@@ -1292,6 +1348,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, + /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, + /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock, }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -@@ -1351,7 +1408,7 @@ done: +@@ -1381,7 +1438,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 ccde86b..1ce55c6 100644 if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; -@@ -1359,8 +1416,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1389,8 +1446,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 ccde86b..1ce55c6 100644 } cs->ops = &wined3d_cs_st_ops; -@@ -1369,17 +1425,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1399,17 +1455,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 ccde86b..1ce55c6 100644 } if (wined3d_settings.cs_multithreaded) -@@ -1392,15 +1444,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1422,15 +1474,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"); @@ -212,7 +212,7 @@ index d48fbfa..33b7fc3 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 b6bbb9f..662f326 100644 +index d4903f7..f27dc4e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2917,7 +2917,7 @@ struct wined3d_cs_block @@ -224,7 +224,7 @@ index b6bbb9f..662f326 100644 }; struct wined3d_cs_ops -@@ -2958,6 +2958,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -2960,6 +2960,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 921e8608..973a2aec 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 5d9fe669f53bba48569e58eab46b21da0e0b322d Mon Sep 17 00:00:00 2001 +From 7d7e3691cdb6482d0873883abc6a611e30f57edb 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,19 +10,19 @@ Subject: wined3d: Send float constant updates through the command stream 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 55cd5d6..2668244 100644 +index b128af1..1c1987a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -64,6 +64,8 @@ enum wined3d_cs_op - WINED3D_CS_OP_SET_MATERIAL, +@@ -65,6 +65,8 @@ enum wined3d_cs_op WINED3D_CS_OP_RESET_STATE, + WINED3D_CS_OP_DESTROY_OBJECT, WINED3D_CS_OP_STATEBLOCK, + WINED3D_CS_OP_SET_VS_CONSTS_F, + WINED3D_CS_OP_SET_PS_CONSTS_F, WINED3D_CS_OP_STOP, }; -@@ -280,6 +282,14 @@ struct wined3d_cs_stateblock +@@ -290,6 +292,14 @@ struct wined3d_cs_stateblock struct wined3d_state state; }; @@ -37,7 +37,7 @@ index 55cd5d6..2668244 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) { -@@ -922,11 +932,9 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi +@@ -942,11 +952,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 55cd5d6..2668244 100644 memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights)); -@@ -948,11 +956,9 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win +@@ -967,11 +975,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 55cd5d6..2668244 100644 /* FIXME: This is not ideal. CS is still running synchronously, so this is ok. * It will go away soon anyway. */ -@@ -1032,6 +1038,64 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1051,6 +1057,64 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -126,9 +126,9 @@ index 55cd5d6..2668244 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; -@@ -1308,6 +1372,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, +@@ -1349,6 +1413,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, + /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, /* WINED3D_CS_OP_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, @@ -136,10 +136,10 @@ index 55cd5d6..2668244 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 5c10851..0142691 100644 +index 33b7fc3..4b2ea91 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -2501,7 +2501,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, +@@ -2518,7 +2518,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, memset(&device->recording->changed.vs_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.vs_consts_f)); else @@ -149,7 +149,7 @@ index 5c10851..0142691 100644 return WINED3D_OK; } -@@ -2735,7 +2736,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, +@@ -2752,7 +2753,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, memset(&device->recording->changed.ps_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.ps_consts_f)); else @@ -160,10 +160,10 @@ index 5c10851..0142691 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index b167921..796a3d0 100644 +index f27dc4e..07ca86c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2949,6 +2949,8 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -2996,6 +2996,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/0024-wined3d-Send-bool-constant-updates-through-the-comma.patch b/patches/wined3d-CSMT_Main/0024-wined3d-Send-bool-constant-updates-through-the-comma.patch index 59120242..7219c4c3 100644 --- a/patches/wined3d-CSMT_Main/0024-wined3d-Send-bool-constant-updates-through-the-comma.patch +++ b/patches/wined3d-CSMT_Main/0024-wined3d-Send-bool-constant-updates-through-the-comma.patch @@ -1,4 +1,4 @@ -From 60240619668343b3c9e6c7aac3b3f053a0d3aa5b Mon Sep 17 00:00:00 2001 +From e7526c85b4cb8c71e64234c9a3fa932f80261aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 9 Apr 2013 21:50:30 +0200 Subject: wined3d: Send bool constant updates through the command stream @@ -10,11 +10,11 @@ Subject: wined3d: Send bool constant updates through the command stream 3 files changed, 76 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 4f4f21b..4c9e11e 100644 +index d240c33..ff98e30 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -65,7 +65,9 @@ enum wined3d_cs_op - WINED3D_CS_OP_RESET_STATE, +@@ -66,7 +66,9 @@ enum wined3d_cs_op + WINED3D_CS_OP_DESTROY_OBJECT, WINED3D_CS_OP_STATEBLOCK, WINED3D_CS_OP_SET_VS_CONSTS_F, + WINED3D_CS_OP_SET_VS_CONSTS_B, @@ -23,7 +23,7 @@ index 4f4f21b..4c9e11e 100644 WINED3D_CS_OP_GLFINISH, WINED3D_CS_OP_SET_BASE_VERTEX_INDEX, WINED3D_CS_OP_SET_PRIMITIVE_TYPE, -@@ -293,6 +295,14 @@ struct wined3d_cs_set_consts_f +@@ -303,6 +305,14 @@ struct wined3d_cs_set_consts_f struct wined3d_vec4 constants[1]; }; @@ -38,7 +38,7 @@ index 4f4f21b..4c9e11e 100644 struct wined3d_cs_finish { enum wined3d_cs_op opcode; -@@ -961,10 +971,8 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi +@@ -982,10 +992,8 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi /* Don't memcpy the entire struct, we'll remove single items as we add dedicated * ops for setting states */ @@ -49,7 +49,7 @@ index 4f4f21b..4c9e11e 100644 memcpy(cs->state.ps_consts_i, op->state.ps_consts_i, sizeof(cs->state.ps_consts_i)); memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights)); -@@ -981,10 +989,8 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win +@@ -1002,10 +1010,8 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win /* Don't memcpy the entire struct, we'll remove single items as we add dedicated * ops for setting states */ @@ -60,7 +60,7 @@ index 4f4f21b..4c9e11e 100644 memcpy(op->state.ps_consts_i, state->ps_consts_i, sizeof(op->state.ps_consts_i)); /* FIXME: This is not ideal. CS is still running synchronously, so this is ok. -@@ -1143,6 +1149,62 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1164,6 +1170,62 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->value = value; cs->ops->submit(cs); @@ -123,8 +123,8 @@ index 4f4f21b..4c9e11e 100644 } static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data) -@@ -1471,7 +1533,9 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, +@@ -1514,7 +1576,9 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, /* 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, @@ -134,10 +134,10 @@ index 4f4f21b..4c9e11e 100644 /* 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, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 799d235..dfb4ceb 100644 +index 0b8534a..1b2e7e3 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -2353,7 +2353,7 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3 +@@ -2370,7 +2370,7 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3 return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx]; } @@ -146,7 +146,7 @@ index 799d235..dfb4ceb 100644 { UINT i; -@@ -2390,7 +2390,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, +@@ -2407,7 +2407,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, } else { @@ -156,7 +156,7 @@ index 799d235..dfb4ceb 100644 } return WINED3D_OK; -@@ -2624,7 +2625,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, +@@ -2641,7 +2642,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, } else { @@ -167,10 +167,10 @@ index 799d235..dfb4ceb 100644 return WINED3D_OK; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 834a551..4fd446e 100644 +index 016c5c6..eb91406 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2369,6 +2369,7 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2416,6 +2416,7 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; @@ -178,7 +178,7 @@ index 834a551..4fd446e 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2949,6 +2950,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, +@@ -2996,6 +2997,8 @@ 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_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; 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 7596af9b..482f6195 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 75acb9a0c48ad7285a75dfd319e19e551c7a88f2 Mon Sep 17 00:00:00 2001 +From fb8eb9da970ffe7ce1d39a233375e113c8c5d48c 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 943375a..e632d25 100644 +index a7b8f79..556edc0 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -63,7 +63,6 @@ enum wined3d_cs_op - WINED3D_CS_OP_SET_COLOR_KEY, +@@ -64,7 +64,6 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_RESET_STATE, + WINED3D_CS_OP_DESTROY_OBJECT, - 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, -@@ -73,6 +72,8 @@ enum wined3d_cs_op +@@ -74,6 +73,8 @@ enum wined3d_cs_op WINED3D_CS_OP_GLFINISH, WINED3D_CS_OP_SET_BASE_VERTEX_INDEX, WINED3D_CS_OP_SET_PRIMITIVE_TYPE, @@ -30,8 +30,8 @@ index 943375a..e632d25 100644 WINED3D_CS_OP_STOP, }; -@@ -285,12 +286,6 @@ struct wined3d_cs_reset_state - enum wined3d_cs_op opcode; +@@ -293,12 +294,6 @@ struct wined3d_cs_destroy_object + void *object; }; -struct wined3d_cs_stateblock @@ -43,7 +43,7 @@ index 943375a..e632d25 100644 struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -332,6 +327,19 @@ struct wined3d_cs_set_primitive_type +@@ -340,6 +335,19 @@ struct wined3d_cs_set_primitive_type GLenum gl_primitive_type; }; @@ -63,7 +63,7 @@ index 943375a..e632d25 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) { -@@ -988,35 +996,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -996,35 +1004,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -99,7 +99,7 @@ index 943375a..e632d25 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; -@@ -1575,6 +1554,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -1604,6 +1583,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ cs->ops->submit(cs); } @@ -252,15 +252,15 @@ index 943375a..e632d25 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -1604,7 +1729,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, +@@ -1634,7 +1759,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, + /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, - /* 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, -@@ -1614,6 +1738,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1644,6 +1768,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, @@ -356,7 +356,7 @@ index 766e393..cb6f2ee 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 7c7009b..cd42a74 100644 +index fe1cd27..0cf9522 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2913,7 +2913,9 @@ struct wined3d_cs_block @@ -370,7 +370,7 @@ index 7c7009b..cd42a74 100644 }; struct wined3d_cs_ops -@@ -2957,8 +2959,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -2959,8 +2961,6 @@ 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; @@ -379,7 +379,7 @@ index 7c7009b..cd42a74 100644 void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -3004,6 +3004,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, +@@ -3006,6 +3006,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, UINT base_vertex_index) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_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 b87943f2..439fe2ff 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 4e89489b010072ddcd86bdd213efa01edc6aa12e Mon Sep 17 00:00:00 2001 +From 3ffcccfe4b97290f5a206933ce25b0737806066b 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 | 363 +++++++++++++++++------------------------ + dlls/wined3d/cs.c | 365 +++++++++++++++++------------------------ dlls/wined3d/wined3d_private.h | 20 +-- - 2 files changed, 161 insertions(+), 222 deletions(-) + 2 files changed, 162 insertions(+), 223 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 5397fc7..ae9ef50 100644 +index 68c7142..d1eb571 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -22,20 +22,10 @@ @@ -35,7 +35,7 @@ index 5397fc7..ae9ef50 100644 WINED3D_CS_OP_FENCE, WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, -@@ -383,99 +373,30 @@ struct wined3d_cs_texture_unmap +@@ -392,99 +382,30 @@ struct wined3d_cs_texture_unmap unsigned int sub_resource_idx; }; @@ -149,7 +149,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_fence(struct wined3d_cs *cs, const void *data) -@@ -496,14 +417,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) +@@ -505,14 +426,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 5397fc7..ae9ef50 100644 /* A busy wait should be fine, we're not supposed to have to wait very * long. */ -@@ -542,7 +463,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -551,7 +472,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw pending = InterlockedIncrement(&cs->pending_presents); @@ -175,7 +175,7 @@ index 5397fc7..ae9ef50 100644 while (pending > 1) pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0); -@@ -568,8 +489,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -577,8 +498,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { struct wined3d_cs_clear *op; @@ -186,7 +186,7 @@ index 5397fc7..ae9ef50 100644 op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -578,7 +499,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -587,7 +508,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * op->rect_count = rect_count; memcpy(op->rects, rects, sizeof(*rects) * rect_count); @@ -195,7 +195,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) -@@ -619,7 +540,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun +@@ -637,7 +558,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i op->instance_count = instance_count; op->indexed = indexed; @@ -204,7 +204,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data) -@@ -641,7 +562,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -659,7 +580,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data) -@@ -662,7 +583,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -680,7 +601,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data) -@@ -683,7 +604,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -701,7 +622,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) -@@ -706,7 +627,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -724,7 +645,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data) -@@ -760,7 +681,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -778,7 +699,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data) -@@ -781,7 +702,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -799,7 +720,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) -@@ -818,7 +739,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -836,7 +757,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) -@@ -845,7 +766,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -863,7 +784,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) -@@ -878,7 +799,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -896,7 +817,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) -@@ -912,7 +833,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -930,7 +851,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) -@@ -943,7 +864,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -961,7 +882,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) -@@ -1035,7 +956,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1053,7 +974,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data) -@@ -1059,7 +980,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1077,7 +998,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) -@@ -1083,7 +1004,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1101,7 +1022,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) -@@ -1106,7 +1027,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1124,7 +1045,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 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_vs_consts_f(struct wined3d_cs *cs, const void *data) -@@ -1139,8 +1060,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1157,8 +1078,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; @@ -350,7 +350,7 @@ index 5397fc7..ae9ef50 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1164,7 +1086,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1182,7 +1104,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); @@ -359,7 +359,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) -@@ -1186,8 +1108,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1204,8 +1126,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->state = state; op->value = value; @@ -370,7 +370,7 @@ index 5397fc7..ae9ef50 100644 static UINT wined3d_cs_exec_set_vs_consts_b(struct wined3d_cs *cs, const void *data) { -@@ -1217,8 +1139,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1235,8 +1157,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; @@ -381,7 +381,7 @@ index 5397fc7..ae9ef50 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1242,7 +1165,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1260,7 +1183,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); @@ -390,7 +390,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_vs_consts_i(struct wined3d_cs *cs, const void *data) -@@ -1273,8 +1196,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1291,8 +1214,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; @@ -401,7 +401,7 @@ index 5397fc7..ae9ef50 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1298,7 +1222,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1316,7 +1240,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); @@ -410,7 +410,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data) -@@ -1322,7 +1246,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1340,7 +1264,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, op->state = state; op->value = value; @@ -419,7 +419,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data) -@@ -1346,7 +1270,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1364,7 +1288,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, op->state = state; op->value = value; @@ -428,7 +428,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) -@@ -1370,7 +1294,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1388,7 +1312,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform op->state = state; op->matrix = *matrix; @@ -437,7 +437,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data) -@@ -1392,7 +1316,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1410,7 +1334,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const op->plane_idx = plane_idx; op->plane = *plane; @@ -446,7 +446,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) -@@ -1477,7 +1401,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1495,7 +1419,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -455,7 +455,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data) -@@ -1498,7 +1422,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1516,7 +1440,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; @@ -464,16 +464,25 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) -@@ -1522,7 +1446,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1540,7 +1464,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; +- cs->ops->submit(cs); ++ cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) +@@ -1561,7 +1485,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void + op->callback = callback; + op->object = object; + - cs->ops->submit(cs); + cs->ops->submit(cs, sizeof(*op)); } static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data) -@@ -1548,7 +1472,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -1587,7 +1511,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_GLFINISH; @@ -482,7 +491,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_base_vertex_index(struct wined3d_cs *cs, const void *data) -@@ -1570,7 +1494,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, +@@ -1609,7 +1533,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; @@ -491,7 +500,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data) -@@ -1596,7 +1520,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -1635,7 +1559,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; @@ -500,7 +509,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) -@@ -1653,7 +1577,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light +@@ -1692,7 +1616,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; @@ -509,7 +518,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data) -@@ -1742,7 +1666,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab +@@ -1781,7 +1705,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab op->idx = idx; op->enable = enable; @@ -518,7 +527,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) -@@ -1774,7 +1698,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -1813,7 +1737,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf if (fx) op->fx = *fx; @@ -527,7 +536,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) -@@ -1807,7 +1731,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -1846,7 +1770,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge op->stencil = stencil; op->blitter = blitter; @@ -536,7 +545,7 @@ index 5397fc7..ae9ef50 100644 } static UINT wined3d_cs_exec_texture_map(struct wined3d_cs *cs, const void *data) -@@ -1832,12 +1756,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture +@@ -1871,12 +1795,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture op->flags = flags; op->mem = &ret; @@ -552,7 +561,7 @@ index 5397fc7..ae9ef50 100644 return ret; } -@@ -1860,11 +1786,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture +@@ -1899,11 +1825,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture op->texture = texture; op->sub_resource_idx = sub_resource_idx; @@ -567,7 +576,7 @@ index 5397fc7..ae9ef50 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, -@@ -1909,42 +1837,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1949,42 +1877,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, }; @@ -650,7 +659,7 @@ index 5397fc7..ae9ef50 100644 }; /* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -@@ -1956,9 +1901,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) +@@ -1996,9 +1941,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; @@ -690,7 +699,7 @@ index 5397fc7..ae9ef50 100644 void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) { -@@ -1982,31 +1956,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, +@@ -2022,31 +1996,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; @@ -737,7 +746,7 @@ index 5397fc7..ae9ef50 100644 } done: -@@ -2031,25 +2006,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2071,25 +2046,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) cs->ops = &wined3d_cs_st_ops; cs->device = device; @@ -763,7 +772,7 @@ index 5397fc7..ae9ef50 100644 if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL))) { ERR("Failed to create wined3d command stream thread.\n"); -@@ -2061,12 +2021,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2101,12 +2061,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) err: if (cs) @@ -776,7 +785,7 @@ index 5397fc7..ae9ef50 100644 HeapFree(GetProcessHeap(), 0, cs); return NULL; } -@@ -2085,17 +2040,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -2125,17 +2080,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) CloseHandle(cs->thread); if (ret != WAIT_OBJECT_0) ERR("Wait failed (%#x).\n", ret); @@ -795,7 +804,7 @@ index 5397fc7..ae9ef50 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 51eb280..e13880a 100644 +index 159f79e..4ea1f51 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -31,6 +31,7 @@ @@ -806,7 +815,7 @@ index 51eb280..e13880a 100644 #include #include #include -@@ -2898,19 +2899,17 @@ struct wined3d_cs_list +@@ -2916,19 +2917,17 @@ struct wined3d_cs_list struct list blocks; }; @@ -831,7 +840,7 @@ index 51eb280..e13880a 100644 void (*finish)(struct wined3d_cs *cs); }; -@@ -2921,14 +2920,9 @@ struct wined3d_cs +@@ -2939,14 +2938,9 @@ struct wined3d_cs struct wined3d_state state; HANDLE thread; DWORD thread_id; diff --git a/patches/wined3d-CSMT_Main/0089-wined3d-Destroy-views-through-the-CS.patch b/patches/wined3d-CSMT_Main/0089-wined3d-Destroy-views-through-the-CS.patch index c5c858ea..932566e8 100644 --- a/patches/wined3d-CSMT_Main/0089-wined3d-Destroy-views-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0089-wined3d-Destroy-views-through-the-CS.patch @@ -1,92 +1,18 @@ -From 6b9da441bf00c2b644a4bc85dcfea976f78edae3 Mon Sep 17 00:00:00 2001 +From 21fc0b94f7981bc3bc1450835abd5534723072c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 21 Aug 2014 22:47:58 +0200 Subject: wined3d: Destroy views through the CS. Move this ahead. This has caused sporadic test failures ever since blits were moved to the CS. --- - dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++ - dlls/wined3d/view.c | 13 ++++++------- - dlls/wined3d/wined3d_private.h | 3 +++ - 3 files changed, 37 insertions(+), 7 deletions(-) + dlls/wined3d/view.c | 6 ------ + 1 file changed, 6 deletions(-) -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index f0b21c0..ecb9d9e 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -78,6 +78,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_UPDATE_TEXTURE, - WINED3D_CS_OP_EVICT_RESOURCE, - WINED3D_CS_OP_UPDATE_SUB_RESOURCE, -+ WINED3D_CS_OP_VIEW_DESTROY, - WINED3D_CS_OP_STOP, - }; - -@@ -454,6 +455,12 @@ struct wined3d_cs_buffer_preload - struct wined3d_buffer *buffer; - }; - -+struct wined3d_cs_view_destroy -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_rendertarget_view *view; -+}; -+ - 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); -@@ -2334,6 +2341,26 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_view_destroy(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_view_destroy *op = data; -+ -+ wined3d_rendertarget_view_destroy(op->view); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -+{ -+ struct wined3d_cs_view_destroy *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_VIEW_DESTROY; -+ op->view = view; -+ -+ 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, -@@ -2390,6 +2417,7 @@ 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_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, - /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, -+ /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, - }; - - static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index 5ad4ab0..1a8e88c 100644 +index b4bc771..2147cc7 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c -@@ -33,6 +33,11 @@ ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *v - return refcount; - } - -+void wined3d_rendertarget_view_destroy(struct wined3d_rendertarget_view *view) -+{ -+ HeapFree(GetProcessHeap(), 0, view); -+} -+ - ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view) - { - ULONG refcount = InterlockedDecrement(&view->refcount); -@@ -43,17 +48,11 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v +@@ -48,12 +48,6 @@ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *v { struct wined3d_device *device = view->resource->device; @@ -99,33 +25,6 @@ index 5ad4ab0..1a8e88c 100644 /* Call wined3d_object_destroyed() before releasing the resource, * since releasing the resource may end up destroying the parent. */ view->parent_ops->wined3d_object_destroyed(view->parent); - wined3d_resource_decref(view->resource); -- HeapFree(GetProcessHeap(), 0, view); -+ wined3d_cs_emit_view_destroy(device->cs, view); - } - - return refcount; -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index b5b0246..4714ca7 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3038,6 +3038,7 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe - 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_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -@@ -3162,6 +3163,8 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface( - return texture->sub_resources[view->sub_resource_idx].u.surface; - } - -+void wined3d_rendertarget_view_destroy(struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; -+ - struct wined3d_shader_resource_view - { - LONG refcount; -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0091-wined3d-Destroy-vertex-declarations-through-the-CS.patch b/patches/wined3d-CSMT_Main/0091-wined3d-Destroy-vertex-declarations-through-the-CS.patch index f6fa0e37..6b1f0d20 100644 --- a/patches/wined3d-CSMT_Main/0091-wined3d-Destroy-vertex-declarations-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0091-wined3d-Destroy-vertex-declarations-through-the-CS.patch @@ -1,85 +1,24 @@ -From 6d92669e1105b8631d662e6a9b1fd563e93ba090 Mon Sep 17 00:00:00 2001 +From 60b42d6c2c6d5d2ce0dde5925a5873a4a051842e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 31 Jul 2013 23:06:27 +0200 Subject: wined3d: Destroy vertex declarations through the CS --- - dlls/wined3d/cs.c | 29 +++++++++++++++++++++++++++++ - dlls/wined3d/vertexdeclaration.c | 15 ++++++++------- - dlls/wined3d/wined3d_private.h | 4 ++++ - 3 files changed, 41 insertions(+), 7 deletions(-) + dlls/wined3d/vertexdeclaration.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index ecb9d9e..9b195f9 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -79,6 +79,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_EVICT_RESOURCE, - WINED3D_CS_OP_UPDATE_SUB_RESOURCE, - WINED3D_CS_OP_VIEW_DESTROY, -+ WINED3D_CS_OP_VDECL_DESTROY, - WINED3D_CS_OP_STOP, - }; - -@@ -461,6 +462,12 @@ struct wined3d_cs_view_destroy - struct wined3d_rendertarget_view *view; - }; - -+struct wined3d_cs_vertex_declaration_destroy -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_vertex_declaration *declaration; -+}; -+ - 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); -@@ -2361,6 +2368,27 @@ void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_renderta - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_vertex_declaration_destroy(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_vertex_declaration_destroy *op = data; -+ -+ wined3d_vertex_declaration_destroy(op->declaration); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, -+ struct wined3d_vertex_declaration *declaration) -+{ -+ struct wined3d_cs_vertex_declaration_destroy *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_VDECL_DESTROY; -+ op->declaration = declaration; -+ -+ 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, -@@ -2418,6 +2446,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, - /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, - /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, -+ /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, - }; - - static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c -index 601a5f5..2a1f6a2 100644 +index 3349f4f..808e092 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c -@@ -50,6 +50,12 @@ ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration +@@ -50,6 +50,14 @@ ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration return refcount; } -+void wined3d_vertex_declaration_destroy(struct wined3d_vertex_declaration *declaration) ++static void wined3d_vertex_declaration_destroy_object(void *object) +{ ++ struct wined3d_vertex_declaration *declaration = object; ++ + HeapFree(GetProcessHeap(), 0, declaration->elements); + HeapFree(GetProcessHeap(), 0, declaration); +} @@ -87,7 +26,7 @@ index 601a5f5..2a1f6a2 100644 ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration) { ULONG refcount = InterlockedDecrement(&declaration->ref); -@@ -58,14 +64,9 @@ ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration +@@ -58,14 +66,9 @@ ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration if (!refcount) { @@ -100,32 +39,10 @@ index 601a5f5..2a1f6a2 100644 + const struct wined3d_device *device = declaration->device; declaration->parent_ops->wined3d_object_destroyed(declaration->parent); - HeapFree(GetProcessHeap(), 0, declaration); -+ wined3d_cs_emit_vertex_declaration_destroy(device->cs, declaration); ++ wined3d_cs_emit_destroy_object(device->cs, wined3d_vertex_declaration_destroy_object, declaration); } return refcount; -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 4714ca7..a6b8142 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -2834,6 +2834,8 @@ struct wined3d_vertex_declaration - BOOL half_float_conv_needed; - }; - -+void wined3d_vertex_declaration_destroy(struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; -+ - struct wined3d_saved_states - { - DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1]; -@@ -3039,6 +3041,8 @@ 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_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, -+ struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0092-wined3d-Destroy-shaders-through-the-CS.patch b/patches/wined3d-CSMT_Main/0092-wined3d-Destroy-shaders-through-the-CS.patch index 2d3323bc..64ef72f0 100644 --- a/patches/wined3d-CSMT_Main/0092-wined3d-Destroy-shaders-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0092-wined3d-Destroy-shaders-through-the-CS.patch @@ -1,89 +1,32 @@ -From 2c2611d940789f2697c8eb515b284fafd53a0f5f Mon Sep 17 00:00:00 2001 +From 2bba243cce7043d8cbac3f670d994a032db0fc77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 31 Jul 2013 23:18:28 +0200 Subject: wined3d: Destroy shaders through the CS --- - dlls/wined3d/cs.c | 29 +++++++++++++++++++++++++++++ - dlls/wined3d/shader.c | 12 ++++-------- - dlls/wined3d/wined3d_private.h | 2 ++ - 3 files changed, 35 insertions(+), 8 deletions(-) + dlls/wined3d/shader.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 9b195f9..b58cc89 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -80,6 +80,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_UPDATE_SUB_RESOURCE, - WINED3D_CS_OP_VIEW_DESTROY, - WINED3D_CS_OP_VDECL_DESTROY, -+ WINED3D_CS_OP_SHADER_CLEANUP, - WINED3D_CS_OP_STOP, - }; - -@@ -468,6 +469,12 @@ struct wined3d_cs_vertex_declaration_destroy - struct wined3d_vertex_declaration *declaration; - }; - -+struct wined3d_cs_shader_cleanup -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_shader *shader; -+}; -+ - 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); -@@ -2389,6 +2396,27 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_shader_cleanup(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_shader_cleanup *op = data; -+ -+ shader_cleanup(op->shader); -+ HeapFree(GetProcessHeap(), 0, op->shader); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) -+{ -+ struct wined3d_cs_shader_cleanup *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SHADER_CLEANUP; -+ op->shader = shader; -+ -+ 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, -@@ -2447,6 +2475,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, - /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, - /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, -+ /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, - }; - - static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index 21ecdd5..8b10fa5 100644 +index 72ea8bc..f5e29b4 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2309,7 +2309,7 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe - string_buffer_free(&buffer); +@@ -2612,6 +2612,14 @@ ULONG CDECL wined3d_shader_incref(struct wined3d_shader *shader) + return refcount; } --static void shader_cleanup(struct wined3d_shader *shader) -+void shader_cleanup(struct wined3d_shader *shader) ++static void wined3d_shader_destroy_object(void *object) ++{ ++ struct wined3d_shader *shader = object; ++ ++ shader_cleanup(shader); ++ HeapFree(GetProcessHeap(), 0, shader); ++} ++ + ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) { - HeapFree(GetProcessHeap(), 0, shader->output_signature.elements); - HeapFree(GetProcessHeap(), 0, shader->input_signature.elements); -@@ -2578,14 +2578,10 @@ ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) + ULONG refcount = InterlockedDecrement(&shader->ref); +@@ -2620,14 +2628,10 @@ ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) if (!refcount) { @@ -97,30 +40,10 @@ index 21ecdd5..8b10fa5 100644 + shader->parent_ops->wined3d_object_destroyed(shader->parent); - HeapFree(GetProcessHeap(), 0, shader); -+ wined3d_cs_emit_shader_cleanup(device->cs, shader); ++ wined3d_cs_emit_destroy_object(device->cs, wined3d_shader_destroy_object, shader); } return refcount; -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index a6b8142..44a77ce 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3043,6 +3043,7 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer - void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; - void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, - struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -@@ -3425,6 +3426,7 @@ unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_map - void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, - const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; - BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; -+void shader_cleanup(struct wined3d_shader *shader) DECLSPEC_HIDDEN; - - static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) - { -- 2.8.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 6120113e..bc4f69d8 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 c7a8885b345150606ee93c1ada440109f8e26126 Mon Sep 17 00:00:00 2001 +From 9b3cf0aa76222ef02934a1689065411f5a2c3ac2 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. @@ -44,19 +44,19 @@ index 5566c1e..b611daf 100644 flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index bd40193..badc0b1 100644 +index 477af0b..f501fa4 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -81,6 +81,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_VIEW_DESTROY, - WINED3D_CS_OP_VDECL_DESTROY, - WINED3D_CS_OP_SHADER_CLEANUP, +@@ -79,6 +79,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_UPDATE_TEXTURE, + WINED3D_CS_OP_EVICT_RESOURCE, + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_CREATE_VBO, WINED3D_CS_OP_STOP, }; -@@ -478,6 +479,12 @@ struct wined3d_cs_shader_cleanup - struct wined3d_shader *shader; +@@ -467,6 +468,12 @@ struct wined3d_cs_buffer_preload + struct wined3d_buffer *buffer; }; +struct wined3d_cs_create_vbo @@ -68,7 +68,7 @@ index bd40193..badc0b1 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); -@@ -2411,6 +2418,30 @@ void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader +@@ -2370,6 +2377,30 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer cs->ops->submit(cs, sizeof(*op)); } @@ -99,27 +99,27 @@ index bd40193..badc0b1 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2470,6 +2501,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, - /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, - /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, +@@ -2427,6 +2458,7 @@ 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_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, }; 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 4bf5313..0cfe28a 100644 +index 399e310..012494d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3066,6 +3066,7 @@ void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_renderta - void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, - struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; - void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN; +@@ -3085,6 +3085,7 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe + 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_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3158,6 +3159,8 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, +@@ -3177,6 +3178,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/0094-wined3d-Clean-up-resource-data-through-the-CS.patch b/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch index 6ead0b43..89c20ec4 100644 --- a/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch @@ -1,4 +1,4 @@ -From 790ed84dedaba0c7dbbb31c28d6d304cf92c312b Mon Sep 17 00:00:00 2001 +From c2e47132931b0ace4129f74f3905732be5575277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 2 Oct 2013 22:38:51 +0200 Subject: wined3d: Clean up resource data through the CS. @@ -13,10 +13,10 @@ Subject: wined3d: Clean up resource data through the CS. 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 62360c0..348a24a 100644 +index b611daf..e1ce265 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -571,6 +571,9 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) +@@ -570,6 +570,9 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) } resource_cleanup(&buffer->resource); @@ -26,7 +26,7 @@ index 62360c0..348a24a 100644 buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); HeapFree(GetProcessHeap(), 0, buffer->maps); HeapFree(GetProcessHeap(), 0, buffer); -@@ -1357,6 +1360,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1354,6 +1357,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device ERR("Out of memory.\n"); buffer_unload(&buffer->resource); resource_cleanup(&buffer->resource); @@ -35,7 +35,7 @@ index 62360c0..348a24a 100644 return E_OUTOFMEMORY; } buffer->maps_size = 1; -@@ -1367,6 +1372,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1364,6 +1369,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer_unload(&buffer->resource); resource_cleanup(&buffer->resource); HeapFree(GetProcessHeap(), 0, buffer->maps); @@ -45,18 +45,18 @@ index 62360c0..348a24a 100644 } diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index badc0b1..d727e71 100644 +index f501fa4..fec2ac3 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -82,6 +82,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_VDECL_DESTROY, - WINED3D_CS_OP_SHADER_CLEANUP, +@@ -80,6 +80,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_EVICT_RESOURCE, + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, WINED3D_CS_OP_CREATE_VBO, + WINED3D_CS_OP_RESOURCE_CLEANUP, WINED3D_CS_OP_STOP, }; -@@ -485,6 +486,12 @@ struct wined3d_cs_create_vbo +@@ -474,6 +475,12 @@ struct wined3d_cs_create_vbo struct wined3d_buffer *buffer; }; @@ -69,7 +69,7 @@ index badc0b1..d727e71 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); -@@ -2442,6 +2449,26 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu +@@ -2401,6 +2408,26 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu cs->ops->finish_prio(cs); } @@ -96,19 +96,19 @@ index badc0b1..d727e71 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2502,6 +2529,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, - /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, +@@ -2459,6 +2486,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, + /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, }; 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 b35fa06..627eca6 100644 +index f1c8eae..5bf3dfb 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4982,8 +4982,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5000,8 +5000,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -148,7 +148,7 @@ index 9acc7be..3af6851 100644 void resource_unload(struct wined3d_resource *resource) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index eacdca1..8190279 100644 +index d810267..53dfea6 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -521,6 +521,8 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) @@ -161,10 +161,10 @@ index eacdca1..8190279 100644 void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 0cfe28a..e0ce86e 100644 +index 012494d..0477ef9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2484,6 +2484,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * +@@ -2507,6 +2507,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -172,9 +172,9 @@ index 0cfe28a..e0ce86e 100644 void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; -@@ -3067,6 +3068,8 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, - struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; - void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN; +@@ -3086,6 +3087,8 @@ 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_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; +void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, + struct wined3d_resource *resource) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch b/patches/wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch index 7d4fe816..3b305fa9 100644 --- a/patches/wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0095-wined3d-Clean-up-buffer-resource-data-through-the-CS.patch @@ -1,24 +1,23 @@ -From aaf9ef9f3a7faffd7be99a68a8d788c71db7b376 Mon Sep 17 00:00:00 2001 +From 0be542d41f7f87ac5b400b92dcca2c0cb9c63f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 2 Oct 2013 22:50:08 +0200 Subject: wined3d: Clean up buffer resource data through the CS. --- - dlls/wined3d/buffer.c | 39 ++++++++++++++++++++------------------- - dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++ - dlls/wined3d/wined3d_private.h | 2 ++ - 3 files changed, 50 insertions(+), 19 deletions(-) + dlls/wined3d/buffer.c | 40 +++++++++++++++++++++------------------- + 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index b06c502..c4d9740 100644 +index e1ce265..31c2629 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -553,37 +553,38 @@ static void buffer_unload(struct wined3d_resource *resource) +@@ -545,37 +545,39 @@ static void buffer_unload(struct wined3d_resource *resource) resource_unload(resource); } -+void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) ++static void wined3d_buffer_destroy_object(void *object) +{ ++ struct wined3d_buffer *buffer = object; + struct wined3d_context *context; + struct wined3d_device *device = buffer->resource.device; + @@ -67,90 +66,10 @@ index b06c502..c4d9740 100644 buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); - HeapFree(GetProcessHeap(), 0, buffer->maps); - HeapFree(GetProcessHeap(), 0, buffer); -+ wined3d_cs_emit_buffer_cleanup(device->cs, buffer); ++ wined3d_cs_emit_destroy_object(device->cs, wined3d_buffer_destroy_object, buffer); } return refcount; -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index f8c14ce..b08ca4b 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -83,6 +83,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_SHADER_CLEANUP, - WINED3D_CS_OP_CREATE_VBO, - WINED3D_CS_OP_RESOURCE_CLEANUP, -+ WINED3D_CS_OP_BUFFER_CLEANUP, - WINED3D_CS_OP_STOP, - }; - -@@ -489,6 +490,12 @@ struct wined3d_cs_resource_cleanup - struct wined3d_resource *resource; - }; - -+struct wined3d_cs_buffer_cleanup -+{ -+ 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); -@@ -2475,6 +2482,26 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, struct wined3d_reso - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_buffer_cleanup(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_buffer_cleanup *op = data; -+ -+ wined3d_buffer_cleanup_cs(op->buffer); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) -+{ -+ struct wined3d_cs_buffer_cleanup *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_BUFFER_CLEANUP; -+ 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, -@@ -2536,6 +2563,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, - /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, - /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, -+ /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, - }; - - 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 0f16e5f..3d972d3 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3048,6 +3048,7 @@ void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader - void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; - void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, - struct wined3d_resource *resource) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -@@ -3142,6 +3143,7 @@ void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offs - void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; - void buffer_create_buffer_object(struct wined3d_buffer *This, - struct wined3d_context *context) DECLSPEC_HIDDEN; -+void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; - - struct wined3d_rendertarget_view - { -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch index 572ccbee..20c5b8e5 100644 --- a/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch @@ -1,89 +1,29 @@ -From 964c9547663bccec6e1dc8d1e6de8c66d1651d99 Mon Sep 17 00:00:00 2001 +From 70d900c4a460e27e5b6da3de623df8fffa0b9b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 7 May 2016 13:02:33 +0100 Subject: wined3d: Clean up textures through the command stream. FIXME: This HeapFree stuff when creation fails is ugly. --- - dlls/wined3d/cs.c | 28 +++++++++++++++ - dlls/wined3d/texture.c | 79 ++++++++++++++++++++++-------------------- - dlls/wined3d/wined3d_private.h | 2 ++ - 3 files changed, 72 insertions(+), 37 deletions(-) + dlls/wined3d/texture.c | 82 +++++++++++++++++++++++++++----------------------- + 1 file changed, 44 insertions(+), 38 deletions(-) -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 5a521d3..452b16f 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -84,6 +84,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_CREATE_VBO, - WINED3D_CS_OP_RESOURCE_CLEANUP, - WINED3D_CS_OP_BUFFER_CLEANUP, -+ WINED3D_CS_OP_TEXTURE_CLEANUP, - WINED3D_CS_OP_STOP, - }; - -@@ -499,6 +500,12 @@ struct wined3d_cs_buffer_cleanup - struct wined3d_buffer *buffer; - }; - -+struct wined3d_cs_texture_cleanup -+{ -+ 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); -@@ -2496,6 +2503,26 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_texture_cleanup(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_texture_cleanup *op = data; -+ -+ wined3d_texture_cleanup(op->texture); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) -+{ -+ struct wined3d_cs_texture_cleanup *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_TEXTURE_CLEANUP; -+ 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, -@@ -2558,6 +2585,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, - /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, - /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, -+ /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, - }; - - 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 4db6bb4..4a4c4f8 100644 +index 53dfea6..18e71ff 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -404,7 +404,7 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) +@@ -479,8 +479,9 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) resource_unload(&texture->resource); } -static void wined3d_texture_cleanup(struct wined3d_texture *texture) -+void wined3d_texture_cleanup(struct wined3d_texture *texture) ++static void wined3d_texture_destroy_object(void *object) { ++ struct wined3d_texture *texture = object; unsigned int sub_count = texture->level_count * texture->layer_count; struct wined3d_device *device = texture->resource.device; -@@ -414,12 +414,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) + struct wined3d_context *context = NULL; +@@ -489,12 +490,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) TRACE("texture %p.\n", texture); @@ -96,7 +36,16 @@ index 4db6bb4..4a4c4f8 100644 for (i = 0; i < sub_count; ++i) { if (texture->sub_resources[i].buffer != texture->sub_resources[i].map_buffer) -@@ -445,9 +439,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -506,7 +501,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) + + TRACE("Deleting buffer object %u.\n", buffer->name); + +- /* We may not be able to get a context in wined3d_texture_cleanup() in ++ /* We may not be able to get a context in wined3d_texture_destroy_object() in + * general, but if a buffer object was previously created we can. */ + if (!context) + context = context_acquire(device, NULL); +@@ -520,9 +515,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) texture->texture_ops->texture_cleanup_sub_resources(texture); wined3d_texture_unload_gl_texture(texture); @@ -107,7 +56,7 @@ index 4db6bb4..4a4c4f8 100644 } void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) -@@ -741,6 +733,23 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) +@@ -816,6 +809,23 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) return refcount; } @@ -125,13 +74,13 @@ index 4db6bb4..4a4c4f8 100644 + } + + resource_cleanup(&texture->resource); -+ wined3d_cs_emit_texture_cleanup(device->cs, texture); ++ wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture); +} + ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) { ULONG refcount; -@@ -755,9 +764,8 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) +@@ -830,9 +840,8 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) if (!refcount) { @@ -142,7 +91,7 @@ index 4db6bb4..4a4c4f8 100644 } return refcount; -@@ -1502,8 +1510,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture) +@@ -1546,8 +1555,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture) list_remove(&overlay->overlay_entry); overlay->overlay_dest = NULL; } @@ -151,7 +100,7 @@ index 4db6bb4..4a4c4f8 100644 } if (context) context_release(context); -@@ -1903,6 +1909,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1947,6 +1954,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 && !gl_info->supported[EXT_TEXTURE_ARRAY]) { WARN("OpenGL implementation does not support array textures.\n"); @@ -159,7 +108,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } -@@ -1911,6 +1918,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1955,6 +1963,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -167,7 +116,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } -@@ -1933,6 +1941,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1977,6 +1986,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (desc->pool != WINED3D_POOL_SCRATCH) { WARN("Attempted to create a mipmapped/cube/array NPOT texture without unconditional NPOT support.\n"); @@ -175,7 +124,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } -@@ -1950,6 +1959,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1994,6 +2004,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 { FIXME("Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n", desc->width, desc->height); @@ -183,7 +132,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_NOTAVAILABLE; } -@@ -1981,6 +1991,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2025,6 +2036,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (desc->pool == WINED3D_POOL_DEFAULT || desc->pool == WINED3D_POOL_MANAGED) { WARN("Dimensions (%ux%u) exceed the maximum texture size.\n", pow2_width, pow2_height); @@ -191,7 +140,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_NOTAVAILABLE; } -@@ -1994,12 +2005,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2038,12 +2050,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); @@ -206,7 +155,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } } -@@ -2008,6 +2021,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2052,6 +2066,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 flags, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -214,7 +163,7 @@ index 4db6bb4..4a4c4f8 100644 return hr; } -@@ -2049,7 +2063,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2093,7 +2108,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (level_count > ~(SIZE_T)0 / layer_count || !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces)))) { @@ -223,7 +172,7 @@ index 4db6bb4..4a4c4f8 100644 return E_OUTOFMEMORY; } -@@ -2092,7 +2106,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2136,7 +2151,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 texture, idx, &sub_resource->parent, &sub_resource->parent_ops))) { WARN("Failed to create surface parent, hr %#x.\n", hr); @@ -232,7 +181,7 @@ index 4db6bb4..4a4c4f8 100644 return hr; } -@@ -2103,7 +2117,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2147,7 +2162,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D)) && FAILED(hr = wined3d_surface_create_dc(surface))) { @@ -241,7 +190,7 @@ index 4db6bb4..4a4c4f8 100644 return hr; } } -@@ -2160,21 +2174,6 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi +@@ -2215,21 +2230,6 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture) { @@ -263,7 +212,7 @@ index 4db6bb4..4a4c4f8 100644 HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume); } -@@ -2228,6 +2227,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2283,6 +2283,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (layer_count != 1) { ERR("Invalid layer count for volume texture.\n"); @@ -271,7 +220,7 @@ index 4db6bb4..4a4c4f8 100644 return E_INVALIDARG; } -@@ -2236,12 +2236,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2291,12 +2292,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -286,7 +235,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } -@@ -2251,12 +2253,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2306,12 +2309,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -301,7 +250,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } } -@@ -2265,6 +2269,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2320,6 +2325,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct || desc->pool == WINED3D_POOL_SCRATCH)) { WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool)); @@ -309,7 +258,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } -@@ -2291,6 +2296,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2346,6 +2352,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -317,7 +266,7 @@ index 4db6bb4..4a4c4f8 100644 return WINED3DERR_INVALIDCALL; } } -@@ -2300,6 +2306,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2355,6 +2362,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct 0, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -325,7 +274,7 @@ index 4db6bb4..4a4c4f8 100644 return hr; } -@@ -2318,7 +2325,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2373,7 +2381,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes)))) { @@ -334,7 +283,7 @@ index 4db6bb4..4a4c4f8 100644 return E_OUTOFMEMORY; } -@@ -2340,7 +2347,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2395,7 +2403,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct texture, i, &sub_resource->parent, &sub_resource->parent_ops))) { WARN("Failed to create volume parent, hr %#x.\n", hr); @@ -343,7 +292,7 @@ index 4db6bb4..4a4c4f8 100644 return hr; } -@@ -2637,7 +2644,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -2692,7 +2700,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -351,7 +300,7 @@ index 4db6bb4..4a4c4f8 100644 return hr; } -@@ -2645,8 +2651,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -2700,8 +2707,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct * in this case. */ if (data && FAILED(hr = wined3d_texture_upload_data(object, data))) { @@ -361,26 +310,6 @@ index 4db6bb4..4a4c4f8 100644 return hr; } -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index b366807..6f0656e 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -2652,6 +2652,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; -+void wined3d_texture_cleanup(struct wined3d_texture *texture) DECLSPEC_HIDDEN; - 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; -@@ -3065,6 +3066,7 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu - void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, - struct wined3d_resource *resource) DECLSPEC_HIDDEN; - void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch b/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch index a9eccaf7..3edd6f21 100644 --- a/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch +++ b/patches/wined3d-CSMT_Main/0110-wined3d-Wait-for-the-resource-to-be-idle-when-destro.patch @@ -1,4 +1,4 @@ -From ceb5e15dca96c44ee25df8830a26d75f0f1f931d Mon Sep 17 00:00:00 2001 +From 025efa13f043ec294bea8f5efac0c39782d4f774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 3 Sep 2014 20:20:39 +0200 Subject: wined3d: Wait for the resource to be idle when destroying user memory @@ -9,10 +9,10 @@ Subject: wined3d: Wait for the resource to be idle when destroying user memory 1 file changed, 6 insertions(+) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 77ef2e8..44d38f8 100644 +index c075b3c..2f57373 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -746,6 +746,12 @@ static void wined3d_texture_cleanup_main(struct wined3d_texture *texture) +@@ -822,6 +822,12 @@ static void wined3d_texture_cleanup_main(struct wined3d_texture *texture) sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent); } @@ -23,7 +23,7 @@ index 77ef2e8..44d38f8 100644 + wined3d_resource_wait_fence(&texture->resource); + resource_cleanup(&texture->resource); - wined3d_cs_emit_texture_cleanup(device->cs, texture); + wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture); } -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0115-wined3d-Destroy-samplers-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0115-wined3d-Destroy-samplers-through-the-command-stream.patch index 48a2f076..d79ccd76 100644 --- a/patches/wined3d-CSMT_Main/0115-wined3d-Destroy-samplers-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0115-wined3d-Destroy-samplers-through-the-command-stream.patch @@ -1,84 +1,23 @@ -From dc11fbb6d581044d08aa04f76d7c264b276054b0 Mon Sep 17 00:00:00 2001 +From 4dc96ab42f9d44017ed6510922c1a324a3e1f2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 27 Aug 2015 23:43:08 +0200 Subject: wined3d: Destroy samplers through the command stream. --- - dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++ - dlls/wined3d/sampler.c | 21 +++++++++++++-------- - dlls/wined3d/wined3d_private.h | 3 +++ - 3 files changed, 44 insertions(+), 8 deletions(-) + dlls/wined3d/sampler.c | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index b8ee474..4ec6260 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -85,6 +85,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_RESOURCE_CLEANUP, - WINED3D_CS_OP_BUFFER_CLEANUP, - WINED3D_CS_OP_TEXTURE_CLEANUP, -+ WINED3D_CS_OP_SAMPLER_DESTROY, - WINED3D_CS_OP_STOP, - }; - -@@ -503,6 +504,12 @@ struct wined3d_cs_texture_cleanup - struct wined3d_texture *texture; - }; - -+struct wined3d_cs_sampler_destroy -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_sampler *sampler; -+}; -+ - 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); -@@ -2551,6 +2558,26 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_sampler_destroy(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_sampler_destroy *op = data; -+ -+ wined3d_sampler_destroy(op->sampler); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) -+{ -+ struct wined3d_cs_sampler_destroy *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SAMPLER_DESTROY; -+ op->sampler = sampler; -+ -+ 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, -@@ -2614,6 +2641,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, - /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, - /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, -+ /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, - }; - - static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c -index 865198b..7c04472 100644 +index 865198b..8c73466 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c -@@ -33,22 +33,27 @@ ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler) +@@ -33,22 +33,28 @@ ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler) return refcount; } -+void wined3d_sampler_destroy(struct wined3d_sampler *sampler) ++static void wined3d_sampler_destroy_object(void *object) +{ ++ struct wined3d_sampler *sampler = object; + struct wined3d_context *context = context_acquire(sampler->device, NULL); + const struct wined3d_gl_info *gl_info = context->gl_info; + @@ -105,31 +44,10 @@ index 865198b..7c04472 100644 - - HeapFree(GetProcessHeap(), 0, sampler); + struct wined3d_device *device = sampler->device; -+ wined3d_cs_emit_sampler_destroy(device->cs, sampler); ++ wined3d_cs_emit_destroy_object(device->cs, wined3d_sampler_destroy_object, sampler); } return refcount; -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 9f966fa..dc1386a 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -2808,6 +2808,8 @@ struct wined3d_sampler - GLuint name; - }; - -+void wined3d_sampler_destroy(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; -+ - struct wined3d_vertex_declaration_element - { - const struct wined3d_format *format; -@@ -3056,6 +3058,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, - struct wined3d_resource *resource) DECLSPEC_HIDDEN; - void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; - void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0116-wined3d-Destroy-shader-resource-views-through-the-CS.patch b/patches/wined3d-CSMT_Main/0116-wined3d-Destroy-shader-resource-views-through-the-CS.patch index f70a9346..d22d80d6 100644 --- a/patches/wined3d-CSMT_Main/0116-wined3d-Destroy-shader-resource-views-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0116-wined3d-Destroy-shader-resource-views-through-the-CS.patch @@ -1,103 +1,17 @@ -From c9eddaea0012e092e914b997cbeda8ebf5d00ba4 Mon Sep 17 00:00:00 2001 +From 44d9ed38c0388ba76f6bcfa79f003754564c5ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 5 Nov 2015 16:39:01 +0100 Subject: wined3d: Destroy shader resource views through the CS. --- - dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++ - dlls/wined3d/view.c | 37 ++++++++++++++++++------------------- - dlls/wined3d/wined3d_private.h | 4 ++++ - 3 files changed, 50 insertions(+), 19 deletions(-) + dlls/wined3d/view.c | 6 ------ + 1 file changed, 6 deletions(-) -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index bf446aa..9965e9b 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -86,6 +86,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_BUFFER_CLEANUP, - WINED3D_CS_OP_TEXTURE_CLEANUP, - WINED3D_CS_OP_SAMPLER_DESTROY, -+ WINED3D_CS_OP_SRV_DESTROY, - WINED3D_CS_OP_STOP, - }; - -@@ -514,6 +515,12 @@ struct wined3d_cs_sampler_destroy - struct wined3d_sampler *sampler; - }; - -+struct wined3d_cs_shader_resource_view_destroy -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_shader_resource_view *view; -+}; -+ - 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); -@@ -2575,6 +2582,26 @@ void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampl - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_shader_resource_view_destroy(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_shader_resource_view_destroy *op = data; -+ -+ wined3d_shader_resource_view_destroy_cs(op->view); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view) -+{ -+ struct wined3d_cs_shader_resource_view_destroy *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SRV_DESTROY; -+ op->view = view; -+ -+ 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, -@@ -2639,6 +2666,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, - /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, - /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, -+ /* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy, - }; - - static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index 070694e..7797c58 100644 +index dc68687..6dd7ae2 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c -@@ -184,6 +184,23 @@ ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_v - return refcount; - } - -+void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) -+{ -+ if (view->object) -+ { -+ const struct wined3d_gl_info *gl_info; -+ struct wined3d_context *context; -+ -+ context = context_acquire(view->resource->device, NULL); -+ gl_info = context->gl_info; -+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object); -+ checkGLcall("glDeleteTextures"); -+ context_release(context); -+ } -+ -+ HeapFree(GetProcessHeap(), 0, view); -+} -+ - ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view) - { - ULONG refcount = InterlockedDecrement(&view->refcount); -@@ -194,29 +211,11 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v +@@ -236,12 +236,6 @@ ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_v { struct wined3d_device *device = view->resource->device; @@ -106,50 +20,10 @@ index 070694e..7797c58 100644 - FIXME("Waiting for cs.\n"); - device->cs->ops->finish(device->cs); - } -- -- if (view->object) -- { -- const struct wined3d_gl_info *gl_info; -- struct wined3d_context *context; -- -- context = context_acquire(view->resource->device, NULL); -- gl_info = context->gl_info; -- gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object); -- checkGLcall("glDeleteTextures"); -- context_release(context); -- } - /* Call wined3d_object_destroyed() before releasing the resource, * since releasing the resource may end up destroying the parent. */ view->parent_ops->wined3d_object_destroyed(view->parent); - wined3d_resource_decref(view->resource); -- HeapFree(GetProcessHeap(), 0, view); -+ wined3d_cs_emit_shader_resource_view_destroy(device->cs, view); - } - - return refcount; -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 51ffe6f..c285702 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3096,6 +3096,8 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, - void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; - void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; - void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, -+ struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -@@ -3240,6 +3242,8 @@ struct wined3d_shader_resource_view - void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view, - struct wined3d_context *context) DECLSPEC_HIDDEN; - -+void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; -+ - struct wined3d_swapchain_ops - { - void (*swapchain_present)(struct wined3d_swapchain *swapchain, -- 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 a433f51c..c8bd9687 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 242374f346ff9108cd2d450f2fe79d7d1d48752b Mon Sep 17 00:00:00 2001 +From 3bf5e65dbf7f9c4afd8b48c277c354222a9761c3 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,20 +11,20 @@ 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 6de25ab..3208c35 100644 +index 64585f6..959ce85 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -87,6 +87,8 @@ enum wined3d_cs_op - WINED3D_CS_OP_TEXTURE_CLEANUP, - WINED3D_CS_OP_SAMPLER_DESTROY, - WINED3D_CS_OP_SRV_DESTROY, +@@ -81,6 +81,8 @@ enum wined3d_cs_op + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_CREATE_VBO, + WINED3D_CS_OP_RESOURCE_CLEANUP, + WINED3D_CS_OP_GET_DC, + WINED3D_CS_OP_RELEASE_DC, WINED3D_CS_OP_STOP, }; -@@ -517,6 +519,13 @@ struct wined3d_cs_shader_resource_view_destroy - struct wined3d_shader_resource_view *view; +@@ -481,6 +483,13 @@ struct wined3d_cs_resource_cleanup + struct wined3d_resource *resource; }; +struct wined3d_cs_get_release_dc @@ -37,7 +37,7 @@ index 6de25ab..3208c35 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); -@@ -2605,6 +2614,52 @@ void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, struct +@@ -2450,6 +2459,52 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, struct wined3d_reso cs->ops->submit(cs, sizeof(*op)); } @@ -90,20 +90,20 @@ index 6de25ab..3208c35 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2670,6 +2725,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, - /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, - /* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy, +@@ -2509,6 +2564,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, + /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, + /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, + /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, }; 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 7b27fd5..4b6c1d8 100644 +index 2f57373..f36ae61 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -2677,13 +2677,39 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -2734,13 +2734,39 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -145,7 +145,7 @@ index 7b27fd5..4b6c1d8 100644 TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -2701,35 +2727,30 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -2758,35 +2784,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 7b27fd5..4b6c1d8 100644 } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -2760,14 +2781,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -2817,14 +2838,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -217,10 +217,10 @@ index 7b27fd5..4b6c1d8 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 496f521..38ab06c 100644 +index 6753579..7141256 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2538,6 +2538,7 @@ struct wined3d_texture +@@ -2587,6 +2587,7 @@ struct wined3d_texture DWORD flags; GLenum target; DWORD update_map_binding; @@ -228,15 +228,15 @@ index 496f521..38ab06c 100644 GLuint rb_multisample; GLuint rb_resolved; -@@ -2633,6 +2634,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture, +@@ -2681,6 +2682,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; - void wined3d_texture_cleanup(struct wined3d_texture *texture) DECLSPEC_HIDDEN; +void wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; 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; -@@ -2652,6 +2654,8 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -2700,6 +2702,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,10 +245,10 @@ index 496f521..38ab06c 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; -@@ -3061,6 +3065,10 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu - void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; - void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, - struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; +@@ -3094,6 +3098,10 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer + void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; + void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, + struct wined3d_resource *resource) 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_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, diff --git a/patches/wined3d-CSMT_Main/0121-wined3d-Create-dummy-textures-through-the-CS.patch b/patches/wined3d-CSMT_Main/0121-wined3d-Create-dummy-textures-through-the-CS.patch index a0df75c1..813f89ca 100644 --- a/patches/wined3d-CSMT_Main/0121-wined3d-Create-dummy-textures-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0121-wined3d-Create-dummy-textures-through-the-CS.patch @@ -1,4 +1,4 @@ -From 3088a7530fb33a12a44cba688a5d14ea86f55590 Mon Sep 17 00:00:00 2001 +From 287c22bdc1ce3cc81fcd80ea9b2e555acb07895b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 10 Oct 2013 16:29:42 +0200 Subject: wined3d: Create dummy textures through the CS. @@ -12,18 +12,18 @@ crash. 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 83eb233..a7dde00 100644 +index 959ce85..e50d2fa 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -89,6 +89,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_SRV_DESTROY, +@@ -83,6 +83,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_RESOURCE_CLEANUP, WINED3D_CS_OP_GET_DC, WINED3D_CS_OP_RELEASE_DC, + WINED3D_CS_OP_CREATE_DUMMY_TEXTURES, WINED3D_CS_OP_STOP, }; -@@ -530,6 +531,11 @@ struct wined3d_cs_get_release_dc +@@ -490,6 +491,11 @@ struct wined3d_cs_get_release_dc unsigned int sub_resource_idx; }; @@ -35,7 +35,7 @@ index 83eb233..a7dde00 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); -@@ -2657,6 +2663,28 @@ void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *t +@@ -2505,6 +2511,28 @@ void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *t cs->ops->finish(cs); } @@ -64,8 +64,8 @@ index 83eb233..a7dde00 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2724,6 +2752,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy, +@@ -2566,6 +2594,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, /* 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, @@ -73,7 +73,7 @@ index 83eb233..a7dde00 100644 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 bc2ffd8..2c93215 100644 +index 5c47a70..bca71ad 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -664,7 +664,7 @@ out: @@ -85,7 +85,7 @@ index bc2ffd8..2c93215 100644 { const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -1044,17 +1044,15 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1045,17 +1045,15 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); @@ -105,7 +105,7 @@ index bc2ffd8..2c93215 100644 /* Clear the screen */ if (swapchain->back_buffers && swapchain->back_buffers[0]) clear_flags |= WINED3DCLEAR_TARGET; -@@ -4602,7 +4600,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4604,7 +4602,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru swapchain->context[0] = context; swapchain->num_contexts = 1; @@ -115,10 +115,10 @@ index bc2ffd8..2c93215 100644 context_release(context); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index f61681d..41de5fb 100644 +index 7141256..bd4abc9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2417,7 +2417,7 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT +@@ -2435,7 +2435,7 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN; void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo, const struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -127,7 +127,7 @@ index f61681d..41de5fb 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -3096,6 +3096,7 @@ void wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *textu +@@ -3102,6 +3102,7 @@ void wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *textu unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0128-wined3d-Do-the-sampler-GL-init-through-the-CS.patch b/patches/wined3d-CSMT_Main/0128-wined3d-Do-the-sampler-GL-init-through-the-CS.patch index 194ea7f1..beb2e436 100644 --- a/patches/wined3d-CSMT_Main/0128-wined3d-Do-the-sampler-GL-init-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0128-wined3d-Do-the-sampler-GL-init-through-the-CS.patch @@ -1,62 +1,48 @@ -From b4e606f58cff1cdcd57d77686342bd938833225c Mon Sep 17 00:00:00 2001 +From 3672080dca25e19d625417d907ec26ac1f8d4b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 7 May 2016 22:07:22 +0100 Subject: wined3d: Do the sampler GL init through the CS. This extra parameter is barf-inducing. --- - dlls/wined3d/cs.c | 28 ++++++++++++++++++++--- + dlls/wined3d/cs.c | 28 +++++++++++++++++++++++ dlls/wined3d/sampler.c | 51 ++++++++++++++++++++++++------------------ dlls/wined3d/state.c | 2 +- dlls/wined3d/wined3d_private.h | 5 +++++ - 4 files changed, 60 insertions(+), 26 deletions(-) + 4 files changed, 63 insertions(+), 23 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index c3e50ef..d59ffb7 100644 +index 70d3e1f..028003f 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -86,6 +86,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_BUFFER_CLEANUP, - WINED3D_CS_OP_TEXTURE_CLEANUP, - WINED3D_CS_OP_SAMPLER_DESTROY, +@@ -81,6 +81,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_CREATE_VBO, + WINED3D_CS_OP_RESOURCE_CLEANUP, + WINED3D_CS_OP_SAMPLER_INIT, - WINED3D_CS_OP_SRV_DESTROY, WINED3D_CS_OP_GET_DC, WINED3D_CS_OP_RELEASE_DC, -@@ -511,7 +512,7 @@ struct wined3d_cs_texture_cleanup - struct wined3d_texture *texture; + WINED3D_CS_OP_CREATE_DUMMY_TEXTURES, +@@ -487,6 +488,12 @@ struct wined3d_cs_resource_cleanup + struct wined3d_resource *resource; }; --struct wined3d_cs_sampler_destroy -+struct wined3d_cs_sampler_init_destroy ++struct wined3d_cs_sampler_init ++{ ++ enum wined3d_cs_op opcode; ++ struct wined3d_sampler *sampler; ++}; ++ + struct wined3d_cs_get_release_dc { enum wined3d_cs_op opcode; - struct wined3d_sampler *sampler; -@@ -2604,7 +2605,7 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu - - static UINT wined3d_cs_exec_sampler_destroy(struct wined3d_cs *cs, const void *data) - { -- const struct wined3d_cs_sampler_destroy *op = data; -+ const struct wined3d_cs_sampler_init_destroy *op = data; - - wined3d_sampler_destroy(op->sampler); - -@@ -2613,7 +2614,7 @@ static UINT wined3d_cs_exec_sampler_destroy(struct wined3d_cs *cs, const void *d - - void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) - { -- struct wined3d_cs_sampler_destroy *op; -+ struct wined3d_cs_sampler_init_destroy *op; - - op = cs->ops->require_space(cs, sizeof(*op)); - op->opcode = WINED3D_CS_OP_SAMPLER_DESTROY; -@@ -2622,6 +2623,26 @@ void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampl +@@ -2487,6 +2494,26 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, struct wined3d_reso cs->ops->submit(cs, sizeof(*op)); } +static UINT wined3d_cs_exec_sampler_init(struct wined3d_cs *cs, const void *data) +{ -+ const struct wined3d_cs_sampler_init_destroy *op = data; ++ const struct wined3d_cs_sampler_init *op = data; + + wined3d_sampler_init(op->sampler); + @@ -65,7 +51,7 @@ index c3e50ef..d59ffb7 100644 + +void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler *sampler) +{ -+ struct wined3d_cs_sampler_init_destroy *op; ++ struct wined3d_cs_sampler_init *op; + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SAMPLER_INIT; @@ -74,22 +60,22 @@ index c3e50ef..d59ffb7 100644 + cs->ops->submit(cs, sizeof(*op)); +} + - static UINT wined3d_cs_exec_shader_resource_view_destroy(struct wined3d_cs *cs, const void *data) + static UINT wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data) { - const struct wined3d_cs_shader_resource_view_destroy *op = data; -@@ -2841,6 +2862,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, - /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, - /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, + const struct wined3d_cs_get_release_dc *op = data; +@@ -2681,6 +2708,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, + /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, + /* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init, - /* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy, /* 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, diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c -index 7c04472..714b7e9 100644 +index 8c73466..bc165a8 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c -@@ -66,43 +66,37 @@ void * CDECL wined3d_sampler_get_parent(const struct wined3d_sampler *sampler) +@@ -67,43 +67,37 @@ void * CDECL wined3d_sampler_get_parent(const struct wined3d_sampler *sampler) return sampler->parent; } @@ -148,7 +134,7 @@ index 7c04472..714b7e9 100644 GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT)); checkGLcall("sampler creation"); -@@ -114,6 +108,12 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d +@@ -115,6 +109,12 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc, void *parent, struct wined3d_sampler **sampler) { @@ -161,7 +147,7 @@ index 7c04472..714b7e9 100644 struct wined3d_sampler *object; TRACE("device %p, desc %p, parent %p, sampler %p.\n", device, desc, parent, sampler); -@@ -134,7 +134,14 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct +@@ -135,7 +135,14 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; @@ -178,7 +164,7 @@ index 7c04472..714b7e9 100644 TRACE("Created sampler %p.\n", object); *sampler = object; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c -index 67aae67..d7ad944 100644 +index ed578b8..a513298 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3604,7 +3604,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state @@ -191,29 +177,28 @@ index 67aae67..d7ad944 100644 ERR("Failed to create sampler.\n"); sampler = NULL; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 8b807c9..68ea987 100644 +index 629ac6d..8b48d64 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2814,7 +2814,11 @@ struct wined3d_sampler +@@ -2858,6 +2858,10 @@ struct wined3d_sampler GLuint name; }; -+ +HRESULT wined3d_sampler_create_from_cs(struct wined3d_device *device, const struct wined3d_sampler_desc *desc, + void *parent, struct wined3d_sampler **sampler, BOOL from_cs) DECLSPEC_HIDDEN; - void wined3d_sampler_destroy(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; +void wined3d_sampler_init(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; - ++ struct wined3d_vertex_declaration_element { -@@ -3065,6 +3069,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, - void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; - void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; - void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; + const struct wined3d_format *format; +@@ -3100,6 +3104,7 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer + void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; + void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, + struct wined3d_resource *resource) DECLSPEC_HIDDEN; +void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; - void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, - struct wined3d_shader_resource_view *view) 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_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 4e1ffbb1..698d31b4 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -199,13 +199,13 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } +#if defined(STAGING_CSMT) - void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) + static void wined3d_buffer_destroy_object(void *object) { - struct wined3d_context *context; -@@ -577,6 +600,30 @@ + struct wined3d_buffer *buffer = object; +@@ -578,6 +601,30 @@ buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); - wined3d_cs_emit_buffer_cleanup(device->cs, buffer); + wined3d_cs_emit_destroy_object(device->cs, wined3d_buffer_destroy_object, buffer); +#else /* STAGING_CSMT */ +ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) +{ @@ -233,7 +233,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } return refcount; -@@ -661,6 +708,7 @@ +@@ -662,6 +709,7 @@ /* The caller provides a GL context */ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags) { @@ -241,7 +241,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c UINT start = 0, len = 0; /* This potentially invalidates the element array buffer binding, but the -@@ -684,6 +732,45 @@ +@@ -685,6 +733,45 @@ GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)); checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)"); This->flags &= ~WINED3D_BUFFER_APPLESYNC; @@ -287,7 +287,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } while (This->modified_areas) -@@ -692,12 +779,33 @@ +@@ -693,12 +780,33 @@ start = This->maps[This->modified_areas].offset; len = This->maps[This->modified_areas].size; @@ -321,7 +321,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD); } -@@ -716,6 +824,14 @@ +@@ -717,6 +825,14 @@ TRACE("buffer %p.\n", buffer); @@ -336,7 +336,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_mark_used(buffer); if (!buffer->buffer_object) -@@ -903,6 +1019,7 @@ +@@ -904,6 +1020,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) { @@ -344,7 +344,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c struct wined3d_device *device = buffer->resource.device; if (buffer->resource.map_count) -@@ -912,6 +1029,12 @@ +@@ -913,6 +1030,12 @@ } wined3d_cs_emit_buffer_preload(device->cs, buffer); @@ -357,7 +357,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer) -@@ -925,6 +1048,7 @@ +@@ -926,6 +1049,7 @@ { LONG count; BYTE *base; @@ -365,7 +365,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c struct wined3d_device *device = buffer->resource.device; struct wined3d_context *context; -@@ -948,6 +1072,10 @@ +@@ -949,6 +1073,10 @@ { wined3d_cs_emit_create_vbo(device->cs, buffer); } @@ -376,7 +376,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture -@@ -956,7 +1084,11 @@ +@@ -957,7 +1085,11 @@ * previous contents of the buffer. The r600g driver only does this when * the buffer is currently in use, while the proprietary NVIDIA driver * appears to do this unconditionally. */ @@ -388,7 +388,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; -@@ -967,6 +1099,7 @@ +@@ -968,6 +1100,7 @@ * being uploaded in that case. Two such applications are Port Royale * and Darkstar One. */ if (flags & WINED3D_MAP_DISCARD) @@ -396,7 +396,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, 0, 0); else if (!(flags & WINED3D_MAP_READONLY)) wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, offset, size); -@@ -984,6 +1117,19 @@ +@@ -985,6 +1118,19 @@ wined3d_cs_emit_glfinish(device->cs); device->cs->ops->finish(device->cs); } @@ -416,7 +416,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -1032,6 +1178,7 @@ +@@ -1033,6 +1179,7 @@ buffer_get_sysmem(buffer, context); } TRACE("New pointer is %p.\n", buffer->resource.heap_memory); @@ -424,7 +424,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } context_release(context); } -@@ -1071,6 +1218,21 @@ +@@ -1072,6 +1219,21 @@ } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.map_heap_memory; @@ -446,7 +446,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c *data = base + offset; TRACE("Returning memory at %p (base %p, offset %u).\n", *data, base, offset); -@@ -1133,6 +1295,7 @@ +@@ -1134,6 +1296,7 @@ } GL_EXTCALL(glUnmapBuffer(buffer->buffer_type_hint)); @@ -454,7 +454,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (wined3d_settings.cs_multithreaded) gl_info->gl_ops.gl.p_glFinish(); else if (wined3d_settings.strict_draw_ordering) -@@ -1141,6 +1304,18 @@ +@@ -1142,6 +1305,18 @@ buffer_clear_dirty_areas(buffer); buffer->map_ptr = NULL; @@ -473,7 +473,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } } -@@ -1333,7 +1508,9 @@ +@@ -1334,7 +1509,9 @@ return hr; } buffer->buffer_type_hint = bind_hint; @@ -483,7 +483,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); -@@ -1369,6 +1546,7 @@ +@@ -1370,6 +1547,7 @@ buffer->flags |= WINED3D_BUFFER_USE_BO; } @@ -491,7 +491,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (wined3d_settings.cs_multithreaded) buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER; -@@ -1379,6 +1557,13 @@ +@@ -1380,6 +1558,13 @@ resource_cleanup(&buffer->resource); if (wined3d_settings.cs_multithreaded) buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); @@ -505,7 +505,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c return E_OUTOFMEMORY; } buffer->maps_size = 1; -@@ -1389,8 +1574,10 @@ +@@ -1390,8 +1575,10 @@ buffer_unload(&buffer->resource); resource_cleanup(&buffer->resource); HeapFree(GetProcessHeap(), 0, buffer->maps); @@ -516,7 +516,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c return hr; } -@@ -1501,6 +1688,7 @@ +@@ -1502,6 +1689,7 @@ return WINED3D_OK; } @@ -524,7 +524,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) { -@@ -1508,3 +1696,4 @@ +@@ -1509,3 +1697,4 @@ buffer->resource.heap_memory = mem; buffer->flags |= WINED3D_BUFFER_DISCARD; } @@ -737,15 +737,15 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DRAW, -@@ -53,6 +60,7 @@ - WINED3D_CS_OP_SET_COLOR_KEY, +@@ -54,6 +61,7 @@ WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_RESET_STATE, + WINED3D_CS_OP_DESTROY_OBJECT, +#if defined(STAGING_CSMT) WINED3D_CS_OP_SET_VS_CONSTS_F, WINED3D_CS_OP_SET_VS_CONSTS_B, WINED3D_CS_OP_SET_VS_CONSTS_I, -@@ -106,6 +114,7 @@ +@@ -100,6 +108,7 @@ { enum wined3d_cs_op opcode; BOOL *signalled; @@ -753,15 +753,15 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -306,6 +315,7 @@ - enum wined3d_cs_op opcode; +@@ -307,6 +316,7 @@ + void *object; }; +#if defined(STAGING_CSMT) struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -654,6 +664,23 @@ +@@ -619,6 +629,23 @@ struct wined3d_cs_present *op; LONG pending; unsigned int i; @@ -785,7 +785,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; -@@ -663,6 +690,7 @@ +@@ -628,6 +655,7 @@ op->dst_rect = *dst_rect; op->flags = flags; @@ -793,7 +793,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_resource_inc_fence(&swapchain->front_buffer->resource); for (i = 0; i < swapchain->desc.backbuffer_count; i++) wined3d_resource_inc_fence(&swapchain->back_buffers[i]->resource); -@@ -720,6 +748,30 @@ +@@ -685,6 +713,30 @@ unsigned int i; op = cs->ops->require_space(cs, size); @@ -824,7 +824,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; -@@ -728,6 +780,7 @@ +@@ -693,6 +745,7 @@ op->rect_count = rect_count; memcpy(op->rects, rects, sizeof(*rects) * rect_count); @@ -832,7 +832,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (flags & WINED3DCLEAR_TARGET) { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++) -@@ -786,6 +839,15 @@ +@@ -751,6 +804,15 @@ cs->state.load_base_vertex_index = 0; device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX); } @@ -848,7 +848,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) -@@ -796,6 +858,7 @@ +@@ -761,6 +823,7 @@ draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx, op->index_count, op->start_instance, op->instance_count, op->indexed); @@ -856,7 +856,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (op->indexed) wined3d_resource_dec_fence(&cs->state.index_buffer->resource); -@@ -826,6 +889,14 @@ +@@ -791,6 +854,14 @@ struct wined3d_cs_draw *op; unsigned int i; const struct wined3d_state *state = &cs->device->state; @@ -871,7 +871,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_DRAW; -@@ -836,6 +907,7 @@ +@@ -801,6 +872,7 @@ op->instance_count = instance_count; op->indexed = indexed; @@ -879,7 +879,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (indexed) { wined3d_resource_inc_fence(&state->index_buffer->resource); -@@ -873,6 +945,17 @@ +@@ -838,6 +910,17 @@ cs->state.predicate_value = op->value; return sizeof(*op); @@ -897,7 +897,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) -@@ -884,6 +967,7 @@ +@@ -849,6 +932,7 @@ op->predicate = predicate; op->value = value; @@ -905,7 +905,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -895,6 +979,17 @@ +@@ -860,6 +944,17 @@ device_invalidate_state(cs->device, STATE_VIEWPORT); return sizeof(*op); @@ -923,7 +923,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) -@@ -905,6 +1000,7 @@ +@@ -870,6 +965,7 @@ op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -931,7 +931,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -916,6 +1012,17 @@ +@@ -881,6 +977,17 @@ device_invalidate_state(cs->device, STATE_SCISSORRECT); return sizeof(*op); @@ -949,7 +949,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) -@@ -926,6 +1033,7 @@ +@@ -891,6 +998,7 @@ op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -957,7 +957,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -937,6 +1045,17 @@ +@@ -902,6 +1010,17 @@ device_invalidate_state(cs->device, STATE_FRAMEBUFFER); return sizeof(*op); @@ -975,7 +975,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, -@@ -949,6 +1068,7 @@ +@@ -914,6 +1033,7 @@ op->view_idx = view_idx; op->view = view; @@ -983,7 +983,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -959,6 +1079,18 @@ +@@ -924,6 +1044,18 @@ struct wined3d_rendertarget_view *prev; if ((prev = cs->state.fb.depth_stencil)) @@ -1002,7 +1002,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -966,6 +1098,7 @@ +@@ -931,6 +1063,7 @@ || prev_surface->container->flags & WINED3D_TEXTURE_DISCARD)) { surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); @@ -1010,7 +1010,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (prev_surface == cs->onscreen_depth_stencil) { wined3d_texture_decref(cs->onscreen_depth_stencil->container); -@@ -975,6 +1108,17 @@ +@@ -940,6 +1073,17 @@ } cs->state.fb.depth_stencil = op->view; @@ -1028,7 +1028,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -991,8 +1135,10 @@ +@@ -956,8 +1100,10 @@ } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1039,7 +1039,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) -@@ -1003,6 +1149,7 @@ +@@ -968,6 +1114,7 @@ op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -1047,7 +1047,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1014,6 +1161,17 @@ +@@ -979,6 +1126,17 @@ device_invalidate_state(cs->device, STATE_VDECL); return sizeof(*op); @@ -1065,7 +1065,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) -@@ -1024,10 +1182,17 @@ +@@ -989,10 +1147,17 @@ op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -1083,7 +1083,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; -@@ -1045,8 +1210,10 @@ +@@ -1010,8 +1175,10 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1094,7 +1094,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, -@@ -1061,10 +1228,17 @@ +@@ -1026,10 +1193,17 @@ op->offset = offset; op->stride = stride; @@ -1112,7 +1112,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; -@@ -1074,8 +1248,10 @@ +@@ -1039,8 +1213,10 @@ stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1123,7 +1123,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) -@@ -1088,10 +1264,17 @@ +@@ -1053,10 +1229,17 @@ op->frequency = frequency; op->flags = flags; @@ -1141,7 +1141,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; -@@ -1106,8 +1289,10 @@ +@@ -1071,8 +1254,10 @@ InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -1152,7 +1152,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, -@@ -1121,10 +1306,17 @@ +@@ -1086,10 +1271,17 @@ op->buffer = buffer; op->offset = offset; @@ -1170,7 +1170,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; -@@ -1140,8 +1332,10 @@ +@@ -1105,8 +1297,10 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -1181,7 +1181,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, -@@ -1155,10 +1349,17 @@ +@@ -1120,10 +1314,17 @@ op->format_id = format_id; op->offset = offset; @@ -1199,7 +1199,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; -@@ -1172,7 +1373,9 @@ +@@ -1137,7 +1338,9 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -1209,7 +1209,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, -@@ -1186,10 +1389,17 @@ +@@ -1151,10 +1354,17 @@ op->cb_idx = cb_idx; op->buffer = buffer; @@ -1227,7 +1227,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; -@@ -1266,8 +1476,10 @@ +@@ -1231,8 +1441,10 @@ if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1238,7 +1238,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) -@@ -1278,6 +1490,7 @@ +@@ -1243,6 +1455,7 @@ op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -1246,7 +1246,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1289,6 +1502,18 @@ +@@ -1254,6 +1467,18 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1265,7 +1265,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, -@@ -1302,6 +1527,7 @@ +@@ -1267,6 +1492,7 @@ op->view_idx = view_idx; op->view = view; @@ -1273,7 +1273,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1313,6 +1539,17 @@ +@@ -1278,6 +1504,17 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1291,7 +1291,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, -@@ -1326,6 +1563,7 @@ +@@ -1291,6 +1528,7 @@ op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -1299,7 +1299,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1338,6 +1576,18 @@ +@@ -1303,6 +1541,18 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1318,7 +1318,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) -@@ -1349,6 +1599,7 @@ +@@ -1314,6 +1564,7 @@ op->type = type; op->shader = shader; @@ -1326,7 +1326,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1419,6 +1670,17 @@ +@@ -1384,6 +1635,17 @@ device_invalidate_state(cs->device, STATE_RENDER(op->state)); return sizeof(*op); @@ -1344,7 +1344,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) -@@ -1430,6 +1692,7 @@ +@@ -1395,6 +1657,7 @@ op->state = state; op->value = value; @@ -1352,7 +1352,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1555,6 +1818,17 @@ +@@ -1520,6 +1783,17 @@ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); return sizeof(*op); @@ -1370,7 +1370,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1568,6 +1842,7 @@ +@@ -1533,6 +1807,7 @@ op->state = state; op->value = value; @@ -1378,7 +1378,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1579,6 +1854,17 @@ +@@ -1544,6 +1819,17 @@ device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); return sizeof(*op); @@ -1396,7 +1396,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1592,6 +1878,7 @@ +@@ -1557,6 +1843,7 @@ op->state = state; op->value = value; @@ -1404,7 +1404,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1604,6 +1891,18 @@ +@@ -1569,6 +1856,18 @@ device_invalidate_state(cs->device, STATE_TRANSFORM(op->state)); return sizeof(*op); @@ -1423,7 +1423,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, -@@ -1616,6 +1915,7 @@ +@@ -1581,6 +1880,7 @@ op->state = state; op->matrix = *matrix; @@ -1431,7 +1431,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1627,6 +1927,17 @@ +@@ -1592,6 +1892,17 @@ device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx)); return sizeof(*op); @@ -1449,7 +1449,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) -@@ -1638,10 +1949,17 @@ +@@ -1603,10 +1914,17 @@ op->plane_idx = plane_idx; op->plane = *plane; @@ -1467,7 +1467,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; -@@ -1702,8 +2020,10 @@ +@@ -1667,8 +1985,10 @@ break; } } @@ -1478,7 +1478,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, -@@ -1723,6 +2043,7 @@ +@@ -1688,6 +2008,7 @@ else op->set = 0; @@ -1486,7 +1486,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1734,6 +2055,17 @@ +@@ -1699,6 +2020,17 @@ device_invalidate_state(cs->device, STATE_MATERIAL); return sizeof(*op); @@ -1504,7 +1504,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) -@@ -1744,6 +2076,7 @@ +@@ -1709,6 +2041,7 @@ op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -1512,7 +1512,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1759,6 +2092,19 @@ +@@ -1724,6 +2057,19 @@ ERR("Failed to initialize CS state, hr %#x.\n", hr); return sizeof(struct wined3d_cs_reset_state); @@ -1532,7 +1532,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1768,6 +2114,7 @@ +@@ -1733,6 +2079,7 @@ op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -1540,7 +1540,32 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -3217,5 +3564,151 @@ +@@ -1743,6 +2090,16 @@ + op->callback(op->object); + + return sizeof(*op); ++#else /* STAGING_CSMT */ ++ cs->ops->submit(cs); ++} ++ ++static void wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) ++{ ++ const struct wined3d_cs_destroy_object *op = data; ++ ++ op->callback(op->object); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) +@@ -1754,6 +2111,7 @@ + op->callback = callback; + op->object = object; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -3055,5 +3413,152 @@ ERR("Closing event failed.\n"); } @@ -1576,6 +1601,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, + /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, + /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, ++ /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, +}; + +static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) @@ -3823,13 +3849,13 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c } +#if defined(STAGING_CSMT) - void wined3d_sampler_destroy(struct wined3d_sampler *sampler) + static void wined3d_sampler_destroy_object(void *object) { - struct wined3d_context *context = context_acquire(sampler->device, NULL); -@@ -54,6 +55,24 @@ + struct wined3d_sampler *sampler = object; +@@ -55,6 +56,24 @@ { struct wined3d_device *device = sampler->device; - wined3d_cs_emit_sampler_destroy(device->cs, sampler); + wined3d_cs_emit_destroy_object(device->cs, wined3d_sampler_destroy_object, sampler); +#else /* STAGING_CSMT */ +ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler) +{ @@ -3851,7 +3877,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c } return refcount; -@@ -66,6 +85,7 @@ +@@ -67,6 +86,7 @@ return sampler->parent; } @@ -3859,7 +3885,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c void wined3d_sampler_init(struct wined3d_sampler *sampler) { const struct wined3d_gl_info *gl_info; -@@ -97,6 +117,45 @@ +@@ -98,6 +118,45 @@ wined3d_gl_compare_func(sampler->desc.comparison_func))); if ((context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL) && gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && !sampler->desc.srgb_decode) @@ -3905,7 +3931,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT)); checkGLcall("sampler creation"); -@@ -108,12 +167,14 @@ +@@ -109,12 +168,14 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc, void *parent, struct wined3d_sampler **sampler) { @@ -3920,7 +3946,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c struct wined3d_sampler *object; TRACE("device %p, desc %p, parent %p, sampler %p.\n", device, desc, parent, sampler); -@@ -134,6 +195,7 @@ +@@ -135,6 +196,7 @@ if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; @@ -3928,7 +3954,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c object->refcount = 1; object->device = device; object->parent = parent; -@@ -142,6 +204,9 @@ +@@ -143,6 +205,9 @@ wined3d_sampler_init(object); else wined3d_cs_emit_sampler_init(device->cs, object); @@ -3941,19 +3967,23 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2352,7 +2352,11 @@ - string_buffer_free(&buffer); +@@ -2612,6 +2612,7 @@ + return refcount; } +#if defined(STAGING_CSMT) - void shader_cleanup(struct wined3d_shader *shader) -+#else /* STAGING_CSMT */ -+static void shader_cleanup(struct wined3d_shader *shader) -+#endif /* STAGING_CSMT */ + static void wined3d_shader_destroy_object(void *object) { - HeapFree(GetProcessHeap(), 0, shader->output_signature.elements); - HeapFree(GetProcessHeap(), 0, shader->input_signature.elements); -@@ -2620,10 +2624,16 @@ + struct wined3d_shader *shader = object; +@@ -2620,6 +2621,7 @@ + HeapFree(GetProcessHeap(), 0, shader); + } + ++#endif /* STAGING_CSMT */ + ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) + { + ULONG refcount = InterlockedDecrement(&shader->ref); +@@ -2628,10 +2630,16 @@ if (!refcount) { @@ -3961,7 +3991,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c const struct wined3d_device *device = shader->device; shader->parent_ops->wined3d_object_destroyed(shader->parent); - wined3d_cs_emit_shader_cleanup(device->cs, shader); + wined3d_cs_emit_destroy_object(device->cs, wined3d_shader_destroy_object, shader); +#else /* STAGING_CSMT */ + shader_cleanup(shader); + shader->parent_ops->wined3d_object_destroyed(shader->parent); @@ -3970,7 +4000,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c } return refcount; -@@ -2944,7 +2954,11 @@ +@@ -2952,7 +2960,11 @@ UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -5694,10 +5724,10 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } +#if defined(STAGING_CSMT) - void wined3d_texture_cleanup(struct wined3d_texture *texture) + static void wined3d_texture_destroy_object(void *object) { - unsigned int sub_count = texture->level_count * texture->layer_count; -@@ -515,6 +552,42 @@ + struct wined3d_texture *texture = object; +@@ -516,6 +553,42 @@ texture->texture_ops->texture_cleanup_sub_resources(texture); wined3d_texture_unload_gl_texture(texture); HeapFree(GetProcessHeap(), 0, texture); @@ -5740,7 +5770,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) -@@ -808,6 +881,7 @@ +@@ -809,6 +882,7 @@ return refcount; } @@ -5748,15 +5778,15 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void wined3d_texture_cleanup_main(struct wined3d_texture *texture) { struct wined3d_device *device = texture->resource.device; -@@ -831,6 +905,7 @@ - wined3d_cs_emit_texture_cleanup(device->cs, texture); +@@ -832,6 +906,7 @@ + wined3d_cs_emit_destroy_object(device->cs, wined3d_texture_destroy_object, texture); } +#endif /* STAGING_CSMT */ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) { ULONG refcount; -@@ -845,8 +920,14 @@ +@@ -846,8 +921,14 @@ if (!refcount) { @@ -5771,7 +5801,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } return refcount; -@@ -896,7 +977,11 @@ +@@ -897,7 +978,11 @@ TRACE("Reloading because of color key value change.\n"); for (i = 0; i < sub_count; i++) { @@ -5783,7 +5813,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); else wined3d_texture_invalidate_location(texture, i, ~texture->resource.map_binding); -@@ -914,7 +999,11 @@ +@@ -915,7 +1000,11 @@ /* Reload the surfaces if the texture is marked dirty. */ for (i = 0; i < sub_count; ++i) { @@ -5795,7 +5825,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB)) ERR("Failed to load location (srgb %#x).\n", srgb); } -@@ -923,8 +1012,15 @@ +@@ -924,8 +1013,15 @@ void CDECL wined3d_texture_preload(struct wined3d_texture *texture) { @@ -5811,7 +5841,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) -@@ -987,6 +1083,7 @@ +@@ -988,6 +1084,7 @@ if (texture->lod != lod) { @@ -5819,7 +5849,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (wined3d_settings.cs_multithreaded) { struct wined3d_device *device = texture->resource.device; -@@ -994,6 +1091,7 @@ +@@ -995,6 +1092,7 @@ device->cs->ops->finish(device->cs); } @@ -5827,7 +5857,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->lod = lod; texture->texture_rgb.base_level = ~0u; -@@ -1114,10 +1212,14 @@ +@@ -1115,10 +1213,14 @@ } if (device->d3d_initialized) @@ -5842,7 +5872,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c sub_resource = &texture->sub_resources[0]; surface = sub_resource->u.surface; -@@ -1128,7 +1230,9 @@ +@@ -1129,7 +1231,9 @@ } wined3d_resource_free_sysmem(&texture->resource); @@ -5852,7 +5882,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((texture->row_pitch = pitch)) texture->slice_pitch = height * pitch; -@@ -1185,6 +1289,7 @@ +@@ -1186,6 +1290,7 @@ wined3d_texture_invalidate_location(texture, 0, ~valid_location); if (create_dib) @@ -5860,7 +5890,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { HDC dc; wined3d_texture_get_dc(texture, 0, &dc); -@@ -1218,6 +1323,31 @@ +@@ -1219,6 +1324,31 @@ * message. Freeing the actual memory and setting the read pointer to 0 is * the task of the worker thread. */ texture->resource.map_heap_memory = NULL; @@ -5892,7 +5922,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_force_reload(struct wined3d_texture *texture) -@@ -1335,7 +1465,9 @@ +@@ -1336,7 +1466,9 @@ ERR("Failed to allocate system memory.\n"); return FALSE; } @@ -5902,7 +5932,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_USER_MEMORY: -@@ -1344,7 +1476,11 @@ +@@ -1345,7 +1477,11 @@ return TRUE; case WINED3D_LOCATION_BUFFER: @@ -5914,7 +5944,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1415,7 +1551,11 @@ +@@ -1416,7 +1552,11 @@ WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); context = context_acquire(texture->resource.device, NULL); @@ -5926,7 +5956,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c context, texture->resource.map_binding)) { ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); -@@ -1461,7 +1601,9 @@ +@@ -1462,7 +1602,9 @@ return WINED3D_OK; } @@ -5936,7 +5966,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_sub_resource_data *data) { -@@ -1484,8 +1626,12 @@ +@@ -1485,8 +1627,12 @@ static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) { @@ -5949,7 +5979,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } /* Context activation is done by the caller. */ -@@ -1575,6 +1721,10 @@ +@@ -1576,6 +1722,10 @@ list_remove(&overlay->overlay_entry); overlay->overlay_dest = NULL; } @@ -5960,7 +5990,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) context_release(context); -@@ -1623,7 +1773,11 @@ +@@ -1624,7 +1774,11 @@ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[i]; if (resource->pool != WINED3D_POOL_DEFAULT @@ -5972,7 +6002,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { wined3d_texture_invalidate_location(texture, i, ~resource->map_binding); } -@@ -1638,8 +1792,13 @@ +@@ -1639,8 +1793,13 @@ wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -5986,7 +6016,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -1664,6 +1823,7 @@ +@@ -1665,6 +1824,7 @@ wined3d_texture_unload_gl_texture(texture); } @@ -5994,7 +6024,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD flags) { struct wined3d_device *device = texture->resource.device; -@@ -1745,6 +1905,7 @@ +@@ -1746,6 +1906,7 @@ return data; } @@ -6002,7 +6032,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) { -@@ -1752,9 +1913,19 @@ +@@ -1753,9 +1914,19 @@ struct wined3d_texture_sub_resource *sub_resource; struct wined3d_device *device = resource->device; unsigned int fmt_flags = resource->format_flags; @@ -6022,7 +6052,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); -@@ -1801,6 +1972,7 @@ +@@ -1802,6 +1973,7 @@ flags = wined3d_resource_sanitize_map_flags(resource, flags); @@ -6030,7 +6060,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (flags & WINED3D_MAP_NOOVERWRITE) FIXME("WINED3D_MAP_NOOVERWRITE is not implemented yet.\n"); -@@ -1822,6 +1994,47 @@ +@@ -1823,6 +1995,47 @@ wined3d_resource_wait_fence(&texture->resource); base_memory = wined3d_cs_emit_texture_map(device->cs, texture, sub_resource_idx, flags); @@ -6078,7 +6108,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) { -@@ -1857,6 +2070,19 @@ +@@ -1858,6 +2071,19 @@ } } @@ -6098,7 +6128,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c ++resource->map_count; ++sub_resource->map_count; -@@ -1866,6 +2092,7 @@ +@@ -1867,6 +2093,7 @@ return WINED3D_OK; } @@ -6106,7 +6136,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx) { struct wined3d_context *context = NULL; -@@ -1921,6 +2148,16 @@ +@@ -1922,6 +2149,16 @@ struct wined3d_texture_sub_resource *sub_resource; struct wined3d_texture *texture; struct wined3d_device *device = resource->device; @@ -6123,7 +6153,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); -@@ -1936,6 +2173,7 @@ +@@ -1937,6 +2174,7 @@ return WINEDDERR_NOTLOCKED; } @@ -6131,7 +6161,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_texture_unmap(device->cs, texture, sub_resource_idx); if (sub_resource->unmap_dirtify) -@@ -1943,6 +2181,28 @@ +@@ -1944,6 +2182,28 @@ wined3d_cs_emit_texture_changed(device->cs, texture, sub_resource_idx, sub_resource->map_buffer, resource->map_heap_memory); sub_resource->unmap_dirtify = FALSE; @@ -6160,7 +6190,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } --sub_resource->map_count; -@@ -1976,7 +2236,9 @@ +@@ -1977,7 +2237,9 @@ && !gl_info->supported[EXT_TEXTURE_ARRAY]) { WARN("OpenGL implementation does not support array textures.\n"); @@ -6170,7 +6200,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1985,7 +2247,9 @@ +@@ -1986,7 +2248,9 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6180,7 +6210,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -2008,7 +2272,9 @@ +@@ -2009,7 +2273,9 @@ if (desc->pool != WINED3D_POOL_SCRATCH) { WARN("Attempted to create a mipmapped/cube/array NPOT texture without unconditional NPOT support.\n"); @@ -6190,7 +6220,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -2026,7 +2292,9 @@ +@@ -2027,7 +2293,9 @@ { FIXME("Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n", desc->width, desc->height); @@ -6200,7 +6230,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_NOTAVAILABLE; } -@@ -2058,7 +2326,9 @@ +@@ -2059,7 +2327,9 @@ if (desc->pool == WINED3D_POOL_DEFAULT || desc->pool == WINED3D_POOL_MANAGED) { WARN("Dimensions (%ux%u) exceed the maximum texture size.\n", pow2_width, pow2_height); @@ -6210,7 +6240,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_NOTAVAILABLE; } -@@ -2072,6 +2342,7 @@ +@@ -2073,6 +2343,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); @@ -6218,7 +6248,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -2080,6 +2351,14 @@ +@@ -2081,6 +2352,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6233,7 +6263,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -2088,7 +2367,9 @@ +@@ -2089,7 +2368,9 @@ flags, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6243,7 +6273,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2130,7 +2411,11 @@ +@@ -2131,7 +2412,11 @@ if (level_count > ~(SIZE_T)0 / layer_count || !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces)))) { @@ -6255,7 +6285,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return E_OUTOFMEMORY; } -@@ -2173,7 +2458,11 @@ +@@ -2174,7 +2459,11 @@ texture, idx, &sub_resource->parent, &sub_resource->parent_ops))) { WARN("Failed to create surface parent, hr %#x.\n", hr); @@ -6267,7 +6297,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2181,6 +2470,7 @@ +@@ -2182,6 +2471,7 @@ TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -6275,7 +6305,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D)) { HDC dc; -@@ -2190,6 +2480,13 @@ +@@ -2191,6 +2481,13 @@ return hr; } wined3d_texture_release_dc(texture, idx, dc); @@ -6289,7 +6319,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } } } -@@ -2197,7 +2494,9 @@ +@@ -2198,7 +2495,9 @@ return WINED3D_OK; } @@ -6299,7 +6329,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_sub_resource_data *data) { -@@ -2256,6 +2555,23 @@ +@@ -2257,6 +2556,23 @@ static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture) { @@ -6323,7 +6353,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume); } -@@ -2309,7 +2625,9 @@ +@@ -2310,7 +2626,9 @@ if (layer_count != 1) { ERR("Invalid layer count for volume texture.\n"); @@ -6333,7 +6363,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return E_INVALIDARG; } -@@ -2318,6 +2636,7 @@ +@@ -2319,6 +2637,7 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6341,7 +6371,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -2326,6 +2645,14 @@ +@@ -2327,6 +2646,14 @@ { WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); HeapFree(GetProcessHeap(), 0, texture); @@ -6356,7 +6386,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -2335,6 +2662,7 @@ +@@ -2336,6 +2663,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6364,7 +6394,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -2343,6 +2671,14 @@ +@@ -2344,6 +2672,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6379,7 +6409,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -2351,7 +2687,9 @@ +@@ -2352,7 +2688,9 @@ || desc->pool == WINED3D_POOL_SCRATCH)) { WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool)); @@ -6389,7 +6419,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -2378,7 +2716,9 @@ +@@ -2379,7 +2717,9 @@ { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -6399,7 +6429,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -2388,7 +2728,9 @@ +@@ -2389,7 +2729,9 @@ 0, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6409,7 +6439,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2401,6 +2743,7 @@ +@@ -2402,6 +2744,7 @@ if (wined3d_texture_use_pbo(texture, gl_info)) { wined3d_resource_free_sysmem(&texture->resource); @@ -6417,7 +6447,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->resource.map_heap_memory = NULL; texture->resource.map_binding = WINED3D_LOCATION_BUFFER; } -@@ -2408,6 +2751,14 @@ +@@ -2409,6 +2752,14 @@ if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes)))) { wined3d_texture_cleanup_main(texture); @@ -6432,7 +6462,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return E_OUTOFMEMORY; } -@@ -2429,7 +2780,11 @@ +@@ -2430,7 +2781,11 @@ texture, i, &sub_resource->parent, &sub_resource->parent_ops))) { WARN("Failed to create volume parent, hr %#x.\n", hr); @@ -6444,7 +6474,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2726,6 +3081,9 @@ +@@ -2727,6 +3082,9 @@ if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6454,7 +6484,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2733,7 +3091,12 @@ +@@ -2734,7 +3092,12 @@ * in this case. */ if (data && FAILED(hr = wined3d_texture_upload_data(object, data))) { @@ -6467,7 +6497,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2743,6 +3106,7 @@ +@@ -2744,6 +3107,7 @@ return WINED3D_OK; } @@ -6475,7 +6505,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) { struct wined3d_device *device = texture->resource.device; -@@ -2776,6 +3140,15 @@ +@@ -2777,6 +3141,15 @@ struct wined3d_device *device = texture->resource.device; struct wined3d_texture_sub_resource *sub_resource; struct wined3d_surface *surface; @@ -6491,7 +6521,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); -@@ -2793,6 +3166,7 @@ +@@ -2794,6 +3167,7 @@ if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) return WINED3DERR_INVALIDCALL; @@ -6499,7 +6529,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_get_dc(device->cs, texture, sub_resource_idx); if (FAILED(texture->dc_hr)) return texture->dc_hr; -@@ -2817,6 +3191,30 @@ +@@ -2818,6 +3192,30 @@ wined3d_texture_update_map_binding(texture); if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; @@ -6530,7 +6560,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) -@@ -2847,6 +3245,7 @@ +@@ -2848,6 +3246,7 @@ return WINED3DERR_INVALIDCALL; } @@ -6538,7 +6568,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx); return WINED3D_OK; -@@ -2980,4 +3379,16 @@ +@@ -2981,4 +3380,16 @@ } } return ret; @@ -6585,14 +6615,15 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c -@@ -50,12 +50,14 @@ +@@ -50,6 +50,7 @@ return refcount; } +#if defined(STAGING_CSMT) - void wined3d_vertex_declaration_destroy(struct wined3d_vertex_declaration *declaration) + static void wined3d_vertex_declaration_destroy_object(void *object) { - HeapFree(GetProcessHeap(), 0, declaration->elements); + struct wined3d_vertex_declaration *declaration = object; +@@ -58,6 +59,7 @@ HeapFree(GetProcessHeap(), 0, declaration); } @@ -6600,14 +6631,14 @@ diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration) { ULONG refcount = InterlockedDecrement(&declaration->ref); -@@ -64,9 +66,15 @@ +@@ -66,9 +68,15 @@ if (!refcount) { +#if defined(STAGING_CSMT) const struct wined3d_device *device = declaration->device; declaration->parent_ops->wined3d_object_destroyed(declaration->parent); - wined3d_cs_emit_vertex_declaration_destroy(device->cs, declaration); + wined3d_cs_emit_destroy_object(device->cs, wined3d_vertex_declaration_destroy_object, declaration); +#else /* STAGING_CSMT */ + HeapFree(GetProcessHeap(), 0, declaration->elements); + declaration->parent_ops->wined3d_object_destroyed(declaration->parent); @@ -6615,94 +6646,6 @@ diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c +#endif /* STAGING_CSMT */ } - return refcount; -diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c ---- a/dlls/wined3d/view.c -+++ b/dlls/wined3d/view.c -@@ -33,11 +33,13 @@ - return refcount; - } - -+#if defined(STAGING_CSMT) - void wined3d_rendertarget_view_destroy(struct wined3d_rendertarget_view *view) - { - HeapFree(GetProcessHeap(), 0, view); - } - -+#endif /* STAGING_CSMT */ - ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view) - { - ULONG refcount = InterlockedDecrement(&view->refcount); -@@ -46,6 +48,7 @@ - - if (!refcount) - { -+#if defined(STAGING_CSMT) - struct wined3d_device *device = view->resource->device; - - /* Call wined3d_object_destroyed() before releasing the resource, -@@ -53,6 +56,13 @@ - view->parent_ops->wined3d_object_destroyed(view->parent); - wined3d_resource_decref(view->resource); - wined3d_cs_emit_view_destroy(device->cs, view); -+#else /* STAGING_CSMT */ -+ /* Call wined3d_object_destroyed() before releasing the resource, -+ * since releasing the resource may end up destroying the parent. */ -+ view->parent_ops->wined3d_object_destroyed(view->parent); -+ wined3d_resource_decref(view->resource); -+ HeapFree(GetProcessHeap(), 0, view); -+#endif /* STAGING_CSMT */ - } - - return refcount; -@@ -201,6 +211,7 @@ - return refcount; - } - -+#if defined(STAGING_CSMT) - void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) - { - if (view->object) -@@ -218,6 +229,7 @@ - HeapFree(GetProcessHeap(), 0, view); - } - -+#endif /* STAGING_CSMT */ - ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view) - { - ULONG refcount = InterlockedDecrement(&view->refcount); -@@ -226,6 +238,7 @@ - - if (!refcount) - { -+#if defined(STAGING_CSMT) - struct wined3d_device *device = view->resource->device; - - /* Call wined3d_object_destroyed() before releasing the resource, -@@ -233,6 +246,24 @@ - view->parent_ops->wined3d_object_destroyed(view->parent); - wined3d_resource_decref(view->resource); - wined3d_cs_emit_shader_resource_view_destroy(device->cs, view); -+#else /* STAGING_CSMT */ -+ if (view->object) -+ { -+ const struct wined3d_gl_info *gl_info; -+ struct wined3d_context *context; -+ -+ context = context_acquire(view->resource->device, NULL); -+ gl_info = context->gl_info; -+ gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object); -+ checkGLcall("glDeleteTextures"); -+ context_release(context); -+ } -+ /* Call wined3d_object_destroyed() before releasing the resource, -+ * since releasing the resource may end up destroying the parent. */ -+ view->parent_ops->wined3d_object_destroyed(view->parent); -+ wined3d_resource_decref(view->resource); -+ HeapFree(GetProcessHeap(), 0, view); -+#endif /* STAGING_CSMT */ - } - return refcount; diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c --- a/dlls/wined3d/volume.c @@ -7083,7 +7026,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_gl_bo *swap_buffer, void *swap_heap_memory) DECLSPEC_HIDDEN; -@@ -2689,6 +2756,13 @@ +@@ -2688,6 +2755,13 @@ 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; @@ -7097,7 +7040,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_texture_invalidate_location(struct wined3d_texture *texture, -@@ -2699,6 +2773,7 @@ +@@ -2698,6 +2772,7 @@ const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; @@ -7105,7 +7048,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location); void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, -@@ -2714,6 +2789,15 @@ +@@ -2713,6 +2788,15 @@ const struct wined3d_gl_info *gl_info, GLenum binding) DECLSPEC_HIDDEN; void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; @@ -7121,7 +7064,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; -@@ -2831,7 +2915,11 @@ +@@ -2830,7 +2914,11 @@ unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -7133,7 +7076,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, -@@ -2842,9 +2930,11 @@ +@@ -2841,9 +2929,11 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -7145,33 +7088,20 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -2859,12 +2949,14 @@ +@@ -2858,10 +2948,12 @@ GLuint name; }; +#if defined(STAGING_CSMT) - HRESULT wined3d_sampler_create_from_cs(struct wined3d_device *device, const struct wined3d_sampler_desc *desc, void *parent, struct wined3d_sampler **sampler, BOOL from_cs) DECLSPEC_HIDDEN; - void wined3d_sampler_destroy(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; void wined3d_sampler_init(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -2893,8 +2985,10 @@ - BOOL half_float_conv_needed; - }; - -+#if defined(STAGING_CSMT) - void wined3d_vertex_declaration_destroy(struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; - -+#endif /* STAGING_CSMT */ - struct wined3d_saved_states - { - DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1]; -@@ -2962,6 +3056,7 @@ +@@ -2957,6 +3049,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -7179,7 +7109,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -3012,6 +3107,44 @@ +@@ -3007,6 +3100,44 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; @@ -7224,7 +7154,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; -@@ -3060,6 +3193,7 @@ +@@ -3057,6 +3188,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; @@ -7232,7 +7162,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, -@@ -3127,6 +3261,14 @@ +@@ -3115,6 +3247,14 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7247,7 +7177,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3141,8 +3283,12 @@ +@@ -3129,8 +3269,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -7260,7 +7190,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -3156,12 +3302,16 @@ +@@ -3144,12 +3288,16 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -7277,7 +7207,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 */ -@@ -3188,7 +3338,9 @@ +@@ -3176,7 +3324,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -7287,7 +7217,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3213,6 +3365,7 @@ +@@ -3201,6 +3351,7 @@ 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; @@ -7295,10 +7225,10 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, -@@ -3222,6 +3375,13 @@ +@@ -3209,6 +3360,13 @@ + void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; - void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; +#else /* STAGING_CSMT */ +void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; +HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, @@ -7309,39 +7239,20 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3254,8 +3414,10 @@ - return texture->sub_resources[view->sub_resource_idx].u.surface; - } - -+#if defined(STAGING_CSMT) - void wined3d_rendertarget_view_destroy(struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; - -+#endif /* STAGING_CSMT */ - struct wined3d_shader_resource_view - { - LONG refcount; -@@ -3271,6 +3433,7 @@ - void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view, - struct wined3d_context *context) DECLSPEC_HIDDEN; - -+#if defined(STAGING_CSMT) - void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; - +@@ -3259,8 +3417,12 @@ struct wined3d_swapchain_ops -@@ -3278,6 +3441,12 @@ + { void (*swapchain_present)(struct wined3d_swapchain *swapchain, ++#if defined(STAGING_CSMT) const RECT *src_rect, const RECT *dst_rect, DWORD flags, struct wined3d_rendertarget_view *depth_stencil); +#else /* STAGING_CSMT */ -+struct wined3d_swapchain_ops -+{ -+ void (*swapchain_present)(struct wined3d_swapchain *swapchain, + const RECT *src_rect, const RECT *dst_rect, DWORD flags); +#endif /* STAGING_CSMT */ void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3313,8 +3482,10 @@ +@@ -3296,8 +3458,10 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7352,16 +7263,6 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -@@ -3526,7 +3697,9 @@ - void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, - const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; - BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; -+#if defined(STAGING_CSMT) - void shader_cleanup(struct wined3d_shader *shader) DECLSPEC_HIDDEN; -+#endif /* STAGING_CSMT */ - - static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) - { diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c