diff --git a/patches/server-Key_State/0001-server-Introduce-a-helper-function-to-update-the-thr.patch b/patches/server-Key_State/0001-server-Introduce-a-helper-function-to-update-the-thr.patch index 14ee8680..aa8a83cc 100644 --- a/patches/server-Key_State/0001-server-Introduce-a-helper-function-to-update-the-thr.patch +++ b/patches/server-Key_State/0001-server-Introduce-a-helper-function-to-update-the-thr.patch @@ -1,4 +1,4 @@ -From b575a8659eb9daa7af14c15f9f564a19e4b5dbd5 Mon Sep 17 00:00:00 2001 +From 8ba268938be7e8f4c749be14decc23ebc67bcbc4 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 12 Mar 2015 00:44:25 +0100 Subject: server: Introduce a helper function to update the thread_input key @@ -9,10 +9,10 @@ Subject: server: Introduce a helper function to update the thread_input key 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/server/queue.c b/server/queue.c -index 3a321cd..85c0786 100644 +index 350d45a..5031ac4 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1215,9 +1215,9 @@ static void set_input_key_state( unsigned char *keystate, unsigned char key, int +@@ -1238,9 +1238,9 @@ static void set_input_key_state( unsigned char *keystate, unsigned char key, int else keystate[key] &= ~0x80; } @@ -25,7 +25,7 @@ index 3a321cd..85c0786 100644 { unsigned char key; int down = 0; -@@ -1279,6 +1279,12 @@ static void update_input_key_state( struct desktop *desktop, unsigned char *keys +@@ -1302,6 +1302,12 @@ static void update_input_key_state( struct desktop *desktop, unsigned char *keys } } @@ -38,7 +38,7 @@ index 3a321cd..85c0786 100644 /* release the hardware message currently being processed by the given thread */ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_id, int remove ) -@@ -1309,7 +1315,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i +@@ -1332,7 +1338,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i } if (clr_bit) clear_queue_bits( queue, clr_bit ); @@ -47,16 +47,16 @@ index 3a321cd..85c0786 100644 list_remove( &msg->entry ); free_message( msg ); } -@@ -1430,7 +1436,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg +@@ -1451,7 +1457,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg + struct thread_input *input; unsigned int msg_code; - struct hardware_msg_data *data = msg->data; - update_input_key_state( desktop, desktop->keystate, msg ); + update_key_state( desktop, desktop->keystate, msg ); last_input_time = get_tick_count(); if (msg->msg != WM_MOUSEMOVE) always_queue = 1; -@@ -1473,7 +1479,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg +@@ -1494,7 +1500,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg win = find_hardware_message_window( desktop, input, msg, &msg_code, &thread ); if (!win || !thread) { @@ -65,7 +65,7 @@ index 3a321cd..85c0786 100644 free_message( msg ); return; } -@@ -1911,7 +1917,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user +@@ -1936,7 +1942,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user if (!win || !win_thread) { /* no window at all, remove it */ @@ -74,7 +74,7 @@ index 3a321cd..85c0786 100644 list_remove( &msg->entry ); free_message( msg ); continue; -@@ -1927,7 +1933,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user +@@ -1952,7 +1958,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user else { /* for another thread input, drop it */ @@ -84,5 +84,5 @@ index 3a321cd..85c0786 100644 free_message( msg ); } -- -2.3.1 +2.3.5 diff --git a/patches/server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch b/patches/server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch index 46c7de0f..ed0986f3 100644 --- a/patches/server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch +++ b/patches/server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch @@ -1,4 +1,4 @@ -From 97a7b572e7556d8867f025d94b9d361c3dd19a5a Mon Sep 17 00:00:00 2001 +From 5418bd3f836d3db0cbc70d5d5d79bc68a512414d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 15 Mar 2015 01:05:48 +0100 Subject: server: Fix handling of GetMessage after previous PeekMessage call. @@ -12,7 +12,7 @@ Changes in v2: 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c -index 5f10a89..dfb002e 100644 +index 5ef3840..9c2b249 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -10459,13 +10459,10 @@ static void test_PeekMessage3(void) @@ -63,10 +63,10 @@ index 5f10a89..dfb002e 100644 ret = PeekMessageA(&msg, NULL, 0, 0, 0); ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); diff --git a/server/queue.c b/server/queue.c -index 3a321cd..68b6a19 100644 +index 350d45a..4931760 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -138,6 +138,7 @@ struct msg_queue +@@ -140,6 +140,7 @@ struct msg_queue struct thread_input *input; /* thread input descriptor */ struct hook_table *hooks; /* hook table */ timeout_t last_get_msg; /* time of last get message call */ @@ -74,7 +74,7 @@ index 3a321cd..68b6a19 100644 }; struct hotkey -@@ -292,6 +293,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ +@@ -294,6 +295,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->input = (struct thread_input *)grab_object( input ); queue->hooks = NULL; queue->last_get_msg = current_time; @@ -82,7 +82,7 @@ index 3a321cd..68b6a19 100644 list_init( &queue->send_result ); list_init( &queue->callback_result ); list_init( &queue->pending_timers ); -@@ -479,13 +481,21 @@ static inline struct msg_queue *get_current_queue(void) +@@ -491,13 +493,21 @@ static inline struct msg_queue *get_current_queue(void) } /* get a (pseudo-)unique id to tag hardware messages */ @@ -105,7 +105,7 @@ index 3a321cd..68b6a19 100644 /* try to merge a message with the last in the list; return 1 if successful */ static int merge_message( struct thread_input *input, const struct message *msg ) { -@@ -772,6 +782,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win, +@@ -786,6 +796,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win, { if (!match_window( win, msg->win )) continue; if (!check_msg_filter( msg->msg, first, last )) continue; @@ -113,7 +113,7 @@ index 3a321cd..68b6a19 100644 goto found; /* found one */ } return 0; -@@ -1341,6 +1352,7 @@ found: +@@ -1364,6 +1375,7 @@ found: msg->msg = WM_HOTKEY; msg->wparam = hotkey->id; msg->lparam = ((hotkey->vkey & 0xffff) << 16) | modifiers; @@ -121,7 +121,7 @@ index 3a321cd..68b6a19 100644 free( msg->data ); msg->data = NULL; -@@ -1944,7 +1956,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user +@@ -1969,7 +1981,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user continue; } /* now we can return it */ @@ -130,15 +130,15 @@ index 3a321cd..68b6a19 100644 reply->type = MSG_HARDWARE; reply->win = win; reply->msg = msg_code; -@@ -2049,6 +2061,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa +@@ -2075,6 +2087,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa msg->result = NULL; msg->data = NULL; msg->data_size = 0; + msg->unique_id = get_unique_post_id(); - list_add_tail( &thread->queue->msg_list[POST_MESSAGE], &msg->entry ); - set_queue_bits( thread->queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE ); -@@ -2263,6 +2276,7 @@ DECL_HANDLER(send_message) + get_message_defaults( thread->queue, &msg->x, &msg->y, &msg->time ); + +@@ -2292,6 +2305,7 @@ DECL_HANDLER(send_message) set_queue_bits( recv_queue, QS_SENDMESSAGE ); break; case MSG_POSTED: @@ -146,7 +146,7 @@ index 3a321cd..68b6a19 100644 list_add_tail( &recv_queue->msg_list[POST_MESSAGE], &msg->entry ); set_queue_bits( recv_queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE ); if (msg->msg == WM_HOTKEY) -@@ -2392,7 +2406,7 @@ DECL_HANDLER(get_message) +@@ -2421,7 +2435,7 @@ DECL_HANDLER(get_message) if ((filter & QS_INPUT) && filter_contains_hw_range( req->get_first, req->get_last ) && get_hardware_message( current, req->hw_id, get_win, req->get_first, req->get_last, req->flags, reply )) @@ -155,17 +155,17 @@ index 3a321cd..68b6a19 100644 /* now check for WM_PAINT */ if ((filter & QS_PAINT) && -@@ -2405,7 +2419,7 @@ DECL_HANDLER(get_message) +@@ -2434,7 +2448,7 @@ DECL_HANDLER(get_message) reply->wparam = 0; reply->lparam = 0; - reply->time = get_tick_count(); + get_message_defaults( queue, &reply->x, &reply->y, &reply->time ); - return; + goto found_msg; } /* now check for timer */ -@@ -2421,13 +2435,20 @@ DECL_HANDLER(get_message) - reply->time = get_tick_count(); +@@ -2450,13 +2464,20 @@ DECL_HANDLER(get_message) + get_message_defaults( queue, &reply->x, &reply->y, &reply->time ); if (!(req->flags & PM_NOYIELD) && current->process->idle_event) set_event( current->process->idle_event ); - return; @@ -186,7 +186,7 @@ index 3a321cd..68b6a19 100644 } -@@ -2445,7 +2466,10 @@ DECL_HANDLER(reply_message) +@@ -2474,7 +2495,10 @@ DECL_HANDLER(reply_message) DECL_HANDLER(accept_hardware_message) { if (current->queue) diff --git a/patches/wined3d-CSMT_Main/0043-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0043-wined3d-Move-the-framebuffer-into-wined3d_state.patch index e0d1bb36..3ca2886d 100644 --- a/patches/wined3d-CSMT_Main/0043-wined3d-Move-the-framebuffer-into-wined3d_state.patch +++ b/patches/wined3d-CSMT_Main/0043-wined3d-Move-the-framebuffer-into-wined3d_state.patch @@ -1,4 +1,4 @@ -From 9e339aaca2d76bc24048081c3e47b49a840c716e Mon Sep 17 00:00:00 2001 +From 0140f5051aba3492e958ed4baf075a328de03c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 20 Dec 2012 13:09:17 +0100 Subject: wined3d: Move the framebuffer into wined3d_state @@ -20,10 +20,10 @@ Subject: wined3d: Move the framebuffer into wined3d_state 13 files changed, 172 insertions(+), 127 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index c3878ea..78ecff7 100644 +index f70562e..718ae0a 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c -@@ -707,7 +707,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, +@@ -684,7 +684,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, { const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL]; const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; @@ -32,7 +32,7 @@ index c3878ea..78ecff7 100644 /* Load DirectX 9 float constants for pixel shader */ priv->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB, -@@ -4665,7 +4665,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context +@@ -4652,7 +4652,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context } else { @@ -42,7 +42,7 @@ index c3878ea..78ecff7 100644 } diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 103d7eb..8f1860b 100644 +index 728a7cc..bf77b69 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1453,6 +1453,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, @@ -74,7 +74,7 @@ index 103d7eb..8f1860b 100644 HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2315,7 +2323,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2318,7 +2326,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win DWORD rt_mask = 0, *cur_mask; UINT i; @@ -83,7 +83,7 @@ index 103d7eb..8f1860b 100644 || rt_count != context->gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, fb->depth_stencil)) -@@ -2358,6 +2366,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2361,6 +2369,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win rt_mask = context_generate_rt_mask_no_fbo(device, rt_count ? wined3d_rendertarget_view_get_surface(rts[0]) : NULL); } @@ -92,7 +92,7 @@ index 103d7eb..8f1860b 100644 } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2408,7 +2418,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2411,7 +2421,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_device *device) { const struct wined3d_state *state = &device->state; @@ -101,7 +101,7 @@ index 103d7eb..8f1860b 100644 struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2438,7 +2448,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2441,7 +2451,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_device *device = context->swapchain->device; @@ -110,7 +110,7 @@ index 103d7eb..8f1860b 100644 DWORD rt_mask = find_draw_buffers_mask(context, device); DWORD *cur_mask; -@@ -2468,6 +2478,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat +@@ -2471,6 +2481,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -119,7 +119,7 @@ index 103d7eb..8f1860b 100644 } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -3056,7 +3068,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de +@@ -3059,7 +3071,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de { const struct wined3d_state *state = &device->state; const struct StateEntry *state_table = context->state_table; @@ -205,7 +205,7 @@ index 874129a..22a2de8 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index c695c2f..4e83d14 100644 +index 596a8bd..f788cf2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -860,7 +860,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi @@ -269,9 +269,9 @@ index c695c2f..4e83d14 100644 /* Unload resources */ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { -@@ -1086,37 +1098,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - device->shader_backend->shader_free_private(device); - destroy_dummy_textures(device, gl_info); +@@ -1092,37 +1104,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) + * destroy the context. */ + context_release(context); - /* Release the buffers (with sanity checks)*/ - if (device->onscreen_depth_stencil) @@ -307,7 +307,7 @@ index c695c2f..4e83d14 100644 if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1136,9 +1117,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1140,9 +1121,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->swapchains = NULL; device->swapchain_count = 0; @@ -317,7 +317,7 @@ index c695c2f..4e83d14 100644 device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1928,7 +1906,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -1932,7 +1910,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) || !(texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; surface = surface_from_resource(texture->sub_resources[0]); @@ -326,7 +326,7 @@ index c695c2f..4e83d14 100644 return; wined3d_surface_blt(surface, NULL, depth_stencil, NULL, 0, NULL, WINED3D_TEXF_POINT); -@@ -3317,6 +3295,8 @@ HRESULT CDECL wined3d_device_present(const struct wined3d_device *device, const +@@ -3321,6 +3299,8 @@ HRESULT CDECL wined3d_device_present(const struct wined3d_device *device, const 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) { @@ -335,7 +335,7 @@ index c695c2f..4e83d14 100644 TRACE("device %p, rect_count %u, rects %p, flags %#x, color {%.8e, %.8e, %.8e, %.8e}, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, color->r, color->g, color->b, color->a, depth, stencil); -@@ -3328,7 +3308,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3332,7 +3312,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -344,7 +344,7 @@ index c695c2f..4e83d14 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3337,8 +3317,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3341,8 +3321,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -355,7 +355,7 @@ index c695c2f..4e83d14 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3697,8 +3677,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3701,8 +3681,8 @@ 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]) { @@ -366,7 +366,7 @@ index c695c2f..4e83d14 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3924,20 +3904,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -3928,20 +3908,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -390,7 +390,7 @@ index c695c2f..4e83d14 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -3977,13 +3958,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -3981,13 +3962,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -406,7 +406,7 @@ index c695c2f..4e83d14 100644 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. */ -@@ -3995,18 +3976,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -3999,18 +3980,19 @@ 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) { @@ -428,7 +428,7 @@ index c695c2f..4e83d14 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4363,10 +4345,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4367,10 +4349,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -440,7 +440,7 @@ index c695c2f..4e83d14 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4375,6 +4356,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4379,6 +4360,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -452,7 +452,7 @@ index c695c2f..4e83d14 100644 if (device->onscreen_depth_stencil) { wined3d_surface_decref(device->onscreen_depth_stencil); -@@ -4665,7 +4651,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4669,7 +4655,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -461,7 +461,7 @@ index c695c2f..4e83d14 100644 &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); device->update_state = &device->state; -@@ -4674,22 +4660,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4678,22 +4664,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } else if (device->back_buffer_view) { @@ -489,7 +489,7 @@ index c695c2f..4e83d14 100644 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4780,17 +4765,17 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -4784,17 +4769,17 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -511,7 +511,7 @@ index c695c2f..4e83d14 100644 } } break; -@@ -4953,7 +4938,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -4957,7 +4942,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -577,10 +577,10 @@ index f2c2f42..c6a72fc 100644 surface_modify_ds_location(ds, location, ds->ds_current_size.cx, ds->ds_current_size.cy); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c -index f1bf0a3..77c526e 100644 +index 851fc28..c4f00cb 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c -@@ -1083,7 +1083,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont +@@ -1359,7 +1359,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont const struct wined3d_state *state = &shader->device->state; const struct ps_compile_args *ps_args = ctx_priv->cur_ps_args; const struct wined3d_gl_info *gl_info = context->gl_info; @@ -590,10 +590,10 @@ index f1bf0a3..77c526e 100644 const struct wined3d_shader_lconst *lconst; const char *prefix; diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index c249c9a..8a21921 100644 +index d9ff768..9217225 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2344,7 +2344,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 +@@ -2392,7 +2392,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && state->render_states[WINED3D_RS_SRGBWRITEENABLE]) { @@ -603,7 +603,7 @@ index c249c9a..8a21921 100644 { static unsigned int warned = 0; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c -index b025dff..9a52777 100644 +index c938771..3966130 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -105,7 +105,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ @@ -790,10 +790,10 @@ index 62b1841..76a80e2 100644 if (FAILED(hr = stateblock_allocate_shader_constants(stateblock))) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index b562f7a..870c32e 100644 +index 6f86bc4..ba6dfce 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3416,8 +3416,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -3418,8 +3418,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE enum wined3d_texture_filter_type filter) { struct wined3d_device *device = dst_surface->resource.device; @@ -817,10 +817,10 @@ index 1ac5e7a..454cb21 100644 struct wined3d_context *context; struct wined3d_surface *front; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c -index 5596375..17435c4 100644 +index 8a7075d..f9c7714 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -3192,7 +3192,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w +@@ -3293,7 +3293,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -829,7 +829,7 @@ index 5596375..17435c4 100644 state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE; float z_scale = zenable ? 2.0f : 0.0f; float z_offset = zenable ? -1.0f : 0.0f; -@@ -3686,7 +3686,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d +@@ -3787,7 +3787,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d unsigned int i; DWORD ttff; DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2; @@ -839,10 +839,10 @@ index 5596375..17435c4 100644 const struct wined3d_d3d_info *d3d_info = context->d3d_info; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index e12ce80..2be7639 100644 +index 7308f6e..c440eda 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1124,6 +1124,36 @@ struct wined3d_timestamp_query +@@ -1126,6 +1126,36 @@ struct wined3d_timestamp_query void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; @@ -879,7 +879,7 @@ index e12ce80..2be7639 100644 struct wined3d_context { const struct wined3d_gl_info *gl_info; -@@ -1138,6 +1168,7 @@ struct wined3d_context +@@ -1140,6 +1170,7 @@ struct wined3d_context DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -887,7 +887,7 @@ index e12ce80..2be7639 100644 struct wined3d_swapchain *swapchain; struct wined3d_surface *current_rt; -@@ -1239,12 +1270,6 @@ struct wined3d_context +@@ -1241,12 +1272,6 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; @@ -900,7 +900,7 @@ index e12ce80..2be7639 100644 typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -1928,7 +1953,7 @@ struct wined3d_stream_state +@@ -1930,7 +1955,7 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -909,7 +909,7 @@ index e12ce80..2be7639 100644 struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2034,7 +2059,6 @@ struct wined3d_device +@@ -2036,7 +2061,6 @@ struct wined3d_device struct wine_rb_tree samplers; /* Render Target Support */ @@ -917,7 +917,7 @@ index e12ce80..2be7639 100644 struct wined3d_surface *onscreen_depth_stencil; struct wined3d_rendertarget_view *auto_depth_stencil_view; -@@ -2539,9 +2563,8 @@ struct wined3d_stateblock +@@ -2542,9 +2566,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -929,7 +929,7 @@ index e12ce80..2be7639 100644 void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; struct wined3d_cs_ops -@@ -2554,7 +2577,6 @@ struct wined3d_cs +@@ -2557,7 +2580,6 @@ struct wined3d_cs { const struct wined3d_cs_ops *ops; struct wined3d_device *device; diff --git a/patches/wined3d-CSMT_Main/0134-wined3d-Destroy-shaders-through-the-CS.patch b/patches/wined3d-CSMT_Main/0134-wined3d-Destroy-shaders-through-the-CS.patch index 1029edb3..593bcf86 100644 --- a/patches/wined3d-CSMT_Main/0134-wined3d-Destroy-shaders-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0134-wined3d-Destroy-shaders-through-the-CS.patch @@ -1,4 +1,4 @@ -From f0534e2583764b2f51690adb1e0b4c4264b4bfcb Mon Sep 17 00:00:00 2001 +From c75e1fc10eb6a040ef2736cee8262e4200366905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 31 Jul 2013 23:18:28 +0200 Subject: wined3d: Destroy shaders through the CS @@ -10,10 +10,10 @@ Subject: wined3d: Destroy shaders through the CS 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index d6581cf..24fdc17 100644 +index f088200..c745460 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -80,6 +80,7 @@ enum wined3d_cs_op +@@ -81,6 +81,7 @@ enum wined3d_cs_op WINED3D_CS_OP_EVICT_RESOURCE, WINED3D_CS_OP_VIEW_DESTROY, WINED3D_CS_OP_VDECL_DESTROY, @@ -21,7 +21,7 @@ index d6581cf..24fdc17 100644 WINED3D_CS_OP_STOP, }; -@@ -463,6 +464,12 @@ struct wined3d_cs_vertex_declaration_destroy +@@ -473,6 +474,12 @@ struct wined3d_cs_vertex_declaration_destroy struct wined3d_vertex_declaration *declaration; }; @@ -34,7 +34,7 @@ index d6581cf..24fdc17 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2282,6 +2289,27 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, +@@ -2392,6 +2399,27 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, cs->ops->submit(cs, sizeof(*op)); } @@ -62,7 +62,7 @@ index d6581cf..24fdc17 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2340,6 +2368,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2451,6 +2479,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, @@ -71,10 +71,10 @@ index d6581cf..24fdc17 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index 3323d12..1e9ff05 100644 +index ec2a269..04e217e 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -1812,7 +1812,7 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe +@@ -1859,7 +1859,7 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe } } @@ -82,8 +82,8 @@ index 3323d12..1e9ff05 100644 +void shader_cleanup(struct wined3d_shader *shader) { HeapFree(GetProcessHeap(), 0, shader->output_signature.elements); - HeapFree(GetProcessHeap(), 0, shader->signature_strings); -@@ -2067,14 +2067,10 @@ ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) + HeapFree(GetProcessHeap(), 0, shader->input_signature.elements); +@@ -2115,14 +2115,10 @@ ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) if (!refcount) { @@ -102,10 +102,10 @@ index 3323d12..1e9ff05 100644 return refcount; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 2df44a9..340ed08 100644 +index a2f2044..545c97e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2728,6 +2728,7 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer +@@ -2751,6 +2751,7 @@ void wined3d_cs_emit_buffer_preload(struct wined3d_cs *cs, struct wined3d_buffer void wined3d_cs_emit_view_destroy(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; @@ -113,8 +113,8 @@ index 2df44a9..340ed08 100644 /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3120,6 +3121,7 @@ unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_map - void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, +@@ -3153,6 +3154,7 @@ unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_map + void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; +void shader_cleanup(struct wined3d_shader *shader) DECLSPEC_HIDDEN; @@ -122,5 +122,5 @@ index 2df44a9..340ed08 100644 static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) { -- -2.3.3 +2.3.5 diff --git a/patches/wined3d-CSMT_Main/0140-wined3d-Clean-up-texture-resources-through-the-cs.patch b/patches/wined3d-CSMT_Main/0140-wined3d-Clean-up-texture-resources-through-the-cs.patch index 0788aca1..59baba45 100644 --- a/patches/wined3d-CSMT_Main/0140-wined3d-Clean-up-texture-resources-through-the-cs.patch +++ b/patches/wined3d-CSMT_Main/0140-wined3d-Clean-up-texture-resources-through-the-cs.patch @@ -1,13 +1,13 @@ -From 18d62357279e7f45df909bbbaa453ecef3fe6c40 Mon Sep 17 00:00:00 2001 +From c2fe136d2b070ad027b0805a24ed3664f02150c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 6 Oct 2013 16:20:32 +0200 Subject: wined3d: Clean up texture resources through the cs. --- dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++ - dlls/wined3d/texture.c | 39 +++++++++++++++++++++++++++++++-------- + dlls/wined3d/texture.c | 38 ++++++++++++++++++++++++++++++-------- dlls/wined3d/wined3d_private.h | 2 ++ - 3 files changed, 61 insertions(+), 8 deletions(-) + 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 6010791..bea93f9 100644 @@ -70,7 +70,7 @@ index 6010791..bea93f9 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 35e3ebf..763b39b 100644 +index cded1c0..d0da497 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -123,17 +123,26 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) @@ -127,7 +127,7 @@ index 35e3ebf..763b39b 100644 } return refcount; -@@ -1012,12 +1019,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1012,6 +1019,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -135,14 +135,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } - if (!gl_info->supported[ARB_TEXTURE_CUBE_MAP] && desc->pool != WINED3D_POOL_SCRATCH) - { - WARN("(%p) : Tried to create not supported cube texture.\n", texture); -+ HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } - -@@ -1027,12 +1036,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1021,12 +1029,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -157,7 +150,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1053,6 +1064,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1047,6 +1057,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi else { WARN("Attempted to create a NPOT cube texture (edge length %u) without GL support.\n", desc->width); @@ -165,7 +158,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1062,6 +1074,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1056,6 +1067,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi surface_flags, WINED3D_GL_RES_TYPE_TEX_CUBE, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x\n", hr); @@ -173,15 +166,15 @@ index 35e3ebf..763b39b 100644 return hr; } -@@ -1124,6 +1137,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1121,6 +1133,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); + HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } - -@@ -1154,6 +1168,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 + format = wined3d_get_format(gl_info, desc->format); +@@ -1152,6 +1165,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 else { WARN("Attempted to create a mipmapped NPOT texture without unconditional NPOT support.\n"); @@ -189,7 +182,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1166,12 +1181,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1164,12 +1178,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); @@ -204,7 +197,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1180,6 +1197,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1195,6 +1211,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 surface_flags, WINED3D_GL_RES_TYPE_TEX_2D, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -212,7 +205,7 @@ index 35e3ebf..763b39b 100644 return hr; } -@@ -1358,12 +1376,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1367,12 +1384,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -227,7 +220,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } -@@ -1373,12 +1393,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1382,12 +1401,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -242,7 +235,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1406,6 +1428,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1415,6 +1436,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -250,7 +243,7 @@ index 35e3ebf..763b39b 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1415,6 +1438,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1424,6 +1446,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct 0, WINED3D_GL_RES_TYPE_TEX_3D, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -258,7 +251,7 @@ index 35e3ebf..763b39b 100644 return hr; } -@@ -1491,7 +1515,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -1500,7 +1523,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -267,10 +260,10 @@ index 35e3ebf..763b39b 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 0e3901e..4dc917d 100644 +index de97d8b..f9a459a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2329,6 +2329,7 @@ static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_t +@@ -2332,6 +2332,7 @@ static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_t void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture, const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; @@ -278,7 +271,7 @@ index 0e3901e..4dc917d 100644 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, -@@ -2758,6 +2759,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, +@@ -2761,6 +2762,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; void wined3d_cs_emit_volume_cleanup(struct wined3d_cs *cs, struct wined3d_volume *volume) DECLSPEC_HIDDEN; void wined3d_cs_emit_surface_cleanup(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0150-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch b/patches/wined3d-CSMT_Main/0150-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch index 43dd0fba..c2aa6c18 100644 --- a/patches/wined3d-CSMT_Main/0150-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch +++ b/patches/wined3d-CSMT_Main/0150-wined3d-Delete-GL-contexts-through-the-CS-in-uninit_.patch @@ -1,14 +1,14 @@ -From f706600f7ffc7710a06809ff57ea8d59793f7d87 Mon Sep 17 00:00:00 2001 +From 4dd8d4df940d07ac83180fd8efa576d5f9cbfdae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 11 Oct 2013 10:17:42 +0200 Subject: wined3d: Delete GL contexts through the CS in uninit_3d. --- - dlls/wined3d/device.c | 31 ++++--------------------------- - 1 file changed, 4 insertions(+), 27 deletions(-) + dlls/wined3d/device.c | 35 ++++------------------------------- + 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 8d80044..bffeebb 100644 +index ee5139b..72e472e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1013,8 +1013,6 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context) @@ -33,7 +33,7 @@ index 8d80044..bffeebb 100644 if (device->logo_texture) wined3d_texture_decref(device->logo_texture); -@@ -1061,24 +1053,8 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1061,30 +1053,8 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) TRACE("Unloading resource %p.\n", resource); wined3d_cs_emit_evict_resource(device->cs, resource); } @@ -50,25 +50,22 @@ index 8d80044..bffeebb 100644 - gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); - device->depth_blt_texture = 0; - } - +- - /* Destroy the shader backend. Note that this has to happen after all shaders are destroyed. */ - device->blitter->free_private(device); - device->shader_backend->shader_free_private(device); - destroy_dummy_textures(device, gl_info); + +- /* Release the context again as soon as possible. In particular, +- * releasing the render target views below may release the last reference +- * to the swapchain associated with this context, which in turn will +- * destroy the context. */ +- context_release(context); + wined3d_cs_emit_delete_opengl_contexts(device->cs, device->swapchains[0]); if (device->back_buffer_view) { -@@ -1086,8 +1062,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) - device->back_buffer_view = NULL; - } - -- context_release(context); -- - for (i = 0; i < device->swapchain_count; ++i) - { - TRACE("Releasing the implicit swapchain %u.\n", i); -@@ -4165,6 +4139,8 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine +@@ -4180,6 +4150,8 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine context = context_acquire(device, NULL); gl_info = context->gl_info; @@ -77,7 +74,7 @@ index 8d80044..bffeebb 100644 if (device->depth_blt_texture) { gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); -@@ -4184,6 +4160,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine +@@ -4199,6 +4171,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -86,5 +83,5 @@ index 8d80044..bffeebb 100644 static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) -- -2.2.1 +2.3.5 diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 160a8a21..b47ce039 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -1099,7 +1099,7 @@ diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -3275,7 +3275,11 @@ +@@ -3293,7 +3293,11 @@ float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -1111,7 +1111,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE; float z_scale = zenable ? 2.0f : 0.0f; float z_offset = zenable ? -1.0f : 0.0f; -@@ -3398,6 +3402,7 @@ +@@ -3416,6 +3420,7 @@ /* case WINED3D_TTFF_COUNT1: Won't ever get here. */ case WINED3D_TTFF_COUNT2: mat._13 = mat._23 = mat._33 = mat._43 = 0.0f; @@ -1119,7 +1119,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c /* OpenGL divides the first 3 vertex coord by the 4th by default, * which is essentially the same as D3DTTFF_PROJECTED. Make sure that * the 4th coord evaluates to 1.0 to eliminate that. -@@ -3410,6 +3415,20 @@ +@@ -3428,6 +3433,20 @@ * A more serious problem occurs if the app passes 4 coordinates in, and the * 4th is != 1.0(opengl default). This would have to be fixed in draw_strided_slow * or a replacement shader. */ @@ -1140,7 +1140,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c default: mat._14 = mat._24 = mat._34 = 0.0f; mat._44 = 1.0f; } -@@ -3769,7 +3788,11 @@ +@@ -3787,7 +3806,11 @@ unsigned int i; DWORD ttff; DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2; @@ -1758,7 +1758,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -997,9 +1027,14 @@ +@@ -1000,9 +1030,14 @@ WORD use_map; /* MAX_ATTRIBS, 16 */ }; @@ -1773,7 +1773,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN; #define eps 1e-8f -@@ -1087,8 +1122,10 @@ +@@ -1090,8 +1125,10 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -1784,7 +1784,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; union wined3d_gl_query_object -@@ -1124,6 +1161,7 @@ +@@ -1127,6 +1164,7 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -1792,7 +1792,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT64 timestamp; }; -@@ -1159,6 +1197,12 @@ +@@ -1162,6 +1200,12 @@ for (i = 0; i < min(dst->rt_size, src->rt_size); i++) dst->render_targets[i] = src->render_targets[i]; } @@ -1805,7 +1805,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context { -@@ -1174,7 +1218,9 @@ +@@ -1177,7 +1221,9 @@ DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -1815,7 +1815,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_swapchain *swapchain; struct wined3d_surface *current_rt; -@@ -1274,8 +1320,17 @@ +@@ -1277,8 +1323,17 @@ GLfloat fog_coord_value; GLfloat color[4], fogstart, fogend, fogcolor[4]; GLuint dummy_arbfp_prog; @@ -1833,7 +1833,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); -@@ -1409,8 +1464,12 @@ +@@ -1412,8 +1467,12 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN; BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN; @@ -1846,7 +1846,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target, struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN; void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, -@@ -1962,7 +2021,11 @@ +@@ -1965,7 +2024,11 @@ struct wined3d_state { DWORD flags; @@ -1858,7 +1858,7 @@ 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]; -@@ -2007,6 +2070,7 @@ +@@ -2010,6 +2073,7 @@ DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; @@ -1866,7 +1866,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_gl_bo { GLuint name; -@@ -2015,6 +2079,7 @@ +@@ -2018,6 +2082,7 @@ UINT size; }; @@ -1874,7 +1874,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 -@@ -2070,11 +2135,23 @@ +@@ -2073,11 +2138,23 @@ struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -1898,7 +1898,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; -@@ -2085,6 +2162,9 @@ +@@ -2088,6 +2165,9 @@ UINT xScreenSpace; UINT yScreenSpace; UINT cursorWidth, cursorHeight; @@ -1908,7 +1908,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HCURSOR hardwareCursor; /* The Wine logo texture */ -@@ -2116,6 +2196,7 @@ +@@ -2119,6 +2199,7 @@ 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; @@ -1916,7 +1916,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, -@@ -2127,6 +2208,11 @@ +@@ -2130,6 +2211,11 @@ void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -1928,7 +1928,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) { -@@ -2143,9 +2229,11 @@ +@@ -2146,9 +2232,11 @@ ULONG (*resource_incref)(struct wined3d_resource *resource); ULONG (*resource_decref)(struct wined3d_resource *resource); void (*resource_unload)(struct wined3d_resource *resource); @@ -1940,7 +1940,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_resource -@@ -2170,6 +2258,7 @@ +@@ -2173,6 +2261,7 @@ UINT depth; UINT size; DWORD priority; @@ -1948,7 +1948,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *heap_memory, *map_heap_memory, *user_memory, *bitmap_data; UINT custom_row_pitch, custom_slice_pitch; struct wined3d_gl_bo *buffer, *map_buffer; -@@ -2177,6 +2266,11 @@ +@@ -2180,6 +2269,11 @@ DWORD locations; LONG access_fence; BOOL unmap_dirtify; @@ -1960,7 +1960,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2201,6 +2295,7 @@ +@@ -2204,6 +2298,7 @@ void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -1968,7 +1968,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h DWORD wined3d_resource_access_from_location(DWORD location) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_resource_changed(struct wined3d_resource *resource, -@@ -2247,6 +2342,15 @@ +@@ -2250,6 +2345,15 @@ { while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); } @@ -1984,7 +1984,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16 -@@ -2331,7 +2435,9 @@ +@@ -2334,7 +2438,9 @@ void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture, const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; @@ -1994,7 +1994,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h 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, -@@ -2365,9 +2471,16 @@ +@@ -2368,9 +2474,16 @@ struct wined3d_resource resource; struct wined3d_texture *container; @@ -2011,7 +2011,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; static inline struct wined3d_volume *volume_from_resource(struct wined3d_resource *resource) -@@ -2375,6 +2488,7 @@ +@@ -2378,6 +2491,7 @@ return CONTAINING_RECORD(resource, struct wined3d_volume, resource); } @@ -2019,7 +2019,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, unsigned int level, struct wined3d_volume **volume) DECLSPEC_HIDDEN; void wined3d_volume_destroy(struct wined3d_volume *volume) DECLSPEC_HIDDEN; -@@ -2387,6 +2501,23 @@ +@@ -2390,6 +2504,23 @@ struct wined3d_surface_dib { HBITMAP DIBsection; @@ -2043,7 +2043,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT bitmap_size; }; -@@ -2412,7 +2543,11 @@ +@@ -2415,7 +2546,11 @@ struct wined3d_surface_ops { HRESULT (*surface_private_setup)(struct wined3d_surface *surface); @@ -2055,7 +2055,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_surface -@@ -2420,12 +2555,25 @@ +@@ -2423,12 +2558,25 @@ struct wined3d_resource resource; const struct wined3d_surface_ops *surface_ops; struct wined3d_texture *container; @@ -2081,7 +2081,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; GLenum texture_target; -@@ -2469,10 +2617,19 @@ +@@ -2472,10 +2620,19 @@ GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN; void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; @@ -2101,7 +2101,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN; -@@ -2484,6 +2641,7 @@ +@@ -2487,6 +2644,7 @@ const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch) DECLSPEC_HIDDEN; HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point, struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN; @@ -2109,7 +2109,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN; -@@ -2502,6 +2660,21 @@ +@@ -2505,6 +2663,21 @@ 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; void surface_flip(struct wined3d_surface *front, struct wined3d_surface *back) DECLSPEC_HIDDEN; @@ -2131,7 +2131,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Surface flags: */ #define SFLAG_DIBSECTION 0x00000001 /* Has a DIB section attached for GetDC. */ -@@ -2549,8 +2722,10 @@ +@@ -2552,8 +2725,10 @@ BOOL half_float_conv_needed; }; @@ -2142,7 +2142,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_saved_states { DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1]; -@@ -2618,6 +2793,7 @@ +@@ -2621,6 +2796,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -2150,7 +2150,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2668,6 +2844,32 @@ +@@ -2671,6 +2847,32 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; @@ -2183,7 +2183,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; -@@ -2717,6 +2919,7 @@ +@@ -2720,6 +2922,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; @@ -2191,7 +2191,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, const float *constants, UINT vector4f_count, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, -@@ -2776,6 +2979,7 @@ +@@ -2779,6 +2982,7 @@ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_cs_emit_getdc(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN; void wined3d_cs_emit_releasedc(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN; @@ -2199,7 +2199,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -2790,8 +2994,12 @@ +@@ -2793,8 +2997,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -2212,7 +2212,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -2805,12 +3013,16 @@ +@@ -2808,12 +3016,16 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -2229,7 +2229,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 */ -@@ -2837,7 +3049,9 @@ +@@ -2840,7 +3052,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -2239,7 +2239,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -2862,11 +3076,15 @@ +@@ -2865,11 +3079,15 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, 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; @@ -2255,7 +2255,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -2905,8 +3123,10 @@ +@@ -2908,8 +3126,10 @@ return surface_from_resource(resource); } @@ -2266,7 +2266,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -2919,8 +3139,12 @@ +@@ -2922,8 +3142,12 @@ struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, @@ -2279,7 +2279,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_swapchain -@@ -2960,8 +3184,10 @@ +@@ -2963,8 +3187,10 @@ HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -2290,8 +2290,8 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /***************************************************************************** * Utility function prototypes -@@ -3176,7 +3402,9 @@ - void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, +@@ -3185,7 +3411,9 @@ + void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; +#if defined(STAGING_CSMT) @@ -3233,10 +3233,10 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; +#if defined(STAGING_CSMT) -+ struct wined3d_swapchain *swapchain = NULL; + struct wined3d_swapchain *swapchain = NULL; +#else /* STAGING_CSMT */ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - struct wined3d_swapchain *swapchain = NULL; ++ struct wined3d_swapchain *swapchain = NULL; + struct wined3d_context *context; +#endif /* STAGING_CSMT */ DWORD clear_flags = 0; @@ -3327,10 +3327,10 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) device->cs->ops->finish(device->cs); -@@ -1061,6 +1159,83 @@ - wined3d_rendertarget_view_decref(device->back_buffer_view); - device->back_buffer_view = NULL; - } +@@ -1056,6 +1154,82 @@ + + wined3d_cs_emit_delete_opengl_contexts(device->cs, device->swapchains[0]); + +#else /* STAGING_CSMT */ + /* I don't think that the interface guarantees that the device is destroyed from the same thread + * it was created. Thus make sure a context is active for the glDelete* calls @@ -3369,6 +3369,12 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c + device->shader_backend->shader_free_private(device); + destroy_dummy_textures(device, gl_info); + ++ /* Release the context again as soon as possible. In particular, ++ * releasing the render target views below may release the last reference ++ * to the swapchain associated with this context, which in turn will ++ * destroy the context. */ ++ context_release(context); ++ + /* Release the buffers (with sanity checks)*/ + if (device->onscreen_depth_stencil) + { @@ -3400,18 +3406,11 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c + { + wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); + } -+ if (device->back_buffer_view) -+ { -+ wined3d_rendertarget_view_decref(device->back_buffer_view); -+ device->back_buffer_view = NULL; -+ } -+ -+ context_release(context); +#endif /* STAGING_CSMT */ - - for (i = 0; i < device->swapchain_count; ++i) + if (device->back_buffer_view) { -@@ -1073,6 +1248,11 @@ + wined3d_rendertarget_view_decref(device->back_buffer_view); +@@ -1073,6 +1247,11 @@ device->swapchains = NULL; device->swapchain_count = 0; @@ -3423,7 +3422,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1436,6 +1616,16 @@ +@@ -1436,6 +1615,16 @@ TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", light->range, light->falloff, light->theta, light->phi); @@ -3440,7 +3439,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Save away the information. */ object->OriginalParms = *light; -@@ -1508,9 +1698,11 @@ +@@ -1508,9 +1697,11 @@ FIXME("Unrecognized light type %#x.\n", light->type); } @@ -3452,7 +3451,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1583,6 +1775,14 @@ +@@ -1583,6 +1774,14 @@ { if (light_info->glIndex != -1) { @@ -3467,7 +3466,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state->lights[light_info->glIndex] = NULL; light_info->glIndex = -1; } -@@ -1624,11 +1824,23 @@ +@@ -1624,11 +1823,23 @@ WARN("Too many concurrently active lights\n"); return WINED3D_OK; } @@ -3491,7 +3490,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1803,9 +2015,11 @@ +@@ -1803,9 +2014,11 @@ TRACE("device %p, base_index %d.\n", device, base_index); device->update_state->base_vertex_index = base_index; @@ -3503,7 +3502,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device) -@@ -1850,7 +2064,11 @@ +@@ -1850,7 +2063,11 @@ || !(texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; surface = surface_from_resource(texture->sub_resources[0]); @@ -3515,7 +3514,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; wined3d_surface_blt(surface, NULL, depth_stencil, NULL, 0, NULL, WINED3D_TEXF_POINT); -@@ -2170,7 +2388,11 @@ +@@ -2170,7 +2387,11 @@ return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx]; } @@ -3527,7 +3526,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { UINT i; -@@ -2203,8 +2425,12 @@ +@@ -2203,8 +2424,12 @@ } else { @@ -3540,7 +3539,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2251,8 +2477,12 @@ +@@ -2251,8 +2476,12 @@ } else { @@ -3553,7 +3552,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2303,8 +2533,13 @@ +@@ -2303,8 +2532,13 @@ memset(device->recording->changed.vertexShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.vertexShaderConstantsF) * vector4f_count); else @@ -3567,7 +3566,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2439,8 +2674,12 @@ +@@ -2439,8 +2673,12 @@ } else { @@ -3580,7 +3579,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2487,8 +2726,12 @@ +@@ -2487,8 +2725,12 @@ } else { @@ -3593,7 +3592,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2540,8 +2783,12 @@ +@@ -2540,8 +2782,12 @@ memset(device->recording->changed.pixelShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.pixelShaderConstantsF) * vector4f_count); else @@ -3606,7 +3605,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2701,6 +2948,7 @@ +@@ -2701,6 +2947,7 @@ return hr; } @@ -3614,7 +3613,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) { FIXME("Waiting for cs.\n"); -@@ -2708,6 +2956,7 @@ +@@ -2708,6 +2955,7 @@ device->cs->ops->finish(device->cs); } @@ -3622,7 +3621,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); -@@ -3209,6 +3458,10 @@ +@@ -3209,6 +3457,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -3633,7 +3632,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3217,6 +3470,15 @@ +@@ -3217,6 +3469,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3649,7 +3648,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3242,8 +3504,10 @@ +@@ -3242,8 +3503,10 @@ 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) { @@ -3660,7 +3659,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, rect_count %u, rects %p, flags %#x, color {%.8e, %.8e, %.8e, %.8e}, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, color->r, color->g, color->b, color->a, depth, stencil); -@@ -3252,12 +3516,19 @@ +@@ -3252,12 +3515,19 @@ WARN("Rects is %p, but rect_count is 0, ignoring clear\n", rects); return WINED3D_OK; } @@ -3680,7 +3679,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"); -@@ -3266,8 +3537,13 @@ +@@ -3266,8 +3536,13 @@ } else if (flags & WINED3DCLEAR_TARGET) { @@ -3694,7 +3693,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; -@@ -3313,6 +3589,9 @@ +@@ -3313,6 +3588,9 @@ enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -3704,7 +3703,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); -@@ -3320,8 +3599,13 @@ +@@ -3320,8 +3598,13 @@ device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -3718,7 +3717,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, -@@ -3344,6 +3628,14 @@ +@@ -3344,6 +3627,14 @@ return WINED3DERR_INVALIDCALL; } @@ -3733,7 +3732,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); return WINED3D_OK; -@@ -3360,6 +3652,10 @@ +@@ -3360,6 +3651,10 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { @@ -3744,7 +3743,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count); if (!device->state.index_buffer) -@@ -3378,6 +3674,15 @@ +@@ -3378,6 +3673,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3760,7 +3759,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); return WINED3D_OK; -@@ -3393,6 +3698,7 @@ +@@ -3393,6 +3697,7 @@ } /* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */ @@ -3768,7 +3767,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c static void device_update_volume(struct wined3d_context *context, struct wined3d_volume *src_volume, struct wined3d_volume *dst_volume) { -@@ -3432,6 +3738,101 @@ +@@ -3432,6 +3737,101 @@ /* Make sure that the destination texture is loaded. */ wined3d_texture_load(dst_texture, context, FALSE); @@ -3870,7 +3869,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Update every surface level of the texture. */ switch (type) -@@ -3445,7 +3846,16 @@ +@@ -3445,7 +3845,16 @@ { src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, i)); dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i)); @@ -3887,7 +3886,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } break; } -@@ -3459,7 +3869,16 @@ +@@ -3459,7 +3868,16 @@ { src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, i)); dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i)); @@ -3904,7 +3903,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } break; } -@@ -3468,6 +3887,7 @@ +@@ -3468,6 +3886,7 @@ { for (i = 0; i < level_count; ++i) { @@ -3912,7 +3911,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device_update_volume(context, volume_from_resource(wined3d_texture_get_sub_resource(src_texture, i)), volume_from_resource(wined3d_texture_get_sub_resource(dst_texture, i))); -@@ -3524,6 +3944,24 @@ +@@ -3524,6 +3943,24 @@ } wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture); @@ -3937,7 +3936,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -3586,8 +4024,13 @@ +@@ -3586,8 +4023,13 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -3951,7 +3950,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3684,6 +4127,7 @@ +@@ -3684,6 +4126,7 @@ struct wined3d_surface *src_surface, const RECT *src_rect, struct wined3d_surface *dst_surface, const POINT *dst_point) { @@ -3959,7 +3958,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c const struct wined3d_format *src_format = src_surface->resource.format; const struct wined3d_format *dst_format = dst_surface->resource.format; UINT update_w, update_h; -@@ -3691,6 +4135,7 @@ +@@ -3691,6 +4134,7 @@ RECT r, dst_rect; POINT p; @@ -3967,7 +3966,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_surface %p, src_rect %s, dst_surface %p, dst_point %s.\n", device, src_surface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_point(dst_point)); -@@ -3702,6 +4147,7 @@ +@@ -3702,6 +4146,7 @@ return WINED3DERR_INVALIDCALL; } @@ -3975,7 +3974,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (src_format->id != dst_format->id) { WARN("Source and destination surfaces should have the same format.\n"); -@@ -3764,6 +4210,9 @@ +@@ -3764,6 +4209,9 @@ wined3d_cs_emit_update_surface(device->cs, src_surface, src_rect, dst_surface, dst_point); return WINED3D_OK; @@ -3985,7 +3984,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_copy_resource(struct wined3d_device *device, -@@ -3865,8 +4314,14 @@ +@@ -3865,8 +4313,14 @@ rect = &r; } @@ -4000,7 +3999,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, -@@ -3880,6 +4335,7 @@ +@@ -3880,6 +4334,7 @@ return NULL; } @@ -4008,7 +4007,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -3895,6 +4351,22 @@ +@@ -3895,6 +4350,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -4031,7 +4030,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); -@@ -3934,6 +4406,7 @@ +@@ -3934,6 +4405,7 @@ } @@ -4039,7 +4038,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c prev = fb->render_targets[view_idx]; if (view == prev) return WINED3D_OK; -@@ -3941,6 +4414,15 @@ +@@ -3941,6 +4413,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -4055,7 +4054,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. */ -@@ -3952,6 +4434,7 @@ +@@ -3952,6 +4433,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4063,7 +4062,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_fb_state *fb = &device->state.fb; struct wined3d_rendertarget_view *prev; -@@ -3976,6 +4459,79 @@ +@@ -3976,6 +4458,79 @@ { TRACE("device %p, x_hotspot %u, y_hotspot %u, cursor_image %p.\n", device, x_hotspot, y_hotspot, cursor_image); @@ -4143,7 +4142,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (cursor_image) { -@@ -4011,8 +4567,16 @@ +@@ -4011,8 +4566,16 @@ * release it after setting the cursor image. Windows doesn't * addref the set surface, so we can't do this either without * creating circular refcount dependencies. */ @@ -4160,7 +4159,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->cursorWidth = cursor_image->resource.width; device->cursorHeight = cursor_image->resource.height; -@@ -4112,6 +4676,12 @@ +@@ -4112,6 +4675,12 @@ else SetCursor(NULL); } @@ -4173,7 +4172,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return oldVisible; } -@@ -4122,8 +4692,10 @@ +@@ -4122,8 +4691,10 @@ TRACE("device %p.\n", device); @@ -4184,7 +4183,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); -@@ -4131,6 +4703,7 @@ +@@ -4131,6 +4702,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -4192,7 +4191,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4151,6 +4724,37 @@ +@@ -4151,6 +4723,37 @@ gl_info = context->gl_info; wine_rb_clear(&device->samplers, device_free_sampler, NULL); @@ -4230,7 +4229,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4171,6 +4775,7 @@ +@@ -4171,6 +4774,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4238,7 +4237,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4190,6 +4795,14 @@ +@@ -4190,6 +4794,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -4253,7 +4252,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, -@@ -4206,6 +4819,7 @@ +@@ -4206,6 +4818,7 @@ return hr; } @@ -4261,7 +4260,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); if (FAILED(hr)) { -@@ -4216,6 +4830,34 @@ +@@ -4216,6 +4829,34 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -4296,7 +4295,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4236,8 +4878,10 @@ +@@ -4236,8 +4877,10 @@ unsigned int i; TRACE("device %p, swapchain_desc %p, mode %p, callback %p.\n", device, swapchain_desc, mode, callback); @@ -4307,7 +4306,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { -@@ -4253,9 +4897,21 @@ +@@ -4253,9 +4896,21 @@ wined3d_texture_decref(device->logo_texture); device->logo_texture = NULL; } @@ -4329,7 +4328,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4264,6 +4920,7 @@ +@@ -4264,6 +4919,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4337,7 +4336,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4273,6 +4930,12 @@ +@@ -4273,6 +4929,12 @@ { wined3d_surface_decref(device->cs->onscreen_depth_stencil); device->cs->onscreen_depth_stencil = NULL; @@ -4350,7 +4349,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4285,6 +4948,7 @@ +@@ -4285,6 +4947,7 @@ } } @@ -4358,7 +4357,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Free implicit resources and wait for the command stream before modifying * swapchain parameters. After modifying the swapchain parameters a new GL * context may be acquired by the worker thread. This causes problems in the -@@ -4306,6 +4970,7 @@ +@@ -4306,6 +4969,7 @@ } device->cs->ops->finish(device->cs); @@ -4366,7 +4365,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Is it necessary to recreate the gl context? Actually every setting can be changed * on an existing gl context, so there's no real need for recreation. * -@@ -4447,6 +5112,13 @@ +@@ -4447,6 +5111,13 @@ } } @@ -4380,7 +4379,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (swapchain->desc.enable_auto_depth_stencil) { struct wined3d_resource_desc surface_desc; -@@ -4484,6 +5156,13 @@ +@@ -4484,6 +5155,13 @@ wined3d_device_set_depth_stencil_view(device, device->auto_depth_stencil_view); } @@ -4394,7 +4393,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (swapchain->desc.backbuffer_count && FAILED(hr = wined3d_rendertarget_view_create_from_surface( surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)), NULL, &wined3d_null_parent_ops, &device->back_buffer_view))) -@@ -4566,12 +5245,20 @@ +@@ -4566,12 +5244,20 @@ } wined3d_cs_emit_reset_state(device->cs); state_cleanup(&device->state); @@ -4415,7 +4414,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); device->update_state = &device->state; -@@ -4580,6 +5267,7 @@ +@@ -4580,6 +5266,7 @@ } else if (device->back_buffer_view) { @@ -4423,7 +4422,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_state *state = &device->state; wined3d_device_set_rendertarget_view(device, 0, device->back_buffer_view, FALSE); -@@ -4595,6 +5283,24 @@ +@@ -4595,6 +5282,24 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; @@ -4448,7 +4447,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4673,6 +5379,10 @@ +@@ -4673,6 +5378,10 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -4459,7 +4458,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c switch (type) { case WINED3D_RTYPE_SURFACE: -@@ -4683,6 +5393,7 @@ +@@ -4683,6 +5392,7 @@ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4467,7 +4466,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_rendertarget_view_get_surface(device->state.fb.render_targets[i]) == surface) { ERR("Surface %p is still in use as render target %u.\n", surface, i); -@@ -4694,6 +5405,19 @@ +@@ -4694,6 +5404,19 @@ { ERR("Surface %p is still in use as depth/stencil buffer.\n", surface); device->state.fb.depth_stencil = NULL; @@ -4487,7 +4486,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } break; -@@ -4856,7 +5580,11 @@ +@@ -4856,7 +5579,11 @@ device->blitter = adapter->blitter; @@ -4499,7 +4498,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) { ERR("Failed to initialize device state, hr %#x.\n", hr); -@@ -4955,6 +5683,7 @@ +@@ -4955,6 +5682,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -4507,7 +4506,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Context activation is done by the caller */ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage, -@@ -5008,3 +5737,4 @@ +@@ -5008,3 +5736,4 @@ wined3d_device_destroy_bo(device, context, bo); } @@ -4515,7 +4514,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c -@@ -1301,8 +1301,15 @@ +@@ -1356,8 +1356,15 @@ const struct wined3d_shader_reg_maps *reg_maps, const struct shader_glsl_ctx_priv *ctx_priv) { const struct wined3d_shader_version *version = ®_maps->shader_version; @@ -4531,7 +4530,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c unsigned int i, extra_constants_needed = 0; const struct wined3d_shader_lconst *lconst; const char *prefix; -@@ -1543,7 +1550,11 @@ +@@ -1598,7 +1605,11 @@ { UINT in_count = min(vec4_varyings(version->major, gl_info), shader->limits->packed_input); @@ -4543,7 +4542,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c shader_addline(buffer, "varying vec4 %s_link[%u];\n", prefix, in_count); shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count); } -@@ -1584,6 +1595,7 @@ +@@ -1639,6 +1650,7 @@ } else { @@ -4551,7 +4550,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c /* This happens because we do not have proper tracking of the * constant registers that are actually used, only the max * limit of the shader version. -@@ -1592,6 +1604,23 @@ +@@ -1647,6 +1659,23 @@ * it and just create the uniform. */ FIXME("Cannot find a free uniform for vpos correction params\n"); @@ -6138,30 +6137,17 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c }; static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc, -@@ -1015,6 +1101,7 @@ +@@ -1015,7 +1101,9 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); +#if defined(STAGING_CSMT) HeapFree(GetProcessHeap(), 0, texture); - return WINED3DERR_INVALIDCALL; - } -@@ -1023,6 +1110,14 @@ - { - WARN("(%p) : Tried to create not supported cube texture.\n", texture); - HeapFree(GetProcessHeap(), 0, texture); -+#else /* STAGING_CSMT */ -+ return WINED3DERR_INVALIDCALL; -+ } -+ -+ if (!gl_info->supported[ARB_TEXTURE_CUBE_MAP] && desc->pool != WINED3D_POOL_SCRATCH) -+ { -+ WARN("(%p) : Tried to create not supported cube texture.\n", texture); +#endif /* STAGING_CSMT */ return WINED3DERR_INVALIDCALL; } -@@ -1032,6 +1127,7 @@ +@@ -1025,6 +1113,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6169,7 +6155,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1040,6 +1136,14 @@ +@@ -1033,6 +1122,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6184,7 +6170,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1060,7 +1164,9 @@ +@@ -1053,7 +1150,9 @@ else { WARN("Attempted to create a NPOT cube texture (edge length %u) without GL support.\n", desc->width); @@ -6194,7 +6180,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1070,7 +1176,9 @@ +@@ -1063,7 +1162,9 @@ surface_flags, WINED3D_GL_RES_TYPE_TEX_CUBE, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x\n", hr); @@ -6204,7 +6190,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1133,7 +1241,9 @@ +@@ -1129,7 +1230,9 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6213,8 +6199,8 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c +#endif /* STAGING_CSMT */ return WINED3DERR_INVALIDCALL; } - -@@ -1164,7 +1274,9 @@ + format = wined3d_get_format(gl_info, desc->format); +@@ -1161,7 +1264,9 @@ else { WARN("Attempted to create a mipmapped NPOT texture without unconditional NPOT support.\n"); @@ -6224,7 +6210,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1177,6 +1289,7 @@ +@@ -1174,6 +1279,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); @@ -6232,7 +6218,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1185,6 +1298,14 @@ +@@ -1182,6 +1288,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6247,7 +6233,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1193,7 +1314,9 @@ +@@ -1207,7 +1321,9 @@ surface_flags, WINED3D_GL_RES_TYPE_TEX_2D, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6257,7 +6243,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1285,12 +1408,25 @@ +@@ -1293,12 +1409,25 @@ static void texture3d_sub_resource_invalidate_location(struct wined3d_resource *sub_resource, DWORD location) { @@ -6283,7 +6269,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void texture3d_sub_resource_upload_data(struct wined3d_resource *sub_resource, -@@ -1325,7 +1461,11 @@ +@@ -1333,7 +1462,11 @@ void *mem = NULL; if (gl_info->supported[APPLE_CLIENT_STORAGE] && !format->convert @@ -6295,7 +6281,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { TRACE("Enabling GL_UNPACK_CLIENT_STORAGE_APPLE for volume %p\n", volume); gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); -@@ -1372,6 +1512,7 @@ +@@ -1380,6 +1513,7 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6303,7 +6289,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1380,6 +1521,14 @@ +@@ -1388,6 +1522,14 @@ { WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); HeapFree(GetProcessHeap(), 0, texture); @@ -6318,7 +6304,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1389,6 +1538,7 @@ +@@ -1397,6 +1539,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6326,7 +6312,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1397,6 +1547,14 @@ +@@ -1405,6 +1548,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6341,7 +6327,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1424,7 +1582,9 @@ +@@ -1432,7 +1583,9 @@ { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -6351,7 +6337,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1434,7 +1594,9 @@ +@@ -1442,7 +1595,9 @@ 0, WINED3D_GL_RES_TYPE_TEX_3D, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6361,7 +6347,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1511,6 +1673,9 @@ +@@ -1519,6 +1674,9 @@ if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -9092,7 +9078,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -1790,7 +1790,11 @@ +@@ -1859,7 +1859,11 @@ } } @@ -9103,8 +9089,8 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c +#endif /* STAGING_CSMT */ { HeapFree(GetProcessHeap(), 0, shader->output_signature.elements); - HeapFree(GetProcessHeap(), 0, shader->signature_strings); -@@ -2045,10 +2049,16 @@ + HeapFree(GetProcessHeap(), 0, shader->input_signature.elements); +@@ -2115,10 +2119,16 @@ if (!refcount) { @@ -9121,7 +9107,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c } return refcount; -@@ -2323,7 +2333,11 @@ +@@ -2393,7 +2403,11 @@ memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && state->render_states[WINED3D_RS_SRGBWRITEENABLE]) { @@ -9625,7 +9611,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c -@@ -5348,9 +5348,15 @@ +@@ -5323,9 +5323,15 @@ DebugBreak(); }