diff --git a/README.md b/README.md index d1b7489d..c97500fd 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,11 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- +**Bug fixes and features included in the next upcoming release [1]:** + +* Revert patch to prepare GL resources before calling context_apply_fbo_state ([Wine Bug #39536](https://bugs.winehq.org/show_bug.cgi?id=39536)) + + **Bug fixes and features in Wine Staging 1.7.54 [268]:** *Note: The following list only contains features and bug fixes which are not diff --git a/debian/changelog b/debian/changelog index 512b4057..6ce165e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,6 @@ wine-staging (1.7.55) UNRELEASED; urgency=low + * Added patch to revert "Prepare GL resources before calling + context_apply_fbo_state". * Remove disabled shell32-Quoted_ShellExecute patchset (bug already fixed and all tests pass). * Remove disabled reg-Cleanup patchset (only cleanup and not actively diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index b4621604..4d572410 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -299,6 +299,7 @@ patch_enable_all () enable_wined3d_MESA_GPU_Info="$1" enable_wined3d_Multisampling="$1" enable_wined3d_Revert_PixelFormat="$1" + enable_wined3d_Revert_Prepare_GL_Resources="$1" enable_wined3d_UnhandledBlendFactor="$1" enable_wined3d_resource_check_usage="$1" enable_wined3d_wined3d_swapchain_present="$1" @@ -994,6 +995,9 @@ patch_enable () wined3d-Revert_PixelFormat) enable_wined3d_Revert_PixelFormat="$2" ;; + wined3d-Revert_Prepare_GL_Resources) + enable_wined3d_Revert_Prepare_GL_Resources="$2" + ;; wined3d-UnhandledBlendFactor) enable_wined3d_UnhandledBlendFactor="$2" ;; @@ -1743,9 +1747,13 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then if test "$enable_wined3d_DXTn" -gt 1; then abort "Patchset wined3d-DXTn disabled, but wined3d-CSMT_Helper depends on that." fi + if test "$enable_wined3d_Revert_Prepare_GL_Resources" -gt 1; then + abort "Patchset wined3d-Revert_Prepare_GL_Resources disabled, but wined3d-CSMT_Helper depends on that." + fi enable_makedep_PARENTSPEC=1 enable_ntdll_DllRedirects=1 enable_wined3d_DXTn=1 + enable_wined3d_Revert_Prepare_GL_Resources=1 fi if test "$enable_uxtheme_GTK_Theming" -eq 1; then @@ -5597,10 +5605,27 @@ if test "$enable_wined3d_Accounting" -eq 1; then ) >> "$patchlist" fi +# Patchset wined3d-Revert_Prepare_GL_Resources +# | +# | This patchset fixes the following Wine bugs: +# | * [#39536] Revert patch to prepare GL resources before calling context_apply_fbo_state +# | +# | Modified files: +# | * dlls/wined3d/context.c, dlls/wined3d/device.c, dlls/wined3d/drawprim.c, dlls/wined3d/surface.c, +# | dlls/wined3d/wined3d_private.h +# | +if test "$enable_wined3d_Revert_Prepare_GL_Resources" -eq 1; then + patch_apply wined3d-Revert_Prepare_GL_Resources/0001-Revert-wined3d-Prepare-GL-resources-before-calling-c.patch + ( + echo '+ { "Sebastian Lackner", "Revert \"wined3d: Prepare GL resources before calling context_apply_fbo_state.\".", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-CSMT_Helper # | # | This patchset has the following (direct or indirect) dependencies: -# | * makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects, wined3d-DXTn +# | * makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects, wined3d-DXTn, wined3d- +# | Revert_Prepare_GL_Resources # | # | Modified files: # | * configure.ac, dlls/d3d11/device.c, dlls/d3d11/texture.c, dlls/d3d8/surface.c, dlls/d3d8/volume.c, dlls/d3d9/surface.c, @@ -5736,7 +5761,7 @@ fi # | # | This patchset has the following (direct or indirect) dependencies: # | * makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects, wined3d-DXTn, wined3d- -# | CSMT_Helper +# | Revert_Prepare_GL_Resources, wined3d-CSMT_Helper # | # | This patchset fixes the following Wine bugs: # | * [#11674] Support for CSMT (command stream) to increase graphic performance diff --git a/patches/wined3d-CSMT_Helper/definition b/patches/wined3d-CSMT_Helper/definition index aa3d9241..91707f27 100644 --- a/patches/wined3d-CSMT_Helper/definition +++ b/patches/wined3d-CSMT_Helper/definition @@ -1,3 +1,4 @@ Depends: wined3d-DXTn +Depends: wined3d-Revert_Prepare_GL_Resources Depends: makedep-PARENTSPEC Depends: ntdll-DllRedirects diff --git a/patches/wined3d-CSMT_Main/0003-wined3d-Make-surface_load_location-return-nothing.patch b/patches/wined3d-CSMT_Main/0003-wined3d-Make-surface_load_location-return-nothing.patch index c66c1c1d..4a4050ea 100644 --- a/patches/wined3d-CSMT_Main/0003-wined3d-Make-surface_load_location-return-nothing.patch +++ b/patches/wined3d-CSMT_Main/0003-wined3d-Make-surface_load_location-return-nothing.patch @@ -1,4 +1,4 @@ -From 52759529f11102038adaa8501a44b03d9b0024ae Mon Sep 17 00:00:00 2001 +From 58c5b8740183684ce7dcb7735e219b13d3a60ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 17 Nov 2013 20:25:01 +0100 Subject: wined3d: Make surface_load_location return nothing. @@ -9,10 +9,10 @@ Subject: wined3d: Make surface_load_location return nothing. 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 89c8ecf..0b10444 100644 +index ebe8049..dc5d249 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -4231,7 +4231,7 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct +@@ -4257,7 +4257,7 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct } /* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */ @@ -21,7 +21,7 @@ index 89c8ecf..0b10444 100644 { HRESULT hr; -@@ -4243,26 +4243,26 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4269,26 +4269,26 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) { surface_load_ds_location(surface, context, location); @@ -52,7 +52,7 @@ index 89c8ecf..0b10444 100644 } if (WARN_ON(d3d_surface)) -@@ -4277,7 +4277,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4303,7 +4303,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co { ERR("Surface %p does not have any up to date location.\n", surface); surface->flags |= SFLAG_LOST; @@ -61,7 +61,7 @@ index 89c8ecf..0b10444 100644 } switch (location) -@@ -4291,7 +4291,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4317,7 +4317,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_DRAWABLE: if (FAILED(hr = surface_load_drawable(surface, context))) @@ -70,7 +70,7 @@ index 89c8ecf..0b10444 100644 break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -4302,7 +4302,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4328,7 +4328,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_TEXTURE_SRGB: if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) @@ -79,7 +79,7 @@ index 89c8ecf..0b10444 100644 break; default: -@@ -4315,7 +4315,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4341,7 +4341,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co if (location != WINED3D_LOCATION_SYSMEM && (surface->locations & WINED3D_LOCATION_SYSMEM)) surface_evict_sysmem(surface); @@ -89,7 +89,7 @@ index 89c8ecf..0b10444 100644 static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 8bbb1ab..9cff40e 100644 +index e9481b5..fac385a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2457,7 +2457,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, @@ -100,7 +100,7 @@ index 8bbb1ab..9cff40e 100644 +void surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; - void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, + void surface_prepare_rb(struct wined3d_surface *surface, -- -2.6.1 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0006-wined3d-Move-surface-locations-into-the-resource.patch b/patches/wined3d-CSMT_Main/0006-wined3d-Move-surface-locations-into-the-resource.patch index a32ce316..fc74cece 100644 --- a/patches/wined3d-CSMT_Main/0006-wined3d-Move-surface-locations-into-the-resource.patch +++ b/patches/wined3d-CSMT_Main/0006-wined3d-Move-surface-locations-into-the-resource.patch @@ -1,4 +1,4 @@ -From aaf34c4edb4e96dc735ca43288c26d46501b9a5d Mon Sep 17 00:00:00 2001 +From d0e2c459cceb86d34019f95a6ec9910eaeba00f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 21 Jan 2014 12:22:30 +0100 Subject: wined3d: Move surface locations into the resource. @@ -25,7 +25,7 @@ index 9ac6666..d576869 100644 && !wined3d_resource_is_offscreen(&src_surface->container->resource)) { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index d00f263..5e43d07 100644 +index 0da8607..b6c98ef 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -236,7 +236,7 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context @@ -47,10 +47,10 @@ index d00f263..5e43d07 100644 ds->ds_current_size.cx, ds->ds_current_size.cy); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 3761830..943a829 100644 +index d2d3bce..afccecd 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -655,7 +655,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co +@@ -651,7 +651,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co if (!context->render_offscreen && ds != device->onscreen_depth_stencil) device_switch_onscreen_ds(device, context, ds); @@ -60,7 +60,7 @@ index 3761830..943a829 100644 else SetRectEmpty(¤t_rect); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 0b10444..8292ead 100644 +index dc5d249..e937e36 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -556,7 +556,7 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface) @@ -90,7 +90,7 @@ index 0b10444..8292ead 100644 { TRACE("Not dirtified, nothing to do.\n"); return; -@@ -1670,7 +1670,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1680,7 +1680,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P surface_load_location(dst_surface, context, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE); @@ -99,7 +99,7 @@ index 0b10444..8292ead 100644 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, -@@ -1793,7 +1793,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte +@@ -1803,7 +1803,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte if (surface->resource.pool == WINED3D_POOL_SCRATCH) ERR("Not supported on scratch surfaces.\n"); @@ -108,7 +108,7 @@ index 0b10444..8292ead 100644 { TRACE("surface is already in texture\n"); return; -@@ -2059,7 +2059,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, +@@ -2069,7 +2069,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, create_dib = TRUE; } @@ -117,7 +117,7 @@ index 0b10444..8292ead 100644 wined3d_resource_free_sysmem(&surface->resource); width = texture_resource->width; -@@ -3235,7 +3235,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -3245,7 +3245,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st checkGLcall("glEnable(texture_target)"); /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ @@ -126,7 +126,7 @@ index 0b10444..8292ead 100644 } /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag -@@ -3762,13 +3762,14 @@ void surface_modify_ds_location(struct wined3d_surface *surface, +@@ -3772,13 +3772,14 @@ void surface_modify_ds_location(struct wined3d_surface *surface, { TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h); @@ -144,7 +144,7 @@ index 0b10444..8292ead 100644 } /* Context activation is done by the caller. */ -@@ -3783,7 +3784,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3793,7 +3794,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co /* TODO: Make this work for modes other than FBO */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return; @@ -153,7 +153,7 @@ index 0b10444..8292ead 100644 { w = surface->ds_current_size.cx; h = surface->ds_current_size.cy; -@@ -3809,21 +3810,21 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3819,7 +3820,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co return; } @@ -161,7 +161,11 @@ index 0b10444..8292ead 100644 + if (surface->resource.locations & WINED3D_LOCATION_DISCARDED) { TRACE("Surface was discarded, no need copy data.\n"); - wined3d_surface_prepare(surface, context, location); + switch (location) +@@ -3839,17 +3840,17 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co + default: + FIXME("Unhandled location %#x\n", location); + } - surface->locations &= ~WINED3D_LOCATION_DISCARDED; - surface->locations |= location; + surface->resource.locations &= ~WINED3D_LOCATION_DISCARDED; @@ -180,7 +184,7 @@ index 0b10444..8292ead 100644 surface->ds_current_size.cx = surface->resource.width; surface->ds_current_size.cy = surface->resource.height; return; -@@ -3911,7 +3912,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3937,7 +3938,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co ERR("Invalid location (%#x) specified.\n", location); } @@ -189,7 +193,7 @@ index 0b10444..8292ead 100644 surface->ds_current_size.cx = surface->resource.width; surface->ds_current_size.cy = surface->resource.height; } -@@ -3920,7 +3921,7 @@ void surface_validate_location(struct wined3d_surface *surface, DWORD location) +@@ -3946,7 +3947,7 @@ void surface_validate_location(struct wined3d_surface *surface, DWORD location) { TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); @@ -198,7 +202,7 @@ index 0b10444..8292ead 100644 } void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) -@@ -3929,9 +3930,9 @@ void surface_invalidate_location(struct wined3d_surface *surface, DWORD location +@@ -3955,9 +3956,9 @@ void surface_invalidate_location(struct wined3d_surface *surface, DWORD location if (location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) wined3d_texture_set_dirty(surface->container); @@ -210,7 +214,7 @@ index 0b10444..8292ead 100644 ERR("Surface %p does not have any up to date location.\n", surface); } -@@ -3967,7 +3968,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD +@@ -3993,7 +3994,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD UINT size = surface->resource.size; surface_get_memory(surface, &dst, location); @@ -219,7 +223,7 @@ index 0b10444..8292ead 100644 if (dst.buffer_object) { -@@ -4000,33 +4001,33 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -4026,33 +4027,33 @@ static void surface_load_sysmem(struct wined3d_surface *surface, { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -259,7 +263,7 @@ index 0b10444..8292ead 100644 } /* Context activation is done by the caller. */ -@@ -4066,14 +4067,14 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4092,14 +4093,14 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && wined3d_resource_is_offscreen(&texture->resource) @@ -276,7 +280,7 @@ index 0b10444..8292ead 100644 && (surface->container->resource.format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB) && fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, NULL, surface->resource.usage, surface->resource.pool, surface->resource.format, -@@ -4089,13 +4090,13 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4115,13 +4116,13 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, return WINED3D_OK; } @@ -292,7 +296,7 @@ index 0b10444..8292ead 100644 WINED3D_LOCATION_RB_RESOLVED : WINED3D_LOCATION_RB_MULTISAMPLE; DWORD dst_location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB; RECT rect = {0, 0, surface->resource.width, surface->resource.height}; -@@ -4110,7 +4111,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4136,7 +4137,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, if (srgb) { @@ -301,7 +305,7 @@ index 0b10444..8292ead 100644 == WINED3D_LOCATION_TEXTURE_RGB) { /* Performance warning... */ -@@ -4121,7 +4122,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4147,7 +4148,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, } else { @@ -310,7 +314,7 @@ index 0b10444..8292ead 100644 == WINED3D_LOCATION_TEXTURE_SRGB) { /* Performance warning... */ -@@ -4131,7 +4132,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4157,7 +4158,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, } } @@ -319,7 +323,7 @@ index 0b10444..8292ead 100644 { WARN("Trying to load a texture from sysmem, but no simple location is valid.\n"); /* Lets hope we get it from somewhere... */ -@@ -4166,7 +4167,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4192,7 +4193,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, surface_remove_pbo(surface, gl_info); } @@ -328,7 +332,7 @@ index 0b10444..8292ead 100644 if (format.convert) { /* This code is entered for texture formats which need a fixup. */ -@@ -4222,7 +4223,7 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct +@@ -4248,7 +4249,7 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct { RECT rect = {0, 0, surface->resource.width, surface->resource.height}; @@ -337,7 +341,7 @@ index 0b10444..8292ead 100644 ERR("Trying to resolve multisampled surface %p, but location WINED3D_LOCATION_RB_MULTISAMPLE not current.\n", surface); -@@ -4240,12 +4241,12 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4266,12 +4267,12 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { if (location == WINED3D_LOCATION_TEXTURE_RGB @@ -352,7 +356,7 @@ index 0b10444..8292ead 100644 && surface->container->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) { /* Already up to date, nothing to do. */ -@@ -4254,12 +4255,12 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4280,12 +4281,12 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte else { FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", @@ -367,7 +371,7 @@ index 0b10444..8292ead 100644 { TRACE("Location already up to date.\n"); return; -@@ -4273,7 +4274,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4299,7 +4300,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte required_access, surface->resource.access_flags); } @@ -376,7 +380,7 @@ index 0b10444..8292ead 100644 { ERR("Surface %p does not have any up to date location.\n", surface); surface->flags |= SFLAG_LOST; -@@ -4312,7 +4313,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4338,7 +4339,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte surface_validate_location(surface, location); @@ -385,7 +389,7 @@ index 0b10444..8292ead 100644 surface_evict_sysmem(surface); return; -@@ -5364,8 +5365,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5390,8 +5391,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC /* In principle this would apply to depth blits as well, but we don't * implement those in the CPU blitter at the moment. */ @@ -396,7 +400,7 @@ index 0b10444..8292ead 100644 { if (scale) TRACE("Not doing sysmem blit because of scaling.\n"); -@@ -5405,8 +5406,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5431,8 +5432,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC color_key = &src_surface->container->async.src_blt_color_key; blit_op = WINED3D_BLIT_OP_COLOR_BLIT_CKEY; } @@ -408,7 +412,7 @@ index 0b10444..8292ead 100644 /* Upload */ if (scale) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index af6c46e..8e120df 100644 +index f42325e..2a23afc 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2401,7 +2401,6 @@ struct wined3d_surface @@ -420,5 +424,5 @@ index af6c46e..8e120df 100644 DWORD flags; -- -2.6.1 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0010-wined3d-Remove-surface_invalidate_location.patch b/patches/wined3d-CSMT_Main/0010-wined3d-Remove-surface_invalidate_location.patch index 147a7ed7..482b32a3 100644 --- a/patches/wined3d-CSMT_Main/0010-wined3d-Remove-surface_invalidate_location.patch +++ b/patches/wined3d-CSMT_Main/0010-wined3d-Remove-surface_invalidate_location.patch @@ -1,4 +1,4 @@ -From e8c231756407f3846d3247cd4f01955d9e5a757d Mon Sep 17 00:00:00 2001 +From 855de6d9c2e7e1254123141eb8962061e1234d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 4 Jan 2014 01:02:15 +0100 Subject: wined3d: Remove surface_invalidate_location. @@ -28,10 +28,10 @@ index d080585..9a882cc 100644 static HRESULT arbfp_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface, diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 978f7d7..8ec2964 100644 +index 97f3c04..abc41dc 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -3288,7 +3288,7 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d +@@ -3295,7 +3295,7 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d if (texture->texture_srgb.name) wined3d_texture_load(texture, context, TRUE); wined3d_texture_load(texture, context, FALSE); @@ -41,10 +41,10 @@ index 978f7d7..8ec2964 100644 } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 2226f53..bb133c4 100644 +index 86671dd..5f2fa7c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -398,7 +398,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c +@@ -393,7 +393,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c if (rt) { wined3d_resource_validate_location(&rt->resource, rt->container->resource.draw_binding); @@ -53,7 +53,7 @@ index 2226f53..bb133c4 100644 } } -@@ -4016,7 +4016,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4013,7 +4013,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str context_release(context); wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_TEXTURE_RGB); @@ -63,20 +63,20 @@ index 2226f53..bb133c4 100644 HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 943a829..95245a9 100644 +index afccecd..d756182 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -628,7 +628,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co - if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) +@@ -629,7 +629,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + if (target) { surface_load_location(target, context, target->container->resource.draw_binding); - surface_invalidate_location(target, ~target->container->resource.draw_binding); + wined3d_resource_invalidate_location(&target->resource, ~target->container->resource.draw_binding); } - else - { + } + } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index ce3c439..237a6de 100644 +index 596ad5c..307ac96 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -599,7 +599,7 @@ static void surface_evict_sysmem(struct wined3d_surface *surface) @@ -88,7 +88,7 @@ index ce3c439..237a6de 100644 } static void surface_release_client_storage(struct wined3d_surface *surface) -@@ -1119,7 +1119,7 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win +@@ -1114,7 +1114,7 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win checkGLcall("glDeleteBuffers(1, &surface->pbo)"); surface->pbo = 0; @@ -97,7 +97,7 @@ index ce3c439..237a6de 100644 } static ULONG surface_resource_incref(struct wined3d_resource *resource) -@@ -1159,7 +1159,7 @@ static void surface_unload(struct wined3d_resource *resource) +@@ -1154,7 +1154,7 @@ static void surface_unload(struct wined3d_resource *resource) surface_prepare_system_memory(surface); memset(surface->resource.heap_memory, 0, surface->resource.size); wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_SYSMEM); @@ -106,7 +106,7 @@ index ce3c439..237a6de 100644 /* 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 -@@ -1171,7 +1171,7 @@ static void surface_unload(struct wined3d_resource *resource) +@@ -1166,7 +1166,7 @@ static void surface_unload(struct wined3d_resource *resource) { surface_prepare_map_memory(surface); surface_load_location(surface, context, surface->resource.map_binding); @@ -115,7 +115,7 @@ index ce3c439..237a6de 100644 } /* Destroy PBOs, but load them into real sysmem before */ -@@ -1209,7 +1209,10 @@ static void surface_unload(struct wined3d_resource *resource) +@@ -1217,7 +1217,10 @@ static HRESULT surface_resource_sub_resource_unmap(struct wined3d_resource *reso static void wined3d_surface_location_invalidated(struct wined3d_resource *resource, DWORD location) { @@ -127,7 +127,7 @@ index ce3c439..237a6de 100644 } static const struct wined3d_resource_ops surface_resource_ops = -@@ -1685,7 +1688,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1695,7 +1698,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P context_release(context); wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB); @@ -136,7 +136,7 @@ index ce3c439..237a6de 100644 return WINED3D_OK; } -@@ -2701,7 +2704,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2711,7 +2714,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, } if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY))) @@ -145,7 +145,7 @@ index ce3c439..237a6de 100644 switch (surface->resource.map_binding) { -@@ -2817,7 +2820,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2827,7 +2830,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) } surface_load_location(surface, context, WINED3D_LOCATION_DIB); @@ -154,7 +154,7 @@ index ce3c439..237a6de 100644 if (context) context_release(context); -@@ -2866,7 +2869,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) +@@ -2876,7 +2879,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) context = context_acquire(device, NULL); surface_load_location(surface, context, surface->resource.map_binding); @@ -163,7 +163,7 @@ index ce3c439..237a6de 100644 if (context) context_release(context); } -@@ -3173,7 +3176,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc +@@ -3183,7 +3186,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc /* The texture is now most up to date - If the surface is a render target * and has a drawable, this path is never entered. */ wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB); @@ -172,7 +172,7 @@ index ce3c439..237a6de 100644 } /* Uses the hardware to stretch and flip the image */ -@@ -3241,7 +3244,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -3251,7 +3254,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st checkGLcall("glEnable(texture_target)"); /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ @@ -181,7 +181,7 @@ index ce3c439..237a6de 100644 } /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag -@@ -3446,7 +3449,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -3456,7 +3459,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st /* The texture is now most up to date - If the surface is a render target * and has a drawable, this path is never entered. */ wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB); @@ -190,7 +190,7 @@ index ce3c439..237a6de 100644 } /* Front buffer coordinates are always full screen coordinates, but our GL -@@ -3923,18 +3926,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3949,18 +3952,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co surface->ds_current_size.cy = surface->resource.height; } @@ -209,7 +209,7 @@ index ce3c439..237a6de 100644 static DWORD resource_access_from_location(DWORD location) { switch (location) -@@ -4485,7 +4476,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter, +@@ -4511,7 +4502,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter, (old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL); wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding); @@ -218,7 +218,7 @@ index ce3c439..237a6de 100644 } const struct blit_shader ffp_blit = { -@@ -5466,7 +5457,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5492,7 +5483,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC context_release(context); wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding); @@ -227,7 +227,7 @@ index ce3c439..237a6de 100644 return WINED3D_OK; } -@@ -5588,7 +5579,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text +@@ -5614,7 +5605,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text { wined3d_resource_free_sysmem(&surface->resource); wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DIB); @@ -237,7 +237,7 @@ index ce3c439..237a6de 100644 return hr; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index 45b69c8..e9fe241 100644 +index 9758be4..4e50ef9 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -518,7 +518,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT @@ -268,7 +268,7 @@ index 45b69c8..e9fe241 100644 /* MSDN says we're only allowed a single fullscreen swapchain per device, diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 2f1df55..64d115c 100644 +index 7e31832..be378fc 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -776,7 +776,7 @@ static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub @@ -292,7 +292,7 @@ index 2f1df55..64d115c 100644 static void texture2d_sub_resource_validate_location(struct wined3d_resource *sub_resource, DWORD location) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 5b4ae99..3b02457 100644 +index da39f65..f20121e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2452,7 +2452,6 @@ HRESULT surface_color_fill(struct wined3d_surface *s, @@ -304,5 +304,5 @@ index 5b4ae99..3b02457 100644 void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; -- -2.6.1 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0013-wined3d-Replace-surface_load_location-with-resource_.patch b/patches/wined3d-CSMT_Main/0013-wined3d-Replace-surface_load_location-with-resource_.patch index 96b2aea9..7b2179ca 100644 --- a/patches/wined3d-CSMT_Main/0013-wined3d-Replace-surface_load_location-with-resource_.patch +++ b/patches/wined3d-CSMT_Main/0013-wined3d-Replace-surface_load_location-with-resource_.patch @@ -1,4 +1,4 @@ -From c733f3af4517be13e6c673cf28fc4df6e09b9f78 Mon Sep 17 00:00:00 2001 +From 4c30573555207c5e8fa9518f50c611446c89097c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 17 Nov 2013 20:33:17 +0100 Subject: wined3d: Replace surface_load_location with resource_load_location. @@ -15,10 +15,10 @@ FIXME: Check if this patch is complete enough to make sense. 7 files changed, 46 insertions(+), 89 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 8ec2964..4909344 100644 +index abc41dc..a9d6664 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -2286,7 +2286,7 @@ static void context_validate_onscreen_formats(struct wined3d_context *context, +@@ -2293,7 +2293,7 @@ static void context_validate_onscreen_formats(struct wined3d_context *context, 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 */ @@ -28,19 +28,19 @@ index 8ec2964..4909344 100644 swapchain_update_draw_bindings(swapchain); context_set_render_offscreen(context, TRUE); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 352efc3..4d7fa53 100644 +index 5f2fa7c..1dc934d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -323,7 +323,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c - if (rt && rt->resource.format->id != WINED3DFMT_NULL) { - if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, clear_rect)) + struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); + if (rt) - surface_load_location(rt, context, rt->container->resource.draw_binding); + wined3d_resource_load_location(&rt->resource, context, rt->container->resource.draw_binding); - else - wined3d_surface_prepare(rt, context, rt->container->resource.draw_binding); } -@@ -4009,7 +4009,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str + } + +@@ -4004,7 +4004,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str && src_rect.bottom == sub_resource->height) wined3d_texture_prepare_texture(texture, context, FALSE); else @@ -50,20 +50,20 @@ index 352efc3..4d7fa53 100644 wined3d_surface_upload_data(surface, gl_info, resource->format, diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 95245a9..4b01b7d 100644 +index d756182..0e1f4ec 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -627,7 +627,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co - { - if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) +@@ -628,7 +628,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); + if (target) { - surface_load_location(target, context, target->container->resource.draw_binding); + wined3d_resource_load_location(&target->resource, context, target->container->resource.draw_binding); wined3d_resource_invalidate_location(&target->resource, ~target->container->resource.draw_binding); } - else + } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index fed3aaf..742ebc3 100644 +index 0b1716e..c0f7479 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -759,7 +759,7 @@ static void surface_unmap(struct wined3d_surface *surface) @@ -84,10 +84,10 @@ index fed3aaf..742ebc3 100644 if (!surface_is_full_rect(dst_surface, dst_rect)) - surface_load_location(dst_surface, context, dst_location); + wined3d_resource_load_location(&dst_surface->resource, context, dst_location); - else - wined3d_surface_prepare(dst_surface, context, dst_location); -@@ -918,9 +918,9 @@ static void surface_blt_fbo(const struct wined3d_device *device, + gl_info = context->gl_info; + +@@ -916,9 +916,9 @@ static void surface_blt_fbo(const struct wined3d_device *device, * 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.) */ @@ -96,10 +96,10 @@ index fed3aaf..742ebc3 100644 if (!surface_is_full_rect(dst_surface, &dst_rect)) - surface_load_location(dst_surface, old_ctx, dst_location); + wined3d_resource_load_location(&dst_surface->resource, old_ctx, dst_location); - else - wined3d_surface_prepare(dst_surface, old_ctx, dst_location); -@@ -1170,7 +1170,7 @@ static void surface_unload(struct wined3d_resource *resource) + if (src_location == WINED3D_LOCATION_DRAWABLE) required_rt = src_surface; + else if (dst_location == WINED3D_LOCATION_DRAWABLE) required_rt = dst_surface; +@@ -1165,7 +1165,7 @@ static void surface_unload(struct wined3d_resource *resource) else { surface_prepare_map_memory(surface); @@ -108,7 +108,7 @@ index fed3aaf..742ebc3 100644 wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding); } -@@ -1228,24 +1228,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour +@@ -1223,24 +1223,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour wined3d_texture_set_dirty(surface->container); } @@ -133,7 +133,7 @@ index fed3aaf..742ebc3 100644 static const struct wined3d_surface_ops surface_ops = { surface_private_setup, -@@ -1699,7 +1681,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1694,7 +1676,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P if (update_w == dst_w && update_h == dst_h) wined3d_texture_prepare_texture(dst_surface->container, context, FALSE); else @@ -142,7 +142,7 @@ index fed3aaf..742ebc3 100644 wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE); surface_get_memory(src_surface, &data, src_surface->resource.locations); -@@ -1832,7 +1814,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte +@@ -1827,7 +1809,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte } TRACE("Reloading because surface is dirty.\n"); @@ -151,7 +151,7 @@ index fed3aaf..742ebc3 100644 surface_evict_sysmem(surface); } -@@ -2721,7 +2703,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2716,7 +2698,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, if (surface->resource.device->d3d_initialized) context = context_acquire(surface->resource.device, NULL); @@ -160,7 +160,7 @@ index fed3aaf..742ebc3 100644 if (context) context_release(context); } -@@ -2826,7 +2808,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2821,7 +2803,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) { if (surface->flags & SFLAG_CLIENT) { @@ -169,7 +169,7 @@ index fed3aaf..742ebc3 100644 surface_release_client_storage(surface); } hr = surface_create_dib_section(surface); -@@ -2842,7 +2824,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2837,7 +2819,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) surface->resource.map_binding = WINED3D_LOCATION_DIB; } @@ -178,7 +178,7 @@ index fed3aaf..742ebc3 100644 wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB); if (context) -@@ -2891,7 +2873,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) +@@ -2886,7 +2868,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) if (device->d3d_initialized) context = context_acquire(device, NULL); @@ -187,7 +187,7 @@ index fed3aaf..742ebc3 100644 wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB); if (context) context_release(context); -@@ -3528,8 +3510,8 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, +@@ -3523,8 +3505,8 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, gl_info = context->gl_info; /* Make sure the surface is up-to-date. This should probably use @@ -198,7 +198,7 @@ index fed3aaf..742ebc3 100644 wined3d_texture_load(src_surface->container, context, FALSE); /* Activate the destination context, set it up for blitting */ -@@ -3949,29 +3931,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3960,29 +3942,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co surface->ds_current_size.cy = surface->resource.height; } @@ -228,7 +228,7 @@ index fed3aaf..742ebc3 100644 static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD location) { struct wined3d_device *device = surface->resource.device; -@@ -4021,7 +3980,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -4032,7 +3991,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface, } if (surface->resource.locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED)) @@ -237,7 +237,7 @@ index fed3aaf..742ebc3 100644 /* Download the surface to system memory. */ if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) -@@ -4057,7 +4016,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, +@@ -4068,7 +4027,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, } surface_get_rect(surface, NULL, &r); @@ -246,7 +246,7 @@ index fed3aaf..742ebc3 100644 surface_blt_to_drawable(surface->resource.device, context, WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r); -@@ -4130,7 +4089,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4141,7 +4100,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, /* Performance warning... */ FIXME("Downloading RGB surface %p to reload it as sRGB.\n", surface); surface_prepare_map_memory(surface); @@ -255,7 +255,7 @@ index fed3aaf..742ebc3 100644 } } else -@@ -4141,7 +4100,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4152,7 +4111,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, /* Performance warning... */ FIXME("Downloading sRGB surface %p to reload it as RGB.\n", surface); surface_prepare_map_memory(surface); @@ -264,7 +264,7 @@ index fed3aaf..742ebc3 100644 } } -@@ -4150,7 +4109,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4161,7 +4120,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, WARN("Trying to load a texture from sysmem, but no simple location is valid.\n"); /* Lets hope we get it from somewhere... */ surface_prepare_system_memory(surface); @@ -273,7 +273,7 @@ index fed3aaf..742ebc3 100644 } wined3d_texture_prepare_texture(texture, context, srgb); -@@ -4176,7 +4135,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4187,7 +4146,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; surface_prepare_map_memory(surface); @@ -282,7 +282,7 @@ index fed3aaf..742ebc3 100644 surface_remove_pbo(surface, gl_info); } -@@ -4244,9 +4203,11 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct +@@ -4255,9 +4214,11 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct surface, WINED3D_LOCATION_RB_MULTISAMPLE, &rect, surface, WINED3D_LOCATION_RB_RESOLVED, &rect); } @@ -296,7 +296,7 @@ index fed3aaf..742ebc3 100644 HRESULT hr; TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); -@@ -4273,20 +4234,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4284,20 +4245,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte } } @@ -317,7 +317,7 @@ index fed3aaf..742ebc3 100644 if (!surface->resource.locations) { ERR("Surface %p does not have any up to date location.\n", surface); -@@ -5436,7 +5383,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5447,7 +5394,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC if (!wined3d_resource_is_offscreen(&dst_surface->container->resource)) { struct wined3d_context *context = context_acquire(device, dst_surface); @@ -327,7 +327,7 @@ index fed3aaf..742ebc3 100644 context_release(context); } return WINED3D_OK; -@@ -5509,6 +5457,17 @@ cpu: +@@ -5520,6 +5468,17 @@ cpu: return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter); } @@ -346,7 +346,7 @@ index fed3aaf..742ebc3 100644 const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags) { diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index 50cd3ea..6ceac57 100644 +index e87a209..b9bf4c1 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -315,7 +315,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, @@ -385,7 +385,7 @@ index 50cd3ea..6ceac57 100644 src_dc = front->hDC; window = swapchain->win_handle; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 7650f36..7e7df06 100644 +index 2a183e8..29c7eec 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -774,7 +774,7 @@ static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub @@ -398,7 +398,7 @@ index 7650f36..7e7df06 100644 wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index e970088..c5c1442 100644 +index 3a6309c..ff547d3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2460,8 +2460,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, @@ -408,8 +408,8 @@ index e970088..c5c1442 100644 -void surface_load_location(struct wined3d_surface *surface, - struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; - void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, - DWORD location) DECLSPEC_HIDDEN; + void surface_prepare_rb(struct wined3d_surface *surface, + const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN; -- 2.6.2 diff --git a/patches/wined3d-CSMT_Main/0038-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0038-wined3d-Move-the-framebuffer-into-wined3d_state.patch index 3ce4963c..4a40d2e2 100644 --- a/patches/wined3d-CSMT_Main/0038-wined3d-Move-the-framebuffer-into-wined3d_state.patch +++ b/patches/wined3d-CSMT_Main/0038-wined3d-Move-the-framebuffer-into-wined3d_state.patch @@ -1,4 +1,4 @@ -From 68280056e300f90beae6bac338aa94ebacaa4bfc Mon Sep 17 00:00:00 2001 +From 8831f7064e0757addb08763c263bf7498f8a6f43 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 @@ -42,10 +42,10 @@ index 9a882cc..df89a05 100644 } diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 6d08df9..104172f 100644 +index a9d6664..9f8397f 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1506,6 +1506,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1513,6 +1513,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } @@ -58,7 +58,7 @@ index 6d08df9..104172f 100644 /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -1833,6 +1839,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1840,6 +1846,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, out: device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -66,7 +66,7 @@ index 6d08df9..104172f 100644 HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -1867,6 +1874,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont +@@ -1874,6 +1881,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); @@ -74,7 +74,7 @@ index 6d08df9..104172f 100644 HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2378,7 +2386,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2385,7 +2393,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 6d08df9..104172f 100644 || rt_count != context->gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2423,6 +2431,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2430,6 +2438,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 6d08df9..104172f 100644 } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2473,7 +2483,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2480,7 +2490,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 6d08df9..104172f 100644 struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2503,7 +2513,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2510,7 +2520,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 6d08df9..104172f 100644 DWORD rt_mask = find_draw_buffers_mask(context, device); DWORD *cur_mask; -@@ -2535,6 +2545,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat +@@ -2542,6 +2552,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 6d08df9..104172f 100644 } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -3159,7 +3171,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de +@@ -3166,7 +3178,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 316ccb8..eefa142 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index a5c1e59..42c5d14 100644 +index 1dc934d..d05ff2d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -865,7 +865,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 a5c1e59..42c5d14 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -883,7 +883,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 a5c1e59..42c5d14 100644 struct wined3d_swapchain *swapchain = NULL; struct wined3d_context *context; DWORD clear_flags = 0; -@@ -896,9 +895,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 a5c1e59..42c5d14 100644 if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -986,7 +982,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 a5c1e59..42c5d14 100644 HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -1065,8 +1060,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1060,8 +1055,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 a5c1e59..42c5d14 100644 /* Unload resources */ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { -@@ -1097,37 +1109,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1092,37 +1104,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) * destroy the context. */ context_release(context); @@ -307,7 +307,7 @@ index a5c1e59..42c5d14 100644 if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1145,9 +1126,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1140,9 +1121,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->swapchains = NULL; device->swapchain_count = 0; @@ -317,7 +317,7 @@ index a5c1e59..42c5d14 100644 device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1943,7 +1921,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -1938,7 +1916,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 a5c1e59..42c5d14 100644 return; wined3d_surface_blt(surface, NULL, depth_stencil, NULL, 0, NULL, WINED3D_TEXF_POINT); -@@ -3298,6 +3276,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3293,6 +3271,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -335,7 +335,7 @@ index a5c1e59..42c5d14 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); -@@ -3309,7 +3289,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3304,7 +3284,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -344,7 +344,7 @@ index a5c1e59..42c5d14 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3318,8 +3298,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3313,8 +3293,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -355,7 +355,7 @@ index a5c1e59..42c5d14 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3682,8 +3662,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3677,8 +3657,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 a5c1e59..42c5d14 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4065,20 +4045,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4060,20 +4040,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -390,7 +390,7 @@ index a5c1e59..42c5d14 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4118,13 +4099,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4113,13 +4094,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -406,7 +406,7 @@ index a5c1e59..42c5d14 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. */ -@@ -4136,18 +4117,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4131,18 +4112,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 a5c1e59..42c5d14 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4511,10 +4493,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4506,10 +4488,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 a5c1e59..42c5d14 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4523,6 +4504,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4518,6 +4499,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -452,7 +452,7 @@ index a5c1e59..42c5d14 100644 if (device->onscreen_depth_stencil) { wined3d_texture_decref(device->onscreen_depth_stencil->container); -@@ -4741,7 +4727,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4736,7 +4722,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -461,7 +461,7 @@ index a5c1e59..42c5d14 100644 &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); device->update_state = &device->state; -@@ -4750,22 +4736,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4745,22 +4731,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } else if (device->back_buffer_view) { @@ -489,7 +489,7 @@ index a5c1e59..42c5d14 100644 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4853,17 +4838,17 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -4848,17 +4833,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 a5c1e59..42c5d14 100644 } } break; -@@ -5026,7 +5011,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5021,7 +5006,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -521,7 +521,7 @@ index a5c1e59..42c5d14 100644 { ERR("Failed to initialize device state, hr %#x.\n", hr); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 4b01b7d..7e3a7f7 100644 +index 0e1f4ec..17054c1 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -611,7 +611,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co @@ -533,16 +533,16 @@ index 4b01b7d..7e3a7f7 100644 if (!context->valid) { context_release(context); -@@ -622,7 +622,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co - - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) - { -- struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); -+ struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(state->fb.render_targets[i]); - if (target && target->resource.format->id != WINED3DFMT_NULL) +@@ -625,7 +625,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + /* Invalidate the back buffer memory so LockRect will read it the next time */ + for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) -@@ -637,16 +637,16 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co +- struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); ++ struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(state->fb.render_targets[i]); + if (target) + { + wined3d_resource_load_location(&target->resource, context, target->container->resource.draw_binding); +@@ -634,18 +634,18 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co } } @@ -557,12 +557,14 @@ index 4b01b7d..7e3a7f7 100644 - DWORD location = context->render_offscreen ? device->fb.depth_stencil->resource->draw_binding + DWORD location = context->render_offscreen ? state->fb.depth_stencil->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; -- struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); -+ struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(state->fb.depth_stencil); - if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]) { -@@ -679,9 +679,9 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co +- struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); ++ struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(state->fb.depth_stencil); + RECT current_rect, draw_rect, r; + + if (!context->render_offscreen && ds != device->onscreen_depth_stencil) +@@ -671,9 +671,9 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co return; } @@ -788,10 +790,10 @@ index cb3d494..6b348b8 100644 if (FAILED(hr = stateblock_allocate_shader_constants(stateblock))) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index de8d6dc..db36a59 100644 +index f2494b8..a8c48be 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3283,8 +3283,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -3278,8 +3278,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE enum wined3d_texture_filter_type filter) { struct wined3d_device *device = dst_surface->resource.device; @@ -837,7 +839,7 @@ index 4ddfead..32519eb 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 720eb3a..6a10ad7 100644 +index 40e806a..41b14bd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1149,6 +1149,36 @@ struct wined3d_timestamp_query @@ -915,7 +917,7 @@ index 720eb3a..6a10ad7 100644 struct wined3d_surface *onscreen_depth_stencil; struct wined3d_rendertarget_view *auto_depth_stencil_view; -@@ -2608,9 +2632,8 @@ struct wined3d_stateblock +@@ -2606,9 +2630,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -927,7 +929,7 @@ index 720eb3a..6a10ad7 100644 void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; struct wined3d_cs_ops -@@ -2623,7 +2646,6 @@ struct wined3d_cs +@@ -2621,7 +2644,6 @@ struct wined3d_cs { const struct wined3d_cs_ops *ops; struct wined3d_device *device; diff --git a/patches/wined3d-CSMT_Main/0046-wined3d-Pass-the-state-to-draw_primitive.patch b/patches/wined3d-CSMT_Main/0046-wined3d-Pass-the-state-to-draw_primitive.patch index 97692726..6db93fc3 100644 --- a/patches/wined3d-CSMT_Main/0046-wined3d-Pass-the-state-to-draw_primitive.patch +++ b/patches/wined3d-CSMT_Main/0046-wined3d-Pass-the-state-to-draw_primitive.patch @@ -1,4 +1,4 @@ -From 78e1e4771d85128087e911b9a0ad81998fb98096 Mon Sep 17 00:00:00 2001 +From b8968006147a8c5708e737055655b0360643dd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 2 Apr 2013 17:25:19 +0200 Subject: wined3d: Pass the state to draw_primitive @@ -15,7 +15,7 @@ Subject: wined3d: Pass the state to draw_primitive 8 files changed, 29 insertions(+), 28 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 6fff047..4f4827f 100644 +index 7adfb28..55c972b 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -423,7 +423,7 @@ static inline void fixup_d3dcolor(DWORD *dst_color) @@ -27,7 +27,7 @@ index 6fff047..4f4827f 100644 * If we want that stuff to work on big endian machines too we have to consider more things * * 0xff000000: Alpha mask -@@ -1190,11 +1190,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1230,11 +1230,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device dynamic_buffer_ok = gl_info->supported[APPLE_FLUSH_BUFFER_RANGE] || gl_info->supported[ARB_MAP_BUFFER_RANGE]; @@ -42,10 +42,10 @@ index 6fff047..4f4827f 100644 */ if (!gl_info->supported[ARB_VERTEX_BUFFER_OBJECT]) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index c1b6e01..d9e2bc1 100644 +index 474af3b..f21c81d 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -2992,7 +2992,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st +@@ -2999,7 +2999,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st { if (state->vertex_declaration->half_float_conv_needed && !stream_info->all_vbo) { @@ -54,7 +54,7 @@ index c1b6e01..d9e2bc1 100644 context->use_immediate_mode_draw = TRUE; } else -@@ -3167,9 +3167,9 @@ static void context_bind_shader_resources(struct wined3d_context *context, const +@@ -3174,9 +3174,9 @@ static void context_bind_shader_resources(struct wined3d_context *context, const } /* Context activation is done by the caller. */ @@ -67,7 +67,7 @@ index c1b6e01..d9e2bc1 100644 const struct wined3d_fb_state *fb = &state->fb; unsigned int i; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 784de6e..d14fd82 100644 +index 7fdfb9b..680e2bc 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -492,7 +492,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) @@ -80,10 +80,10 @@ index 784de6e..d14fd82 100644 return sizeof(*op); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c -index d7f0512..71688a5 100644 +index a7329e7..1892dec 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c -@@ -5503,7 +5503,7 @@ static void WINE_GLAPI invalid_texcoord_func(GLenum unit, const void *data) +@@ -5486,7 +5486,7 @@ static void WINE_GLAPI invalid_texcoord_func(GLenum unit, const void *data) } /* Helper functions for providing vertex data to opengl. The arrays are initialized based on @@ -93,7 +93,7 @@ index d7f0512..71688a5 100644 static void WINE_GLAPI position_d3dcolor(const void *data) { diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index af51dfd..bfbdf8c 100644 +index d39bf28..b682088 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -36,7 +36,7 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_perf); @@ -154,8 +154,8 @@ index af51dfd..bfbdf8c 100644 const struct wined3d_stream_info *stream_info; struct wined3d_event_query *ib_query = NULL; struct wined3d_stream_info si_emulated; -@@ -672,7 +671,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co - wined3d_surface_prepare(ds, context, location); +@@ -664,7 +663,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + } } - if (!context_apply_draw_state(context, device)) @@ -163,7 +163,7 @@ index af51dfd..bfbdf8c 100644 { context_release(context); WARN("Unable to apply draw state, skipping draw.\n"); -@@ -764,28 +763,28 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co +@@ -756,28 +755,28 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co else WARN_(d3d_perf)("Using immediate mode with vertex shaders for half float emulation.\n"); @@ -220,7 +220,7 @@ index e789786..8362ef8 100644 */ WARN("unsupported blending in openGl\n"); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c -index 81af9d5..64e6d6a 100644 +index 32519eb..04c6dc6 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3866,7 +3866,7 @@ static void compute_texture_matrix(const struct wined3d_gl_info *gl_info, const @@ -233,7 +233,7 @@ index 81af9d5..64e6d6a 100644 default: mat._14 = mat._24 = mat._34 = 0.0f; mat._44 = 1.0f; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 2667936..2467c22 100644 +index e11e11a..076fe88 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1021,8 +1021,9 @@ struct wined3d_stream_info @@ -259,5 +259,5 @@ index 2667936..2467c22 100644 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, -- -2.6.1 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0058-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch b/patches/wined3d-CSMT_Main/0058-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch index 5d31c349..65dfc5eb 100644 --- a/patches/wined3d-CSMT_Main/0058-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch +++ b/patches/wined3d-CSMT_Main/0058-wined3d-Keep-track-of-the-onscreen-depth-stencil-in-.patch @@ -1,4 +1,4 @@ -From 8842cf6a7d2b87f69462e5fe513f51bc127a8140 Mon Sep 17 00:00:00 2001 +From 610e06aa206c46a868c373e485adde24638727d9 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 d5e2c52..b20d32f 100644 { struct wined3d_cs *cs = thread_param; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 1fef5ff..4de7eb2 100644 +index 99e68d0..6360275 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 @@ -90,7 +90,7 @@ index 1fef5ff..4de7eb2 100644 static BOOL is_full_clear(const struct wined3d_surface *target, const RECT *draw_rect, const RECT *clear_rect) { /* partial draw rect */ -@@ -348,8 +332,8 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c +@@ -343,8 +327,8 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c { DWORD location = render_offscreen ? fb->depth_stencil->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; @@ -101,7 +101,7 @@ index 1fef5ff..4de7eb2 100644 prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect, &ds_rect); } -@@ -1064,11 +1048,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1059,11 +1043,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 1fef5ff..4de7eb2 100644 wined3d_texture_decref(surface->container); } -@@ -4561,10 +4546,10 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4556,10 +4541,10 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, state_unbind_resources(&device->state); } @@ -133,11 +133,11 @@ index 1fef5ff..4de7eb2 100644 if (reset_state) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 21ce53a..9ec380a 100644 +index 03095e0..bfdf814 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -651,8 +651,8 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s - { +@@ -647,8 +647,8 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s + struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(state->fb.depth_stencil); RECT current_rect, draw_rect, r; - if (!context->render_offscreen && ds != device->onscreen_depth_stencil) @@ -166,7 +166,7 @@ index 6ded6cc..0a8da3d 100644 } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index dec58e5..035517f 100644 +index 5e5d900..4050489 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2116,15 +2116,12 @@ struct wined3d_device @@ -195,7 +195,7 @@ index dec58e5..035517f 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) -@@ -2667,6 +2662,7 @@ struct wined3d_cs +@@ -2665,6 +2660,7 @@ struct wined3d_cs struct wined3d_state state; HANDLE thread; DWORD tls_idx; @@ -203,7 +203,7 @@ index dec58e5..035517f 100644 size_t data_size; void *data; -@@ -2677,6 +2673,8 @@ struct wined3d_cs +@@ -2675,6 +2671,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; diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index ab6dfe88..f242bf25 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -1298,7 +1298,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1448,6 +1448,7 @@ +@@ -1455,6 +1455,7 @@ goto out; } @@ -1306,7 +1306,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c ret->current_fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret->current_fb.render_targets) * gl_info->limits.buffers); ret->current_fb.rt_size = gl_info->limits.buffers; -@@ -1456,6 +1457,7 @@ +@@ -1463,6 +1464,7 @@ if (device->context_count) ret->offscreenBuffer = device->contexts[0]->offscreenBuffer; @@ -1314,7 +1314,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -1778,7 +1780,9 @@ +@@ -1785,7 +1787,9 @@ out: device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -1324,7 +1324,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -1813,7 +1817,9 @@ +@@ -1820,7 +1824,9 @@ device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); @@ -1334,7 +1334,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); -@@ -2233,6 +2239,7 @@ +@@ -2240,6 +2246,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 */ @@ -1342,7 +1342,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); -@@ -2247,6 +2254,22 @@ +@@ -2254,6 +2261,22 @@ return context_generate_rt_mask_from_surface(rt); else return context_generate_rt_mask(context->offscreenBuffer); @@ -1365,7 +1365,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } /* Context activation is done by the caller. */ -@@ -2278,7 +2301,11 @@ +@@ -2285,7 +2308,11 @@ } else { @@ -1377,7 +1377,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; -@@ -2325,7 +2352,11 @@ +@@ -2332,7 +2359,11 @@ DWORD rt_mask = 0, *cur_mask; UINT i; @@ -1389,7 +1389,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, dsv)) -@@ -2367,11 +2398,17 @@ +@@ -2374,11 +2405,17 @@ } else { @@ -1407,7 +1407,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))) -@@ -2384,7 +2421,11 @@ +@@ -2391,7 +2428,11 @@ } else { @@ -1419,7 +1419,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c rt_count ? wined3d_rendertarget_view_get_surface(rts[0]) : NULL); } -@@ -2419,6 +2460,7 @@ +@@ -2426,6 +2467,7 @@ return TRUE; } @@ -1427,7 +1427,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; -@@ -2428,6 +2470,18 @@ +@@ -2435,6 +2477,18 @@ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return context_generate_rt_mask_no_fbo(context, wined3d_rendertarget_view_get_surface(rts[0])); @@ -1446,7 +1446,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])); -@@ -2450,8 +2504,14 @@ +@@ -2457,8 +2511,14 @@ /* Context activation is done by the caller. */ void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -1461,7 +1461,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -2482,8 +2542,10 @@ +@@ -2489,8 +2549,10 @@ context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -1472,7 +1472,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) -@@ -2721,12 +2783,22 @@ +@@ -2728,12 +2790,22 @@ /* Context activation is done by the caller. */ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -1495,7 +1495,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); -@@ -2928,7 +3000,11 @@ +@@ -2935,7 +3007,11 @@ { if (state->vertex_declaration->half_float_conv_needed && !stream_info->all_vbo) { @@ -1507,7 +1507,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c context->use_immediate_mode_draw = TRUE; } else -@@ -3103,11 +3179,19 @@ +@@ -3110,11 +3186,19 @@ } /* Context activation is done by the caller. */ @@ -1527,7 +1527,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i; WORD map; -@@ -3140,12 +3224,17 @@ +@@ -3147,12 +3231,17 @@ for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i) { if (map & 1) @@ -1545,7 +1545,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } if (state->index_buffer) { -@@ -3240,7 +3329,11 @@ +@@ -3247,7 +3336,11 @@ if (texture->texture_srgb.name) wined3d_texture_load(texture, context, TRUE); wined3d_texture_load(texture, context, FALSE); @@ -2113,9 +2113,9 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h + struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; - void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, - DWORD location) DECLSPEC_HIDDEN; -@@ -2553,6 +2716,7 @@ + void surface_prepare_rb(struct wined3d_surface *surface, + const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN; +@@ -2551,6 +2714,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; @@ -2123,7 +2123,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; -@@ -2567,6 +2731,17 @@ +@@ -2565,6 +2729,17 @@ void wined3d_surface_cleanup_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void wined3d_surface_getdc_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void wined3d_surface_releasedc_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN; @@ -2141,7 +2141,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -2589,8 +2764,10 @@ +@@ -2587,8 +2762,10 @@ GLuint name; }; @@ -2152,7 +2152,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -2619,8 +2796,10 @@ +@@ -2617,8 +2794,10 @@ BOOL half_float_conv_needed; }; @@ -2163,7 +2163,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]; -@@ -2688,6 +2867,7 @@ +@@ -2686,6 +2865,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -2171,7 +2171,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; -@@ -2738,6 +2918,32 @@ +@@ -2736,6 +2916,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; @@ -2204,7 +2204,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; -@@ -2787,6 +2993,7 @@ +@@ -2785,6 +2991,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; @@ -2212,7 +2212,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, -@@ -2850,6 +3057,7 @@ +@@ -2848,6 +3055,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int depth_pitch) DECLSPEC_HIDDEN; @@ -2220,7 +2220,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 -@@ -2864,8 +3072,12 @@ +@@ -2862,8 +3070,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -2233,7 +2233,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -2879,12 +3091,16 @@ +@@ -2877,12 +3089,16 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -2250,7 +2250,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 */ -@@ -2911,7 +3127,9 @@ +@@ -2909,7 +3125,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -2260,7 +2260,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -2936,11 +3154,15 @@ +@@ -2934,11 +3152,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; @@ -2276,7 +2276,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -2979,8 +3201,10 @@ +@@ -2977,8 +3199,10 @@ return surface_from_resource(resource); } @@ -2287,7 +2287,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -2993,8 +3217,12 @@ +@@ -2991,8 +3215,12 @@ struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, @@ -2300,7 +2300,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_swapchain -@@ -3033,8 +3261,10 @@ +@@ -3031,8 +3259,10 @@ void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -2311,7 +2311,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /***************************************************************************** * Utility function prototypes -@@ -3234,7 +3464,9 @@ +@@ -3232,7 +3462,9 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; @@ -2996,43 +2996,28 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c if (!context->valid) { context_release(context); -@@ -621,6 +651,7 @@ - - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) - { -+#if defined(STAGING_CSMT) - struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(state->fb.render_targets[i]); - if (target && target->resource.format->id != WINED3DFMT_NULL) +@@ -624,6 +654,7 @@ + /* Invalidate the back buffer memory so LockRect will read it the next time */ + for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -628,6 +659,15 @@ - { - wined3d_resource_load_location(&target->resource, context, target->container->resource.draw_binding); - wined3d_resource_invalidate_location(&target->resource, ~target->container->resource.draw_binding); -+#else /* STAGING_CSMT */ -+ struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); -+ if (target && target->resource.format->id != WINED3DFMT_NULL) -+ { -+ if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) -+ { -+ surface_load_location(target, context, target->container->resource.draw_binding); -+ surface_invalidate_location(target, ~target->container->resource.draw_binding); -+#endif /* STAGING_CSMT */ - } - else - { -@@ -636,6 +676,7 @@ - } - } - +#if defined(STAGING_CSMT) - if (state->fb.depth_stencil) - { - /* Note that this depends on the context_acquire() call above to set -@@ -655,6 +696,27 @@ + struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(state->fb.render_targets[i]); + if (target) + { +@@ -651,6 +682,35 @@ wined3d_cs_switch_onscreen_ds(device->cs, context, ds); if (ds->resource.locations & location) +#else /* STAGING_CSMT */ ++ struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); ++ if (target) ++ { ++ surface_load_location(target, context, target->container->resource.draw_binding); ++ surface_invalidate_location(target, ~target->container->resource.draw_binding); ++ } ++ } ++ } ++ + if (device->fb.depth_stencil) + { + /* Note that this depends on the context_acquire() call above to set @@ -3042,10 +3027,9 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c + * that we never copy the stencil data.*/ + DWORD location = context->render_offscreen ? device->fb.depth_stencil->resource->draw_binding + : WINED3D_LOCATION_DRAWABLE; -+ struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); -+ + if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]) + { ++ struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); + RECT current_rect, draw_rect, r; + + if (!context->render_offscreen && ds != device->onscreen_depth_stencil) @@ -3056,15 +3040,15 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c SetRect(¤t_rect, 0, 0, ds->ds_current_size.cx, ds->ds_current_size.cy); else SetRectEmpty(¤t_rect); -@@ -671,6 +733,7 @@ - wined3d_surface_prepare(ds, context, location); +@@ -663,6 +723,7 @@ + } } +#if defined(STAGING_CSMT) if (!context_apply_draw_state(context, device, state)) { context_release(context); -@@ -681,6 +744,18 @@ +@@ -673,6 +734,18 @@ if (state->fb.depth_stencil && state->render_states[WINED3D_RS_ZWRITEENABLE]) { struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(state->fb.depth_stencil); @@ -3083,7 +3067,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c DWORD location = context->render_offscreen ? ds->container->resource.draw_binding : WINED3D_LOCATION_DRAWABLE; surface_modify_ds_location(ds, location, ds->ds_current_size.cx, ds->ds_current_size.cy); -@@ -763,6 +838,7 @@ +@@ -755,6 +828,7 @@ else WARN_(d3d_perf)("Using immediate mode with vertex shaders for half float emulation.\n"); @@ -3091,7 +3075,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c draw_strided_slow_vs(context, state, stream_info, index_count, state->gl_primitive_type, idx_data, idx_size, start_idx); } -@@ -785,6 +861,30 @@ +@@ -777,6 +851,30 @@ else { draw_strided_fast(gl_info, state->gl_primitive_type, index_count, idx_size, idx_data, @@ -3175,18 +3159,18 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ds->ds_current_size.cx, ds->ds_current_size.cy); @@ -307,7 +333,11 @@ - if (rt && rt->resource.format->id != WINED3DFMT_NULL) { - if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, clear_rect)) + struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); + if (rt) +#if defined(STAGING_CSMT) wined3d_resource_load_location(&rt->resource, context, rt->container->resource.draw_binding); +#else /* STAGING_CSMT */ + surface_load_location(rt, context, rt->container->resource.draw_binding); +#endif /* STAGING_CSMT */ - else - wined3d_surface_prepare(rt, context, rt->container->resource.draw_binding); } -@@ -332,8 +362,13 @@ + } + +@@ -327,8 +357,13 @@ { DWORD location = render_offscreen ? fb->depth_stencil->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; @@ -3200,7 +3184,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect, &ds_rect); } -@@ -381,8 +416,13 @@ +@@ -376,8 +411,13 @@ if (rt) { @@ -3214,7 +3198,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } -@@ -622,7 +662,11 @@ +@@ -617,7 +657,11 @@ } /* Context activation is done by the caller. */ @@ -3226,7 +3210,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; -@@ -849,7 +893,11 @@ +@@ -844,7 +888,11 @@ BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil; unsigned int i; @@ -3238,7 +3222,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -867,7 +915,13 @@ +@@ -862,7 +910,13 @@ struct wined3d_swapchain_desc *swapchain_desc) { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -3252,7 +3236,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c DWORD clear_flags = 0; HRESULT hr; -@@ -878,6 +932,11 @@ +@@ -873,6 +927,11 @@ if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; @@ -3264,7 +3248,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))) { -@@ -918,7 +977,14 @@ +@@ -913,7 +972,14 @@ device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); @@ -3279,7 +3263,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->contexts[0]->last_was_rhw = 0; -@@ -930,7 +996,11 @@ +@@ -925,7 +991,11 @@ case ORM_BACKBUFFER: { @@ -3291,7 +3275,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; -@@ -942,9 +1012,16 @@ +@@ -937,9 +1007,16 @@ } } } @@ -3308,7 +3292,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Clear the screen */ if (swapchain->back_buffers && swapchain->back_buffers[0]) -@@ -961,6 +1038,9 @@ +@@ -956,6 +1033,9 @@ return WINED3D_OK; err_out: @@ -3318,7 +3302,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) -@@ -1018,6 +1098,10 @@ +@@ -1013,6 +1093,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) { struct wined3d_resource *resource, *cursor; @@ -3329,7 +3313,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_surface *surface; UINT i; -@@ -1026,6 +1110,7 @@ +@@ -1021,6 +1105,7 @@ if (!device->d3d_initialized) return WINED3DERR_INVALIDCALL; @@ -3337,7 +3321,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) device->cs->ops->finish(device->cs); -@@ -1064,6 +1149,82 @@ +@@ -1059,6 +1144,82 @@ /* FIXME: Is this in the right place??? */ wined3d_cs_emit_delete_opengl_contexts(device->cs, device->swapchains[0]); @@ -3420,7 +3404,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1081,6 +1242,11 @@ +@@ -1076,6 +1237,11 @@ device->swapchains = NULL; device->swapchain_count = 0; @@ -3432,7 +3416,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1466,6 +1632,16 @@ +@@ -1461,6 +1627,16 @@ TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", light->range, light->falloff, light->theta, light->phi); @@ -3449,7 +3433,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Save away the information. */ object->OriginalParms = *light; -@@ -1545,9 +1721,11 @@ +@@ -1540,9 +1716,11 @@ FIXME("Unrecognized light type %#x.\n", light->type); } @@ -3461,7 +3445,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1620,6 +1798,14 @@ +@@ -1615,6 +1793,14 @@ { if (light_info->glIndex != -1) { @@ -3476,7 +3460,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; } -@@ -1661,11 +1847,23 @@ +@@ -1656,11 +1842,23 @@ WARN("Too many concurrently active lights\n"); return WINED3D_OK; } @@ -3500,7 +3484,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1840,9 +2038,11 @@ +@@ -1835,9 +2033,11 @@ TRACE("device %p, base_index %d.\n", device, base_index); device->update_state->base_vertex_index = base_index; @@ -3512,7 +3496,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) -@@ -1887,7 +2087,11 @@ +@@ -1882,7 +2082,11 @@ || !(texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; surface = surface_from_resource(texture->sub_resources[0]); @@ -3524,7 +3508,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); -@@ -2207,7 +2411,11 @@ +@@ -2202,7 +2406,11 @@ return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx]; } @@ -3536,7 +3520,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { UINT i; -@@ -2240,8 +2448,12 @@ +@@ -2235,8 +2443,12 @@ } else { @@ -3549,7 +3533,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2288,8 +2500,12 @@ +@@ -2283,8 +2495,12 @@ } else { @@ -3562,7 +3546,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2340,8 +2556,13 @@ +@@ -2335,8 +2551,13 @@ memset(device->recording->changed.vertexShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.vertexShaderConstantsF) * vector4f_count); else @@ -3576,7 +3560,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2476,8 +2697,12 @@ +@@ -2471,8 +2692,12 @@ } else { @@ -3589,7 +3573,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2524,8 +2749,12 @@ +@@ -2519,8 +2744,12 @@ } else { @@ -3602,7 +3586,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2577,8 +2806,12 @@ +@@ -2572,8 +2801,12 @@ memset(device->recording->changed.pixelShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.pixelShaderConstantsF) * vector4f_count); else @@ -3615,7 +3599,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2738,6 +2971,7 @@ +@@ -2733,6 +2966,7 @@ return hr; } @@ -3623,7 +3607,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) { FIXME("Waiting for cs.\n"); -@@ -2745,6 +2979,7 @@ +@@ -2740,6 +2974,7 @@ device->cs->ops->finish(device->cs); } @@ -3631,7 +3615,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); -@@ -3230,6 +3465,10 @@ +@@ -3225,6 +3460,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -3642,7 +3626,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3238,6 +3477,15 @@ +@@ -3233,6 +3472,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3658,7 +3642,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3245,8 +3493,10 @@ +@@ -3240,8 +3488,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) { @@ -3669,7 +3653,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); -@@ -3255,12 +3505,19 @@ +@@ -3250,12 +3500,19 @@ WARN("Rects is %p, but rect_count is 0, ignoring clear\n", rects); return WINED3D_OK; } @@ -3689,7 +3673,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"); -@@ -3269,8 +3526,13 @@ +@@ -3264,8 +3521,13 @@ } else if (flags & WINED3DCLEAR_TARGET) { @@ -3703,7 +3687,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; -@@ -3316,6 +3578,9 @@ +@@ -3311,6 +3573,9 @@ enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -3713,7 +3697,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); -@@ -3323,8 +3588,13 @@ +@@ -3318,8 +3583,13 @@ device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -3727,7 +3711,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, -@@ -3347,6 +3617,14 @@ +@@ -3342,6 +3612,14 @@ return WINED3DERR_INVALIDCALL; } @@ -3742,7 +3726,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; -@@ -3363,6 +3641,10 @@ +@@ -3358,6 +3636,10 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { @@ -3753,7 +3737,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) -@@ -3381,6 +3663,15 @@ +@@ -3376,6 +3658,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3769,7 +3753,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; -@@ -3396,6 +3687,7 @@ +@@ -3391,6 +3682,7 @@ } /* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */ @@ -3777,7 +3761,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c static void device_update_volume(struct wined3d_context *context, struct wined3d_volume *src_volume, struct wined3d_volume *dst_volume) { -@@ -3432,6 +3724,88 @@ +@@ -3427,6 +3719,88 @@ { enum wined3d_resource_type type = src_texture->resource.type; unsigned int level_count, i, j, src_size, dst_size, src_skip_levels = 0; @@ -3866,7 +3850,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c level_count = min(wined3d_texture_get_level_count(src_texture), wined3d_texture_get_level_count(dst_texture)); -@@ -3450,7 +3824,13 @@ +@@ -3445,7 +3819,13 @@ } /* Make sure that the destination texture is loaded. */ @@ -3880,7 +3864,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Update every surface level of the texture. */ switch (type) -@@ -3465,7 +3845,16 @@ +@@ -3460,7 +3840,16 @@ src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, i + src_skip_levels)); dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i)); @@ -3897,7 +3881,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } break; } -@@ -3485,7 +3874,16 @@ +@@ -3480,7 +3869,16 @@ i * src_levels + j + src_skip_levels)); dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i * dst_levels + j)); @@ -3914,7 +3898,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } break; -@@ -3495,6 +3893,7 @@ +@@ -3490,6 +3888,7 @@ { for (i = 0; i < level_count; ++i) { @@ -3922,7 +3906,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 + src_skip_levels)), -@@ -3548,6 +3947,25 @@ +@@ -3543,6 +3942,25 @@ } wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture); @@ -3948,7 +3932,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -3597,8 +4015,13 @@ +@@ -3592,8 +4010,13 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -3962,7 +3946,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3697,6 +4120,7 @@ +@@ -3692,6 +4115,7 @@ struct wined3d_surface *src_surface, const RECT *src_rect, struct wined3d_surface *dst_surface, const POINT *dst_point) { @@ -3970,7 +3954,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; -@@ -3704,6 +4128,7 @@ +@@ -3699,6 +4123,7 @@ RECT r, dst_rect; POINT p; @@ -3978,7 +3962,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)); -@@ -3715,6 +4140,7 @@ +@@ -3710,6 +4135,7 @@ return WINED3DERR_INVALIDCALL; } @@ -3986,7 +3970,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"); -@@ -3779,6 +4205,9 @@ +@@ -3774,6 +4200,9 @@ wined3d_cs_emit_update_surface(device->cs, src_surface, src_rect, dst_surface, dst_point); return WINED3D_OK; @@ -3996,7 +3980,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_copy_resource(struct wined3d_device *device, -@@ -3933,7 +4362,17 @@ +@@ -3928,7 +4357,17 @@ unsigned int depth_pitch) { struct wined3d_resource *sub_resource; @@ -4014,7 +3998,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, resource %p, sub_resource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u.\n", device, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); -@@ -3950,7 +4389,14 @@ +@@ -3945,7 +4384,14 @@ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -4029,7 +4013,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box) { if (box->left >= box->right || box->right > sub_resource->width -@@ -3960,9 +4406,47 @@ +@@ -3955,9 +4401,47 @@ box->left, box->top, box->front, box->right, box->bottom, box->back); return; } @@ -4077,7 +4061,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -3993,8 +4477,14 @@ +@@ -3988,8 +4472,14 @@ rect = &r; } @@ -4092,7 +4076,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, -@@ -4008,6 +4498,7 @@ +@@ -4003,6 +4493,7 @@ return NULL; } @@ -4100,7 +4084,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -4023,6 +4514,22 @@ +@@ -4018,6 +4509,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -4123,7 +4107,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); -@@ -4062,6 +4569,7 @@ +@@ -4057,6 +4564,7 @@ } @@ -4131,7 +4115,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; -@@ -4069,6 +4577,15 @@ +@@ -4064,6 +4572,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -4147,7 +4131,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. */ -@@ -4080,6 +4597,7 @@ +@@ -4075,6 +4592,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4155,7 +4139,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; -@@ -4097,6 +4615,66 @@ +@@ -4092,6 +4610,66 @@ wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) wined3d_rendertarget_view_decref(prev); @@ -4222,7 +4206,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device, -@@ -4117,6 +4695,14 @@ +@@ -4112,6 +4690,14 @@ cursor_image = surface_from_resource(sub_resource); @@ -4237,7 +4221,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (cursor_image->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM) { WARN("Surface %p has an invalid format %s.\n", -@@ -4144,6 +4730,13 @@ +@@ -4139,6 +4725,13 @@ * 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. */ @@ -4251,7 +4235,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (cursor_image->resource.width == 32 && cursor_image->resource.height == 32) { -@@ -4248,6 +4841,12 @@ +@@ -4243,6 +4836,12 @@ else SetCursor(NULL); } @@ -4264,7 +4248,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return oldVisible; } -@@ -4258,8 +4857,10 @@ +@@ -4253,8 +4852,10 @@ TRACE("device %p.\n", device); @@ -4275,7 +4259,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); -@@ -4267,6 +4868,7 @@ +@@ -4262,6 +4863,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -4283,7 +4267,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4285,6 +4887,37 @@ +@@ -4280,6 +4882,37 @@ context = context_acquire(device, NULL); gl_info = context->gl_info; @@ -4321,7 +4305,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4305,6 +4938,7 @@ +@@ -4300,6 +4933,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4329,7 +4313,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4324,6 +4958,14 @@ +@@ -4319,6 +4953,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -4344,7 +4328,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, -@@ -4340,6 +4982,7 @@ +@@ -4335,6 +4977,7 @@ return hr; } @@ -4352,7 +4336,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)) { -@@ -4350,6 +4993,34 @@ +@@ -4345,6 +4988,34 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -4387,7 +4371,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4368,9 +5039,11 @@ +@@ -4363,9 +5034,11 @@ TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -4399,7 +4383,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { ERR("Failed to get the first implicit swapchain.\n"); -@@ -4385,9 +5058,21 @@ +@@ -4380,9 +5053,21 @@ wined3d_texture_decref(device->logo_texture); device->logo_texture = NULL; } @@ -4421,7 +4405,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4396,6 +5081,7 @@ +@@ -4391,6 +5076,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4429,7 +4413,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4405,6 +5091,12 @@ +@@ -4400,6 +5086,12 @@ { wined3d_texture_decref(device->cs->onscreen_depth_stencil->container); device->cs->onscreen_depth_stencil = NULL; @@ -4442,7 +4426,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4417,6 +5109,7 @@ +@@ -4412,6 +5104,7 @@ } } @@ -4450,7 +4434,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 -@@ -4438,6 +5131,7 @@ +@@ -4433,6 +5126,7 @@ } device->cs->ops->finish(device->cs); @@ -4458,7 +4442,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("New params:\n"); TRACE("backbuffer_width %u\n", swapchain_desc->backbuffer_width); TRACE("backbuffer_height %u\n", swapchain_desc->backbuffer_height); -@@ -4564,6 +5258,13 @@ +@@ -4559,6 +5253,13 @@ swapchain_desc->multisample_type, swapchain_desc->multisample_quality))) return hr; @@ -4472,7 +4456,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (swapchain->desc.enable_auto_depth_stencil) { struct wined3d_resource_desc texture_desc; -@@ -4606,6 +5307,13 @@ +@@ -4601,6 +5302,13 @@ wined3d_device_set_depth_stencil_view(device, device->auto_depth_stencil_view); } @@ -4486,7 +4470,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))) -@@ -4626,12 +5334,20 @@ +@@ -4621,12 +5329,20 @@ } wined3d_cs_emit_reset_state(device->cs); state_cleanup(&device->state); @@ -4507,7 +4491,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; -@@ -4640,6 +5356,7 @@ +@@ -4635,6 +5351,7 @@ } else if (device->back_buffer_view) { @@ -4515,7 +4499,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); -@@ -4655,6 +5372,24 @@ +@@ -4650,6 +5367,24 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; @@ -4540,7 +4524,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4730,6 +5465,10 @@ +@@ -4725,6 +5460,10 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -4551,7 +4535,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c switch (type) { case WINED3D_RTYPE_SURFACE: -@@ -4740,6 +5479,7 @@ +@@ -4735,6 +5474,7 @@ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4559,7 +4543,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); -@@ -4751,6 +5491,19 @@ +@@ -4746,6 +5486,19 @@ { ERR("Surface %p is still in use as depth/stencil buffer.\n", surface); device->state.fb.depth_stencil = NULL; @@ -4579,7 +4563,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } break; -@@ -4913,7 +5666,11 @@ +@@ -4908,7 +5661,11 @@ device->blitter = adapter->blitter; @@ -4591,7 +4575,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); -@@ -5012,6 +5769,7 @@ +@@ -5007,6 +5764,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -4599,7 +4583,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, -@@ -5065,3 +5823,4 @@ +@@ -5060,3 +5818,4 @@ wined3d_device_destroy_bo(device, context, bo); } @@ -6844,10 +6828,10 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + if (!surface_is_full_rect(dst_surface, dst_rect)) + surface_load_location(dst_surface, context, dst_location); +#endif /* STAGING_CSMT */ - else - wined3d_surface_prepare(dst_surface, context, dst_location); -@@ -762,9 +1014,15 @@ + gl_info = context->gl_info; + +@@ -760,9 +1012,15 @@ * 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.) */ @@ -6860,10 +6844,10 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + if (!surface_is_full_rect(dst_surface, &dst_rect)) + surface_load_location(dst_surface, old_ctx, dst_location); +#endif /* STAGING_CSMT */ - else - wined3d_surface_prepare(dst_surface, old_ctx, dst_location); -@@ -956,6 +1214,18 @@ + if (src_location == WINED3D_LOCATION_DRAWABLE) required_rt = src_surface; + else if (dst_location == WINED3D_LOCATION_DRAWABLE) required_rt = dst_surface; +@@ -951,6 +1209,18 @@ return WINED3D_OK; } @@ -6882,7 +6866,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)); -@@ -981,12 +1251,28 @@ +@@ -976,12 +1246,28 @@ if (resource->pool == WINED3D_POOL_DEFAULT) { @@ -6911,7 +6895,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 -@@ -996,10 +1282,21 @@ +@@ -991,10 +1277,21 @@ } else { @@ -6933,7 +6917,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 -@@ -1043,6 +1340,7 @@ +@@ -1038,6 +1335,7 @@ return WINED3DERR_INVALIDCALL; } @@ -6941,7 +6925,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); -@@ -1058,6 +1356,21 @@ +@@ -1053,6 +1351,21 @@ { surface_private_setup, surface_frontbuffer_updated, @@ -6963,7 +6947,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c }; /***************************************************************************** -@@ -1101,6 +1414,7 @@ +@@ -1096,6 +1409,7 @@ return WINED3D_OK; } @@ -6971,7 +6955,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); -@@ -1110,6 +1424,23 @@ +@@ -1105,6 +1419,23 @@ { gdi_surface_private_setup, gdi_surface_frontbuffer_updated, @@ -6995,7 +6979,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 -@@ -1128,7 +1459,11 @@ +@@ -1123,7 +1454,11 @@ return; } @@ -7007,7 +6991,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface->container->resource.format_flags & WINED3DFMT_FLAG_COMPRESSED) { -@@ -1156,6 +1491,7 @@ +@@ -1151,6 +1486,7 @@ void *mem; GLenum gl_format = format->glFormat; GLenum gl_type = format->glType; @@ -7015,7 +6999,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c UINT src_pitch = 0; UINT dst_row_pitch, dst_slice_pitch; -@@ -1164,6 +1500,16 @@ +@@ -1159,6 +1495,16 @@ unsigned char alignment = surface->resource.device->surface_alignment; src_pitch = format->byte_count * surface->pow2Width; wined3d_resource_get_pitch(&surface->resource, &dst_row_pitch, &dst_slice_pitch); @@ -7032,7 +7016,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_pitch = (src_pitch + alignment - 1) & ~(alignment - 1); mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * surface->pow2Height); } -@@ -1250,12 +1596,21 @@ +@@ -1245,12 +1591,21 @@ * won't be released, and doesn't have to be re-read. */ src_data = mem; dst_data = data.addr; @@ -7054,7 +7038,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HeapFree(GetProcessHeap(), 0, mem); -@@ -1379,10 +1734,33 @@ +@@ -1374,10 +1729,33 @@ static BOOL surface_check_block_align(struct wined3d_surface *surface, const struct wined3d_box *box) { @@ -7088,7 +7072,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { struct wined3d_box box = {rect->left, rect->top, rect->right, rect->bottom, 0, 1}; -@@ -1401,7 +1779,11 @@ +@@ -1396,7 +1774,11 @@ UINT update_w, update_h; UINT dst_w, dst_h; RECT r, dst_rect; @@ -7100,7 +7084,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c POINT p; TRACE("dst_surface %p, dst_point %s, src_surface %p, src_rect %s.\n", -@@ -1472,11 +1854,17 @@ +@@ -1467,11 +1849,17 @@ return WINED3DERR_INVALIDCALL; } @@ -7118,7 +7102,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; -@@ -1487,6 +1875,7 @@ +@@ -1482,6 +1870,7 @@ if (update_w == dst_w && update_h == dst_h) wined3d_texture_prepare_texture(dst_surface->container, context, FALSE); else @@ -7126,7 +7110,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_load_location(&dst_surface->resource, context, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE); -@@ -1500,6 +1889,21 @@ +@@ -1495,6 +1884,21 @@ wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB); wined3d_resource_invalidate_location(&dst_surface->resource, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -7148,7 +7132,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -1613,6 +2017,7 @@ +@@ -1608,6 +2012,7 @@ if (surface->resource.pool == WINED3D_POOL_SCRATCH) ERR("Not supported on scratch surfaces.\n"); @@ -7156,7 +7140,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface->resource.locations & location) { TRACE("surface is already in texture\n"); -@@ -1621,6 +2026,16 @@ +@@ -1616,6 +2021,16 @@ TRACE("Reloading because surface is dirty.\n"); wined3d_resource_load_location(&surface->resource, context, location); @@ -7173,7 +7157,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_evict_sysmem(surface); } -@@ -1703,6 +2118,7 @@ +@@ -1698,6 +2113,7 @@ void CDECL wined3d_surface_preload(struct wined3d_surface *surface) { @@ -7181,7 +7165,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); -@@ -1713,6 +2129,17 @@ +@@ -1708,6 +2124,17 @@ } wined3d_cs_emit_surface_preload(device->cs, surface); @@ -7199,7 +7183,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface) -@@ -1747,10 +2174,28 @@ +@@ -1742,10 +2169,28 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface) { @@ -7228,7 +7212,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y) -@@ -1875,6 +2320,7 @@ +@@ -1870,6 +2315,7 @@ { DeleteDC(surface->hDC); DeleteObject(surface->dib.DIBsection); @@ -7236,7 +7220,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; -@@ -1883,6 +2329,15 @@ +@@ -1878,6 +2324,15 @@ surface->resource.locations = 0; wined3d_resource_free_sysmem(&surface->resource); surface->resource.map_heap_memory = NULL; @@ -7252,7 +7236,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c width = texture_resource->width; height = texture_resource->height; -@@ -1908,6 +2363,7 @@ +@@ -1903,6 +2358,7 @@ else surface->flags &= ~SFLAG_NONPOW2; @@ -7260,7 +7244,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if ((surface->resource.user_memory = mem)) { surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY; -@@ -1928,6 +2384,27 @@ +@@ -1923,6 +2379,27 @@ surface->resource.size = wined3d_format_calculate_size(texture_resource->format, 1, width, height, 1); surface->resource.custom_row_pitch = wined3d_format_calculate_pitch(texture_resource->format, width); @@ -7288,7 +7272,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* The format might be changed to a format that needs conversion. -@@ -1950,11 +2427,19 @@ +@@ -1945,11 +2422,19 @@ if (!valid_location) { @@ -7308,7 +7292,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -2313,6 +2798,7 @@ +@@ -2308,6 +2793,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_surface *source, enum wined3d_format_id to_fmt) { @@ -7316,7 +7300,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; -@@ -2321,6 +2807,13 @@ +@@ -2316,6 +2802,13 @@ struct wined3d_surface *dst; struct wined3d_context *context = NULL; struct wined3d_device *device = source->resource.device; @@ -7330,7 +7314,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c conv = find_converter(source->resource.format->id, to_fmt); if (!conv) -@@ -2344,6 +2837,7 @@ +@@ -2339,6 +2832,7 @@ } dst = surface_from_resource(wined3d_texture_get_sub_resource(ret, 0)); @@ -7338,7 +7322,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); -@@ -2384,6 +2878,32 @@ +@@ -2379,6 +2873,32 @@ if (context) context_release(context); return NULL; @@ -7371,7 +7355,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, -@@ -2451,6 +2971,7 @@ +@@ -2446,6 +2966,7 @@ HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface) { @@ -7379,7 +7363,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HRESULT hr; TRACE("surface %p.\n", surface); -@@ -2461,6 +2982,20 @@ +@@ -2456,6 +2977,20 @@ memset(&surface->lockedRect, 0, sizeof(surface->lockedRect)); return hr; @@ -7400,7 +7384,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, -@@ -2468,6 +3003,21 @@ +@@ -2463,6 +2998,21 @@ { const struct wined3d_format *format = surface->resource.format; unsigned int fmt_flags = surface->container->resource.format_flags; @@ -7422,7 +7406,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box && !surface_check_block_align(surface, box)) -@@ -2479,6 +3029,13 @@ +@@ -2474,6 +3024,13 @@ return WINED3DERR_INVALIDCALL; } @@ -7436,7 +7420,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 -@@ -2494,6 +3051,7 @@ +@@ -2489,6 +3046,7 @@ } } @@ -7444,7 +7428,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (box) { surface->lockedRect.left = box->left; -@@ -2575,6 +3133,179 @@ +@@ -2570,6 +3128,179 @@ void wined3d_surface_releasedc_cs(struct wined3d_surface *surface) { if (surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY || (surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM @@ -7624,7 +7608,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c && surface->resource.map_binding != WINED3D_LOCATION_DIB)) { /* The game Salammbo modifies the surface contents without mapping the surface between -@@ -2590,6 +3321,7 @@ +@@ -2585,6 +3316,7 @@ if (device->d3d_initialized) context = context_acquire(device, NULL); @@ -7632,7 +7616,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding); wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB); if (context) -@@ -2615,6 +3347,13 @@ +@@ -2610,6 +3342,13 @@ surface->flags &= ~SFLAG_DCINUSE; wined3d_cs_emit_releasedc(surface->resource.device->cs, surface); @@ -7646,7 +7630,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -2631,9 +3370,14 @@ +@@ -2626,9 +3365,14 @@ int i; BOOL srcIsUpsideDown; struct wined3d_bo_address data; @@ -7661,7 +7645,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface != old_ctx->current_rt) { -@@ -2673,8 +3417,13 @@ +@@ -2668,8 +3412,13 @@ } /* Setup pixel store pack state -- to glReadPixels into the correct place */ @@ -7675,7 +7659,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c checkGLcall("glPixelStorei"); gl_info->gl_ops.gl.p_glReadPixels(0, 0, -@@ -2691,6 +3440,10 @@ +@@ -2686,6 +3435,10 @@ { /* glReadPixels returns the image upside down, and there is no way to prevent this. * Flip the lines in software. */ @@ -7686,7 +7670,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!(row = HeapAlloc(GetProcessHeap(), 0, pitch))) goto error; -@@ -2917,8 +3670,13 @@ +@@ -2912,8 +3665,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. */ @@ -7700,7 +7684,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Uses the hardware to stretch and flip the image */ -@@ -2986,7 +3744,11 @@ +@@ -2981,7 +3739,11 @@ checkGLcall("glEnable(texture_target)"); /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ @@ -7712,7 +7696,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 -@@ -3183,6 +3945,7 @@ +@@ -3178,6 +3940,7 @@ checkGLcall("glDeleteTextures(1, &backup)"); } @@ -7720,7 +7704,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) -@@ -3194,6 +3957,17 @@ +@@ -3189,6 +3952,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); @@ -7738,7 +7722,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Front buffer coordinates are always full screen coordinates, but our GL -@@ -3248,9 +4022,15 @@ +@@ -3243,9 +4017,15 @@ gl_info = context->gl_info; @@ -7754,7 +7738,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 */ -@@ -3293,9 +4073,13 @@ +@@ -3288,9 +4068,13 @@ /* Leave the opengl state valid for blitting */ device->blitter->unset_shader(context->gl_info); @@ -7768,7 +7752,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c || (dst_surface->container->swapchain && dst_surface->container->swapchain->front_buffer == dst_surface->container)) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ -@@ -3325,8 +4109,13 @@ +@@ -3320,8 +4104,13 @@ enum wined3d_texture_filter_type filter) { struct wined3d_device *device = dst_surface->resource.device; @@ -7782,7 +7766,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), -@@ -3517,6 +4306,7 @@ +@@ -3512,6 +4301,7 @@ { TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h); @@ -7790,7 +7774,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))) -@@ -3525,6 +4315,15 @@ +@@ -3520,6 +4310,15 @@ surface->ds_current_size.cx = w; surface->ds_current_size.cy = h; surface->resource.locations = location; @@ -7806,7 +7790,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Context activation is done by the caller. */ -@@ -3539,7 +4338,11 @@ +@@ -3534,7 +4333,11 @@ /* TODO: Make this work for modes other than FBO */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return; @@ -7818,23 +7802,31 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { w = surface->ds_current_size.cx; h = surface->ds_current_size.cy; -@@ -3565,6 +4368,7 @@ +@@ -3560,7 +4363,11 @@ return; } +#if defined(STAGING_CSMT) if (surface->resource.locations & WINED3D_LOCATION_DISCARDED) ++#else /* STAGING_CSMT */ ++ if (surface->locations & WINED3D_LOCATION_DISCARDED) ++#endif /* STAGING_CSMT */ { TRACE("Surface was discarded, no need copy data.\n"); -@@ -3580,6 +4384,23 @@ + switch (location) +@@ -3580,6 +4387,7 @@ + default: + FIXME("Unhandled location %#x\n", location); + } ++#if defined(STAGING_CSMT) + surface->resource.locations &= ~WINED3D_LOCATION_DISCARDED; + surface->resource.locations |= location; + surface->ds_current_size.cx = surface->resource.width; +@@ -3591,6 +4399,19 @@ { FIXME("No up to date depth stencil location.\n"); surface->resource.locations |= location; +#else /* STAGING_CSMT */ -+ if (surface->locations & WINED3D_LOCATION_DISCARDED) -+ { -+ TRACE("Surface was discarded, no need copy data.\n"); -+ wined3d_surface_prepare(surface, context, location); + surface->locations &= ~WINED3D_LOCATION_DISCARDED; + surface->locations |= location; + surface->ds_current_size.cx = surface->resource.width; @@ -7850,7 +7842,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; -@@ -3643,9 +4464,13 @@ +@@ -3654,9 +4475,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7864,7 +7856,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) -@@ -3661,9 +4486,13 @@ +@@ -3672,9 +4497,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7878,7 +7870,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 -@@ -3671,6 +4500,7 @@ +@@ -3682,6 +4511,7 @@ ERR("Invalid location (%#x) specified.\n", location); } @@ -7886,7 +7878,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; -@@ -3703,6 +4533,124 @@ +@@ -3714,6 +4544,124 @@ FIXME("Can't load surface %p with location flags %s into sysmem.\n", surface, wined3d_debug_location(surface->resource.locations)); @@ -8011,7 +8003,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Context activation is done by the caller. */ -@@ -3711,12 +4659,14 @@ +@@ -3722,12 +4670,14 @@ { RECT r; @@ -8026,7 +8018,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)) { -@@ -3725,7 +4675,11 @@ +@@ -3736,7 +4686,11 @@ } surface_get_rect(surface, NULL, &r); @@ -8038,7 +8030,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_blt_to_drawable(surface->resource.device, context, WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r); -@@ -3740,6 +4694,7 @@ +@@ -3751,6 +4705,7 @@ struct wined3d_device *device = surface->resource.device; const struct wined3d_color_key_conversion *conversion; struct wined3d_texture *texture = surface->container; @@ -8046,7 +8038,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c UINT width, src_row_pitch, src_slice_pitch, dst_pitch; struct wined3d_bo_address data; struct wined3d_format format; -@@ -3766,6 +4721,24 @@ +@@ -3777,6 +4732,24 @@ } if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_SRGB | WINED3D_LOCATION_TEXTURE_RGB) @@ -8071,7 +8063,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c && (surface->container->resource.format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB) && fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, NULL, surface->resource.usage, surface->resource.pool, surface->resource.format, -@@ -3781,6 +4754,7 @@ +@@ -3792,6 +4765,7 @@ return WINED3D_OK; } @@ -8079,7 +8071,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface->resource.locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED) && (!srgb || (surface->container->resource.format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB)) && fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, -@@ -3788,6 +4762,15 @@ +@@ -3799,6 +4773,15 @@ NULL, surface->resource.usage, surface->resource.pool, surface->resource.format)) { DWORD src_location = surface->resource.locations & WINED3D_LOCATION_RB_RESOLVED ? @@ -8095,7 +8087,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c WINED3D_LOCATION_RB_RESOLVED : WINED3D_LOCATION_RB_MULTISAMPLE; DWORD dst_location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB; RECT rect = {0, 0, surface->resource.width, surface->resource.height}; -@@ -3802,6 +4785,7 @@ +@@ -3813,6 +4796,7 @@ if (srgb) { @@ -8103,7 +8095,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) { -@@ -3836,15 +4820,55 @@ +@@ -3847,15 +4831,55 @@ width = surface->resource.width; wined3d_resource_get_pitch(&surface->resource, &src_row_pitch, &src_slice_pitch); @@ -8112,6 +8104,9 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c - if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE))) - format = *wined3d_get_format(gl_info, conversion->dst_format); - +- /* 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. */ +#else /* STAGING_CSMT */ + if ((surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->resource.map_binding)) + == WINED3D_LOCATION_TEXTURE_RGB) @@ -8153,9 +8148,9 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE))) + format = *wined3d_get_format(gl_info, conversion->dst_format); + - /* 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. */ ++ /* 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. */ +#if defined(STAGING_CSMT) if ((format.convert || conversion) && surface->resource.buffer) +#else /* STAGING_CSMT */ @@ -8164,7 +8159,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -3853,6 +4877,7 @@ +@@ -3864,6 +4888,7 @@ else surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; @@ -8172,7 +8167,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); -@@ -3860,6 +4885,14 @@ +@@ -3871,6 +4896,14 @@ } wined3d_resource_get_memory(&surface->resource, surface->resource.locations, &data); @@ -8187,7 +8182,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. */ -@@ -3874,9 +4907,15 @@ +@@ -3885,9 +4918,15 @@ context_release(context); return E_OUTOFMEMORY; } @@ -8203,7 +8198,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c data.addr = mem; } else if (conversion) -@@ -3896,6 +4935,7 @@ +@@ -3907,6 +4946,7 @@ } if (texture->swapchain && texture->swapchain->palette) palette = texture->swapchain->palette; @@ -8211,7 +8206,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c conversion->convert(data.addr, src_row_pitch, mem, dst_pitch, width, height, palette, &texture->async.gl_color_key); src_row_pitch = dst_pitch; -@@ -3904,6 +4944,16 @@ +@@ -3915,6 +4955,16 @@ wined3d_surface_upload_data(surface, gl_info, &format, &src_rect, src_row_pitch, &dst_point, srgb, wined3d_const_bo_address(&data)); @@ -8228,7 +8223,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HeapFree(GetProcessHeap(), 0, mem); -@@ -3915,7 +4965,11 @@ +@@ -3926,7 +4976,11 @@ { RECT rect = {0, 0, surface->resource.width, surface->resource.height}; @@ -8240,7 +8235,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c ERR("Trying to resolve multisampled surface %p, but location WINED3D_LOCATION_RB_MULTISAMPLE not current.\n", surface); -@@ -3923,11 +4977,17 @@ +@@ -3934,11 +4988,17 @@ surface, WINED3D_LOCATION_RB_MULTISAMPLE, &rect, surface, WINED3D_LOCATION_RB_RESOLVED, &rect); } @@ -8258,7 +8253,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)); -@@ -3935,6 +4995,7 @@ +@@ -3946,6 +5006,7 @@ if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { if (location == WINED3D_LOCATION_TEXTURE_RGB @@ -8266,7 +8261,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); -@@ -3959,6 +5020,46 @@ +@@ -3970,6 +5031,46 @@ ERR("Surface %p does not have any up to date location.\n", surface); surface->flags |= SFLAG_LOST; return; @@ -8313,7 +8308,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } switch (location) -@@ -3972,7 +5073,11 @@ +@@ -3983,7 +5084,11 @@ case WINED3D_LOCATION_DRAWABLE: if (FAILED(hr = surface_load_drawable(surface, context))) @@ -8325,7 +8320,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -3983,7 +5088,11 @@ +@@ -3994,7 +5099,11 @@ case WINED3D_LOCATION_TEXTURE_SRGB: if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) @@ -8337,7 +8332,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; default: -@@ -3991,12 +5100,21 @@ +@@ -4002,12 +5111,21 @@ break; } @@ -8359,7 +8354,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; } -@@ -4104,6 +5222,7 @@ +@@ -4115,6 +5233,7 @@ const RECT *dst_rect, const struct wined3d_color *color) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8367,7 +8362,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; -@@ -4124,6 +5243,21 @@ +@@ -4135,6 +5254,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); @@ -8389,7 +8384,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4132,6 +5266,7 @@ +@@ -4143,6 +5277,7 @@ const RECT *dst_rect, float depth) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8397,7 +8392,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; -@@ -4147,6 +5282,20 @@ +@@ -4158,6 +5293,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); @@ -8418,7 +8413,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4175,8 +5324,13 @@ +@@ -4186,8 +5335,13 @@ wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT, (old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL); @@ -8432,7 +8427,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } const struct blit_shader ffp_blit = { -@@ -4332,6 +5486,7 @@ +@@ -4343,6 +5497,7 @@ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) { @@ -8440,7 +8435,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c int bpp, srcheight, srcwidth, dstheight, dstwidth, width; const struct wined3d_format *src_format, *dst_format; unsigned int src_fmt_flags, dst_fmt_flags; -@@ -4366,6 +5521,28 @@ +@@ -4377,6 +5532,28 @@ wined3d_resource_get_pitch(&dst_surface->resource, &dst_row_pitch, &dst_slice_pitch); src_data = dst_data; src_row_pitch = dst_row_pitch; @@ -8469,7 +8464,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format = dst_surface->resource.format; dst_format = src_format; dst_fmt_flags = dst_surface->container->resource.format_flags; -@@ -4377,12 +5554,14 @@ +@@ -4388,12 +5565,14 @@ dst_fmt_flags = dst_surface->container->resource.format_flags; if (src_surface) { @@ -8484,7 +8479,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))) -@@ -4393,9 +5572,13 @@ +@@ -4404,9 +5583,13 @@ } src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, 0)); } @@ -8498,7 +8493,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format = src_surface->resource.format; src_fmt_flags = src_surface->container->resource.format_flags; } -@@ -4405,8 +5588,12 @@ +@@ -4416,8 +5599,12 @@ src_fmt_flags = dst_fmt_flags; } @@ -8511,7 +8506,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } bpp = dst_surface->resource.format->byte_count; -@@ -4417,12 +5604,24 @@ +@@ -4428,12 +5615,24 @@ width = (dst_rect->right - dst_rect->left) * bpp; if (src_surface) @@ -8536,7 +8531,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS) { -@@ -4457,7 +5656,11 @@ +@@ -4468,7 +5667,11 @@ } hr = surface_cpu_blt_compressed(sbase, dbuf, @@ -8548,7 +8543,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format, flags, fx); goto release; } -@@ -4465,7 +5668,11 @@ +@@ -4476,7 +5679,11 @@ /* First, all the 'source-less' blits */ if (flags & WINEDDBLT_COLORFILL) { @@ -8560,7 +8555,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c flags &= ~WINEDDBLT_COLORFILL; } -@@ -4514,6 +5721,7 @@ +@@ -4525,6 +5732,7 @@ for (y = 0; y < dstheight; ++y) { memcpy(dbuf, sbuf, width); @@ -8568,7 +8563,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c sbuf += src_row_pitch; dbuf += dst_row_pitch; } -@@ -4527,6 +5735,21 @@ +@@ -4538,6 +5746,21 @@ { sbuf -= src_row_pitch; dbuf -= dst_row_pitch; @@ -8590,7 +8585,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c memcpy(dbuf, sbuf, width); } } -@@ -4536,8 +5759,13 @@ +@@ -4547,8 +5770,13 @@ for (y = 0; y < dstheight; ++y) { memmove(dbuf, sbuf, width); @@ -8604,7 +8599,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4546,9 +5774,15 @@ +@@ -4557,9 +5785,15 @@ /* Stretching in y direction only. */ for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8620,7 +8615,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4558,6 +5792,7 @@ +@@ -4569,6 +5803,7 @@ int last_sy = -1; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8628,7 +8623,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)) -@@ -4565,6 +5800,15 @@ +@@ -4576,6 +5811,15 @@ /* This source row is the same as last source row - * Copy the already stretched row. */ memcpy(dbuf, dbuf - dst_row_pitch, width); @@ -8644,7 +8639,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4611,6 +5855,7 @@ +@@ -4622,6 +5866,7 @@ } #undef STRETCH_ROW } @@ -8652,7 +8647,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dbuf += dst_row_pitch; last_sy = sy; } -@@ -4619,6 +5864,16 @@ +@@ -4630,6 +5875,16 @@ else { LONG dstyinc = dst_row_pitch, dstxinc = bpp; @@ -8669,7 +8664,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)) -@@ -4668,7 +5923,11 @@ +@@ -4679,7 +5934,11 @@ LONG tmpxy; dTopLeft = dbuf; dTopRight = dbuf + ((dstwidth - 1) * bpp); @@ -8681,7 +8676,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp); if (fx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY) -@@ -4745,6 +6004,7 @@ +@@ -4756,6 +6015,7 @@ flags &= ~(WINEDDBLT_DDFX); } @@ -8689,7 +8684,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c #define COPY_COLORKEY_FX(type) \ do { \ const type *s; \ -@@ -4766,6 +6026,29 @@ +@@ -4777,6 +6037,29 @@ d = (type *)(((BYTE *)d) + dstyinc); \ } \ } while(0) @@ -8719,7 +8714,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c switch (bpp) { -@@ -4784,7 +6067,11 @@ +@@ -4795,7 +6078,11 @@ BYTE *d = dbuf, *dx; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8731,7 +8726,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dx = d; for (x = sx = 0; x < dstwidth; ++x, sx+= xinc) { -@@ -4815,10 +6102,12 @@ +@@ -4826,10 +6113,12 @@ } } @@ -8744,7 +8739,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c error: if (flags && FIXME_ON(d3d_surface)) { -@@ -4826,6 +6115,7 @@ +@@ -4837,6 +6126,7 @@ } release: @@ -8752,7 +8747,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); -@@ -4844,6 +6134,14 @@ +@@ -4855,6 +6145,14 @@ wined3d_texture_decref(src_texture); if (context) context_release(context); @@ -8767,7 +8762,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -4888,6 +6186,7 @@ +@@ -4899,6 +6197,7 @@ cpu_blit_blit_surface, }; @@ -8775,7 +8770,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) -@@ -4895,6 +6194,16 @@ +@@ -4906,6 +6205,16 @@ struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_device *device = dst_surface->resource.device; DWORD src_ds_flags, dst_ds_flags; @@ -8792,7 +8787,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c BOOL scale, convert; static const DWORD simple_blit = WINEDDBLT_ASYNC -@@ -4905,6 +6214,106 @@ +@@ -4916,6 +6225,106 @@ | WINEDDBLT_DEPTHFILL | WINEDDBLT_DONOTWAIT; @@ -8899,7 +8894,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!device->d3d_initialized) { WARN("D3D not initialized, using fallback.\n"); -@@ -4947,8 +6356,13 @@ +@@ -4958,8 +6367,13 @@ } scale = src_surface @@ -8913,7 +8908,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->container->resource.format_flags -@@ -4968,6 +6382,7 @@ +@@ -4979,6 +6393,7 @@ TRACE("Depth fill.\n"); if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) @@ -8921,7 +8916,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))) -@@ -4978,6 +6393,24 @@ +@@ -4989,6 +6404,24 @@ if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->container->resource.draw_binding, src_rect, dst_surface, dst_surface->container->resource.draw_binding, dst_rect))) return; @@ -8946,7 +8941,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -4986,8 +6419,13 @@ +@@ -4997,8 +6430,13 @@ /* In principle this would apply to depth blits as well, but we don't * implement those in the CPU blitter at the moment. */ @@ -8960,7 +8955,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { if (scale) TRACE("Not doing sysmem blit because of scaling.\n"); -@@ -5008,8 +6446,13 @@ +@@ -5019,8 +6457,13 @@ palette, fx->u5.dwFillColor, &color)) goto fallback; @@ -8974,7 +8969,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -5027,8 +6470,13 @@ +@@ -5038,8 +6481,13 @@ color_key = &src_surface->container->async.src_blt_color_key; blit_op = WINED3D_BLIT_OP_COLOR_BLIT_CKEY; } @@ -8988,7 +8983,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { /* Upload */ if (scale) -@@ -5037,6 +6485,7 @@ +@@ -5048,6 +6496,7 @@ TRACE("Not doing upload because of format conversion.\n"); else { @@ -8996,7 +8991,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))) -@@ -5049,6 +6498,19 @@ +@@ -5060,6 +6509,19 @@ context_release(context); } return; @@ -9016,7 +9011,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -5072,6 +6534,7 @@ +@@ -5083,6 +6545,7 @@ wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -9024,7 +9019,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return; } -@@ -5279,6 +6742,53 @@ +@@ -5290,6 +6753,53 @@ wined3d_surface_location_invalidated, wined3d_surface_load_location, }; @@ -9078,7 +9073,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) -@@ -5340,7 +6850,11 @@ +@@ -5351,7 +6861,11 @@ } surface->container = container; @@ -9090,7 +9085,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c list_init(&surface->renderbuffers); list_init(&surface->overlays); -@@ -5372,9 +6886,14 @@ +@@ -5383,9 +6897,14 @@ if (surface->resource.map_binding == WINED3D_LOCATION_DIB) { wined3d_resource_free_sysmem(&surface->resource); @@ -9105,7 +9100,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } return hr; -@@ -5401,7 +6920,11 @@ +@@ -5412,7 +6931,11 @@ if (FAILED(hr = surface_init(object, container, desc, target, level, layer, flags))) { WARN("Failed to initialize surface, returning %#x.\n", hr); diff --git a/patches/wined3d-Revert_Prepare_GL_Resources/0001-Revert-wined3d-Prepare-GL-resources-before-calling-c.patch b/patches/wined3d-Revert_Prepare_GL_Resources/0001-Revert-wined3d-Prepare-GL-resources-before-calling-c.patch new file mode 100644 index 00000000..45a37fd0 --- /dev/null +++ b/patches/wined3d-Revert_Prepare_GL_Resources/0001-Revert-wined3d-Prepare-GL-resources-before-calling-c.patch @@ -0,0 +1,244 @@ +From b0e2839c98b1b0f2a16b3382b1bd32fe60130700 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Tue, 10 Nov 2015 00:36:45 +0100 +Subject: Revert "wined3d: Prepare GL resources before calling + context_apply_fbo_state." + +This reverts commit 1ca9dfc8ee25f4ae188fdacd4d3d56046cef8003. +--- + dlls/wined3d/context.c | 7 +++++++ + dlls/wined3d/device.c | 13 ++++-------- + dlls/wined3d/drawprim.c | 20 ++++++------------ + dlls/wined3d/surface.c | 46 ++++++++++++++++-------------------------- + dlls/wined3d/wined3d_private.h | 2 -- + 5 files changed, 34 insertions(+), 54 deletions(-) + +diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c +index 1692d0d..97f3c04 100644 +--- a/dlls/wined3d/context.c ++++ b/dlls/wined3d/context.c +@@ -141,6 +141,8 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context, + { + case WINED3D_LOCATION_TEXTURE_RGB: + case WINED3D_LOCATION_TEXTURE_SRGB: ++ wined3d_texture_prepare_texture(depth_stencil->container, context, FALSE); ++ + if (format_flags & WINED3DFMT_FLAG_DEPTH) + { + gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_DEPTH_ATTACHMENT, +@@ -159,11 +161,13 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context, + break; + + case WINED3D_LOCATION_RB_MULTISAMPLE: ++ surface_prepare_rb(depth_stencil, gl_info, TRUE); + context_attach_depth_stencil_rb(gl_info, fbo_target, + format_flags, depth_stencil->rb_multisample); + break; + + case WINED3D_LOCATION_RB_RESOLVED: ++ surface_prepare_rb(depth_stencil, gl_info, FALSE); + context_attach_depth_stencil_rb(gl_info, fbo_target, + format_flags, depth_stencil->rb_resolved); + break; +@@ -213,6 +217,7 @@ static void context_attach_surface_fbo(struct wined3d_context *context, + case WINED3D_LOCATION_TEXTURE_RGB: + case WINED3D_LOCATION_TEXTURE_SRGB: + srgb = location == WINED3D_LOCATION_TEXTURE_SRGB; ++ wined3d_texture_prepare_texture(surface->container, context, srgb); + gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx, + surface->texture_target, surface_get_texture_name(surface, gl_info, srgb), + surface->texture_level); +@@ -220,12 +225,14 @@ static void context_attach_surface_fbo(struct wined3d_context *context, + break; + + case WINED3D_LOCATION_RB_MULTISAMPLE: ++ surface_prepare_rb(surface, gl_info, TRUE); + gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_COLOR_ATTACHMENT0 + idx, + GL_RENDERBUFFER, surface->rb_multisample); + checkGLcall("glFramebufferRenderbuffer()"); + break; + + case WINED3D_LOCATION_RB_RESOLVED: ++ surface_prepare_rb(surface, gl_info, FALSE); + gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_COLOR_ATTACHMENT0 + idx, + GL_RENDERBUFFER, surface->rb_resolved); + checkGLcall("glFramebufferRenderbuffer()"); +diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c +index 2960e08..0da8607 100644 +--- a/dlls/wined3d/device.c ++++ b/dlls/wined3d/device.c +@@ -317,15 +317,13 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c + * anyway. If we're not clearing the color buffer we don't have to copy either since we're not going to set + * the drawable up to date. We have to check all settings that limit the clear area though. Do not bother + * checking all this if the dest surface is in the drawable anyway. */ +- for (i = 0; i < rt_count; ++i) ++ if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, clear_rect)) + { +- struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); +- if (rt && rt->resource.format->id != WINED3DFMT_NULL) ++ for (i = 0; i < rt_count; ++i) + { +- if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, clear_rect)) ++ struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); ++ if (rt) + surface_load_location(rt, context, rt->container->resource.draw_binding); +- else +- wined3d_surface_prepare(rt, context, rt->container->resource.draw_binding); + } + } + +@@ -341,9 +339,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c + drawable_height = depth_stencil->pow2Height; + } + +- if (depth_stencil && render_offscreen) +- wined3d_surface_prepare(depth_stencil, context, depth_stencil->container->resource.draw_binding); +- + if (flags & WINED3DCLEAR_ZBUFFER) + { + DWORD location = render_offscreen ? fb->depth_stencil->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; +diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c +index 3761830..d2d3bce 100644 +--- a/dlls/wined3d/drawprim.c ++++ b/dlls/wined3d/drawprim.c +@@ -620,20 +620,17 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + } + gl_info = context->gl_info; + +- for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) ++ if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) + { +- struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); +- if (target && target->resource.format->id != WINED3DFMT_NULL) ++ /* Invalidate the back buffer memory so LockRect will read it the next time */ ++ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) + { +- if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) ++ struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); ++ if (target) + { + surface_load_location(target, context, target->container->resource.draw_binding); + surface_invalidate_location(target, ~target->container->resource.draw_binding); + } +- else +- { +- wined3d_surface_prepare(target, context, target->container->resource.draw_binding); +- } + } + } + +@@ -646,10 +643,9 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + * that we never copy the stencil data.*/ + DWORD location = context->render_offscreen ? device->fb.depth_stencil->resource->draw_binding + : WINED3D_LOCATION_DRAWABLE; +- struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); +- + if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]) + { ++ struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); + RECT current_rect, draw_rect, r; + + if (!context->render_offscreen && ds != device->onscreen_depth_stencil) +@@ -665,11 +661,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + IntersectRect(&r, &draw_rect, ¤t_rect); + if (!EqualRect(&r, &draw_rect)) + surface_load_ds_location(ds, context, location); +- else +- wined3d_surface_prepare(ds, context, location); + } +- else +- wined3d_surface_prepare(ds, context, location); + } + + if (!context_apply_draw_state(context, device)) +diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c +index c3ddc84..179ce02 100644 +--- a/dlls/wined3d/surface.c ++++ b/dlls/wined3d/surface.c +@@ -821,8 +821,6 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device, + surface_load_location(src_surface, context, src_location); + if (!surface_is_full_rect(dst_surface, dst_rect)) + surface_load_location(dst_surface, context, dst_location); +- else +- wined3d_surface_prepare(dst_surface, context, dst_location); + + gl_info = context->gl_info; + +@@ -914,9 +912,6 @@ static void surface_blt_fbo(const struct wined3d_device *device, + surface_load_location(src_surface, old_ctx, src_location); + if (!surface_is_full_rect(dst_surface, &dst_rect)) + surface_load_location(dst_surface, old_ctx, dst_location); +- else +- wined3d_surface_prepare(dst_surface, old_ctx, dst_location); +- + + if (src_location == WINED3D_LOCATION_DRAWABLE) required_rt = src_surface; + else if (dst_location == WINED3D_LOCATION_DRAWABLE) required_rt = dst_surface; +@@ -3678,7 +3673,23 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co + if (surface->locations & WINED3D_LOCATION_DISCARDED) + { + TRACE("Surface was discarded, no need copy data.\n"); +- wined3d_surface_prepare(surface, context, location); ++ switch (location) ++ { ++ case WINED3D_LOCATION_TEXTURE_RGB: ++ wined3d_texture_prepare_texture(surface->container, context, FALSE); ++ break; ++ case WINED3D_LOCATION_RB_MULTISAMPLE: ++ surface_prepare_rb(surface, gl_info, TRUE); ++ break; ++ case WINED3D_LOCATION_RB_RESOLVED: ++ surface_prepare_rb(surface, gl_info, FALSE); ++ break; ++ case WINED3D_LOCATION_DRAWABLE: ++ /* Nothing to do */ ++ break; ++ default: ++ FIXME("Unhandled location %#x\n", location); ++ } + surface->locations &= ~WINED3D_LOCATION_DISCARDED; + surface->locations |= location; + surface->ds_current_size.cx = surface->resource.width; +@@ -5501,26 +5512,3 @@ HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct w + + return hr; + } +- +-/* Context activation is done by the caller. */ +-void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) +-{ +- switch (location) +- { +- case WINED3D_LOCATION_TEXTURE_RGB: +- wined3d_texture_prepare_texture(surface->container, context, FALSE); +- break; +- +- case WINED3D_LOCATION_TEXTURE_SRGB: +- wined3d_texture_prepare_texture(surface->container, context, TRUE); +- break; +- +- case WINED3D_LOCATION_RB_MULTISAMPLE: +- surface_prepare_rb(surface, context->gl_info, TRUE); +- break; +- +- case WINED3D_LOCATION_RB_RESOLVED: +- surface_prepare_rb(surface, context->gl_info, FALSE); +- break; +- } +-} +diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +index ac0b09a..49cc29f 100644 +--- a/dlls/wined3d/wined3d_private.h ++++ b/dlls/wined3d/wined3d_private.h +@@ -2459,8 +2459,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, + HRESULT surface_load_location(struct wined3d_surface *surface, + struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; + void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; +-void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, +- DWORD location) DECLSPEC_HIDDEN; + void surface_prepare_rb(struct wined3d_surface *surface, + const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN; + void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, +-- +2.6.2 + diff --git a/patches/wined3d-Revert_Prepare_GL_Resources/definition b/patches/wined3d-Revert_Prepare_GL_Resources/definition new file mode 100644 index 00000000..aaf4f0ed --- /dev/null +++ b/patches/wined3d-Revert_Prepare_GL_Resources/definition @@ -0,0 +1 @@ +Fixes: [39536] Revert patch to prepare GL resources before calling context_apply_fbo_state