diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 299affca..694f4a7d 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "63fcf7faee88aea9425f57de8516dea262f54531" + echo "52a3a3b20633bf3a08860d43c8a9130a693cbedb" } # 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 49f2b354..4fca5afb 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 c8122e4e9084199c6ae10a4314beffd02c9479cd Mon Sep 17 00:00:00 2001 +From 58b512db9806c5b765e05bd63fc34decf955b30d 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 | 361 +++++++++++++++++++++++++++++++++++++---- + dlls/wined3d/cs.c | 365 +++++++++++++++++++++++++++++++++++++---- dlls/wined3d/wined3d_main.c | 9 + dlls/wined3d/wined3d_private.h | 18 ++ - 3 files changed, 360 insertions(+), 28 deletions(-) + 3 files changed, 363 insertions(+), 29 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 0f2156b..ce3f475 100644 +index 44cfb39..a3245a0 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -24,8 +24,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -33,7 +33,7 @@ index 0f2156b..ce3f475 100644 WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DRAW, -@@ -53,6 +64,18 @@ enum wined3d_cs_op +@@ -54,6 +65,18 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_RESET_STATE, WINED3D_CS_OP_DESTROY_OBJECT, @@ -52,7 +52,7 @@ index 0f2156b..ce3f475 100644 }; struct wined3d_cs_present -@@ -260,7 +283,134 @@ struct wined3d_cs_destroy_object +@@ -267,7 +290,134 @@ struct wined3d_cs_destroy_object void *object; }; @@ -188,7 +188,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -276,6 +426,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -283,6 +433,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) { wined3d_resource_release(&swapchain->back_buffers[i]->resource); } @@ -197,7 +197,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -301,13 +453,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -308,13 +460,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw cs->ops->submit(cs); } @@ -213,7 +213,7 @@ index 0f2156b..ce3f475 100644 device = cs->device; state = &device->state; -@@ -326,6 +479,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -333,6 +486,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) } if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) wined3d_resource_release(state->fb.depth_stencil->resource); @@ -222,7 +222,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -358,7 +513,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -365,7 +520,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * cs->ops->submit(cs); } @@ -231,7 +231,7 @@ index 0f2156b..ce3f475 100644 { struct wined3d_state *state = &cs->device->state; struct wined3d_shader_sampler_map_entry *entry; -@@ -417,6 +572,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -424,6 +579,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) wined3d_resource_release(view->resource); } } @@ -240,7 +240,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, -@@ -482,12 +639,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -489,12 +646,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i cs->ops->submit(cs); } @@ -256,7 +256,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -502,12 +661,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -509,12 +668,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query cs->ops->submit(cs); } @@ -272,7 +272,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -521,12 +682,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -528,12 +689,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi cs->ops->submit(cs); } @@ -288,7 +288,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -540,12 +703,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -547,12 +710,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) cs->ops->submit(cs); } @@ -304,7 +304,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -561,7 +726,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -568,7 +733,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v cs->ops->submit(cs); } @@ -313,7 +313,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_set_depth_stencil_view *op = data; struct wined3d_device *device = cs->device; -@@ -600,6 +765,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -607,6 +772,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -322,7 +322,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -613,12 +780,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -620,12 +787,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -338,7 +338,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -632,7 +801,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -639,7 +808,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -347,7 +347,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -650,6 +819,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -657,6 +826,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -356,7 +356,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -667,7 +838,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -674,7 +845,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -365,7 +365,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -677,6 +848,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -684,6 +855,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -374,7 +374,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -692,7 +865,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -699,7 +872,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i cs->ops->submit(cs); } @@ -383,7 +383,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -707,6 +880,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -714,6 +887,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -392,7 +392,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -723,7 +898,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -730,7 +905,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -401,7 +401,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -739,6 +914,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -746,6 +921,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -410,7 +410,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -755,7 +932,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -762,7 +939,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff cs->ops->submit(cs); } @@ -419,7 +419,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -769,6 +946,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -776,6 +953,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -427,7 +427,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -785,7 +963,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -792,7 +970,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha cs->ops->submit(cs); } @@ -436,7 +436,7 @@ index 0f2156b..ce3f475 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; -@@ -862,6 +1040,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -869,6 +1047,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -445,7 +445,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -876,12 +1056,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -883,12 +1063,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -461,7 +461,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -898,12 +1080,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -905,12 +1087,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 cs->ops->submit(cs); } @@ -477,7 +477,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -920,13 +1104,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -927,13 +1111,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -494,7 +494,23 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -941,12 +1127,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -948,12 +1134,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type + cs->ops->submit(cs); + } + +-static void wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data) ++static UINT wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data) + { + const struct wined3d_cs_set_rasterizer_state *op = data; + + cs->state.rasterizer_state = op->state; + device_invalidate_state(cs->device, STATE_FRONTFACE); ++ ++ return sizeof(*op); + } + + void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -968,12 +1156,14 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -510,7 +526,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -961,12 +1149,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -988,12 +1178,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render cs->ops->submit(cs); } @@ -526,7 +542,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -983,12 +1173,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1010,12 +1202,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, cs->ops->submit(cs); } @@ -542,7 +558,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1005,13 +1197,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1032,13 +1226,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, cs->ops->submit(cs); } @@ -559,7 +575,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1027,12 +1221,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1054,12 +1250,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform cs->ops->submit(cs); } @@ -575,7 +591,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -1047,7 +1243,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1074,7 +1272,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const cs->ops->submit(cs); } @@ -584,7 +600,7 @@ index 0f2156b..ce3f475 100644 { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1108,6 +1304,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1135,6 +1333,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -593,7 +609,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1130,12 +1328,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1157,12 +1357,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture cs->ops->submit(cs); } @@ -609,7 +625,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1149,7 +1349,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1176,7 +1378,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma cs->ops->submit(cs); } @@ -618,7 +634,7 @@ index 0f2156b..ce3f475 100644 { struct wined3d_adapter *adapter = cs->device->adapter; HRESULT hr; -@@ -1159,6 +1359,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +@@ -1186,6 +1388,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); @@ -627,7 +643,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1171,11 +1373,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1198,11 +1402,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) cs->ops->submit(cs); } @@ -642,7 +658,7 @@ index 0f2156b..ce3f475 100644 } void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) -@@ -1190,8 +1394,9 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1217,8 +1423,9 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void cs->ops->submit(cs); } @@ -653,7 +669,7 @@ index 0f2156b..ce3f475 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, -@@ -1251,6 +1456,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = +@@ -1279,6 +1486,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = wined3d_cs_st_submit, }; @@ -712,7 +728,7 @@ index 0f2156b..ce3f475 100644 struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -1277,12 +1534,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1305,12 +1564,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) return NULL; } @@ -801,7 +817,7 @@ index 1dd6a8b..f573dcb 100644 if (appkey) RegCloseKey( appkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 90629cf..cf28daf 100644 +index 0659aa5..71bbe74 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -310,6 +310,7 @@ struct wined3d_settings @@ -812,7 +828,7 @@ index 90629cf..cf28daf 100644 }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -2980,6 +2981,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl +@@ -3031,6 +3032,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -831,7 +847,7 @@ index 90629cf..cf28daf 100644 struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); -@@ -2991,9 +3004,14 @@ struct wined3d_cs +@@ -3042,9 +3055,14 @@ struct wined3d_cs const struct wined3d_cs_ops *ops; struct wined3d_device *device; struct wined3d_state state; diff --git a/patches/wined3d-CSMT_Main/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 41e2a215..2bcc9c2a 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 378d4c2fbd1babfcfa29255353300743f6f2ba43 Mon Sep 17 00:00:00 2001 +From d34a6b379ff644f59aa7efa4c33979a8dbff3c49 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 | 365 +++++++++++++++++------------------------ + dlls/wined3d/cs.c | 367 ++++++++++++++++++----------------------- dlls/wined3d/wined3d_private.h | 20 +-- - 2 files changed, 162 insertions(+), 223 deletions(-) + 2 files changed, 163 insertions(+), 224 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 03f7916..229be26 100644 +index 5d8e20c..fb5ae07 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -22,20 +22,10 @@ @@ -35,7 +35,7 @@ index 03f7916..229be26 100644 WINED3D_CS_OP_FENCE, WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, -@@ -392,99 +382,30 @@ struct wined3d_cs_texture_unmap +@@ -399,99 +389,30 @@ struct wined3d_cs_texture_unmap unsigned int sub_resource_idx; }; @@ -149,7 +149,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_fence(struct wined3d_cs *cs, const void *data) -@@ -505,14 +426,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) +@@ -512,14 +433,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 03f7916..229be26 100644 /* A busy wait should be fine, we're not supposed to have to wait very * long. */ -@@ -565,7 +486,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -572,7 +493,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw pending = InterlockedIncrement(&cs->pending_presents); @@ -175,7 +175,7 @@ index 03f7916..229be26 100644 while (pending > 1) pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0); -@@ -607,8 +528,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -614,8 +535,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_clear *op; unsigned int i; @@ -186,7 +186,7 @@ index 03f7916..229be26 100644 op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -628,7 +549,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -635,7 +556,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) wined3d_resource_acquire(state->fb.depth_stencil->resource); @@ -195,7 +195,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) -@@ -769,7 +690,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -776,7 +697,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } } @@ -204,7 +204,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data) -@@ -791,7 +712,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -798,7 +719,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data) -@@ -812,7 +733,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -819,7 +740,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data) -@@ -833,7 +754,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -840,7 +761,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) -@@ -856,7 +777,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -863,7 +784,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data) -@@ -910,7 +831,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -917,7 +838,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data) -@@ -931,7 +852,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -938,7 +859,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) -@@ -968,7 +889,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -975,7 +896,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) -@@ -995,7 +916,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -1002,7 +923,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) -@@ -1028,7 +949,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -1035,7 +956,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) -@@ -1062,7 +983,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -1069,7 +990,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) -@@ -1093,7 +1014,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -1100,7 +1021,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) -@@ -1185,7 +1106,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1192,7 +1113,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data) -@@ -1209,7 +1130,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1216,7 +1137,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 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) -@@ -1233,7 +1154,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1240,7 +1161,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -330,16 +330,25 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) -@@ -1256,7 +1177,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1263,7 +1184,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type op->type = type; op->shader = shader; +- cs->ops->submit(cs); ++ cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data) +@@ -1285,7 +1206,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, + op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; + op->state = rasterizer_state; + - cs->ops->submit(cs); + cs->ops->submit(cs, sizeof(*op)); } static UINT wined3d_cs_exec_set_vs_consts_f(struct wined3d_cs *cs, const void *data) -@@ -1289,8 +1210,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1318,8 +1239,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 +359,7 @@ index 03f7916..229be26 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1315,7 +1237,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1344,7 +1266,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 +368,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) -@@ -1337,8 +1259,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1366,8 +1288,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->state = state; op->value = value; @@ -370,7 +379,7 @@ index 03f7916..229be26 100644 static UINT wined3d_cs_exec_set_vs_consts_b(struct wined3d_cs *cs, const void *data) { -@@ -1368,8 +1290,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1397,8 +1319,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 +390,7 @@ index 03f7916..229be26 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1394,7 +1317,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1423,7 +1346,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 +399,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_vs_consts_i(struct wined3d_cs *cs, const void *data) -@@ -1425,8 +1348,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1454,8 +1377,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 +410,7 @@ index 03f7916..229be26 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1451,7 +1375,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, +@@ -1480,7 +1404,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 +419,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data) -@@ -1475,7 +1399,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1504,7 +1428,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, op->state = state; op->value = value; @@ -419,7 +428,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data) -@@ -1499,7 +1423,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1528,7 +1452,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, op->state = state; op->value = value; @@ -428,7 +437,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) -@@ -1523,7 +1447,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1552,7 +1476,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform op->state = state; op->matrix = *matrix; @@ -437,7 +446,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data) -@@ -1545,7 +1469,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1574,7 +1498,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 +455,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) -@@ -1630,7 +1554,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1659,7 +1583,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -455,7 +464,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data) -@@ -1651,7 +1575,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1680,7 +1604,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,7 +473,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) -@@ -1675,7 +1599,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1704,7 +1628,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; @@ -473,7 +482,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data) -@@ -1696,7 +1620,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1725,7 +1649,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void op->callback = callback; op->object = object; @@ -482,7 +491,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data) -@@ -1722,7 +1646,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -1751,7 +1675,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_GLFINISH; @@ -491,7 +500,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_base_vertex_index(struct wined3d_cs *cs, const void *data) -@@ -1744,7 +1668,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, +@@ -1773,7 +1697,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; @@ -500,7 +509,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data) -@@ -1770,7 +1694,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -1799,7 +1723,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; @@ -509,7 +518,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) -@@ -1827,7 +1751,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light +@@ -1856,7 +1780,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; @@ -518,7 +527,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data) -@@ -1916,7 +1840,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab +@@ -1945,7 +1869,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab op->idx = idx; op->enable = enable; @@ -527,7 +536,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) -@@ -1948,7 +1872,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -1977,7 +1901,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf if (fx) op->fx = *fx; @@ -536,7 +545,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) -@@ -1981,7 +1905,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -2010,7 +1934,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge op->stencil = stencil; op->blitter = blitter; @@ -545,7 +554,7 @@ index 03f7916..229be26 100644 } static UINT wined3d_cs_exec_texture_map(struct wined3d_cs *cs, const void *data) -@@ -2006,12 +1930,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture +@@ -2035,12 +1959,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture op->flags = flags; op->mem = &ret; @@ -561,7 +570,7 @@ index 03f7916..229be26 100644 return ret; } -@@ -2034,11 +1960,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture +@@ -2063,11 +1989,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture op->texture = texture; op->sub_resource_idx = sub_resource_idx; @@ -576,7 +585,7 @@ index 03f7916..229be26 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, -@@ -2084,42 +2012,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2114,42 +2042,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, }; @@ -659,7 +668,7 @@ index 03f7916..229be26 100644 }; /* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -@@ -2131,9 +2076,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) +@@ -2161,9 +2106,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; @@ -699,7 +708,7 @@ index 03f7916..229be26 100644 void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) { -@@ -2157,31 +2131,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, +@@ -2187,31 +2161,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; @@ -746,7 +755,7 @@ index 03f7916..229be26 100644 } done: -@@ -2206,25 +2181,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2236,25 +2211,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) cs->ops = &wined3d_cs_st_ops; cs->device = device; @@ -772,7 +781,7 @@ index 03f7916..229be26 100644 if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL))) { ERR("Failed to create wined3d command stream thread.\n"); -@@ -2236,12 +2196,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2266,12 +2226,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) err: if (cs) @@ -785,7 +794,7 @@ index 03f7916..229be26 100644 HeapFree(GetProcessHeap(), 0, cs); return NULL; } -@@ -2260,17 +2215,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -2290,17 +2245,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) CloseHandle(cs->thread); if (ret != WAIT_OBJECT_0) ERR("Wait failed (%#x).\n", ret); @@ -804,7 +813,7 @@ index 03f7916..229be26 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index f2f03c5..2f2c92e 100644 +index b8553ec..86de475 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -31,6 +31,7 @@ @@ -815,7 +824,7 @@ index f2f03c5..2f2c92e 100644 #include #include #include -@@ -2989,19 +2990,17 @@ struct wined3d_cs_list +@@ -3040,19 +3041,17 @@ struct wined3d_cs_list struct list blocks; }; @@ -840,7 +849,7 @@ index f2f03c5..2f2c92e 100644 void (*finish)(struct wined3d_cs *cs); }; -@@ -3012,14 +3011,9 @@ struct wined3d_cs +@@ -3063,14 +3062,9 @@ struct wined3d_cs struct wined3d_state state; HANDLE thread; DWORD thread_id; diff --git a/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch b/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch index afa6d6cd..3b43261d 100644 --- a/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch +++ b/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch @@ -1,4 +1,4 @@ -From 1b7f01d44d06c0dcca1d1ff4220f12062f15b75a Mon Sep 17 00:00:00 2001 +From f7e627297065b53c0517701fae5203bf0af3e4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 30 Aug 2013 17:00:35 +0200 Subject: wined3d: Wrap GL BOs in a structure @@ -14,10 +14,10 @@ them for DISCARD maps. 5 files changed, 91 insertions(+), 32 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 0375480..62d64f6 100644 +index 0b393ca..cf60d3d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -5200,3 +5200,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5267,3 +5267,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -75,10 +75,10 @@ index 0375480..62d64f6 100644 + wined3d_device_destroy_bo(device, context, bo); +} diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index fe9eedb..9fbd0db 100644 +index 444237e..46f79db 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -2933,7 +2933,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3080,7 +3080,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, /* Don't use PBOs for converted surfaces. During PBO conversion we look at * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is * getting called. */ @@ -88,10 +88,10 @@ index fe9eedb..9fbd0db 100644 TRACE("Removing the pbo attached to surface %p.\n", surface); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 1b656df..bd415eb 100644 +index 34e5582..91e35f8 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -192,7 +192,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su +@@ -206,7 +206,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su if (locations & WINED3D_LOCATION_BUFFER) { data->addr = NULL; @@ -100,7 +100,7 @@ index 1b656df..bd415eb 100644 return; } if (locations & WINED3D_LOCATION_USER_MEMORY) -@@ -289,18 +289,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc +@@ -303,18 +303,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc /* Context activation is done by the caller. */ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture, @@ -125,7 +125,7 @@ index 1b656df..bd415eb 100644 } static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) -@@ -320,7 +319,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) +@@ -334,7 +333,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) && !wined3d_texture_load_location(texture, i, context, map_binding)) ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding)); if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER) @@ -134,7 +134,7 @@ index 1b656df..bd415eb 100644 } if (context) -@@ -393,8 +392,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -491,28 +490,25 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) unsigned int sub_count = texture->level_count * texture->layer_count; struct wined3d_device *device = texture->resource.device; struct wined3d_context *context = NULL; @@ -144,7 +144,6 @@ index 1b656df..bd415eb 100644 unsigned int i; TRACE("texture %p.\n", texture); -@@ -407,20 +405,18 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) for (i = 0; i < sub_count; ++i) { @@ -169,7 +168,7 @@ index 1b656df..bd415eb 100644 } if (context) context_release(context); -@@ -1084,22 +1080,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1185,22 +1181,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT /* Context activation is done by the caller. */ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture, @@ -197,7 +196,7 @@ index 1b656df..bd415eb 100644 } static void wined3d_texture_force_reload(struct wined3d_texture *texture) -@@ -1225,7 +1218,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1326,7 +1319,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned return TRUE; case WINED3D_LOCATION_BUFFER: @@ -206,7 +205,7 @@ index 1b656df..bd415eb 100644 return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1552,8 +1545,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1620,8 +1613,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -218,7 +217,7 @@ index 1b656df..bd415eb 100644 if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c -index dda5f98..a57c244 100644 +index 3fbf698..25b774a 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -174,7 +174,7 @@ BOOL wined3d_volume_load_location(struct wined3d_volume *volume, @@ -240,11 +239,11 @@ index dda5f98..a57c244 100644 if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 0934cee..55b96ee 100644 +index 2bf9a14..0178bb4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2266,6 +2266,14 @@ struct wined3d_state - DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; +@@ -2426,6 +2426,14 @@ struct wined3d_state + struct wined3d_rasterizer_state *rasterizer_state; }; +struct wined3d_gl_bo @@ -258,7 +257,7 @@ index 0934cee..55b96ee 100644 #define WINED3D_UNMAPPED_STAGE ~0U /* Multithreaded flag. Removed from the public header to signal that -@@ -2373,6 +2381,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D +@@ -2534,6 +2542,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN; @@ -270,7 +269,7 @@ index 0934cee..55b96ee 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2560,7 +2573,7 @@ struct wined3d_texture +@@ -2721,7 +2734,7 @@ struct wined3d_texture unsigned int map_count; DWORD locations; diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 57a29294..c2aceefc 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -690,7 +690,7 @@ 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 +61,52 @@ enum wined3d_cs_op +@@ -54,6 +62,52 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_RESET_STATE, WINED3D_CS_OP_DESTROY_OBJECT, @@ -743,7 +743,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -260,7 +314,284 @@ struct wined3d_cs_destroy_object +@@ -267,7 +321,284 @@ struct wined3d_cs_destroy_object void *object; }; @@ -1028,7 +1028,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -269,13 +600,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -276,13 +607,24 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) swapchain = op->swapchain; wined3d_swapchain_set_window(swapchain, op->dst_window_override); @@ -1053,7 +1053,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -283,6 +625,9 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -290,6 +632,9 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw { struct wined3d_cs_present *op; unsigned int i; @@ -1063,7 +1063,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; -@@ -298,34 +643,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -305,34 +650,75 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); } @@ -1139,7 +1139,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -334,8 +720,13 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -341,8 +727,13 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_clear *op; unsigned int i; @@ -1153,7 +1153,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; -@@ -348,11 +739,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -355,11 +746,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1171,7 +1171,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_resource_acquire(state->fb->depth_stencil->resource); cs->ops->submit(cs); -@@ -361,12 +758,65 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -368,12 +765,65 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { struct wined3d_state *state = &cs->device->state; @@ -1237,7 +1237,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) { -@@ -391,11 +841,19 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -398,11 +848,19 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1257,7 +1257,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -417,6 +875,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -424,6 +882,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) wined3d_resource_release(view->resource); } } @@ -1268,7 +1268,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, -@@ -439,11 +901,25 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -446,11 +908,25 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i op->indexed = indexed; if (indexed) @@ -1294,7 +1294,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } for (i = 0; i < ARRAY_SIZE(state->textures); ++i) { -@@ -452,11 +928,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -459,11 +935,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -1314,7 +1314,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -479,15 +963,26 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -486,15 +970,26 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } } @@ -1341,7 +1341,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) -@@ -499,15 +994,26 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -506,15 +1001,26 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query op->predicate = predicate; op->value = value; @@ -1368,7 +1368,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) -@@ -518,15 +1024,26 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -525,15 +1031,26 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -1395,7 +1395,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) -@@ -537,15 +1054,29 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -544,15 +1061,29 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -1425,7 +1425,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, -@@ -558,16 +1089,27 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -565,16 +1096,27 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v op->view_idx = view_idx; op->view = view; @@ -1453,7 +1453,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -575,15 +1117,26 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -582,15 +1124,26 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const || prev_surface->container->flags & WINED3D_TEXTURE_DISCARD)) { surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); @@ -1480,7 +1480,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -600,6 +1153,10 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -607,6 +1160,10 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1491,7 +1491,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) -@@ -610,15 +1167,26 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -617,15 +1174,26 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -1518,7 +1518,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) -@@ -629,10 +1197,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -636,10 +1204,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -1536,7 +1536,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; -@@ -650,6 +1225,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -657,6 +1232,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1547,7 +1547,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, -@@ -664,10 +1243,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -671,10 +1250,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, op->offset = offset; op->stride = stride; @@ -1565,7 +1565,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; -@@ -677,6 +1263,10 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -684,6 +1270,10 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1576,7 +1576,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) -@@ -689,10 +1279,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -696,10 +1286,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i op->frequency = frequency; op->flags = flags; @@ -1594,7 +1594,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; -@@ -707,6 +1304,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -714,6 +1311,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -1605,7 +1605,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, -@@ -720,10 +1321,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -727,10 +1328,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, op->buffer = buffer; op->offset = offset; @@ -1623,7 +1623,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; -@@ -739,6 +1347,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -746,6 +1354,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -1634,7 +1634,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, -@@ -752,11 +1364,18 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -759,11 +1371,18 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff op->format_id = format_id; op->offset = offset; @@ -1654,7 +1654,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; -@@ -769,6 +1388,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -776,6 +1395,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -1664,7 +1664,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, -@@ -782,10 +1404,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -789,10 +1411,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha op->cb_idx = cb_idx; op->buffer = buffer; @@ -1682,7 +1682,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; -@@ -862,6 +1491,10 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -869,6 +1498,10 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1693,7 +1693,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) -@@ -872,16 +1505,27 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -879,16 +1512,27 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -1721,7 +1721,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, -@@ -895,15 +1539,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -902,15 +1546,26 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 op->view_idx = view_idx; op->view = view; @@ -1748,7 +1748,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, -@@ -917,16 +1572,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -924,16 +1579,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -1776,10 +1776,37 @@ 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) -@@ -938,15 +1604,86 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -945,15 +1611,26 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type op->type = type; op->shader = shader; ++#if !defined(STAGING_CSMT) + cs->ops->submit(cs); + } + + static void wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ ++ cs->ops->submit(cs, sizeof(*op)); ++} ++ ++static UINT wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data) ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_rasterizer_state *op = data; + + cs->state.rasterizer_state = op->state; + device_invalidate_state(cs->device, STATE_FRONTFACE); ++#if defined(STAGING_CSMT) ++ ++ return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -965,15 +1642,86 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, + op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; + op->state = rasterizer_state; + +#if !defined(STAGING_CSMT) cs->ops->submit(cs); } @@ -1863,7 +1890,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) -@@ -958,6 +1695,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -985,6 +1733,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->state = state; op->value = value; @@ -1871,7 +1898,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -967,6 +1705,135 @@ static void wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void +@@ -994,6 +1743,135 @@ static void wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void cs->state.texture_states[op->stage][op->state] = op->value; device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); @@ -2007,7 +2034,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, -@@ -980,15 +1847,26 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1007,15 +1885,26 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, op->state = state; op->value = value; @@ -2034,7 +2061,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, -@@ -1002,16 +1880,27 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1029,16 +1918,27 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, op->state = state; op->value = value; @@ -2062,7 +2089,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, -@@ -1024,15 +1913,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1051,15 +1951,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform op->state = state; op->matrix = *matrix; @@ -2089,7 +2116,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) -@@ -1044,10 +1944,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1071,10 +1982,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const op->plane_idx = plane_idx; op->plane = *plane; @@ -2107,7 +2134,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; -@@ -1108,6 +2015,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1135,6 +2053,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -2118,7 +2145,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, -@@ -1127,15 +2038,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1154,15 +2076,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -2145,7 +2172,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) -@@ -1146,17 +2068,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1173,17 +2106,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -2181,7 +2208,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1166,14 +2106,25 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1193,14 +2144,25 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -2207,7 +2234,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) -@@ -1185,6 +2136,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void +@@ -1212,6 +2174,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void op->callback = callback; op->object = object; @@ -2215,7 +2242,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); } -@@ -1330,5 +2282,1263 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -1358,5 +2321,1264 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) state_cleanup(&cs->state); HeapFree(GetProcessHeap(), 0, cs->fb.render_targets); HeapFree(GetProcessHeap(), 0, cs->data); @@ -3095,6 +3122,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + /* WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW */ wined3d_cs_exec_set_shader_resource_view, + /* WINED3D_CS_OP_SET_SAMPLER */ wined3d_cs_exec_set_sampler, + /* WINED3D_CS_OP_SET_SHADER */ wined3d_cs_exec_set_shader, ++ /* WINED3D_CS_OP_SET_RASTERIZER_STATE */ wined3d_cs_exec_set_rasterizer_state, + /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state, + /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state, + /* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state, @@ -3936,7 +3964,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; if (src_view->resource->type == WINED3D_RTYPE_BUFFER) { -@@ -2403,6 +2570,18 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3 +@@ -2429,6 +2596,18 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3 return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx]; } @@ -3955,7 +3983,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants) { -@@ -2430,7 +2609,12 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, +@@ -2456,7 +2635,12 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, } else { @@ -3968,7 +3996,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2479,7 +2663,12 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, +@@ -2505,7 +2689,12 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, } else { @@ -3981,7 +4009,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2524,7 +2713,12 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, +@@ -2550,7 +2739,12 @@ 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 @@ -3994,7 +4022,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2663,7 +2857,12 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, +@@ -2689,7 +2883,12 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, } else { @@ -4007,7 +4035,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2712,7 +2911,12 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, +@@ -2738,7 +2937,12 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, } else { @@ -4020,7 +4048,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2758,7 +2962,12 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, +@@ -2784,7 +2988,12 @@ 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 @@ -4033,7 +4061,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2918,6 +3127,15 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO +@@ -2944,6 +3153,15 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO return hr; } @@ -4049,7 +4077,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_device_get_transform(device, WINED3D_TS_VIEW, &view_mat); wined3d_device_get_transform(device, WINED3D_TS_PROJECTION, &proj_mat); wined3d_device_get_transform(device, WINED3D_TS_WORLD_MATRIX(0), &world_mat); -@@ -3403,8 +3621,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) +@@ -3429,8 +3647,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -4060,7 +4088,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3413,6 +3633,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3439,6 +3659,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) return WINED3DERR_INVALIDCALL; } @@ -4068,7 +4096,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c context = context_acquire(device, NULL); /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ context->gl_info->gl_ops.gl.p_glFlush(); -@@ -3420,6 +3641,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3446,6 +3667,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) * fails. */ context_release(context); @@ -4076,7 +4104,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3427,6 +3649,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3453,6 +3675,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -4087,7 +4115,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, debug_color(color), depth, stencil); -@@ -3438,7 +3664,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3464,7 +3690,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -4099,7 +4127,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3447,8 +3677,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3473,8 +3703,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -4113,7 +4141,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3494,7 +3729,9 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, +@@ -3520,7 +3755,9 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -4123,7 +4151,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type)); gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); -@@ -3502,8 +3739,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, +@@ -3528,8 +3765,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -4137,7 +4165,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device, -@@ -3563,10 +3805,16 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3589,10 +3831,16 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device start_idx, index_count, start_instance, instance_count, TRUE); } @@ -4154,7 +4182,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_const_bo_address data; struct wined3d_context *context; struct wined3d_map_desc src; -@@ -3591,6 +3839,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3617,6 +3865,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, } context = context_acquire(device, NULL); @@ -4168,7 +4196,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3598,6 +3853,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3624,6 +3879,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, for (i = 0; i < level_count; ++i) { @@ -4176,7 +4204,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_resource_map(&src_texture->resource, src_level + i, &src, NULL, WINED3D_MAP_READONLY))) goto done; -@@ -3614,16 +3870,92 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3640,16 +3896,92 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, done: context_release(context); return hr; @@ -4269,7 +4297,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3660,6 +3992,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3686,6 +4018,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } @@ -4277,7 +4305,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c level_count = min(wined3d_texture_get_level_count(src_texture), wined3d_texture_get_level_count(dst_texture)); -@@ -3682,9 +4015,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3708,9 +4041,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, context_release(context); /* Update every surface level of the texture. */ @@ -4299,7 +4327,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { unsigned int src_levels = src_texture->level_count; unsigned int dst_levels = dst_texture->level_count; -@@ -3717,6 +4062,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3743,6 +4088,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, FIXME("Unsupported texture type %#x.\n", type); return WINED3DERR_INVALIDCALL; } @@ -4338,7 +4366,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3764,8 +4141,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3790,8 +4167,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -4352,7 +4380,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3954,6 +4336,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -3980,6 +4362,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev struct wined3d_texture *dst_texture, *src_texture; RECT dst_rect, src_rect; HRESULT hr; @@ -4362,7 +4390,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -4041,6 +4426,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4067,6 +4452,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev if (src_box) { @@ -4379,7 +4407,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); } else -@@ -4054,6 +4449,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4080,6 +4475,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), dst_y + (src_rect.bottom - src_rect.top)); @@ -4405,7 +4433,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) WARN("Failed to blit, hr %#x.\n", hr); -@@ -4066,6 +4480,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4092,6 +4506,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str unsigned int depth_pitch) { struct wined3d_texture_sub_resource *sub_resource; @@ -4413,7 +4441,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c const struct wined3d_gl_info *gl_info; struct wined3d_const_bo_address addr; unsigned int width, height, level; -@@ -4074,6 +4489,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4100,6 +4515,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str struct wined3d_surface *surface; POINT dst_point; RECT src_rect; @@ -4423,7 +4451,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch); -@@ -4107,6 +4525,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4133,6 +4551,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -4431,7 +4459,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c surface = sub_resource->u.surface; level = sub_resource_idx % texture->level_count; -@@ -4117,6 +4536,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4143,6 +4562,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str src_rect.top = 0; if (box) { @@ -4449,7 +4477,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box->left >= box->right || box->right > width || box->top >= box->bottom || box->bottom > height || box->front >= box->back) -@@ -4124,6 +4554,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4150,6 +4580,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str WARN("Invalid box %s specified.\n", debug_box(box)); return; } @@ -4457,7 +4485,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c src_rect.right = box->right - box->left; src_rect.bottom = box->bottom - box->top; -@@ -4158,6 +4589,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4184,6 +4615,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -4469,7 +4497,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4166,8 +4602,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4192,8 +4628,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi { const struct blit_shader *blitter; struct wined3d_resource *resource; @@ -4483,7 +4511,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n", device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil); -@@ -4206,10 +4647,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4232,10 +4673,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3DERR_INVALIDCALL; } @@ -4499,7 +4527,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4223,20 +4669,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4249,20 +4695,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -4531,7 +4559,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4276,13 +4733,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4302,13 +4759,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -4553,7 +4581,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4294,18 +4759,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4320,18 +4785,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4583,7 +4611,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4527,6 +5003,10 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4553,6 +5029,10 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) TRACE("device %p.\n", device); @@ -4594,7 +4622,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Checking resource %p for eviction.\n", resource); -@@ -4534,6 +5014,7 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4560,6 +5040,7 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -4602,7 +4630,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c resource->resource_ops->resource_unload(resource); } } -@@ -4545,10 +5026,20 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4571,10 +5052,20 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { struct wined3d_resource *resource, *cursor; @@ -4623,7 +4651,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -4558,11 +5049,17 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d +@@ -4584,11 +5075,17 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d resource->resource_ops->resource_unload(resource); } @@ -4641,7 +4669,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); -@@ -4583,12 +5080,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d +@@ -4609,12 +5106,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4672,7 +4700,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4605,6 +5120,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4631,6 +5146,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru return hr; } @@ -4680,7 +4708,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Recreate the primary swapchain's context */ swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); if (!swapchain->context) -@@ -4617,10 +5133,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4643,10 +5159,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; if (!(context = context_create(swapchain, target, swapchain->ds_format))) @@ -4696,7 +4724,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HeapFree(GetProcessHeap(), 0, swapchain->context); return E_FAIL; } -@@ -4630,6 +5151,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4656,6 +5177,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru create_dummy_textures(device, context); create_default_samplers(device); context_release(context); @@ -4709,7 +4737,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4649,6 +5176,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4675,6 +5202,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -4724,7 +4752,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { ERR("Failed to get the first implicit swapchain.\n"); -@@ -4668,10 +5203,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4694,10 +5229,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -4741,7 +4769,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4680,10 +5221,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4706,10 +5247,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4764,7 +4792,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4905,30 +5458,52 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4931,30 +5484,52 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -4817,7 +4845,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4936,7 +5511,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4962,7 +5537,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = create_primary_opengl_context(device, swapchain); @@ -4829,7 +4857,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* All done. There is no need to reload resources or shaders, this will happen automatically on the -@@ -5018,11 +5597,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5044,11 +5623,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4849,7 +4877,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5158,8 +5745,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5184,8 +5771,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -4867,7 +4895,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state = &device->state; if (!(device->cs = wined3d_cs_create(device))) -@@ -5253,3 +5849,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5279,3 +5875,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -5812,7 +5840,7 @@ 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 -@@ -3052,7 +3052,11 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 +@@ -3066,7 +3066,11 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -5827,7 +5855,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c -@@ -105,7 +105,11 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ +@@ -152,7 +152,11 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ const struct wined3d_gl_info *gl_info = context->gl_info; /* No z test without depth stencil buffers */ @@ -5839,7 +5867,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c { TRACE("No Z buffer - disabling depth test\n"); zenable = WINED3D_ZB_FALSE; -@@ -382,14 +386,23 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st +@@ -429,14 +433,23 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st GLenum srcBlend, dstBlend; unsigned int rt_fmt_flags; @@ -5863,7 +5891,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c /* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific * blending parameters to work. */ -@@ -823,7 +836,11 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ +@@ -870,7 +883,11 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ GLint depthFail_ccw; /* No stencil test without a stencil buffer. */ @@ -5875,7 +5903,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c { gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST); checkGLcall("glDisable GL_STENCIL_TEST"); -@@ -919,7 +936,11 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ +@@ -966,7 +983,11 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ static void state_stencilwrite2s(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -5887,7 +5915,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c const struct wined3d_gl_info *gl_info = context->gl_info; GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK)); -@@ -933,7 +954,11 @@ static void state_stencilwrite2s(struct wined3d_context *context, const struct w +@@ -980,7 +1001,11 @@ static void state_stencilwrite2s(struct wined3d_context *context, const struct w static void state_stencilwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -5899,7 +5927,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c const struct wined3d_gl_info *gl_info = context->gl_info; gl_info->gl_ops.gl.p_glStencilMask(mask); -@@ -1671,7 +1696,11 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 +@@ -1718,7 +1743,11 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS] || state->render_states[WINED3D_RS_DEPTHBIAS]) { @@ -5911,7 +5939,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c float scale; union -@@ -3604,7 +3633,11 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state +@@ -3651,7 +3680,11 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state } else { @@ -5923,7 +5951,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c { ERR("Failed to create sampler.\n"); sampler = NULL; -@@ -4585,8 +4618,13 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine +@@ -4632,8 +4665,13 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -5937,7 +5965,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; unsigned int width, height; -@@ -4772,7 +4810,11 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st +@@ -4819,7 +4857,11 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st } else { @@ -5949,7 +5977,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c UINT height; UINT width; -@@ -4840,7 +4882,11 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state +@@ -4884,7 +4926,11 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); @@ -8804,7 +8832,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN; BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2338,7 +2401,11 @@ struct wined3d_stream_state +@@ -2346,7 +2409,11 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -8816,8 +8844,8 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2384,6 +2451,16 @@ struct wined3d_state - DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; +@@ -2393,6 +2460,16 @@ struct wined3d_state + struct wined3d_rasterizer_state *rasterizer_state; }; +#if defined(STAGING_CSMT) @@ -8833,7 +8861,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #define WINED3D_UNMAPPED_STAGE ~0U /* Multithreaded flag. Removed from the public header to signal that -@@ -2436,16 +2513,21 @@ struct wined3d_device +@@ -2445,16 +2522,21 @@ struct wined3d_device struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -8855,7 +8883,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; -@@ -2492,9 +2574,23 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2501,9 +2583,23 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -8879,7 +8907,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2538,7 +2634,11 @@ struct wined3d_resource +@@ -2547,7 +2643,11 @@ struct wined3d_resource UINT depth; UINT size; DWORD priority; @@ -8891,7 +8919,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct list resource_list_entry; LONG access_count; -@@ -2645,6 +2745,9 @@ struct wined3d_texture +@@ -2654,6 +2754,9 @@ struct wined3d_texture DWORD flags; GLenum target; DWORD update_map_binding; @@ -8901,7 +8929,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; -@@ -2682,7 +2785,12 @@ struct wined3d_texture +@@ -2691,7 +2794,12 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -8914,7 +8942,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2733,11 +2841,23 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2742,11 +2850,23 @@ void wined3d_texture_bind(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -8938,7 +8966,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, -@@ -2748,13 +2868,28 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size +@@ -2757,13 +2877,28 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; @@ -8967,7 +8995,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; -@@ -2872,7 +3007,11 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru +@@ -2881,7 +3016,11 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -8979,7 +9007,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, -@@ -2883,6 +3022,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -2892,6 +3031,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -8991,7 +9019,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -2897,6 +3041,12 @@ struct wined3d_sampler +@@ -2906,6 +3050,12 @@ struct wined3d_sampler GLuint name; }; @@ -9004,7 +9032,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -2992,6 +3142,7 @@ struct wined3d_stateblock +@@ -3001,6 +3151,7 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -9012,7 +9040,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; -@@ -3005,29 +3156,74 @@ enum wined3d_push_constants +@@ -3014,29 +3165,74 @@ enum wined3d_push_constants WINED3D_PUSH_CONSTANTS_PS_I, WINED3D_PUSH_CONSTANTS_VS_B, WINED3D_PUSH_CONSTANTS_PS_B, @@ -9087,7 +9115,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; -@@ -3078,12 +3274,70 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -3089,12 +3285,70 @@ 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; @@ -9158,7 +9186,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 */ -@@ -3110,6 +3364,9 @@ struct wined3d_buffer +@@ -3121,6 +3375,9 @@ struct wined3d_buffer GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -9168,7 +9196,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3134,11 +3391,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co +@@ -3145,11 +3402,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -9188,7 +9216,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3200,7 +3465,12 @@ struct wined3d_unordered_access_view +@@ -3211,7 +3476,12 @@ struct wined3d_unordered_access_view struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -9201,7 +9229,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3236,6 +3506,10 @@ struct wined3d_swapchain +@@ -3247,6 +3517,10 @@ struct wined3d_swapchain void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;