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 453220cb..8127747b 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 b9c81476bc8d3bc8aa55fac10f0c7fc22a74dcb0 Mon Sep 17 00:00:00 2001 +From 449bdd36396ceefa6340fb06d462c26b05ee6d9d 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,7 +20,7 @@ Subject: wined3d: Move the framebuffer into wined3d_state 13 files changed, 170 insertions(+), 125 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index f612099..2875fe1 100644 +index f7bea42..9f29aa4 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -706,7 +706,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, @@ -42,7 +42,7 @@ index f612099..2875fe1 100644 } diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index cc60348..679e728 100644 +index 39f7d8c..9e2adfc 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1448,6 +1448,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, @@ -74,7 +74,7 @@ index cc60348..679e728 100644 HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2306,7 +2314,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2308,7 +2316,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 cc60348..679e728 100644 || rt_count != context->gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, fb->depth_stencil)) -@@ -2349,6 +2357,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2351,6 +2359,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 cc60348..679e728 100644 } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2399,7 +2409,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2401,7 +2411,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 cc60348..679e728 100644 struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2429,7 +2439,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2431,7 +2441,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 cc60348..679e728 100644 DWORD rt_mask = find_draw_buffers_mask(context, device); DWORD *cur_mask; -@@ -2459,6 +2469,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat +@@ -2461,6 +2471,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 cc60348..679e728 100644 } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -2960,7 +2972,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de +@@ -2962,7 +2974,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,10 +205,10 @@ index b8a32e5..7bebe80 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 565a92c..92478d7 100644 +index 9f09736..1e4eb0f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -851,7 +851,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi +@@ -860,7 +860,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil; unsigned int i; @@ -217,7 +217,7 @@ index 565a92c..92478d7 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -869,7 +869,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -878,7 +878,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc) { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -225,7 +225,7 @@ index 565a92c..92478d7 100644 struct wined3d_swapchain *swapchain = NULL; struct wined3d_context *context; DWORD clear_flags = 0; -@@ -882,9 +881,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -891,9 +890,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; @@ -235,7 +235,7 @@ index 565a92c..92478d7 100644 if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -972,7 +968,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -981,7 +977,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, return WINED3D_OK; err_out: @@ -243,7 +243,7 @@ index 565a92c..92478d7 100644 HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -1044,8 +1039,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1061,8 +1056,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) if (device->cursor_texture) wined3d_texture_decref(device->cursor_texture); @@ -269,7 +269,7 @@ index 565a92c..92478d7 100644 /* Unload resources */ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { -@@ -1068,37 +1080,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1087,37 +1099,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->shader_backend->shader_free_private(device); destroy_dummy_textures(device, gl_info); @@ -307,7 +307,7 @@ index 565a92c..92478d7 100644 if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1118,9 +1099,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1137,9 +1118,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->swapchains = NULL; device->swapchain_count = 0; @@ -317,7 +317,7 @@ index 565a92c..92478d7 100644 device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1910,7 +1888,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -1929,7 +1907,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 565a92c..92478d7 100644 return; wined3d_surface_blt(surface, NULL, depth_stencil, NULL, 0, NULL, WINED3D_TEXF_POINT); -@@ -3299,6 +3277,8 @@ HRESULT CDECL wined3d_device_present(const struct wined3d_device *device, const +@@ -3318,6 +3296,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 565a92c..92478d7 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); -@@ -3310,7 +3290,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3329,7 +3309,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -344,7 +344,7 @@ index 565a92c..92478d7 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3319,8 +3299,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3338,8 +3318,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -355,7 +355,7 @@ index 565a92c..92478d7 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3668,8 +3648,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3687,8 +3667,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 565a92c..92478d7 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3895,20 +3875,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -3914,20 +3894,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -390,7 +390,7 @@ index 565a92c..92478d7 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -3948,13 +3929,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -3967,13 +3948,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -406,7 +406,7 @@ index 565a92c..92478d7 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. */ -@@ -3966,18 +3947,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -3985,18 +3966,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 565a92c..92478d7 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4350,10 +4332,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4352,10 +4334,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 565a92c..92478d7 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4362,6 +4343,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4364,6 +4345,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -452,7 +452,7 @@ index 565a92c..92478d7 100644 if (device->onscreen_depth_stencil) { wined3d_surface_decref(device->onscreen_depth_stencil); -@@ -4644,7 +4630,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4646,7 +4632,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -461,7 +461,7 @@ index 565a92c..92478d7 100644 &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); device->update_state = &device->state; -@@ -4653,22 +4639,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4655,22 +4641,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } else if (device->back_buffer_view) { @@ -489,7 +489,7 @@ index 565a92c..92478d7 100644 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4759,17 +4744,17 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -4763,17 +4748,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 565a92c..92478d7 100644 } } break; -@@ -4910,7 +4895,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -4936,7 +4921,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -577,10 +577,10 @@ index 62b7032..98261f9 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 0ab591f..4ef473b 100644 +index a829651..5239aa7 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c -@@ -957,7 +957,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont +@@ -952,7 +952,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; @@ -603,7 +603,7 @@ index 6531803..cc969b8 100644 { static unsigned int warned = 0; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c -index 700db84..20f00d6 100644 +index 3c672db..da2976d 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -106,7 +106,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ @@ -651,7 +651,7 @@ index 700db84..20f00d6 100644 const struct wined3d_gl_info *gl_info = context->gl_info; gl_info->gl_ops.gl.p_glStencilMask(mask); -@@ -1765,7 +1765,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 +@@ -1766,7 +1766,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS] || state->render_states[WINED3D_RS_DEPTHBIAS]) { @@ -660,7 +660,7 @@ index 700db84..20f00d6 100644 float scale; union -@@ -4653,7 +4653,7 @@ void vertexdeclaration(struct wined3d_context *context, const struct wined3d_sta +@@ -4772,7 +4772,7 @@ void vertexdeclaration(struct wined3d_context *context, const struct wined3d_sta static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -669,7 +669,7 @@ index 700db84..20f00d6 100644 const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; -@@ -4833,7 +4833,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st +@@ -4952,7 +4952,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st } else { @@ -678,7 +678,7 @@ index 700db84..20f00d6 100644 UINT height; UINT width; -@@ -4900,7 +4900,7 @@ static void psorigin(struct wined3d_context *context, const struct wined3d_state +@@ -5019,7 +5019,7 @@ static void psorigin(struct wined3d_context *context, const struct wined3d_state void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -788,10 +788,10 @@ index dc146fc..141e539 100644 if (FAILED(hr = stateblock_allocate_shader_constants(stateblock))) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 3702866..642210d 100644 +index f7ea41f..7469a15 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3332,9 +3332,9 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -3484,9 +3484,9 @@ 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; @@ -829,10 +829,10 @@ index 6ce07b8..8ff4e3e 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 43e1c21..7339ae5 100644 +index 511e924..1cf3dc7 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1088,6 +1088,36 @@ struct wined3d_timestamp_query +@@ -1098,6 +1098,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; @@ -869,7 +869,7 @@ index 43e1c21..7339ae5 100644 struct wined3d_context { const struct wined3d_gl_info *gl_info; -@@ -1102,6 +1132,7 @@ struct wined3d_context +@@ -1112,6 +1142,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 */ @@ -877,7 +877,7 @@ index 43e1c21..7339ae5 100644 struct wined3d_swapchain *swapchain; struct wined3d_surface *current_rt; -@@ -1201,12 +1232,6 @@ struct wined3d_context +@@ -1211,12 +1242,6 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; @@ -890,7 +890,7 @@ index 43e1c21..7339ae5 100644 typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -1881,7 +1906,7 @@ struct wined3d_stream_state +@@ -1891,7 +1916,7 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -899,15 +899,15 @@ index 43e1c21..7339ae5 100644 struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -1986,7 +2011,6 @@ struct wined3d_device - struct list shaders; /* a linked list to track shaders (pixel and vertex) */ +@@ -1997,7 +2022,6 @@ struct wined3d_device + struct wine_rb_tree samplers; /* Render Target Support */ - struct wined3d_fb_state fb; struct wined3d_surface *onscreen_depth_stencil; struct wined3d_rendertarget_view *auto_depth_stencil_view; -@@ -2497,9 +2521,8 @@ struct wined3d_stateblock +@@ -2500,9 +2524,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -919,7 +919,7 @@ index 43e1c21..7339ae5 100644 void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; struct wined3d_cs_ops -@@ -2512,7 +2535,6 @@ struct wined3d_cs +@@ -2515,7 +2538,6 @@ struct wined3d_cs { const struct wined3d_cs_ops *ops; struct wined3d_device *device; @@ -928,5 +928,5 @@ index 43e1c21..7339ae5 100644 size_t data_size; -- -2.1.3 +2.2.1 diff --git a/patches/wined3d-CSMT_Main/0056-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch b/patches/wined3d-CSMT_Main/0056-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch index d67ea21d..c34c318f 100644 --- a/patches/wined3d-CSMT_Main/0056-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch +++ b/patches/wined3d-CSMT_Main/0056-wined3d-Finish-the-cs-before-changing-the-texture-lo.patch @@ -1,4 +1,4 @@ -From 64d0e5c85cdd399857597ab57cfd4e2444e17226 Mon Sep 17 00:00:00 2001 +From 58db2f20f55fd78d4831475a5bdce14339c1e66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 10 Apr 2013 19:53:44 +0200 Subject: wined3d: Finish the cs before changing the texture lod @@ -8,10 +8,10 @@ Subject: wined3d: Finish the cs before changing the texture lod 1 file changed, 7 insertions(+) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 68889e5..8212c96 100644 +index 6381613..0eb191e 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -601,6 +601,13 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) +@@ -510,6 +510,13 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) if (texture->lod != lod) { @@ -24,7 +24,7 @@ index 68889e5..8212c96 100644 + texture->lod = lod; - texture->texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; + texture->texture_rgb.base_level = ~0u; -- -2.1.3 +2.2.1 diff --git a/patches/wined3d-CSMT_Main/0063-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch b/patches/wined3d-CSMT_Main/0063-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch index 2fcf8fb5..eb1ee0f6 100644 --- a/patches/wined3d-CSMT_Main/0063-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch +++ b/patches/wined3d-CSMT_Main/0063-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch @@ -1,4 +1,4 @@ -From 9afc54cc004880662dff5ebe6734d27b11c2e8bc Mon Sep 17 00:00:00 2001 +From 3d851db23b85050b91b68a9556fd5b3407166089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 5 Apr 2013 14:37:44 +0200 Subject: wined3d: Keep track of the onscreen depth stencil in the command @@ -64,7 +64,7 @@ index 4b1ed18..236e2f2 100644 { struct wined3d_cs *cs = thread_param; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index ee8b418..dfc0619 100644 +index c3e7d33..9fe7760 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -198,22 +198,6 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context @@ -101,7 +101,7 @@ index ee8b418..dfc0619 100644 prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect, &ds_rect); } -@@ -1043,11 +1027,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1060,11 +1044,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) /* Release the buffers (with sanity checks). * FIXME: Move this move into a separate patch. I think the idea * behind this is that those surfaces should be freed before unloading @@ -118,7 +118,7 @@ index ee8b418..dfc0619 100644 wined3d_surface_decref(surface); } -@@ -4400,10 +4385,10 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4402,10 +4387,10 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, state_unbind_resources(&device->state); } @@ -166,10 +166,10 @@ index e190892..fa0c241 100644 } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 024b55b..e4dbd9d 100644 +index 0aed164..aadb8db 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2011,14 +2011,11 @@ struct wined3d_device +@@ -2021,15 +2021,12 @@ struct wined3d_device struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -177,6 +177,7 @@ index 024b55b..e4dbd9d 100644 struct list resources; /* a linked list to track resources created by the device */ struct list shaders; /* a linked list to track shaders (pixel and vertex) */ + struct wine_rb_tree samplers; - /* Render Target Support */ - struct wined3d_surface *onscreen_depth_stencil; @@ -185,7 +186,7 @@ index 024b55b..e4dbd9d 100644 /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; -@@ -2060,8 +2057,6 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2071,8 +2068,6 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -194,7 +195,7 @@ index 024b55b..e4dbd9d 100644 void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) -@@ -2556,6 +2551,7 @@ struct wined3d_cs +@@ -2559,6 +2554,7 @@ struct wined3d_cs struct wined3d_state state; HANDLE thread; DWORD tls_idx; @@ -202,7 +203,7 @@ index 024b55b..e4dbd9d 100644 size_t data_size; void *data; -@@ -2566,6 +2562,8 @@ struct wined3d_cs +@@ -2569,6 +2565,8 @@ struct wined3d_cs struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN; void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; @@ -212,5 +213,5 @@ index 024b55b..e4dbd9d 100644 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; -- -2.1.3 +2.2.1 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 a2c3009b..249da06d 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,4 +1,4 @@ -From 76c15351903191f31484a66c498dbfc39e763a5a Mon Sep 17 00:00:00 2001 +From 91f2801402040e6750d2ba344189c84c1e1326cf 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. @@ -70,10 +70,10 @@ index 7675214..5e4aa53 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 3fc020e..49bd366 100644 +index 627da81..e0b6a2b 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -131,17 +131,26 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) +@@ -120,17 +120,26 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) resource_unload(&texture->resource); } @@ -101,7 +101,7 @@ index 3fc020e..49bd366 100644 } for (i = 0; i < sub_count; ++i) -@@ -152,11 +161,8 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -141,11 +150,8 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) texture->texture_ops->texture_sub_resource_cleanup(sub_resource); } @@ -114,7 +114,7 @@ index 3fc020e..49bd366 100644 } void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) -@@ -523,9 +529,10 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) +@@ -432,9 +438,10 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) if (!refcount) { @@ -127,7 +127,7 @@ index 3fc020e..49bd366 100644 } return refcount; -@@ -1092,12 +1099,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -999,12 +1006,14 @@ 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); @@ -142,7 +142,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } -@@ -1107,12 +1116,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1014,12 +1023,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 +157,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1133,6 +1144,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1040,6 +1051,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 +165,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1142,6 +1154,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1049,6 +1061,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi surface_flags, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x\n", hr); @@ -173,7 +173,7 @@ index 3fc020e..49bd366 100644 return hr; } -@@ -1204,6 +1217,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1111,6 +1124,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); @@ -181,7 +181,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } -@@ -1234,6 +1248,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1141,6 +1155,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 +189,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1246,12 +1261,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1153,12 +1168,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 +204,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1260,6 +1277,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1167,6 +1184,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 surface_flags, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -212,7 +212,7 @@ index 3fc020e..49bd366 100644 return hr; } -@@ -1446,12 +1464,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1345,12 +1363,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 +227,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } -@@ -1461,12 +1481,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1360,12 +1380,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 +242,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1494,6 +1516,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1393,6 +1415,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 +250,7 @@ index 3fc020e..49bd366 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1503,6 +1526,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1402,6 +1425,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct 0, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -258,7 +258,7 @@ index 3fc020e..49bd366 100644 return hr; } -@@ -1579,7 +1603,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -1478,7 +1502,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,18 +267,18 @@ index 3fc020e..49bd366 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 5b1a286..2f5fbf3 100644 +index af72d74..b62022f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2307,6 +2307,7 @@ static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_t - void wined3d_texture_apply_state_changes(struct wined3d_texture *texture, - const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1], - const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; +@@ -2289,6 +2289,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; +void wined3d_texture_cleanup_cs(struct wined3d_texture *texture) DECLSPEC_HIDDEN; 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, -@@ -2732,6 +2733,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, +@@ -2717,6 +2718,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; @@ -287,5 +287,5 @@ index 5b1a286..2f5fbf3 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 -- -1.9.1 +2.2.1 diff --git a/patches/wined3d-CSMT_Main/0141-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch b/patches/wined3d-CSMT_Main/0141-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch index 7b0080fa..d5334dc4 100644 --- a/patches/wined3d-CSMT_Main/0141-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch +++ b/patches/wined3d-CSMT_Main/0141-wined3d-Unload-resources-through-the-CS-in-uninit_3d.patch @@ -1,4 +1,4 @@ -From a2b1d967f8c0ee199803ba6e7ebb0b07c26a65f0 Mon Sep 17 00:00:00 2001 +From 1e5a27c212131073531e6c1cf8d45b9d67d70693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 2 Oct 2013 23:28:56 +0200 Subject: wined3d: Unload resources through the CS in uninit_3d. @@ -8,10 +8,10 @@ Subject: wined3d: Unload resources through the CS in uninit_3d. 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index f5cb7bd..28819af 100644 +index 29a4d33..8d896a0 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -1050,9 +1050,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1067,9 +1067,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Unloading resource %p.\n", resource); @@ -22,8 +22,8 @@ index f5cb7bd..28819af 100644 + if (wined3d_settings.cs_multithreaded) + device->cs->ops->finish(device->cs); - /* Destroy the depth blt resources, they will be invalid after the reset. Also free shader - * private data, it might contain opengl pointers + wine_rb_for_each_entry(&device->samplers, device_free_sampler, device); + -- -2.1.3 +2.2.1 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 c55c649c..0b0540e1 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,17 +1,17 @@ -From cdfd2659beba10a60a6535bb489c976b97f28ec5 Mon Sep 17 00:00:00 2001 +From 07c7bd93784b29a1b75f701b9a358c85babfc003 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 | 27 ++------------------------- - 1 file changed, 2 insertions(+), 25 deletions(-) + dlls/wined3d/device.c | 31 ++++--------------------------- + 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index b96f20f..278bbdc 100644 +index f171df8..2d00ada 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -997,8 +997,6 @@ err_out: +@@ -1014,8 +1014,6 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context) HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) { struct wined3d_resource *resource, *cursor; @@ -20,7 +20,7 @@ index b96f20f..278bbdc 100644 struct wined3d_surface *surface; UINT i; -@@ -1010,12 +1008,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1027,12 +1025,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) if (wined3d_settings.cs_multithreaded) device->cs->ops->finish(device->cs); @@ -33,13 +33,15 @@ index b96f20f..278bbdc 100644 if (device->logo_texture) wined3d_texture_decref(device->logo_texture); -@@ -1045,22 +1037,8 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1062,24 +1054,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); } - if (wined3d_settings.cs_multithreaded) - device->cs->ops->finish(device->cs); - +- wine_rb_for_each_entry(&device->samplers, device_free_sampler, device); +- - /* Destroy the depth blt resources, they will be invalid after the reset. Also free shader - * private data, it might contain opengl pointers - */ @@ -57,7 +59,7 @@ index b96f20f..278bbdc 100644 if (device->back_buffer_view) { -@@ -1068,8 +1046,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1087,8 +1063,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->back_buffer_view = NULL; } @@ -66,7 +68,16 @@ index b96f20f..278bbdc 100644 for (i = 0; i < device->swapchain_count; ++i) { TRACE("Releasing the implicit swapchain %u.\n", i); -@@ -4175,6 +4151,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine +@@ -4166,6 +4140,8 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine + context = context_acquire(device, NULL); + gl_info = context->gl_info; + ++ wine_rb_for_each_entry(&device->samplers, device_free_sampler, device); ++ + if (device->depth_blt_texture) + { + gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); +@@ -4185,6 +4161,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -75,5 +86,5 @@ index b96f20f..278bbdc 100644 static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) -- -2.1.3 +2.2.1 diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index c1557ce1..25e48131 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -394,7 +394,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c new_source = FOGSOURCE_COORD; gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)"); -@@ -1765,7 +1792,11 @@ +@@ -1766,7 +1793,11 @@ if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS] || state->render_states[WINED3D_RS_DEPTHBIAS]) { @@ -406,7 +406,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c float scale; union -@@ -4296,9 +4327,15 @@ +@@ -4415,9 +4446,15 @@ } } } else { @@ -422,7 +422,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c WARN("unsupported blending in openGl\n"); } } -@@ -4653,7 +4690,11 @@ +@@ -4772,7 +4809,11 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -434,7 +434,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; -@@ -4833,7 +4874,11 @@ +@@ -4952,7 +4993,11 @@ } else { @@ -446,7 +446,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c UINT height; UINT width; -@@ -4900,7 +4945,11 @@ +@@ -5019,7 +5064,11 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -1308,7 +1308,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2209,7 +2215,11 @@ +@@ -2211,7 +2217,11 @@ return TRUE; } @@ -1320,7 +1320,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c static void context_validate_onscreen_formats(struct wined3d_context *context, const struct wined3d_rendertarget_view *depth_stencil) { -@@ -2225,6 +2235,7 @@ +@@ -2227,6 +2237,7 @@ WARN("Depth stencil format is not supported by WGL, rendering the backbuffer in an FBO\n"); /* The currently active context is the necessary context to access the swapchain's onscreen buffers */ @@ -1328,7 +1328,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c wined3d_resource_load_location(&context->current_rt->resource, context, WINED3D_LOCATION_TEXTURE_RGB); swapchain->render_to_fbo = TRUE; swapchain_update_draw_bindings(swapchain); -@@ -2239,6 +2250,22 @@ +@@ -2241,6 +2252,22 @@ return context_generate_rt_mask_from_surface(rt); else return context_generate_rt_mask(context->offscreenBuffer); @@ -1351,7 +1351,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } /* Context activation is done by the caller. */ -@@ -2270,7 +2297,11 @@ +@@ -2272,7 +2299,11 @@ } else { @@ -1363,7 +1363,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } cur_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask; -@@ -2316,7 +2347,11 @@ +@@ -2318,7 +2349,11 @@ DWORD rt_mask = 0, *cur_mask; UINT i; @@ -1375,7 +1375,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c || rt_count != context->gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, fb->depth_stencil)) -@@ -2356,11 +2391,17 @@ +@@ -2358,11 +2393,17 @@ } else { @@ -1393,7 +1393,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2373,7 +2414,11 @@ +@@ -2375,7 +2416,11 @@ } else { @@ -1405,7 +1405,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c rt_count ? wined3d_rendertarget_view_get_surface(rts[0]) : NULL); } -@@ -2408,6 +2453,7 @@ +@@ -2410,6 +2455,7 @@ return TRUE; } @@ -1413,7 +1413,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { struct wined3d_rendertarget_view **rts = state->fb.render_targets; -@@ -2417,6 +2463,18 @@ +@@ -2419,6 +2465,18 @@ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return context_generate_rt_mask_no_fbo(context, wined3d_rendertarget_view_get_surface(rts[0])); @@ -1432,7 +1432,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c else if (!context->render_offscreen) return context_generate_rt_mask_from_surface(wined3d_rendertarget_view_get_surface(rts[0])); -@@ -2439,8 +2497,14 @@ +@@ -2441,8 +2499,14 @@ /* Context activation is done by the caller. */ void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -1447,7 +1447,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -2469,8 +2533,10 @@ +@@ -2471,8 +2535,10 @@ context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -1458,7 +1458,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -2708,12 +2774,22 @@ +@@ -2710,12 +2776,22 @@ /* Context activation is done by the caller. */ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -1481,7 +1481,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c if (rt_mask != *cur_mask) { context_apply_draw_buffers(context, rt_mask); -@@ -2895,7 +2971,11 @@ +@@ -2897,7 +2973,11 @@ { if (state->vertex_declaration->half_float_conv_needed && !stream_info->all_vbo) { @@ -1493,7 +1493,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c context->use_immediate_mode_draw = TRUE; } else -@@ -2967,11 +3047,19 @@ +@@ -2969,11 +3049,19 @@ } /* Context activation is done by the caller. */ @@ -1513,7 +1513,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i, j; WORD map; -@@ -2998,12 +3086,17 @@ +@@ -3000,12 +3088,17 @@ for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i) { if (map & 1) @@ -1531,7 +1531,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } if (state->index_buffer) { -@@ -3100,7 +3193,11 @@ +@@ -3102,7 +3195,11 @@ if (texture->texture_srgb.name) wined3d_texture_load(texture, context, TRUE); wined3d_texture_load(texture, context, FALSE); @@ -1728,7 +1728,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #include #include #include -@@ -280,8 +308,10 @@ +@@ -279,8 +307,10 @@ unsigned int max_sm_gs; unsigned int max_sm_ps; BOOL no_3d; @@ -1739,7 +1739,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -979,9 +1009,14 @@ +@@ -978,9 +1008,14 @@ WORD use_map; /* MAX_ATTRIBS, 16 */ }; @@ -1754,7 +1754,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 -@@ -1063,8 +1098,10 @@ +@@ -1062,8 +1097,10 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -1765,7 +1765,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; union wined3d_gl_query_object -@@ -1100,6 +1137,7 @@ +@@ -1099,6 +1136,7 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -1773,7 +1773,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT64 timestamp; }; -@@ -1135,6 +1173,12 @@ +@@ -1134,6 +1172,12 @@ for (i = 0; i < min(dst->rt_size, src->rt_size); i++) dst->render_targets[i] = src->render_targets[i]; } @@ -1786,7 +1786,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context { -@@ -1150,7 +1194,9 @@ +@@ -1149,7 +1193,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 */ @@ -1796,7 +1796,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_swapchain *swapchain; struct wined3d_surface *current_rt; -@@ -1248,8 +1294,17 @@ +@@ -1247,8 +1293,17 @@ GLfloat fog_coord_value; GLfloat color[4], fogstart, fogend, fogcolor[4]; GLuint dummy_arbfp_prog; @@ -1814,7 +1814,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); -@@ -1377,8 +1432,12 @@ +@@ -1376,8 +1431,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; @@ -1827,7 +1827,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, -@@ -1927,7 +1986,11 @@ +@@ -1926,7 +1985,11 @@ struct wined3d_state { DWORD flags; @@ -1839,7 +1839,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]; -@@ -1972,6 +2035,7 @@ +@@ -1971,6 +2034,7 @@ DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; @@ -1847,7 +1847,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_gl_bo { GLuint name; -@@ -1980,6 +2044,7 @@ +@@ -1979,6 +2043,7 @@ UINT size; }; @@ -1855,7 +1855,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 -@@ -2035,10 +2100,21 @@ +@@ -2034,11 +2099,23 @@ struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -1864,10 +1864,12 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct list resources; /* a linked list to track resources created by the device */ struct list shaders; /* a linked list to track shaders (pixel and vertex) */ + struct wine_rb_tree samplers; +#else /* STAGING_CSMT */ + + struct list resources; /* a linked list to track resources created by the device */ + struct list shaders; /* a linked list to track shaders (pixel and vertex) */ ++ struct wine_rb_tree samplers; + + /* Render Target Support */ + struct wined3d_fb_state fb; @@ -1877,7 +1879,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; -@@ -2049,6 +2125,9 @@ +@@ -2049,6 +2126,9 @@ UINT xScreenSpace; UINT yScreenSpace; UINT cursorWidth, cursorHeight; @@ -1887,7 +1889,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HCURSOR hardwareCursor; /* The Wine logo texture */ -@@ -2080,6 +2159,7 @@ +@@ -2080,6 +2160,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; @@ -1895,7 +1897,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, -@@ -2091,6 +2171,11 @@ +@@ -2091,6 +2172,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; @@ -1907,7 +1909,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) { -@@ -2114,9 +2199,11 @@ +@@ -2114,9 +2200,11 @@ ULONG (*resource_incref)(struct wined3d_resource *resource); ULONG (*resource_decref)(struct wined3d_resource *resource); void (*resource_unload)(struct wined3d_resource *resource); @@ -1919,7 +1921,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_resource -@@ -2139,6 +2226,7 @@ +@@ -2139,6 +2227,7 @@ UINT depth; UINT size; DWORD priority; @@ -1927,7 +1929,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; -@@ -2146,6 +2234,11 @@ +@@ -2146,6 +2235,11 @@ DWORD locations; LONG access_fence; BOOL unmap_dirtify; @@ -1939,7 +1941,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2170,6 +2263,7 @@ +@@ -2170,6 +2264,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; @@ -1947,7 +1949,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, -@@ -2216,6 +2310,15 @@ +@@ -2216,6 +2311,15 @@ { while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); } @@ -1963,17 +1965,17 @@ 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 -@@ -2309,7 +2412,9 @@ - void wined3d_texture_apply_state_changes(struct wined3d_texture *texture, - const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1], - const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; +@@ -2291,7 +2395,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; +#if defined(STAGING_CSMT) void wined3d_texture_cleanup_cs(struct wined3d_texture *texture) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ 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, -@@ -2343,9 +2448,16 @@ +@@ -2325,9 +2431,16 @@ struct wined3d_resource resource; struct wined3d_texture *container; @@ -1990,7 +1992,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) -@@ -2353,6 +2465,7 @@ +@@ -2335,6 +2448,7 @@ return CONTAINING_RECORD(resource, struct wined3d_volume, resource); } @@ -1998,7 +2000,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; -@@ -2365,6 +2478,23 @@ +@@ -2347,6 +2461,23 @@ struct wined3d_surface_dib { HBITMAP DIBsection; @@ -2022,7 +2024,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT bitmap_size; }; -@@ -2390,7 +2520,11 @@ +@@ -2372,7 +2503,11 @@ struct wined3d_surface_ops { HRESULT (*surface_private_setup)(struct wined3d_surface *surface); @@ -2034,7 +2036,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_surface -@@ -2398,12 +2532,25 @@ +@@ -2380,12 +2515,25 @@ struct wined3d_resource resource; const struct wined3d_surface_ops *surface_ops; struct wined3d_texture *container; @@ -2060,7 +2062,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; GLenum texture_target; -@@ -2449,10 +2596,19 @@ +@@ -2431,10 +2579,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; @@ -2080,7 +2082,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; -@@ -2464,6 +2620,7 @@ +@@ -2446,6 +2603,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; @@ -2088,7 +2090,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; -@@ -2482,6 +2639,21 @@ +@@ -2464,6 +2622,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; @@ -2110,7 +2112,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. */ -@@ -2524,8 +2696,10 @@ +@@ -2510,8 +2683,10 @@ BOOL half_float_conv_needed; }; @@ -2121,7 +2123,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]; -@@ -2593,6 +2767,7 @@ +@@ -2579,6 +2754,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -2129,7 +2131,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; -@@ -2643,6 +2818,32 @@ +@@ -2629,6 +2805,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; @@ -2162,7 +2164,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; -@@ -2690,6 +2891,7 @@ +@@ -2676,6 +2878,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; @@ -2170,7 +2172,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, -@@ -2749,6 +2951,7 @@ +@@ -2735,6 +2938,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; @@ -2178,7 +2180,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 -@@ -2763,8 +2966,12 @@ +@@ -2749,8 +2953,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -2191,7 +2193,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -2778,12 +2985,16 @@ +@@ -2764,12 +2972,16 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -2208,7 +2210,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 */ -@@ -2810,7 +3021,9 @@ +@@ -2796,7 +3008,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -2218,7 +2220,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -2835,11 +3048,15 @@ +@@ -2821,11 +3035,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; @@ -2234,7 +2236,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -2877,8 +3094,10 @@ +@@ -2863,8 +3081,10 @@ return surface_from_resource(resource); } @@ -2245,7 +2247,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -2891,8 +3110,12 @@ +@@ -2877,8 +3097,12 @@ struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, @@ -2258,7 +2260,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_swapchain -@@ -2932,8 +3155,10 @@ +@@ -2918,8 +3142,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; @@ -2269,7 +2271,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /***************************************************************************** * Utility function prototypes -@@ -3152,7 +3377,9 @@ +@@ -3138,7 +3364,9 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_shader_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; @@ -3183,7 +3185,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } -@@ -608,7 +661,11 @@ +@@ -617,7 +670,11 @@ } /* Context activation is done by the caller. */ @@ -3195,7 +3197,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; unsigned int i, j, count; -@@ -835,7 +892,11 @@ +@@ -844,7 +901,11 @@ BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil; unsigned int i; @@ -3207,21 +3209,21 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -853,7 +914,13 @@ +@@ -862,7 +923,13 @@ struct wined3d_swapchain_desc *swapchain_desc) { 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; HRESULT hr; -@@ -864,6 +931,11 @@ +@@ -873,6 +940,11 @@ if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; @@ -3233,7 +3235,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -904,7 +976,14 @@ +@@ -913,7 +985,14 @@ device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); @@ -3248,7 +3250,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->contexts[0]->last_was_rhw = 0; -@@ -916,7 +995,11 @@ +@@ -925,7 +1004,11 @@ case ORM_BACKBUFFER: { @@ -3260,7 +3262,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { TRACE("Using auxiliary buffer for offscreen rendering\n"); device->offscreenBuffer = GL_AUX0; -@@ -928,9 +1011,16 @@ +@@ -937,9 +1020,16 @@ } } } @@ -3277,7 +3279,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Clear the screen */ if (swapchain->back_buffers && swapchain->back_buffers[0]) -@@ -947,6 +1037,9 @@ +@@ -956,6 +1046,9 @@ return WINED3D_OK; err_out: @@ -3287,7 +3289,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -997,6 +1090,10 @@ +@@ -1014,6 +1107,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) { struct wined3d_resource *resource, *cursor; @@ -3298,7 +3300,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_surface *surface; UINT i; -@@ -1005,6 +1102,7 @@ +@@ -1022,6 +1119,7 @@ if (!device->d3d_initialized) return WINED3DERR_INVALIDCALL; @@ -3306,7 +3308,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) device->cs->ops->finish(device->cs); -@@ -1045,6 +1143,81 @@ +@@ -1062,6 +1160,83 @@ wined3d_rendertarget_view_decref(device->back_buffer_view); device->back_buffer_view = NULL; } @@ -3332,6 +3334,8 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c + resource->resource_ops->resource_unload(resource); + } + ++ wine_rb_for_each_entry(&device->samplers, device_free_sampler, device); ++ + /* Destroy the depth blt resources, they will be invalid after the reset. Also free shader + * private data, it might contain opengl pointers + */ @@ -3388,7 +3392,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c for (i = 0; i < device->swapchain_count; ++i) { -@@ -1057,6 +1230,11 @@ +@@ -1074,6 +1249,11 @@ device->swapchains = NULL; device->swapchain_count = 0; @@ -3400,7 +3404,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1420,6 +1598,16 @@ +@@ -1437,6 +1617,16 @@ TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", light->range, light->falloff, light->theta, light->phi); @@ -3417,7 +3421,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Save away the information. */ object->OriginalParms = *light; -@@ -1492,9 +1680,11 @@ +@@ -1509,9 +1699,11 @@ FIXME("Unrecognized light type %#x.\n", light->type); } @@ -3429,7 +3433,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1567,6 +1757,14 @@ +@@ -1584,6 +1776,14 @@ { if (light_info->glIndex != -1) { @@ -3444,7 +3448,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; } -@@ -1608,11 +1806,23 @@ +@@ -1625,11 +1825,23 @@ WARN("Too many concurrently active lights\n"); return WINED3D_OK; } @@ -3468,7 +3472,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1787,9 +1997,11 @@ +@@ -1804,9 +2016,11 @@ TRACE("device %p, base_index %d.\n", device, base_index); device->update_state->base_vertex_index = base_index; @@ -3480,7 +3484,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) -@@ -1834,7 +2046,11 @@ +@@ -1851,7 +2065,11 @@ || !(texture->resource.format->flags & WINED3DFMT_FLAG_DEPTH)) return; surface = surface_from_resource(texture->sub_resources[0]); @@ -3492,7 +3496,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); -@@ -2154,7 +2370,11 @@ +@@ -2171,7 +2389,11 @@ return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx]; } @@ -3504,7 +3508,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { UINT i; -@@ -2187,8 +2407,12 @@ +@@ -2204,8 +2426,12 @@ } else { @@ -3517,7 +3521,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2235,8 +2459,12 @@ +@@ -2252,8 +2478,12 @@ } else { @@ -3530,7 +3534,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2287,8 +2515,13 @@ +@@ -2304,8 +2534,13 @@ memset(device->recording->changed.vertexShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.vertexShaderConstantsF) * vector4f_count); else @@ -3544,7 +3548,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2423,8 +2656,12 @@ +@@ -2440,8 +2675,12 @@ } else { @@ -3557,7 +3561,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2471,8 +2708,12 @@ +@@ -2488,8 +2727,12 @@ } else { @@ -3570,7 +3574,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2524,8 +2765,12 @@ +@@ -2541,8 +2784,12 @@ memset(device->recording->changed.pixelShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.pixelShaderConstantsF) * vector4f_count); else @@ -3583,7 +3587,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2685,6 +2930,7 @@ +@@ -2702,6 +2949,7 @@ return hr; } @@ -3591,7 +3595,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) { FIXME("Waiting for cs.\n"); -@@ -2692,6 +2938,7 @@ +@@ -2709,6 +2957,7 @@ device->cs->ops->finish(device->cs); } @@ -3599,7 +3603,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); -@@ -3193,6 +3440,10 @@ +@@ -3210,6 +3459,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -3610,7 +3614,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3201,6 +3452,15 @@ +@@ -3218,6 +3471,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3626,7 +3630,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3226,8 +3486,10 @@ +@@ -3243,8 +3505,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) { @@ -3637,7 +3641,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); -@@ -3236,12 +3498,19 @@ +@@ -3253,12 +3517,19 @@ WARN("Rects is %p, but rect_count is 0, ignoring clear\n", rects); return WINED3D_OK; } @@ -3657,7 +3661,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"); -@@ -3250,8 +3519,13 @@ +@@ -3267,8 +3538,13 @@ } else if (flags & WINED3DCLEAR_TARGET) { @@ -3671,7 +3675,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; -@@ -3297,6 +3571,9 @@ +@@ -3314,6 +3590,9 @@ enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -3681,7 +3685,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); -@@ -3304,8 +3581,13 @@ +@@ -3321,8 +3600,13 @@ device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -3695,7 +3699,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, -@@ -3328,6 +3610,14 @@ +@@ -3345,6 +3629,14 @@ return WINED3DERR_INVALIDCALL; } @@ -3710,7 +3714,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; -@@ -3335,6 +3625,10 @@ +@@ -3352,6 +3644,10 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { @@ -3721,7 +3725,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) -@@ -3353,6 +3647,15 @@ +@@ -3370,6 +3666,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3737,7 +3741,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; -@@ -3367,6 +3670,7 @@ +@@ -3384,6 +3689,7 @@ } /* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */ @@ -3745,7 +3749,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) { -@@ -3405,6 +3709,100 @@ +@@ -3422,6 +3728,100 @@ /* Make sure that the destination texture is loaded. */ wined3d_texture_load(dst_texture, context, FALSE); @@ -3846,7 +3850,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Update every surface level of the texture. */ switch (type) -@@ -3418,7 +3816,16 @@ +@@ -3435,7 +3835,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)); @@ -3863,7 +3867,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } break; } -@@ -3432,7 +3839,16 @@ +@@ -3449,7 +3858,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)); @@ -3880,7 +3884,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } break; } -@@ -3441,6 +3857,7 @@ +@@ -3458,6 +3876,7 @@ { for (i = 0; i < level_count; ++i) { @@ -3888,7 +3892,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))); -@@ -3497,6 +3914,24 @@ +@@ -3514,6 +3933,24 @@ } wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture); @@ -3913,7 +3917,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -3559,8 +3994,13 @@ +@@ -3576,8 +4013,13 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -3927,7 +3931,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3657,6 +4097,7 @@ +@@ -3674,6 +4116,7 @@ struct wined3d_surface *src_surface, const RECT *src_rect, struct wined3d_surface *dst_surface, const POINT *dst_point) { @@ -3935,7 +3939,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; -@@ -3664,6 +4105,7 @@ +@@ -3681,6 +4124,7 @@ RECT r, dst_rect; POINT p; @@ -3943,7 +3947,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)); -@@ -3675,6 +4117,7 @@ +@@ -3692,6 +4136,7 @@ return WINED3DERR_INVALIDCALL; } @@ -3951,7 +3955,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"); -@@ -3737,6 +4180,9 @@ +@@ -3754,6 +4199,9 @@ wined3d_cs_emit_update_surface(device->cs, src_surface, src_rect, dst_surface, dst_point); return WINED3D_OK; @@ -3961,7 +3965,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_copy_resource(struct wined3d_device *device, -@@ -3838,8 +4284,14 @@ +@@ -3855,8 +4303,14 @@ rect = &r; } @@ -3976,7 +3980,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, -@@ -3853,6 +4305,7 @@ +@@ -3870,6 +4324,7 @@ return NULL; } @@ -3984,7 +3988,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -3868,6 +4321,22 @@ +@@ -3885,6 +4340,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -4007,7 +4011,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); -@@ -3907,6 +4376,7 @@ +@@ -3924,6 +4395,7 @@ } @@ -4015,7 +4019,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; -@@ -3914,6 +4384,15 @@ +@@ -3931,6 +4403,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -4031,7 +4035,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. */ -@@ -3925,6 +4404,7 @@ +@@ -3942,6 +4423,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4039,7 +4043,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; -@@ -3949,6 +4429,79 @@ +@@ -3966,6 +4448,79 @@ { TRACE("device %p, x_hotspot %u, y_hotspot %u, cursor_image %p.\n", device, x_hotspot, y_hotspot, cursor_image); @@ -4119,7 +4123,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (cursor_image) { -@@ -3984,8 +4537,16 @@ +@@ -4001,8 +4556,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. */ @@ -4136,7 +4140,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; -@@ -4085,6 +4646,12 @@ +@@ -4102,6 +4665,12 @@ else SetCursor(NULL); } @@ -4149,7 +4153,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return oldVisible; } -@@ -4095,8 +4662,10 @@ +@@ -4112,8 +4681,10 @@ TRACE("device %p.\n", device); @@ -4160,7 +4164,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); -@@ -4104,6 +4673,7 @@ +@@ -4121,6 +4692,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -4168,10 +4172,10 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4122,6 +4692,37 @@ - - context = context_acquire(device, NULL); +@@ -4141,6 +4713,37 @@ gl_info = context->gl_info; + + wine_rb_for_each_entry(&device->samplers, device_free_sampler, device); +#else /* STAGING_CSMT */ + resource->resource_ops->resource_unload(resource); + } @@ -4206,7 +4210,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4142,6 +4743,7 @@ +@@ -4161,6 +4764,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4214,7 +4218,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4161,6 +4763,14 @@ +@@ -4180,6 +4784,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -4229,7 +4233,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, -@@ -4177,6 +4787,7 @@ +@@ -4196,6 +4808,7 @@ return hr; } @@ -4237,7 +4241,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)) { -@@ -4187,6 +4798,34 @@ +@@ -4206,6 +4819,34 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -4272,7 +4276,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4206,8 +4845,10 @@ +@@ -4225,8 +4866,10 @@ unsigned int i; TRACE("device %p, swapchain_desc %p, mode %p, callback %p.\n", device, swapchain_desc, mode, callback); @@ -4283,7 +4287,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { -@@ -4223,9 +4864,21 @@ +@@ -4242,9 +4885,21 @@ wined3d_texture_decref(device->logo_texture); device->logo_texture = NULL; } @@ -4305,7 +4309,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4234,6 +4887,7 @@ +@@ -4253,6 +4908,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4313,7 +4317,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4243,6 +4897,12 @@ +@@ -4262,6 +4918,12 @@ { wined3d_surface_decref(device->cs->onscreen_depth_stencil); device->cs->onscreen_depth_stencil = NULL; @@ -4326,7 +4330,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4255,6 +4915,7 @@ +@@ -4274,6 +4936,7 @@ } } @@ -4334,7 +4338,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 -@@ -4276,6 +4937,7 @@ +@@ -4295,6 +4958,7 @@ } device->cs->ops->finish(device->cs); @@ -4342,7 +4346,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. * -@@ -4411,6 +5073,13 @@ +@@ -4430,6 +5094,13 @@ } } @@ -4356,7 +4360,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; -@@ -4448,6 +5117,13 @@ +@@ -4467,6 +5138,13 @@ wined3d_device_set_depth_stencil_view(device, device->auto_depth_stencil_view); } @@ -4370,7 +4374,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))) -@@ -4528,12 +5204,20 @@ +@@ -4547,12 +5225,20 @@ } wined3d_cs_emit_reset_state(device->cs); state_cleanup(&device->state); @@ -4391,7 +4395,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; -@@ -4542,6 +5226,7 @@ +@@ -4561,6 +5247,7 @@ } else if (device->back_buffer_view) { @@ -4399,7 +4403,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); -@@ -4557,6 +5242,24 @@ +@@ -4576,6 +5263,24 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; @@ -4424,7 +4428,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4635,6 +5338,10 @@ +@@ -4656,6 +5361,10 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -4435,7 +4439,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c switch (type) { case WINED3D_RTYPE_SURFACE: -@@ -4645,6 +5352,7 @@ +@@ -4666,6 +5375,7 @@ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4443,7 +4447,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); -@@ -4656,6 +5364,19 @@ +@@ -4677,6 +5387,19 @@ { ERR("Surface %p is still in use as depth/stencil buffer.\n", surface); device->state.fb.depth_stencil = NULL; @@ -4463,7 +4467,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } break; -@@ -4796,7 +5517,11 @@ +@@ -4839,7 +5562,11 @@ device->blitter = adapter->blitter; @@ -4475,7 +4479,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); -@@ -4884,6 +5609,7 @@ +@@ -4928,6 +5655,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -4483,7 +4487,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, -@@ -4937,3 +5663,4 @@ +@@ -4981,3 +5709,4 @@ wined3d_device_destroy_bo(device, context, bo); } @@ -4491,7 +4495,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 -@@ -954,8 +954,15 @@ +@@ -949,8 +949,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; @@ -4507,7 +4511,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; -@@ -1184,7 +1191,11 @@ +@@ -1179,7 +1186,11 @@ { UINT in_count = min(vec4_varyings(version->major, gl_info), shader->limits->packed_input); @@ -4519,7 +4523,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c shader_addline(buffer, "varying vec4 %s_in[%u];\n", prefix, in_count); else /* TODO: Write a replacement shader for the fixed function -@@ -1231,6 +1242,7 @@ +@@ -1226,6 +1237,7 @@ } else { @@ -4527,7 +4531,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. -@@ -1239,6 +1251,23 @@ +@@ -1234,6 +1246,23 @@ * it and just create the uniform. */ FIXME("Cannot find a free uniform for vpos correction params\n"); @@ -5788,7 +5792,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return E_OUTOFMEMORY; } -@@ -131,6 +133,7 @@ +@@ -120,6 +122,7 @@ resource_unload(&texture->resource); } @@ -5796,7 +5800,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void wined3d_texture_cleanup_cs(struct wined3d_texture *texture) { wined3d_texture_unload_gl_texture(texture); -@@ -143,6 +146,12 @@ +@@ -132,6 +135,12 @@ UINT sub_count = texture->level_count * texture->layer_count; UINT i; struct wined3d_device *device = texture->resource.device; @@ -5809,7 +5813,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("texture %p.\n", texture); -@@ -154,8 +163,14 @@ +@@ -143,8 +152,14 @@ texture->texture_ops->texture_sub_resource_cleanup(sub_resource); } @@ -5824,7 +5828,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) -@@ -522,10 +537,16 @@ +@@ -431,10 +446,16 @@ if (!refcount) { @@ -5841,7 +5845,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } return refcount; -@@ -573,8 +594,15 @@ +@@ -482,8 +503,15 @@ void CDECL wined3d_texture_preload(struct wined3d_texture *texture) { @@ -5857,7 +5861,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) -@@ -603,6 +631,7 @@ +@@ -512,6 +540,7 @@ if (texture->lod != lod) { @@ -5865,15 +5869,15 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (wined3d_settings.cs_multithreaded) { struct wined3d_device *device = texture->resource.device; -@@ -610,6 +639,7 @@ +@@ -519,6 +548,7 @@ device->cs->ops->finish(device->cs); } +#endif /* STAGING_CSMT */ texture->lod = lod; - texture->texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; -@@ -669,12 +699,14 @@ + texture->texture_rgb.base_level = ~0u; +@@ -578,12 +608,14 @@ return WINED3DERR_INVALIDCALL; } @@ -5888,7 +5892,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (color_key) { switch (flags & ~WINEDDCKEY_COLORSPACE) -@@ -762,10 +794,14 @@ +@@ -671,10 +703,14 @@ } if (device->d3d_initialized) @@ -5903,7 +5907,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->resource.format = format; texture->resource.multisample_type = multisample_type; -@@ -866,6 +902,7 @@ +@@ -775,6 +811,7 @@ static void texture2d_sub_resource_load(struct wined3d_resource *sub_resource, struct wined3d_context *context, BOOL srgb) { @@ -5911,7 +5915,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c surface_load(surface_from_resource(sub_resource), context, srgb); } -@@ -880,6 +917,19 @@ +@@ -789,6 +826,19 @@ wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding); context_release(context); wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding); @@ -5931,7 +5935,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource) -@@ -891,12 +941,25 @@ +@@ -800,12 +850,25 @@ static void texture2d_sub_resource_invalidate_location(struct wined3d_resource *sub_resource, DWORD location) { @@ -5957,7 +5961,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void texture2d_sub_resource_upload_data(struct wined3d_resource *sub_resource, -@@ -975,6 +1038,7 @@ +@@ -884,6 +947,7 @@ if (gl_info->supported[APPLE_CLIENT_STORAGE]) { @@ -5965,7 +5969,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (surface->flags & (SFLAG_NONPOW2) || texture->flags & WINED3D_TEXTURE_CONVERTED) { -@@ -983,12 +1047,26 @@ +@@ -892,12 +956,26 @@ * WINED3D_TEXTURE_CONVERTED: The conversion destination memory is freed after loading the surface * heap_memory == NULL: Not defined in the extension. Seems to disable client storage effectively */ @@ -5992,7 +5996,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c surface->flags |= SFLAG_CLIENT; mem = surface->resource.heap_memory; -@@ -1058,6 +1136,7 @@ +@@ -967,6 +1045,7 @@ wined3d_texture_unload_gl_texture(texture); } @@ -6000,7 +6004,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void wined3d_texture_load_location_invalidated(struct wined3d_resource *resource, DWORD location) { ERR("Should not be called on textures.\n"); -@@ -1077,6 +1156,13 @@ +@@ -986,6 +1065,13 @@ wined3d_texture_unload, wined3d_texture_load_location_invalidated, wined3d_texture_load_location, @@ -6014,7 +6018,7 @@ 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, -@@ -1093,6 +1179,7 @@ +@@ -1002,6 +1088,7 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6022,7 +6026,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1101,6 +1188,14 @@ +@@ -1010,6 +1097,14 @@ { WARN("(%p) : Tried to create not supported cube texture.\n", texture); HeapFree(GetProcessHeap(), 0, texture); @@ -6037,7 +6041,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1110,6 +1205,7 @@ +@@ -1019,6 +1114,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6045,7 +6049,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1118,6 +1214,14 @@ +@@ -1027,6 +1123,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6060,7 +6064,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1138,7 +1242,9 @@ +@@ -1047,7 +1151,9 @@ else { WARN("Attempted to create a NPOT cube texture (edge length %u) without GL support.\n", desc->width); @@ -6070,7 +6074,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1148,7 +1254,9 @@ +@@ -1057,7 +1163,9 @@ surface_flags, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x\n", hr); @@ -6080,7 +6084,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1211,7 +1319,9 @@ +@@ -1120,7 +1228,9 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6090,7 +6094,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1242,7 +1352,9 @@ +@@ -1151,7 +1261,9 @@ else { WARN("Attempted to create a mipmapped NPOT texture without unconditional NPOT support.\n"); @@ -6100,7 +6104,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1255,6 +1367,7 @@ +@@ -1164,6 +1276,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); @@ -6108,7 +6112,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1263,6 +1376,14 @@ +@@ -1172,6 +1285,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6123,7 +6127,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1271,7 +1392,9 @@ +@@ -1180,7 +1301,9 @@ surface_flags, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6133,7 +6137,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1369,12 +1492,25 @@ +@@ -1272,12 +1395,25 @@ static void texture3d_sub_resource_invalidate_location(struct wined3d_resource *sub_resource, DWORD location) { @@ -6159,7 +6163,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, -@@ -1409,7 +1545,11 @@ +@@ -1312,7 +1448,11 @@ void *mem = NULL; if (gl_info->supported[APPLE_CLIENT_STORAGE] && !format->convert @@ -6171,7 +6175,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); -@@ -1456,6 +1596,7 @@ +@@ -1359,6 +1499,7 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6179,7 +6183,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1464,6 +1605,14 @@ +@@ -1367,6 +1508,14 @@ { WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); HeapFree(GetProcessHeap(), 0, texture); @@ -6194,7 +6198,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1473,6 +1622,7 @@ +@@ -1376,6 +1525,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6202,7 +6206,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1481,6 +1631,14 @@ +@@ -1384,6 +1534,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6217,7 +6221,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1508,7 +1666,9 @@ +@@ -1411,7 +1569,9 @@ { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -6227,7 +6231,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1518,7 +1678,9 @@ +@@ -1421,7 +1581,9 @@ 0, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6237,7 +6241,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1595,6 +1757,9 @@ +@@ -1498,6 +1660,9 @@ if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6339,7 +6343,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context, -@@ -464,7 +504,11 @@ +@@ -463,7 +503,11 @@ TRACE("Creating a DIB section with size %dx%dx%d, size=%d.\n", b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight, b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage); @@ -6351,7 +6355,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!surface->dib.DIBsection) { -@@ -473,7 +517,11 @@ +@@ -472,7 +516,11 @@ return HRESULT_FROM_WIN32(GetLastError()); } @@ -6363,7 +6367,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface->dib.bitmap_size = b_info->bmiHeader.biSizeImage; HeapFree(GetProcessHeap(), 0, b_info); -@@ -487,6 +535,116 @@ +@@ -486,6 +534,116 @@ return WINED3D_OK; } @@ -6480,7 +6484,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static void surface_evict_sysmem(struct wined3d_surface *surface) { /* In some conditions the surface memory must not be freed: -@@ -499,8 +657,34 @@ +@@ -498,8 +656,34 @@ return; wined3d_resource_free_sysmem(&surface->resource); @@ -6515,7 +6519,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } static BOOL surface_use_pbo(const struct wined3d_surface *surface) -@@ -585,7 +769,11 @@ +@@ -584,7 +768,11 @@ } if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) @@ -6527,7 +6531,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface_use_pbo(surface)) surface->resource.map_binding = WINED3D_LOCATION_BUFFER; -@@ -593,6 +781,7 @@ +@@ -592,6 +780,7 @@ return WINED3D_OK; } @@ -6535,7 +6539,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static void surface_frontbuffer_updated(struct wined3d_surface *surface) { struct wined3d_context *context = NULL; -@@ -609,6 +798,50 @@ +@@ -608,6 +797,50 @@ wined3d_resource_load_location(&surface->resource, context, surface->container->resource.draw_binding); if (context) context_release(context); @@ -6586,7 +6590,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } static BOOL surface_is_full_rect(const struct wined3d_surface *surface, const RECT *r) -@@ -659,6 +892,14 @@ +@@ -658,6 +891,14 @@ if (src_mask & WINED3DFMT_FLAG_STENCIL) gl_mask |= GL_STENCIL_BUFFER_BIT; @@ -6601,7 +6605,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c context = context_acquire(device, NULL); if (!context->valid) { -@@ -667,12 +908,14 @@ +@@ -666,12 +907,14 @@ return; } @@ -6616,7 +6620,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c gl_info = context->gl_info; context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, NULL, src_surface, src_location); -@@ -712,6 +955,7 @@ +@@ -711,6 +954,7 @@ context_release(context); } @@ -6624,7 +6628,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Blit between surface locations. Onscreen on different swapchains is not supported. * Depth / stencil is not supported. Context activation is done by the caller. */ static void surface_blt_fbo(const struct wined3d_device *device, -@@ -722,6 +966,16 @@ +@@ -721,6 +965,16 @@ const struct wined3d_gl_info *gl_info; struct wined3d_context *context; struct wined3d_surface *required_rt, *restore_rt; @@ -6641,7 +6645,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c RECT src_rect, dst_rect; GLenum gl_filter; GLenum buffer; -@@ -760,6 +1014,7 @@ +@@ -759,6 +1013,7 @@ * surface isn't required if the entire surface is overwritten. (And is * in fact harmful if we're being called by surface_load_location() with * the purpose of loading the destination surface.) */ @@ -6649,7 +6653,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_load_location(&src_surface->resource, old_ctx, src_location); if (!surface_is_full_rect(dst_surface, &dst_rect)) wined3d_resource_load_location(&dst_surface->resource, old_ctx, dst_location); -@@ -778,6 +1033,15 @@ +@@ -777,6 +1032,15 @@ restore_rt = NULL; context = old_ctx; } @@ -6665,7 +6669,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!context->valid) { -@@ -840,12 +1104,16 @@ +@@ -839,12 +1103,16 @@ && dst_surface->container->swapchain->front_buffer == dst_surface->container)) gl_info->gl_ops.gl.p_glFlush(); @@ -6682,7 +6686,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, -@@ -1022,6 +1290,18 @@ +@@ -1021,6 +1289,18 @@ return wined3d_surface_blt(surface, NULL, render_target, NULL, 0, NULL, WINED3D_TEXF_POINT); } @@ -6701,7 +6705,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static ULONG surface_resource_incref(struct wined3d_resource *resource) { return wined3d_surface_incref(surface_from_resource(resource)); -@@ -1042,6 +1322,7 @@ +@@ -1041,6 +1321,7 @@ TRACE("surface %p.\n", surface); @@ -6709,7 +6713,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -1053,6 +1334,23 @@ +@@ -1052,6 +1333,23 @@ * opengl resources, so we cannot leave early. */ wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DISCARDED); wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DISCARDED); @@ -6733,7 +6737,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* We also get here when the ddraw swapchain is destroyed, for example * for a mode switch. In this case this surface won't necessarily be -@@ -1062,10 +1360,24 @@ +@@ -1061,10 +1359,24 @@ } else { @@ -6758,7 +6762,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Destroy fbo render buffers. This is needed for implicit render targets, for * all application-created targets the application has to release the surface -@@ -1096,6 +1408,7 @@ +@@ -1095,6 +1407,7 @@ resource_unload(resource); } @@ -6766,7 +6770,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static void wined3d_surface_location_invalidated(struct wined3d_resource *resource, DWORD location) { struct wined3d_surface *surface = surface_from_resource(resource); -@@ -1111,6 +1424,19 @@ +@@ -1110,6 +1423,19 @@ { surface_private_setup, surface_frontbuffer_updated, @@ -6786,7 +6790,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c }; /***************************************************************************** -@@ -1154,6 +1480,7 @@ +@@ -1153,6 +1479,7 @@ return WINED3D_OK; } @@ -6794,7 +6798,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static void gdi_surface_frontbuffer_updated(struct wined3d_surface *surface) { x11_copy_to_screen(surface->container->swapchain, &surface->lockedRect); -@@ -1163,6 +1490,23 @@ +@@ -1162,6 +1489,23 @@ { gdi_surface_private_setup, gdi_surface_frontbuffer_updated, @@ -6818,7 +6822,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c }; /* This call just downloads data, the caller is responsible for binding the -@@ -1181,7 +1525,11 @@ +@@ -1180,7 +1524,11 @@ return; } @@ -6830,7 +6834,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (format->flags & WINED3DFMT_FLAG_COMPRESSED) { -@@ -1430,6 +1778,7 @@ +@@ -1429,6 +1777,7 @@ } } @@ -6838,7 +6842,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c BOOL surface_check_block_align(struct wined3d_surface *surface, const RECT *rect) { struct wined3d_box box; -@@ -1444,6 +1793,27 @@ +@@ -1443,6 +1792,27 @@ box.bottom = rect->bottom; box.back = 1; return wined3d_resource_check_block_align(&surface->resource, &box); @@ -6866,7 +6870,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point, -@@ -1526,11 +1896,17 @@ +@@ -1525,11 +1895,17 @@ return WINED3DERR_INVALIDCALL; } @@ -6884,7 +6888,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c context = context_acquire(dst_surface->resource.device, NULL); gl_info = context->gl_info; -@@ -1541,10 +1917,17 @@ +@@ -1540,10 +1916,17 @@ if (update_w == dst_w && update_h == dst_h) wined3d_texture_prepare_texture(dst_surface->container, context, FALSE); else @@ -6902,7 +6906,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_get_pitch(&src_surface->resource, &src_row_pitch, &src_slice_pitch); wined3d_surface_upload_data(dst_surface, gl_info, src_format, src_rect, -@@ -1554,8 +1937,13 @@ +@@ -1553,8 +1936,13 @@ context_release(context); @@ -6916,7 +6920,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -1659,8 +2047,12 @@ +@@ -1658,8 +2046,12 @@ return GL_BACK; } @@ -6929,7 +6933,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { DWORD location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB; BOOL ck_changed; -@@ -1684,6 +2076,7 @@ +@@ -1683,6 +2075,7 @@ /* To perform the color key conversion we need a sysmem copy of * the surface. Make sure we have it. */ @@ -6937,7 +6941,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_prepare_map_memory(&surface->resource, context); wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding); wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding); -@@ -1692,6 +2085,16 @@ +@@ -1691,6 +2084,16 @@ wined3d_texture_force_reload(surface->container); } else if (!(surface->resource.locations & location)) @@ -6954,7 +6958,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Reloading because surface is dirty.\n"); } -@@ -1701,7 +2104,11 @@ +@@ -1700,7 +2103,11 @@ return; } @@ -6966,7 +6970,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_evict_sysmem(surface); } -@@ -1784,6 +2191,7 @@ +@@ -1783,6 +2190,7 @@ void CDECL wined3d_surface_preload(struct wined3d_surface *surface) { @@ -6974,7 +6978,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct wined3d_device *device = surface->resource.device; TRACE("surface %p.\n", surface); -@@ -1794,6 +2202,17 @@ +@@ -1793,6 +2201,17 @@ } wined3d_cs_emit_surface_preload(device->cs, surface); @@ -6992,7 +6996,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface) -@@ -2001,6 +2420,7 @@ +@@ -2000,6 +2419,7 @@ { DeleteDC(surface->hDC); DeleteObject(surface->dib.DIBsection); @@ -7000,7 +7004,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface->resource.bitmap_data = NULL; surface->flags &= ~SFLAG_DIBSECTION; create_dib = TRUE; -@@ -2009,6 +2429,15 @@ +@@ -2008,6 +2428,15 @@ surface->resource.locations = 0; wined3d_resource_free_sysmem(&surface->resource); surface->resource.map_heap_memory = NULL; @@ -7016,7 +7020,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c width = texture_resource->width; height = texture_resource->height; -@@ -2034,7 +2463,11 @@ +@@ -2033,7 +2462,11 @@ else surface->flags &= ~SFLAG_NONPOW2; @@ -7028,7 +7032,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY; valid_location = WINED3D_LOCATION_USER_MEMORY; -@@ -2070,11 +2503,19 @@ +@@ -2069,11 +2502,19 @@ if (!valid_location) { @@ -7048,7 +7052,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -2433,6 +2874,7 @@ +@@ -2432,6 +2873,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_surface *source, enum wined3d_format_id to_fmt) { @@ -7056,7 +7060,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c void *dst_data = NULL, *src_data = NULL; UINT src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch; const struct d3dfmt_converter_desc *conv; -@@ -2441,6 +2883,13 @@ +@@ -2440,6 +2882,13 @@ struct wined3d_surface *dst; struct wined3d_context *context = NULL; struct wined3d_device *device = source->resource.device; @@ -7070,7 +7074,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c conv = find_converter(source->resource.format->id, to_fmt); if (!conv) -@@ -2464,6 +2913,7 @@ +@@ -2463,6 +2912,7 @@ } dst = surface_from_resource(wined3d_texture_get_sub_resource(ret, 0)); @@ -7078,7 +7082,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_get_pitch(&source->resource, &src_row_pitch, &src_slice_pitch); wined3d_resource_get_pitch(&ret->resource, &dst_row_pitch, &dst_slice_pitch); -@@ -2504,6 +2954,32 @@ +@@ -2503,6 +2953,32 @@ if (context) context_release(context); return NULL; @@ -7111,7 +7115,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } static HRESULT _Blt_ColorFill(BYTE *buf, unsigned int width, unsigned int height, -@@ -2571,6 +3047,7 @@ +@@ -2570,6 +3046,7 @@ HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface) { @@ -7119,7 +7123,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HRESULT hr; TRACE("surface %p.\n", surface); -@@ -2588,6 +3065,39 @@ +@@ -2587,6 +3064,39 @@ { struct wined3d_box box; const struct wined3d_format *format = surface->resource.format; @@ -7159,7 +7163,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if ((format->flags & WINED3DFMT_FLAG_BLOCKS) && rect && !surface_check_block_align(surface, rect)) -@@ -2599,6 +3109,13 @@ +@@ -2598,6 +3108,13 @@ return WINED3DERR_INVALIDCALL; } @@ -7173,7 +7177,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Performance optimization: Count how often a surface is mapped, if it is * mapped regularly do not throw away the system memory copy. This avoids * the need to download the surface from OpenGL all the time. The surface -@@ -2614,6 +3131,7 @@ +@@ -2613,6 +3130,7 @@ } } @@ -7181,7 +7185,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (rect) { surface->lockedRect = *rect; -@@ -2678,22 +3196,121 @@ +@@ -2677,22 +3195,121 @@ WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id)); return WINED3DERR_INVALIDCALL; } @@ -7315,7 +7319,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } void wined3d_surface_releasedc_cs(struct wined3d_surface *surface) -@@ -2719,6 +3336,35 @@ +@@ -2718,6 +3335,35 @@ if (context) context_release(context); } @@ -7351,7 +7355,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) -@@ -2738,6 +3384,7 @@ +@@ -2737,6 +3383,7 @@ surface->resource.map_count--; surface->flags &= ~SFLAG_DCINUSE; @@ -7359,7 +7363,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_cs_emit_releasedc(surface->resource.device->cs, surface); return WINED3D_OK; -@@ -2773,6 +3420,40 @@ +@@ -2772,6 +3419,40 @@ context = context_acquire(device, surface); } @@ -7400,7 +7404,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c context_apply_blit_state(context, device); gl_info = context->gl_info; -@@ -2860,12 +3541,16 @@ +@@ -2859,12 +3540,16 @@ checkGLcall("glBindBuffer"); } @@ -7417,7 +7421,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Read the framebuffer contents into a texture. Note that this function -@@ -2925,6 +3610,85 @@ +@@ -2924,6 +3609,85 @@ } } @@ -7503,7 +7507,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Does a direct frame buffer -> texture copy. Stretching is done with single * pixel copy calls. */ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface, -@@ -3031,8 +3795,13 @@ +@@ -3030,8 +3794,13 @@ /* The texture is now most up to date - If the surface is a render target * and has a drawable, this path is never entered. */ @@ -7517,7 +7521,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Uses the hardware to stretch and flip the image */ -@@ -3100,7 +3869,11 @@ +@@ -3099,7 +3868,11 @@ checkGLcall("glEnable(texture_target)"); /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ @@ -7529,7 +7533,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag -@@ -3298,6 +4071,7 @@ +@@ -3296,6 +4069,7 @@ checkGLcall("glDeleteTextures(1, &backup)"); } @@ -7537,7 +7541,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (wined3d_settings.cs_multithreaded) gl_info->gl_ops.gl.p_glFinish(); else if (wined3d_settings.strict_draw_ordering) -@@ -3309,6 +4083,17 @@ +@@ -3307,6 +4081,17 @@ * and has a drawable, this path is never entered. */ wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB); wined3d_resource_invalidate_location(&dst_surface->resource, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -7555,7 +7559,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Front buffer coordinates are always full screen coordinates, but our GL -@@ -3339,6 +4124,7 @@ +@@ -3337,6 +4122,7 @@ rect->bottom = drawable_height - rect->bottom; } @@ -7563,7 +7567,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Context activation is done by the caller. */ static void surface_blt_to_drawable(const struct wined3d_device *device, struct wined3d_context *old_ctx, -@@ -3373,6 +4159,26 @@ +@@ -3371,6 +4157,26 @@ /* Make sure the surface is up-to-date. This should probably use * wined3d_resource_load_location() and worry about the destination * surface too, unless we're overwriting it completely. */ @@ -7590,7 +7594,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_load(src_surface->container, context, FALSE); /* Activate the destination context, set it up for blitting */ -@@ -3415,6 +4221,7 @@ +@@ -3413,6 +4219,7 @@ /* Leave the opengl state valid for blitting */ device->blitter->unset_shader(context->gl_info); @@ -7598,7 +7602,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (wined3d_settings.cs_multithreaded) gl_info->gl_ops.gl.p_glFinish(); else if (wined3d_settings.strict_draw_ordering -@@ -3428,6 +4235,14 @@ +@@ -3426,6 +4233,14 @@ context = context_acquire(device, restore_rt); context_release(context); } @@ -7613,7 +7617,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const struct wined3d_color *color) -@@ -3451,9 +4266,15 @@ +@@ -3449,9 +4264,15 @@ enum wined3d_texture_filter_type filter) { struct wined3d_device *device = dst_surface->resource.device; @@ -7629,7 +7633,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, blt_fx %p, filter %s.\n", dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), -@@ -3578,7 +4399,9 @@ +@@ -3576,7 +4397,9 @@ /* Blit from offscreen surface to render target */ struct wined3d_color_key old_blt_key = src_surface->container->src_blt_color_key; DWORD old_color_key_flags = src_surface->container->color_key_flags; @@ -7639,7 +7643,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface); -@@ -3612,6 +4435,7 @@ +@@ -3610,6 +4433,7 @@ wined3d_texture_set_color_key(src_surface->container, WINEDDCKEY_SRCBLT, NULL); } @@ -7647,7 +7651,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c context = context_acquire(device, dst_surface); surface_blt_to_drawable(device, context, filter, flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_ALPHATEST), -@@ -3624,6 +4448,18 @@ +@@ -3622,6 +4446,18 @@ wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding); wined3d_resource_invalidate_location(&dst_surface->resource, ~dst_surface->container->resource.draw_binding); @@ -7666,7 +7670,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -3698,6 +4534,7 @@ +@@ -3696,6 +4532,7 @@ { TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h); @@ -7674,7 +7678,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (((surface->resource.locations & WINED3D_LOCATION_TEXTURE_RGB) && !(location & WINED3D_LOCATION_TEXTURE_RGB)) || (!(surface->resource.locations & WINED3D_LOCATION_TEXTURE_RGB) && (location & WINED3D_LOCATION_TEXTURE_RGB))) -@@ -3706,6 +4543,15 @@ +@@ -3704,6 +4541,15 @@ surface->ds_current_size.cx = w; surface->ds_current_size.cy = h; surface->resource.locations = location; @@ -7690,7 +7694,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Context activation is done by the caller. */ -@@ -3720,7 +4566,11 @@ +@@ -3718,7 +4564,11 @@ /* TODO: Make this work for modes other than FBO */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return; @@ -7702,7 +7706,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { w = surface->ds_current_size.cx; h = surface->ds_current_size.cy; -@@ -3746,7 +4596,11 @@ +@@ -3744,7 +4594,11 @@ return; } @@ -7714,7 +7718,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Surface was discarded, no need copy data.\n"); switch (location) -@@ -3763,6 +4617,7 @@ +@@ -3761,6 +4615,7 @@ default: FIXME("Unhandled location %#x\n", location); } @@ -7722,7 +7726,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface->resource.locations &= ~WINED3D_LOCATION_DISCARDED; surface->resource.locations |= location; surface->ds_current_size.cx = surface->resource.width; -@@ -3774,6 +4629,19 @@ +@@ -3772,6 +4627,19 @@ { FIXME("No up to date depth stencil location.\n"); surface->resource.locations |= location; @@ -7742,7 +7746,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface->ds_current_size.cx = surface->resource.width; surface->ds_current_size.cy = surface->resource.height; return; -@@ -3838,9 +4706,13 @@ +@@ -3836,9 +4704,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7756,7 +7760,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ } else if (location == WINED3D_LOCATION_DRAWABLE) -@@ -3856,9 +4728,13 @@ +@@ -3854,9 +4726,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7770,7 +7774,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ } else -@@ -3866,6 +4742,7 @@ +@@ -3864,6 +4740,7 @@ ERR("Invalid location (%#x) specified.\n", location); } @@ -7778,7 +7782,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface->resource.locations |= location; surface->ds_current_size.cx = surface->resource.width; surface->ds_current_size.cy = surface->resource.height; -@@ -3911,6 +4788,135 @@ +@@ -3909,6 +4786,135 @@ TRACE("Surface was discarded, nothing to do.\n"); return WINED3D_OK; } @@ -7914,7 +7918,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && wined3d_resource_is_offscreen(&surface->container->resource)) -@@ -3920,6 +4926,7 @@ +@@ -3918,6 +4924,7 @@ } surface_get_rect(surface, NULL, &r); @@ -7922,7 +7926,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_TEXTURE_RGB); surface_blt_to_drawable(surface->resource.device, context, WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r); -@@ -3988,6 +4995,66 @@ +@@ -3986,6 +4993,66 @@ RECT rect = {0, 0, surface->resource.width, surface->resource.height}; surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, src_location, @@ -7989,7 +7993,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c &rect, surface, dst_location, &rect); return WINED3D_OK; -@@ -3997,6 +5064,7 @@ +@@ -3995,6 +5062,7 @@ if (srgb) { @@ -7997,7 +8001,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if ((surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->resource.map_binding)) == WINED3D_LOCATION_TEXTURE_RGB) { -@@ -4025,6 +5093,39 @@ +@@ -4023,6 +5091,39 @@ wined3d_resource_prepare_system_memory(&surface->resource); wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_SYSMEM); } @@ -8037,7 +8041,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_prepare_texture(texture, context, srgb); wined3d_texture_bind_and_dirtify(texture, context, srgb); -@@ -4046,7 +5147,11 @@ +@@ -4044,7 +5145,11 @@ /* Don't use PBOs for converted surfaces. During PBO conversion we look at * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is * getting called. */ @@ -8049,7 +8053,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -4055,6 +5160,7 @@ +@@ -4053,6 +5158,7 @@ else surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; @@ -8057,7 +8061,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_prepare_map_memory(&surface->resource, context); wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding); wined3d_resource_free_bo(&surface->resource); -@@ -4062,6 +5168,14 @@ +@@ -4060,6 +5166,14 @@ } wined3d_resource_get_memory(&surface->resource, surface->resource.locations, &data); @@ -8072,7 +8076,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (format.convert) { /* This code is entered for texture formats which need a fixup. */ -@@ -4108,6 +5222,7 @@ +@@ -4106,6 +5220,7 @@ wined3d_surface_upload_data(surface, gl_info, &format, &src_rect, src_row_pitch, &dst_point, srgb, wined3d_const_bo_address(&data)); @@ -8080,7 +8084,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HeapFree(GetProcessHeap(), 0, mem); return WINED3D_OK; -@@ -4131,6 +5246,31 @@ +@@ -4129,6 +5244,31 @@ struct wined3d_context *context, DWORD location) { struct wined3d_surface *surface = surface_from_resource(resource); @@ -8112,7 +8116,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HRESULT hr; TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); -@@ -4138,6 +5278,7 @@ +@@ -4136,6 +5276,7 @@ if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { if (location == WINED3D_LOCATION_TEXTURE_RGB @@ -8120,7 +8124,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c && surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) { surface_load_ds_location(surface, context, location); -@@ -4157,11 +5298,53 @@ +@@ -4155,11 +5296,53 @@ } } @@ -8176,7 +8180,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } switch (location) -@@ -4170,6 +5353,7 @@ +@@ -4168,6 +5351,7 @@ case WINED3D_LOCATION_USER_MEMORY: case WINED3D_LOCATION_SYSMEM: case WINED3D_LOCATION_BUFFER: @@ -8184,7 +8188,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_load_sysmem(surface, context, location); break; -@@ -4187,6 +5371,24 @@ +@@ -4185,6 +5369,24 @@ if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) return; @@ -8209,7 +8213,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; default: -@@ -4194,12 +5396,21 @@ +@@ -4192,12 +5394,21 @@ break; } @@ -8231,7 +8235,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } -@@ -4293,6 +5504,7 @@ +@@ -4291,6 +5502,7 @@ const RECT *dst_rect, const struct wined3d_color *color) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8239,7 +8243,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_rendertarget_view view, *view_ptr = &view; struct wined3d_fb_state fb = {&view_ptr, NULL, 1}; struct wined3d_texture *texture = dst_surface->container; -@@ -4313,6 +5525,21 @@ +@@ -4311,6 +5523,21 @@ view.sub_resource_idx = dst_surface->texture_layer * texture->level_count + dst_surface->texture_level; device_clear_render_targets(device, 1, &fb, 1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0); @@ -8261,7 +8265,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4321,6 +5548,7 @@ +@@ -4319,6 +5546,7 @@ const RECT *dst_rect, float depth) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8269,7 +8273,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_rendertarget_view view; struct wined3d_fb_state fb = {NULL, &view}; struct wined3d_texture *texture = dst_surface->container; -@@ -4336,6 +5564,20 @@ +@@ -4334,6 +5562,20 @@ view.sub_resource_idx = dst_surface->texture_layer * texture->level_count + dst_surface->texture_level; device_clear_render_targets(device, 0, &fb, 1, dst_rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0); @@ -8290,7 +8294,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4493,6 +5735,7 @@ +@@ -4491,6 +5733,7 @@ int bpp, srcheight, srcwidth, dstheight, dstwidth, width; const struct wined3d_format *src_format, *dst_format; struct wined3d_texture *src_texture = NULL; @@ -8298,7 +8302,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c void *src_data = NULL, *dst_data = NULL; UINT src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch; const BYTE *sbase = NULL; -@@ -4523,6 +5766,23 @@ +@@ -4521,6 +5764,23 @@ wined3d_resource_get_pitch(&dst_surface->resource, &dst_row_pitch, &dst_slice_pitch); src_data = dst_data; src_row_pitch = dst_row_pitch; @@ -8322,7 +8326,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format = dst_surface->resource.format; dst_format = src_format; } -@@ -4531,12 +5791,14 @@ +@@ -4529,12 +5789,14 @@ dst_format = dst_surface->resource.format; if (src_surface) { @@ -8337,7 +8341,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (dst_surface->resource.format->id != src_surface->resource.format->id) { if (!(src_texture = surface_convert_format(src_surface, dst_format->id))) -@@ -4547,9 +5809,13 @@ +@@ -4545,9 +5807,13 @@ } src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, 0)); } @@ -8351,7 +8355,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format = src_surface->resource.format; } else -@@ -4557,8 +5823,12 @@ +@@ -4555,8 +5821,12 @@ src_format = dst_format; } @@ -8364,7 +8368,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } bpp = dst_surface->resource.format->byte_count; -@@ -4569,12 +5839,24 @@ +@@ -4567,12 +5837,24 @@ width = (dst_rect->right - dst_rect->left) * bpp; if (src_surface) @@ -8389,7 +8393,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_format->flags & dst_format->flags & WINED3DFMT_FLAG_BLOCKS) { -@@ -4609,7 +5891,11 @@ +@@ -4607,7 +5889,11 @@ } hr = surface_cpu_blt_compressed(sbase, dbuf, @@ -8401,7 +8405,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format, flags, fx); goto release; } -@@ -4617,7 +5903,11 @@ +@@ -4615,7 +5901,11 @@ /* First, all the 'source-less' blits */ if (flags & WINEDDBLT_COLORFILL) { @@ -8413,7 +8417,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c flags &= ~WINEDDBLT_COLORFILL; } -@@ -4631,12 +5921,21 @@ +@@ -4629,12 +5919,21 @@ switch (fx->dwROP) { case BLACKNESS: @@ -8435,7 +8439,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; case SRCCOPY: /* Well, we do that below? */ break; -@@ -4687,6 +5986,7 @@ +@@ -4685,6 +5984,7 @@ for (y = 0; y < dstheight; ++y) { memcpy(dbuf, sbuf, width); @@ -8443,7 +8447,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c sbuf += src_row_pitch; dbuf += dst_row_pitch; } -@@ -4700,6 +6000,21 @@ +@@ -4698,6 +5998,21 @@ { sbuf -= src_row_pitch; dbuf -= dst_row_pitch; @@ -8465,7 +8469,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c memcpy(dbuf, sbuf, width); } } -@@ -4709,8 +6024,13 @@ +@@ -4707,8 +6022,13 @@ for (y = 0; y < dstheight; ++y) { memmove(dbuf, sbuf, width); @@ -8479,7 +8483,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4719,9 +6039,15 @@ +@@ -4717,9 +6037,15 @@ /* Stretching in y direction only. */ for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8495,7 +8499,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4731,6 +6057,7 @@ +@@ -4729,6 +6055,7 @@ int last_sy = -1; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8503,7 +8507,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c sbuf = sbase + (sy >> 16) * src_row_pitch; if ((sy >> 16) == (last_sy >> 16)) -@@ -4738,6 +6065,15 @@ +@@ -4736,6 +6063,15 @@ /* This source row is the same as last source row - * Copy the already stretched row. */ memcpy(dbuf, dbuf - dst_row_pitch, width); @@ -8519,7 +8523,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4784,6 +6120,7 @@ +@@ -4782,6 +6118,7 @@ } #undef STRETCH_ROW } @@ -8527,7 +8531,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dbuf += dst_row_pitch; last_sy = sy; } -@@ -4792,6 +6129,16 @@ +@@ -4790,6 +6127,16 @@ else { LONG dstyinc = dst_row_pitch, dstxinc = bpp; @@ -8544,7 +8548,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c DWORD keylow = 0xffffffff, keyhigh = 0, keymask = 0xffffffff; DWORD destkeylow = 0x0, destkeyhigh = 0xffffffff, destkeymask = 0xffffffff; if (flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE)) -@@ -4841,7 +6188,11 @@ +@@ -4839,7 +6186,11 @@ LONG tmpxy; dTopLeft = dbuf; dTopRight = dbuf + ((dstwidth - 1) * bpp); @@ -8556,7 +8560,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp); if (fx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY) -@@ -4918,6 +6269,7 @@ +@@ -4916,6 +6267,7 @@ flags &= ~(WINEDDBLT_DDFX); } @@ -8564,7 +8568,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c #define COPY_COLORKEY_FX(type) \ do { \ const type *s; \ -@@ -4939,6 +6291,29 @@ +@@ -4937,6 +6289,29 @@ d = (type *)(((BYTE *)d) + dstyinc); \ } \ } while(0) @@ -8594,7 +8598,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c switch (bpp) { -@@ -4957,7 +6332,11 @@ +@@ -4955,7 +6330,11 @@ BYTE *d = dbuf, *dx; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8606,7 +8610,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dx = d; for (x = sx = 0; x < dstwidth; ++x, sx+= xinc) { -@@ -4988,10 +6367,12 @@ +@@ -4986,10 +6365,12 @@ } } @@ -8619,7 +8623,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c error: if (flags && FIXME_ON(d3d_surface)) { -@@ -4999,6 +6380,7 @@ +@@ -4997,6 +6378,7 @@ } release: @@ -8627,7 +8631,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (dst_data) { wined3d_resource_release_map_ptr(&dst_surface->resource, context); -@@ -5017,6 +6399,14 @@ +@@ -5015,6 +6397,14 @@ wined3d_texture_decref(src_texture); if (context) context_release(context); @@ -8642,7 +8646,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -5051,6 +6441,7 @@ +@@ -5049,6 +6439,7 @@ cpu_blit_depth_fill, }; @@ -8650,7 +8654,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) -@@ -5058,6 +6449,16 @@ +@@ -5056,6 +6447,16 @@ struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_device *device = dst_surface->resource.device; DWORD src_ds_flags, dst_ds_flags; @@ -8667,7 +8671,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c BOOL scale, convert; static const DWORD simple_blit = WINEDDBLT_ASYNC -@@ -5066,6 +6467,106 @@ +@@ -5064,6 +6465,106 @@ | WINEDDBLT_DEPTHFILL | WINEDDBLT_DONOTWAIT; @@ -8774,7 +8778,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!device->d3d_initialized) { WARN("D3D not initialized, using fallback.\n"); -@@ -5108,8 +6609,13 @@ +@@ -5106,8 +6607,13 @@ } scale = src_surface @@ -8788,7 +8792,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c convert = src_surface && src_surface->resource.format->id != dst_surface->resource.format->id; dst_ds_flags = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); -@@ -5127,6 +6633,7 @@ +@@ -5125,6 +6631,7 @@ TRACE("Depth fill.\n"); if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) @@ -8796,7 +8800,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return; if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth))) -@@ -5145,6 +6652,32 @@ +@@ -5143,6 +6650,32 @@ * implement those in the CPU blitter at the moment. */ if ((dst_surface->resource.locations & dst_surface->resource.map_binding) && (!src_surface || (src_surface->resource.locations & src_surface->resource.map_binding))) @@ -8829,7 +8833,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { if (scale) TRACE("Not doing sysmem blit because of scaling.\n"); -@@ -5163,6 +6696,7 @@ +@@ -5161,6 +6694,7 @@ if (!surface_convert_color_to_float(dst_surface, fx->u5.dwFillColor, &color)) goto fallback; @@ -8837,7 +8841,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) return; } -@@ -5173,6 +6707,18 @@ +@@ -5171,6 +6705,18 @@ /* Upload */ if ((src_surface->resource.locations & WINED3D_LOCATION_SYSMEM) && !(dst_surface->resource.locations & WINED3D_LOCATION_SYSMEM)) @@ -8856,7 +8860,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { if (scale) TRACE("Not doing upload because of scaling.\n"); -@@ -5180,6 +6726,7 @@ +@@ -5178,6 +6724,7 @@ TRACE("Not doing upload because of format conversion.\n"); else { @@ -8864,7 +8868,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c POINT dst_point = {dst_rect->left, dst_rect->top}; if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, src_rect))) -@@ -5192,6 +6739,15 @@ +@@ -5190,6 +6737,15 @@ context_release(context); } return; @@ -8880,7 +8884,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -5216,6 +6772,7 @@ +@@ -5214,6 +6770,7 @@ wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -8888,7 +8892,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return; } -@@ -5412,6 +6969,50 @@ +@@ -5410,6 +6967,50 @@ wined3d_surface_location_invalidated, wined3d_surface_load_location, }; @@ -8939,7 +8943,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container, const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags) -@@ -5479,7 +7080,11 @@ +@@ -5477,7 +7078,11 @@ } surface->container = container; @@ -8951,7 +8955,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c list_init(&surface->renderbuffers); list_init(&surface->overlays); -@@ -5511,9 +7116,14 @@ +@@ -5509,9 +7114,14 @@ if (surface->resource.map_binding == WINED3D_LOCATION_DIB) { wined3d_resource_free_sysmem(&surface->resource); @@ -8966,7 +8970,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } return hr; -@@ -5540,7 +7150,11 @@ +@@ -5538,7 +7148,11 @@ if (FAILED(hr = surface_init(object, container, desc, target, level, layer, flags))) { WARN("Failed to initialize surface, returning %#x.\n", hr); @@ -9514,7 +9518,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 -@@ -5197,9 +5197,15 @@ +@@ -5193,9 +5193,15 @@ DebugBreak(); }