diff --git a/README.md b/README.md index 661204b7..b269a2b2 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features in Wine Staging 1.8-rc1 [268]:** +**Bug fixes and features in Wine Staging 1.8-rc2 [267]:** *Note: The following list only contains features and bug fixes which are not yet available in vanilla Wine. They are removed from the list as soon as they @@ -252,7 +252,6 @@ for more details.* * Return dummy ID3DXSkinInfo interface when skinning info not present ([Wine Bug #33904](https://bugs.winehq.org/show_bug.cgi?id=33904)) * Return fake device type when systemroot is located on virtual disk ([Wine Bug #36546](https://bugs.winehq.org/show_bug.cgi?id=36546)) * Return proper status codes when NtReadFile/NtWriteFile is called on closed (but not disconnected) pipe -* Revert patch to prepare GL resources before calling context_apply_fbo_state ([Wine Bug #39536](https://bugs.winehq.org/show_bug.cgi?id=39536)) * SHFileOperation with FO_MOVE should create new directory on Vista+ ([Wine Bug #25207](https://bugs.winehq.org/show_bug.cgi?id=25207)) * SO_CONNECT_TIME returns the appropriate time * Send WM_PAINT event during dialog creation ([Wine Bug #35652](https://bugs.winehq.org/show_bug.cgi?id=35652)) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index df1e20f2..1403baeb 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,13 +52,13 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "a2c6a2beb68cae239d72e012aa8d4af113b8aaa7" + echo "1d19eb15d4abfdd14dccc5ac05b83c0ee1a1ace1" } # Show version information version() { - echo "Wine Staging 1.8-rc1" + echo "Wine Staging 1.8-rc2" echo "Copyright (C) 2014-2015 the Wine Staging project authors." echo "" echo "Patchset to be applied on upstream Wine:" @@ -311,7 +311,6 @@ 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" @@ -1044,9 +1043,6 @@ 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" ;; @@ -1795,13 +1791,9 @@ 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 @@ -5830,27 +5822,10 @@ 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, wined3d- -# | Revert_Prepare_GL_Resources +# | * makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects, wined3d-DXTn # | # | Modified files: # | * configure.ac, dlls/d3d11/device.c, dlls/d3d11/texture.c, dlls/d3d8/surface.c, dlls/d3d8/volume.c, dlls/d3d9/surface.c, @@ -5984,7 +5959,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- -# | Revert_Prepare_GL_Resources, wined3d-CSMT_Helper +# | 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 91707f27..aa3d9241 100644 --- a/patches/wined3d-CSMT_Helper/definition +++ b/patches/wined3d-CSMT_Helper/definition @@ -1,4 +1,3 @@ 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 4a4050ea..c66c1c1d 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 58c5b8740183684ce7dcb7735e219b13d3a60ddf Mon Sep 17 00:00:00 2001 +From 52759529f11102038adaa8501a44b03d9b0024ae 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 ebe8049..dc5d249 100644 +index 89c8ecf..0b10444 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -4257,7 +4257,7 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct +@@ -4231,7 +4231,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 ebe8049..dc5d249 100644 { HRESULT hr; -@@ -4269,26 +4269,26 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4243,26 +4243,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 ebe8049..dc5d249 100644 } if (WARN_ON(d3d_surface)) -@@ -4303,7 +4303,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4277,7 +4277,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 ebe8049..dc5d249 100644 } switch (location) -@@ -4317,7 +4317,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4291,7 +4291,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 ebe8049..dc5d249 100644 break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -4328,7 +4328,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4302,7 +4302,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 ebe8049..dc5d249 100644 break; default: -@@ -4341,7 +4341,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -4315,7 +4315,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 ebe8049..dc5d249 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 e9481b5..fac385a 100644 +index 8bbb1ab..9cff40e 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 e9481b5..fac385a 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 surface_prepare_rb(struct wined3d_surface *surface, + void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, -- -2.6.2 +2.6.1 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 fc74cece..bb9b3c78 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 d0e2c459cceb86d34019f95a6ec9910eaeba00f9 Mon Sep 17 00:00:00 2001 +From 135a0ad96a413720dd7bc3af682b39b8bc6de16f 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. @@ -7,15 +7,15 @@ Subject: wined3d: Move surface locations into the resource. dlls/wined3d/arb_program_shader.c | 2 +- dlls/wined3d/device.c | 4 +- dlls/wined3d/drawprim.c | 2 +- - dlls/wined3d/surface.c | 93 ++++++++++++++++++++------------------- + dlls/wined3d/surface.c | 97 ++++++++++++++++++++------------------- dlls/wined3d/wined3d_private.h | 1 - - 5 files changed, 51 insertions(+), 51 deletions(-) + 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index 9ac6666..d576869 100644 +index 2af9845..e8526d8 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c -@@ -7850,7 +7850,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter, +@@ -7851,7 +7851,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter, /* Now load the surface */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO @@ -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 0da8607..b6c98ef 100644 +index 170536d..14f28a6 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 0da8607..b6c98ef 100644 ds->ds_current_size.cx, ds->ds_current_size.cy); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index d2d3bce..afccecd 100644 +index 3761830..943a829 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -651,7 +651,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co +@@ -655,7 +655,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 d2d3bce..afccecd 100644 else SetRectEmpty(¤t_rect); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index dc5d249..e937e36 100644 +index e9af37e..dd26bb0 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 dc5d249..e937e36 100644 { TRACE("Not dirtified, nothing to do.\n"); return; -@@ -1680,7 +1680,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1693,7 +1693,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 dc5d249..e937e36 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, -@@ -1803,7 +1803,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte +@@ -1816,7 +1816,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 dc5d249..e937e36 100644 { TRACE("surface is already in texture\n"); return; -@@ -2069,7 +2069,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, +@@ -2082,7 +2082,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, create_dib = TRUE; } @@ -117,7 +117,7 @@ index dc5d249..e937e36 100644 wined3d_resource_free_sysmem(&surface->resource); width = texture_resource->width; -@@ -3245,7 +3245,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -3258,7 +3258,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 dc5d249..e937e36 100644 } /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag -@@ -3772,13 +3772,14 @@ void surface_modify_ds_location(struct wined3d_surface *surface, +@@ -3785,13 +3785,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 dc5d249..e937e36 100644 } /* Context activation is done by the caller. */ -@@ -3793,7 +3794,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3806,7 +3807,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 dc5d249..e937e36 100644 { w = surface->ds_current_size.cx; h = surface->ds_current_size.cy; -@@ -3819,7 +3820,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3832,21 +3833,21 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co return; } @@ -161,11 +161,7 @@ index dc5d249..e937e36 100644 + if (surface->resource.locations & WINED3D_LOCATION_DISCARDED) { TRACE("Surface was discarded, no need copy data.\n"); - 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); - } + wined3d_surface_prepare(surface, context, location); - surface->locations &= ~WINED3D_LOCATION_DISCARDED; - surface->locations |= location; + surface->resource.locations &= ~WINED3D_LOCATION_DISCARDED; @@ -184,7 +180,7 @@ index dc5d249..e937e36 100644 surface->ds_current_size.cx = surface->resource.width; surface->ds_current_size.cy = surface->resource.height; return; -@@ -3937,7 +3938,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3934,7 +3935,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co ERR("Invalid location (%#x) specified.\n", location); } @@ -193,7 +189,7 @@ index dc5d249..e937e36 100644 surface->ds_current_size.cx = surface->resource.width; surface->ds_current_size.cy = surface->resource.height; } -@@ -3946,7 +3947,7 @@ void surface_validate_location(struct wined3d_surface *surface, DWORD location) +@@ -3943,7 +3944,7 @@ void surface_validate_location(struct wined3d_surface *surface, DWORD location) { TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); @@ -202,7 +198,7 @@ index dc5d249..e937e36 100644 } void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) -@@ -3955,9 +3956,9 @@ void surface_invalidate_location(struct wined3d_surface *surface, DWORD location +@@ -3952,9 +3953,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); @@ -214,7 +210,7 @@ index dc5d249..e937e36 100644 ERR("Surface %p does not have any up to date location.\n", surface); } -@@ -3993,7 +3994,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD +@@ -3990,7 +3991,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD UINT size = surface->resource.size; surface_get_memory(surface, &dst, location); @@ -223,7 +219,7 @@ index dc5d249..e937e36 100644 if (dst.buffer_object) { -@@ -4026,33 +4027,33 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -4023,33 +4024,33 @@ static void surface_load_sysmem(struct wined3d_surface *surface, { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -263,7 +259,7 @@ index dc5d249..e937e36 100644 } /* Context activation is done by the caller. */ -@@ -4092,14 +4093,14 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4089,14 +4090,14 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && wined3d_resource_is_offscreen(&texture->resource) @@ -280,7 +276,7 @@ index dc5d249..e937e36 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, -@@ -4115,13 +4116,13 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4112,13 +4113,13 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, return WINED3D_OK; } @@ -296,7 +292,7 @@ index dc5d249..e937e36 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}; -@@ -4136,7 +4137,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4133,7 +4134,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, if (srgb) { @@ -305,7 +301,7 @@ index dc5d249..e937e36 100644 == WINED3D_LOCATION_TEXTURE_RGB) { /* Performance warning... */ -@@ -4147,7 +4148,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4144,7 +4145,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, } else { @@ -314,7 +310,7 @@ index dc5d249..e937e36 100644 == WINED3D_LOCATION_TEXTURE_SRGB) { /* Performance warning... */ -@@ -4157,7 +4158,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4154,7 +4155,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, } } @@ -323,7 +319,7 @@ index dc5d249..e937e36 100644 { WARN("Trying to load a texture from sysmem, but no simple location is valid.\n"); /* Lets hope we get it from somewhere... */ -@@ -4192,7 +4193,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4189,7 +4190,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, surface_remove_pbo(surface, gl_info); } @@ -332,16 +328,22 @@ index dc5d249..e937e36 100644 if (format.convert) { /* This code is entered for texture formats which need a fixup. */ -@@ -4248,7 +4249,7 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct - { - RECT rect = {0, 0, surface->resource.width, surface->resource.height}; +@@ -4247,11 +4248,11 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi + const RECT rect = {0, 0, surface->resource.width, surface->resource.height}; + DWORD src_location; -- if (!(surface->locations & WINED3D_LOCATION_RB_MULTISAMPLE)) -+ if (!(surface->resource.locations & WINED3D_LOCATION_RB_MULTISAMPLE)) - ERR("Trying to resolve multisampled surface %p, but location WINED3D_LOCATION_RB_MULTISAMPLE not current.\n", - surface); - -@@ -4266,12 +4267,12 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +- if (surface->locations & WINED3D_LOCATION_RB_MULTISAMPLE) ++ if (surface->resource.locations & WINED3D_LOCATION_RB_MULTISAMPLE) + src_location = WINED3D_LOCATION_RB_MULTISAMPLE; +- else if (surface->locations & WINED3D_LOCATION_RB_RESOLVED) ++ else if (surface->resource.locations & WINED3D_LOCATION_RB_RESOLVED) + src_location = WINED3D_LOCATION_RB_RESOLVED; +- else if (surface->locations & WINED3D_LOCATION_TEXTURE_SRGB) ++ else if (surface->resource.locations & WINED3D_LOCATION_TEXTURE_SRGB) + src_location = WINED3D_LOCATION_TEXTURE_SRGB; + else /* surface_blt_fbo will load the source location if necessary. */ + src_location = WINED3D_LOCATION_TEXTURE_RGB; +@@ -4270,12 +4271,12 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { if (location == WINED3D_LOCATION_TEXTURE_RGB @@ -356,7 +358,7 @@ index dc5d249..e937e36 100644 && surface->container->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) { /* Already up to date, nothing to do. */ -@@ -4280,12 +4281,12 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4284,12 +4285,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", @@ -371,7 +373,7 @@ index dc5d249..e937e36 100644 { TRACE("Location already up to date.\n"); return; -@@ -4299,7 +4300,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4303,7 +4304,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte required_access, surface->resource.access_flags); } @@ -380,7 +382,7 @@ index dc5d249..e937e36 100644 { ERR("Surface %p does not have any up to date location.\n", surface); surface->flags |= SFLAG_LOST; -@@ -4338,7 +4339,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4343,7 +4344,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte surface_validate_location(surface, location); @@ -389,7 +391,7 @@ index dc5d249..e937e36 100644 surface_evict_sysmem(surface); return; -@@ -5390,8 +5391,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5395,8 +5396,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. */ @@ -400,7 +402,7 @@ index dc5d249..e937e36 100644 { if (scale) TRACE("Not doing sysmem blit because of scaling.\n"); -@@ -5431,8 +5432,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5436,8 +5437,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; } @@ -412,10 +414,10 @@ index dc5d249..e937e36 100644 /* Upload */ if (scale) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index f42325e..2a23afc 100644 +index ea31e35..5abda05 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2401,7 +2401,6 @@ struct wined3d_surface +@@ -2407,7 +2407,6 @@ struct wined3d_surface const struct wined3d_surface_ops *surface_ops; struct wined3d_texture *container; void *user_memory; diff --git a/patches/wined3d-CSMT_Main/0007-wined3d-Remove-surface_validate_location.patch b/patches/wined3d-CSMT_Main/0007-wined3d-Remove-surface_validate_location.patch index a615731d..cd471bbc 100644 --- a/patches/wined3d-CSMT_Main/0007-wined3d-Remove-surface_validate_location.patch +++ b/patches/wined3d-CSMT_Main/0007-wined3d-Remove-surface_validate_location.patch @@ -1,4 +1,4 @@ -From e8ce3e8bef910f4908f92344d7c2d60abfa61935 Mon Sep 17 00:00:00 2001 +From 808dc946d520997b207c6dbea8c034465ea26c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 4 Jan 2014 00:53:47 +0100 Subject: wined3d: Remove surface_validate_location. @@ -6,17 +6,17 @@ Subject: wined3d: Remove surface_validate_location. --- dlls/wined3d/arb_program_shader.c | 2 +- dlls/wined3d/device.c | 4 ++-- - dlls/wined3d/surface.c | 29 +++++++++++------------------ + dlls/wined3d/surface.c | 31 ++++++++++++------------------- dlls/wined3d/swapchain.c | 4 ++-- dlls/wined3d/texture.c | 4 +--- dlls/wined3d/wined3d_private.h | 1 - - 6 files changed, 17 insertions(+), 27 deletions(-) + 6 files changed, 18 insertions(+), 28 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index fc91209..582746c 100644 +index e8526d8..a87b09b 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c -@@ -7886,7 +7886,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter, +@@ -7888,7 +7888,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter, context_release(context); @@ -26,10 +26,10 @@ index fc91209..582746c 100644 } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 1ef681a..2683140 100644 +index 14f28a6..12bc454 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -392,7 +392,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c +@@ -397,7 +397,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c if (rt) { @@ -38,7 +38,7 @@ index 1ef681a..2683140 100644 surface_invalidate_location(rt, ~rt->container->resource.draw_binding); } } -@@ -4041,7 +4041,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4018,7 +4018,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str context_release(context); @@ -48,19 +48,27 @@ index 1ef681a..2683140 100644 } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index d1493a2..dac754e 100644 +index dd26bb0..afbb97e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -1170,7 +1170,7 @@ static void surface_unload(struct wined3d_resource *resource) +@@ -1158,14 +1158,14 @@ static void surface_unload(struct wined3d_resource *resource) * and all flags get lost */ - surface_prepare_system_memory(surface); - memset(surface->resource.heap_memory, 0, surface->resource.size); -- surface_validate_location(surface, WINED3D_LOCATION_SYSMEM); -+ wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_SYSMEM); - surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM); + if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL) + { +- surface_validate_location(surface, WINED3D_LOCATION_DISCARDED); ++ wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DISCARDED); + surface_invalidate_location(surface, ~WINED3D_LOCATION_DISCARDED); + } + else + { + surface_prepare_system_memory(surface); + memset(surface->resource.heap_memory, 0, surface->resource.size); +- surface_validate_location(surface, WINED3D_LOCATION_SYSMEM); ++ wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_SYSMEM); + surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM); + } - /* We also get here when the ddraw swapchain is destroyed, for example -@@ -1683,7 +1683,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1701,7 +1701,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P context_release(context); @@ -69,7 +77,7 @@ index d1493a2..dac754e 100644 surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB); return WINED3D_OK; -@@ -2169,7 +2169,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, +@@ -2155,7 +2155,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, valid_location = WINED3D_LOCATION_SYSMEM; } @@ -78,7 +86,7 @@ index d1493a2..dac754e 100644 return WINED3D_OK; } -@@ -2715,7 +2715,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2701,7 +2701,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, { TRACE("WINED3D_MAP_DISCARD flag passed, marking %s as up to date.\n", wined3d_debug_location(surface->resource.map_binding)); @@ -87,7 +95,7 @@ index d1493a2..dac754e 100644 } else { -@@ -3206,7 +3206,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc +@@ -3189,7 +3189,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. */ @@ -96,7 +104,7 @@ index d1493a2..dac754e 100644 surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB); } -@@ -3479,7 +3479,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -3462,7 +3462,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. */ @@ -105,7 +113,7 @@ index d1493a2..dac754e 100644 surface_invalidate_location(dst_surface, ~WINED3D_LOCATION_TEXTURE_RGB); } -@@ -3985,13 +3985,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3940,13 +3940,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co surface->ds_current_size.cy = surface->resource.height; } @@ -119,7 +127,7 @@ index d1493a2..dac754e 100644 void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) { TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); -@@ -4379,7 +4372,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4342,7 +4335,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte break; } @@ -128,7 +136,7 @@ index d1493a2..dac754e 100644 if (location != WINED3D_LOCATION_SYSMEM && (surface->resource.locations & WINED3D_LOCATION_SYSMEM)) surface_evict_sysmem(surface); -@@ -4553,7 +4546,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter, +@@ -4516,7 +4509,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter, wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT, (old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL); @@ -137,7 +145,7 @@ index d1493a2..dac754e 100644 surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding); } -@@ -5533,7 +5526,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5497,7 +5490,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC dst_surface, dst_surface->container->resource.draw_binding, &dst_rect); context_release(context); @@ -146,7 +154,7 @@ index d1493a2..dac754e 100644 surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding); return WINED3D_OK; -@@ -5623,7 +5616,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text +@@ -5587,7 +5580,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text } surface->container = container; @@ -155,7 +163,7 @@ index d1493a2..dac754e 100644 list_init(&surface->renderbuffers); list_init(&surface->overlays); -@@ -5655,7 +5648,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text +@@ -5619,7 +5612,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text if (surface->resource.map_binding == WINED3D_LOCATION_DIB) { wined3d_resource_free_sysmem(&surface->resource); @@ -165,10 +173,10 @@ index d1493a2..dac754e 100644 } diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index 27bcf70..bbe1b63 100644 +index e45fe17..9758be4 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c -@@ -556,7 +556,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT +@@ -562,7 +562,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); @@ -177,7 +185,7 @@ index 27bcf70..bbe1b63 100644 surface_invalidate_location(front, ~WINED3D_LOCATION_DRAWABLE); /* If the swapeffect is DISCARD, the back buffer is undefined. That means the SYSMEM * and INTEXTURE copies can keep their old content if they have any defined content. -@@ -829,7 +829,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 +@@ -835,7 +835,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 front_buffer = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); if (!(device->wined3d->flags & WINED3D_NO3D)) { @@ -187,10 +195,10 @@ index 27bcf70..bbe1b63 100644 } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 187862c..7671f46 100644 +index 0f40a3c..6b41db8 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -794,9 +794,7 @@ static void texture2d_sub_resource_invalidate_location(struct wined3d_resource * +@@ -795,9 +795,7 @@ static void texture2d_sub_resource_invalidate_location(struct wined3d_resource * static void texture2d_sub_resource_validate_location(struct wined3d_resource *sub_resource, DWORD location) { @@ -202,10 +210,10 @@ index 187862c..7671f46 100644 static void texture2d_sub_resource_upload_data(struct wined3d_resource *sub_resource, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 2353881..e1f211f 100644 +index 5abda05..b0b0d0b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2447,7 +2447,6 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, +@@ -2477,7 +2477,6 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, 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; @@ -214,5 +222,5 @@ index 2353881..e1f211f 100644 GLenum target, unsigned int level, unsigned int layer, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN; -- -2.5.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 482b32a3..3b879f63 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 855de6d9c2e7e1254123141eb8962061e1234d0a Mon Sep 17 00:00:00 2001 +From b868f6317602bb184f3f0ef13c191905096ad342 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. @@ -8,17 +8,17 @@ Subject: wined3d: Remove surface_invalidate_location. dlls/wined3d/context.c | 2 +- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/drawprim.c | 2 +- - dlls/wined3d/surface.c | 45 ++++++++++++++++----------------------- - dlls/wined3d/swapchain.c | 6 +++--- - dlls/wined3d/texture.c | 6 ++---- + dlls/wined3d/surface.c | 47 ++++++++++++++++----------------------- + dlls/wined3d/swapchain.c | 6 ++--- + dlls/wined3d/texture.c | 6 ++--- dlls/wined3d/wined3d_private.h | 1 - - 8 files changed, 28 insertions(+), 40 deletions(-) + 8 files changed, 29 insertions(+), 41 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index d080585..9a882cc 100644 +index a87b09b..4df6e2f 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c -@@ -7888,7 +7888,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter, +@@ -7889,7 +7889,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter, context_release(context); wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding); @@ -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 97f3c04..abc41dc 100644 +index 0e8b32b..52fb407 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -3295,7 +3295,7 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d +@@ -3298,7 +3298,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 97f3c04..abc41dc 100644 } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 86671dd..5f2fa7c 100644 +index 58478ba..77ea1e9 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -393,7 +393,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c +@@ -398,7 +398,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 86671dd..5f2fa7c 100644 } } -@@ -4013,7 +4013,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4019,7 +4019,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 86671dd..5f2fa7c 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 afccecd..d756182 100644 +index 943a829..95245a9 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -629,7 +629,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co - if (target) +@@ -628,7 +628,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + 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); + 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 596ad5c..307ac96 100644 +index 74d3878..35e7adf 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 596ad5c..307ac96 100644 } static void surface_release_client_storage(struct wined3d_surface *surface) -@@ -1114,7 +1114,7 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win +@@ -1119,7 +1119,7 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win checkGLcall("glDeleteBuffers(1, &surface->pbo)"); surface->pbo = 0; @@ -97,16 +97,24 @@ index 596ad5c..307ac96 100644 } static ULONG surface_resource_incref(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); -- surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM); -+ wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_SYSMEM); +@@ -1159,14 +1159,14 @@ static void surface_unload(struct wined3d_resource *resource) + if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL) + { + wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DISCARDED); +- surface_invalidate_location(surface, ~WINED3D_LOCATION_DISCARDED); ++ wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DISCARDED); + } + else + { + surface_prepare_system_memory(surface); + memset(surface->resource.heap_memory, 0, surface->resource.size); + wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_SYSMEM); +- surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM); ++ wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_SYSMEM); + } /* 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 -@@ -1166,7 +1166,7 @@ static void surface_unload(struct wined3d_resource *resource) +@@ -1179,7 +1179,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 +123,7 @@ index 596ad5c..307ac96 100644 } /* Destroy PBOs, but load them into real sysmem before */ -@@ -1217,7 +1217,10 @@ static HRESULT surface_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1230,7 +1230,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 +135,7 @@ index 596ad5c..307ac96 100644 } static const struct wined3d_resource_ops surface_resource_ops = -@@ -1695,7 +1698,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1708,7 +1711,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 +144,7 @@ index 596ad5c..307ac96 100644 return WINED3D_OK; } -@@ -2711,7 +2714,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2724,7 +2727,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, } if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY))) @@ -145,7 +153,7 @@ index 596ad5c..307ac96 100644 switch (surface->resource.map_binding) { -@@ -2827,7 +2830,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2840,7 +2843,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) } surface_load_location(surface, context, WINED3D_LOCATION_DIB); @@ -154,7 +162,7 @@ index 596ad5c..307ac96 100644 if (context) context_release(context); -@@ -2876,7 +2879,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) +@@ -2889,7 +2892,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 +171,7 @@ index 596ad5c..307ac96 100644 if (context) context_release(context); } -@@ -3183,7 +3186,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc +@@ -3196,7 +3199,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 +180,7 @@ index 596ad5c..307ac96 100644 } /* Uses the hardware to stretch and flip the image */ -@@ -3251,7 +3254,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -3264,7 +3267,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 +189,7 @@ index 596ad5c..307ac96 100644 } /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag -@@ -3456,7 +3459,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -3469,7 +3472,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 +198,7 @@ index 596ad5c..307ac96 100644 } /* Front buffer coordinates are always full screen coordinates, but our GL -@@ -3949,18 +3952,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3946,18 +3949,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co surface->ds_current_size.cy = surface->resource.height; } @@ -209,7 +217,7 @@ index 596ad5c..307ac96 100644 static DWORD resource_access_from_location(DWORD location) { switch (location) -@@ -4511,7 +4502,7 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter, +@@ -4516,7 +4507,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 +226,7 @@ index 596ad5c..307ac96 100644 } const struct blit_shader ffp_blit = { -@@ -5492,7 +5483,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5497,7 +5488,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 +235,7 @@ index 596ad5c..307ac96 100644 return WINED3D_OK; } -@@ -5614,7 +5605,7 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text +@@ -5619,7 +5610,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); @@ -292,10 +300,10 @@ index 7e31832..be378fc 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 da39f65..f20121e 100644 +index 4c1e3e4..3e07a16 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, +@@ -2458,7 +2458,6 @@ HRESULT surface_color_fill(struct wined3d_surface *s, GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN; void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; 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 7b2179ca..208e626b 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 4c30573555207c5e8fa9518f50c611446c89097c Mon Sep 17 00:00:00 2001 +From b26629e64f25b8a3a431f7b784fc4d70d1539c48 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 abc41dc..a9d6664 100644 +index 52fb407..15a2dc3 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -2293,7 +2293,7 @@ static void context_validate_onscreen_formats(struct wined3d_context *context, +@@ -2287,7 +2287,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 abc41dc..a9d6664 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 5f2fa7c..1dc934d 100644 +index 77ea1e9..367dc22 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) { - struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); - if (rt) + if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, clear_rect)) - 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); } - } - -@@ -4004,7 +4004,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4010,7 +4010,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 5f2fa7c..1dc934d 100644 wined3d_surface_upload_data(surface, gl_info, resource->format, diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index d756182..0e1f4ec 100644 +index 95245a9..4b01b7d 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 - struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); - if (target) +@@ -627,7 +627,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + { + if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) { - 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 0b1716e..c0f7479 100644 +index 9aff2f2..421b1ed 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 0b1716e..c0f7479 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); - gl_info = context->gl_info; - -@@ -916,9 +916,9 @@ static void surface_blt_fbo(const struct wined3d_device *device, +@@ -918,9 +918,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 0b1716e..c0f7479 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); - 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) +@@ -1178,7 +1178,7 @@ static void surface_unload(struct wined3d_resource *resource) else { surface_prepare_map_memory(surface); @@ -108,7 +108,7 @@ index 0b1716e..c0f7479 100644 wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding); } -@@ -1223,24 +1223,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour +@@ -1236,24 +1236,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour wined3d_texture_set_dirty(surface->container); } @@ -133,7 +133,7 @@ index 0b1716e..c0f7479 100644 static const struct wined3d_surface_ops surface_ops = { surface_private_setup, -@@ -1694,7 +1676,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1707,7 +1689,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 0b1716e..c0f7479 100644 wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE); surface_get_memory(src_surface, &data, src_surface->resource.locations); -@@ -1827,7 +1809,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte +@@ -1840,7 +1822,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte } TRACE("Reloading because surface is dirty.\n"); @@ -151,7 +151,7 @@ index 0b1716e..c0f7479 100644 surface_evict_sysmem(surface); } -@@ -2716,7 +2698,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2729,7 +2711,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 0b1716e..c0f7479 100644 if (context) context_release(context); } -@@ -2821,7 +2803,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2834,7 +2816,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) { if (surface->flags & SFLAG_CLIENT) { @@ -169,7 +169,7 @@ index 0b1716e..c0f7479 100644 surface_release_client_storage(surface); } hr = surface_create_dib_section(surface); -@@ -2837,7 +2819,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2850,7 +2832,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) surface->resource.map_binding = WINED3D_LOCATION_DIB; } @@ -178,7 +178,7 @@ index 0b1716e..c0f7479 100644 wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB); if (context) -@@ -2886,7 +2868,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) +@@ -2899,7 +2881,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 0b1716e..c0f7479 100644 wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB); if (context) context_release(context); -@@ -3523,8 +3505,8 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, +@@ -3536,8 +3518,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 0b1716e..c0f7479 100644 wined3d_texture_load(src_surface->container, context, FALSE); /* Activate the destination context, set it up for blitting */ -@@ -3960,29 +3942,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3957,29 +3939,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 0b1716e..c0f7479 100644 static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD location) { struct wined3d_device *device = surface->resource.device; -@@ -4032,7 +3991,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -4029,7 +3988,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 0b1716e..c0f7479 100644 /* Download the surface to system memory. */ if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) -@@ -4068,7 +4027,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, +@@ -4065,7 +4024,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, } surface_get_rect(surface, NULL, &r); @@ -246,7 +246,7 @@ index 0b1716e..c0f7479 100644 surface_blt_to_drawable(surface->resource.device, context, WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r); -@@ -4141,7 +4100,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4138,7 +4097,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 0b1716e..c0f7479 100644 } } else -@@ -4152,7 +4111,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4149,7 +4108,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 0b1716e..c0f7479 100644 } } -@@ -4161,7 +4120,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4158,7 +4117,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 0b1716e..c0f7479 100644 } wined3d_texture_prepare_texture(texture, context, srgb); -@@ -4187,7 +4146,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4184,7 +4143,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; surface_prepare_map_memory(surface); @@ -282,8 +282,8 @@ index 0b1716e..c0f7479 100644 surface_remove_pbo(surface, gl_info); } -@@ -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); +@@ -4259,9 +4218,11 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi + surface, src_location, &rect, surface, dst_location, &rect); } -/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */ @@ -296,7 +296,7 @@ index 0b1716e..c0f7479 100644 HRESULT hr; TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); -@@ -4284,20 +4245,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4288,20 +4249,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte } } @@ -317,7 +317,7 @@ index 0b1716e..c0f7479 100644 if (!surface->resource.locations) { ERR("Surface %p does not have any up to date location.\n", surface); -@@ -5447,7 +5394,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5452,7 +5399,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 0b1716e..c0f7479 100644 context_release(context); } return WINED3D_OK; -@@ -5520,6 +5468,17 @@ cpu: +@@ -5525,6 +5473,17 @@ cpu: return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter); } @@ -398,18 +398,18 @@ index 2a183e8..29c7eec 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 3a6309c..ff547d3 100644 +index 031e684..879d5f0 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, +@@ -2466,8 +2466,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; -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 surface_prepare_rb(struct wined3d_surface *surface, - const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN; + void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, + DWORD location) DECLSPEC_HIDDEN; -- 2.6.2 diff --git a/patches/wined3d-CSMT_Main/0022-wined3d-Discard-implicit-surfaces-on-unload.patch b/patches/wined3d-CSMT_Main/0022-wined3d-Discard-implicit-surfaces-on-unload.patch index 109a32fe..5f5fbe4c 100644 --- a/patches/wined3d-CSMT_Main/0022-wined3d-Discard-implicit-surfaces-on-unload.patch +++ b/patches/wined3d-CSMT_Main/0022-wined3d-Discard-implicit-surfaces-on-unload.patch @@ -1,17 +1,17 @@ -From 50e46931f38887d0164033482e502f90ef806ffd Mon Sep 17 00:00:00 2001 +From 5a18a8e392bd8e65126b384670e94297b6095aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 4 Jan 2014 13:20:25 +0100 Subject: wined3d: Discard implicit surfaces on unload. --- - dlls/wined3d/surface.c | 13 +++---------- - 1 file changed, 3 insertions(+), 10 deletions(-) + dlls/wined3d/surface.c | 21 +++------------------ + 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 4a7e982..29f4563 100644 +index 38af18c..5d97899 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -1190,16 +1190,9 @@ static void surface_unload(struct wined3d_resource *resource) +@@ -1124,24 +1124,9 @@ static void surface_unload(struct wined3d_resource *resource) /* Default pool resources are supposed to be destroyed before Reset is called. * Implicit resources stay however. So this means we have an implicit render target * or depth stencil. The content may be destroyed, but we still have to tear down @@ -21,10 +21,18 @@ index 4a7e982..29f4563 100644 - * but we can't set the sysmem INDRAWABLE because when we're rendering the swapchain - * or the depth stencil into an FBO the texture or render buffer will be removed - * and all flags get lost */ -- surface_prepare_system_memory(surface); -- memset(surface->resource.heap_memory, 0, surface->resource.size); -- wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_SYSMEM); -- wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_SYSMEM); +- if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL) +- { +- wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DISCARDED); +- wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DISCARDED); +- } +- else +- { +- surface_prepare_system_memory(surface); +- memset(surface->resource.heap_memory, 0, surface->resource.size); +- wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_SYSMEM); +- wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_SYSMEM); +- } + * opengl resources, so we cannot leave early. */ + wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DISCARDED); + wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DISCARDED); @@ -32,5 +40,5 @@ index 4a7e982..29f4563 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 -- -2.1.3 +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 4a40d2e2..3ce4963c 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 8831f7064e0757addb08763c263bf7498f8a6f43 Mon Sep 17 00:00:00 2001 +From 68280056e300f90beae6bac338aa94ebacaa4bfc 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 a9d6664..9f8397f 100644 +index 6d08df9..104172f 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1513,6 +1513,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1506,6 +1506,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } @@ -58,7 +58,7 @@ index a9d6664..9f8397f 100644 /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -1840,6 +1846,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1833,6 +1839,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 a9d6664..9f8397f 100644 HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -1874,6 +1881,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont +@@ -1867,6 +1874,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 a9d6664..9f8397f 100644 HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2385,7 +2393,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2378,7 +2386,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 a9d6664..9f8397f 100644 || rt_count != context->gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2430,6 +2438,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2423,6 +2431,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 a9d6664..9f8397f 100644 } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2480,7 +2490,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2473,7 +2483,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 a9d6664..9f8397f 100644 struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2510,7 +2520,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2503,7 +2513,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 a9d6664..9f8397f 100644 DWORD rt_mask = find_draw_buffers_mask(context, device); DWORD *cur_mask; -@@ -2542,6 +2552,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat +@@ -2535,6 +2545,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 a9d6664..9f8397f 100644 } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -3166,7 +3178,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de +@@ -3159,7 +3171,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 1dc934d..d05ff2d 100644 +index a5c1e59..42c5d14 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -860,7 +860,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi +@@ -865,7 +865,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 1dc934d..d05ff2d 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -878,7 +878,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -883,7 +883,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 1dc934d..d05ff2d 100644 struct wined3d_swapchain *swapchain = NULL; struct wined3d_context *context; DWORD clear_flags = 0; -@@ -891,9 +890,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -896,9 +895,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 1dc934d..d05ff2d 100644 if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -981,7 +977,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -986,7 +982,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, return WINED3D_OK; err_out: @@ -243,7 +243,7 @@ index 1dc934d..d05ff2d 100644 HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -1060,8 +1055,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1065,8 +1060,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 1dc934d..d05ff2d 100644 /* Unload resources */ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { -@@ -1092,37 +1104,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1097,37 +1109,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) * destroy the context. */ context_release(context); @@ -307,7 +307,7 @@ index 1dc934d..d05ff2d 100644 if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1140,9 +1121,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1145,9 +1126,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->swapchains = NULL; device->swapchain_count = 0; @@ -317,7 +317,7 @@ index 1dc934d..d05ff2d 100644 device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1938,7 +1916,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -1943,7 +1921,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 1dc934d..d05ff2d 100644 return; wined3d_surface_blt(surface, NULL, depth_stencil, NULL, 0, NULL, WINED3D_TEXF_POINT); -@@ -3293,6 +3271,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3298,6 +3276,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 1dc934d..d05ff2d 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); -@@ -3304,7 +3284,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3309,7 +3289,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -344,7 +344,7 @@ index 1dc934d..d05ff2d 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3313,8 +3293,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3318,8 +3298,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -355,7 +355,7 @@ index 1dc934d..d05ff2d 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3677,8 +3657,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3682,8 +3662,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 1dc934d..d05ff2d 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4060,20 +4040,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4065,20 +4045,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -390,7 +390,7 @@ index 1dc934d..d05ff2d 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4113,13 +4094,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4118,13 +4099,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -406,7 +406,7 @@ index 1dc934d..d05ff2d 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. */ -@@ -4131,18 +4112,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4136,18 +4117,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 1dc934d..d05ff2d 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4506,10 +4488,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4511,10 +4493,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 1dc934d..d05ff2d 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4518,6 +4499,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4523,6 +4504,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -452,7 +452,7 @@ index 1dc934d..d05ff2d 100644 if (device->onscreen_depth_stencil) { wined3d_texture_decref(device->onscreen_depth_stencil->container); -@@ -4736,7 +4722,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4741,7 +4727,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -461,7 +461,7 @@ index 1dc934d..d05ff2d 100644 &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); device->update_state = &device->state; -@@ -4745,22 +4731,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4750,22 +4736,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } else if (device->back_buffer_view) { @@ -489,7 +489,7 @@ index 1dc934d..d05ff2d 100644 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4848,17 +4833,17 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -4853,17 +4838,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 1dc934d..d05ff2d 100644 } } break; -@@ -5021,7 +5006,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5026,7 +5011,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -521,7 +521,7 @@ index 1dc934d..d05ff2d 100644 { ERR("Failed to initialize device state, hr %#x.\n", hr); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 0e1f4ec..17054c1 100644 +index 4b01b7d..7e3a7f7 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 0e1f4ec..17054c1 100644 if (!context->valid) { context_release(context); -@@ -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) +@@ -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) { -- 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 + if (state->render_states[WINED3D_RS_COLORWRITEENABLE]) +@@ -637,16 +637,16 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co } } @@ -557,14 +557,12 @@ index 0e1f4ec..17054c1 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]) { -- 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 +@@ -679,9 +679,9 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co return; } @@ -790,10 +788,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 f2494b8..a8c48be 100644 +index de8d6dc..db36a59 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3278,8 +3278,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -3283,8 +3283,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; @@ -839,7 +837,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 40e806a..41b14bd 100644 +index 720eb3a..6a10ad7 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1149,6 +1149,36 @@ struct wined3d_timestamp_query @@ -917,7 +915,7 @@ index 40e806a..41b14bd 100644 struct wined3d_surface *onscreen_depth_stencil; struct wined3d_rendertarget_view *auto_depth_stencil_view; -@@ -2606,9 +2630,8 @@ struct wined3d_stateblock +@@ -2608,9 +2632,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -929,7 +927,7 @@ index 40e806a..41b14bd 100644 void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; struct wined3d_cs_ops -@@ -2621,7 +2644,6 @@ struct wined3d_cs +@@ -2623,7 +2646,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 6db93fc3..97692726 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 b8968006147a8c5708e737055655b0360643dd81 Mon Sep 17 00:00:00 2001 +From 78e1e4771d85128087e911b9a0ad81998fb98096 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 7adfb28..55c972b 100644 +index 6fff047..4f4827f 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 7adfb28..55c972b 100644 * If we want that stuff to work on big endian machines too we have to consider more things * * 0xff000000: Alpha mask -@@ -1230,11 +1230,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1190,11 +1190,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 7adfb28..55c972b 100644 */ if (!gl_info->supported[ARB_VERTEX_BUFFER_OBJECT]) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 474af3b..f21c81d 100644 +index c1b6e01..d9e2bc1 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -2999,7 +2999,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st +@@ -2992,7 +2992,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 474af3b..f21c81d 100644 context->use_immediate_mode_draw = TRUE; } else -@@ -3174,9 +3174,9 @@ static void context_bind_shader_resources(struct wined3d_context *context, const +@@ -3167,9 +3167,9 @@ static void context_bind_shader_resources(struct wined3d_context *context, const } /* Context activation is done by the caller. */ @@ -67,7 +67,7 @@ index 474af3b..f21c81d 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 7fdfb9b..680e2bc 100644 +index 784de6e..d14fd82 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 7fdfb9b..680e2bc 100644 return sizeof(*op); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c -index a7329e7..1892dec 100644 +index d7f0512..71688a5 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c -@@ -5486,7 +5486,7 @@ static void WINE_GLAPI invalid_texcoord_func(GLenum unit, const void *data) +@@ -5503,7 +5503,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 a7329e7..1892dec 100644 static void WINE_GLAPI position_d3dcolor(const void *data) { diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index d39bf28..b682088 100644 +index af51dfd..bfbdf8c 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 d39bf28..b682088 100644 const struct wined3d_stream_info *stream_info; struct wined3d_event_query *ib_query = NULL; struct wined3d_stream_info si_emulated; -@@ -664,7 +663,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co - } +@@ -672,7 +671,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co + wined3d_surface_prepare(ds, context, location); } - if (!context_apply_draw_state(context, device)) @@ -163,7 +163,7 @@ index d39bf28..b682088 100644 { context_release(context); WARN("Unable to apply draw state, skipping draw.\n"); -@@ -756,28 +755,28 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co +@@ -764,28 +763,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 32519eb..04c6dc6 100644 +index 81af9d5..64e6d6a 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 32519eb..04c6dc6 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 e11e11a..076fe88 100644 +index 2667936..2467c22 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 e11e11a..076fe88 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.2 +2.6.1 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 65dfc5eb..5d31c349 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 610e06aa206c46a868c373e485adde24638727d9 Mon Sep 17 00:00:00 2001 +From 8842cf6a7d2b87f69462e5fe513f51bc127a8140 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 99e68d0..6360275 100644 +index 1fef5ff..4de7eb2 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 99e68d0..6360275 100644 static BOOL is_full_clear(const struct wined3d_surface *target, const RECT *draw_rect, const RECT *clear_rect) { /* partial draw rect */ -@@ -343,8 +327,8 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c +@@ -348,8 +332,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 99e68d0..6360275 100644 prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect, &ds_rect); } -@@ -1059,11 +1043,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1064,11 +1048,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 99e68d0..6360275 100644 wined3d_texture_decref(surface->container); } -@@ -4556,10 +4541,10 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4561,10 +4546,10 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, state_unbind_resources(&device->state); } @@ -133,11 +133,11 @@ index 99e68d0..6360275 100644 if (reset_state) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 03095e0..bfdf814 100644 +index 21ce53a..9ec380a 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -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); +@@ -651,8 +651,8 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s + { 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 5e5d900..4050489 100644 +index dec58e5..035517f 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 5e5d900..4050489 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) -@@ -2665,6 +2660,7 @@ struct wined3d_cs +@@ -2667,6 +2662,7 @@ struct wined3d_cs struct wined3d_state state; HANDLE thread; DWORD tls_idx; @@ -203,7 +203,7 @@ index 5e5d900..4050489 100644 size_t data_size; void *data; -@@ -2675,6 +2671,8 @@ struct wined3d_cs +@@ -2677,6 +2673,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 ac812de1..181ddef8 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 -@@ -1455,6 +1455,7 @@ +@@ -1448,6 +1448,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; -@@ -1463,6 +1464,7 @@ +@@ -1456,6 +1457,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) { -@@ -1786,7 +1788,9 @@ +@@ -1779,7 +1781,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); -@@ -1821,7 +1825,9 @@ +@@ -1814,7 +1818,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); -@@ -2241,6 +2247,7 @@ +@@ -2234,6 +2240,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); -@@ -2255,6 +2262,22 @@ +@@ -2248,6 +2255,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. */ -@@ -2286,7 +2309,11 @@ +@@ -2279,7 +2302,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; -@@ -2333,7 +2360,11 @@ +@@ -2326,7 +2353,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)) -@@ -2375,11 +2406,17 @@ +@@ -2368,11 +2399,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))) -@@ -2392,7 +2429,11 @@ +@@ -2385,7 +2422,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); } -@@ -2427,6 +2468,7 @@ +@@ -2420,6 +2461,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; -@@ -2436,6 +2478,18 @@ +@@ -2429,6 +2471,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])); -@@ -2458,8 +2512,14 @@ +@@ -2451,8 +2505,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) -@@ -2490,8 +2550,10 @@ +@@ -2483,8 +2543,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) -@@ -2738,12 +2800,22 @@ +@@ -2731,12 +2793,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); -@@ -2945,7 +3017,11 @@ +@@ -2938,7 +3010,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 -@@ -3120,11 +3196,19 @@ +@@ -3113,11 +3189,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; -@@ -3157,12 +3241,17 @@ +@@ -3150,12 +3234,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) { -@@ -3257,7 +3346,11 @@ +@@ -3250,7 +3339,11 @@ if (texture->texture_srgb.name) wined3d_texture_load(texture, context, TRUE); wined3d_texture_load(texture, context, FALSE); @@ -2113,8 +2113,8 @@ 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 surface_prepare_rb(struct wined3d_surface *surface, - const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN; + void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, + DWORD location) DECLSPEC_HIDDEN; @@ -2557,6 +2720,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, @@ -2996,28 +2996,43 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c if (!context->valid) { context_release(context); -@@ -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) - { +@@ -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) + struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(state->fb.render_targets[i]); + if (target && target->resource.format->id != WINED3DFMT_NULL) + { +@@ -628,6 +659,15 @@ { -@@ -651,6 +682,35 @@ + 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 @@ 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 @@ -3027,9 +3042,10 @@ 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) @@ -3040,15 +3056,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); -@@ -663,6 +723,7 @@ - } +@@ -671,6 +733,7 @@ + wined3d_surface_prepare(ds, context, location); } +#if defined(STAGING_CSMT) if (!context_apply_draw_state(context, device, state)) { context_release(context); -@@ -673,6 +734,18 @@ +@@ -681,6 +744,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); @@ -3067,7 +3083,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); -@@ -755,6 +828,7 @@ +@@ -763,6 +838,7 @@ else WARN_(d3d_perf)("Using immediate mode with vertex shaders for half float emulation.\n"); @@ -3075,7 +3091,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); } -@@ -777,6 +851,30 @@ +@@ -785,6 +861,30 @@ else { draw_strided_fast(gl_info, state->gl_primitive_type, index_count, idx_size, idx_data, @@ -3159,18 +3175,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) { - struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); - if (rt) + if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, clear_rect)) +#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); } - } - -@@ -327,8 +357,13 @@ +@@ -332,8 +362,13 @@ { DWORD location = render_offscreen ? fb->depth_stencil->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; @@ -3184,7 +3200,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); } -@@ -376,8 +411,13 @@ +@@ -381,8 +416,13 @@ if (rt) { @@ -3198,7 +3214,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } -@@ -617,7 +657,11 @@ +@@ -622,7 +662,11 @@ } /* Context activation is done by the caller. */ @@ -3210,7 +3226,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; -@@ -844,7 +888,11 @@ +@@ -849,7 +893,11 @@ BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil; unsigned int i; @@ -3222,7 +3238,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -862,7 +910,13 @@ +@@ -867,7 +915,13 @@ struct wined3d_swapchain_desc *swapchain_desc) { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -3236,7 +3252,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c DWORD clear_flags = 0; HRESULT hr; -@@ -873,6 +927,11 @@ +@@ -878,6 +932,11 @@ if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; @@ -3248,7 +3264,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))) { -@@ -913,7 +972,14 @@ +@@ -918,7 +977,14 @@ device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); @@ -3263,7 +3279,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->contexts[0]->last_was_rhw = 0; -@@ -925,7 +991,11 @@ +@@ -930,7 +996,11 @@ case ORM_BACKBUFFER: { @@ -3275,7 +3291,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; -@@ -937,9 +1007,16 @@ +@@ -942,9 +1012,16 @@ } } } @@ -3292,7 +3308,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Clear the screen */ if (swapchain->back_buffers && swapchain->back_buffers[0]) -@@ -956,6 +1033,9 @@ +@@ -961,6 +1038,9 @@ return WINED3D_OK; err_out: @@ -3302,7 +3318,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) -@@ -1013,6 +1093,10 @@ +@@ -1018,6 +1098,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) { struct wined3d_resource *resource, *cursor; @@ -3313,7 +3329,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_surface *surface; UINT i; -@@ -1021,6 +1105,7 @@ +@@ -1026,6 +1110,7 @@ if (!device->d3d_initialized) return WINED3DERR_INVALIDCALL; @@ -3321,7 +3337,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) device->cs->ops->finish(device->cs); -@@ -1059,6 +1144,82 @@ +@@ -1064,6 +1149,82 @@ /* FIXME: Is this in the right place??? */ wined3d_cs_emit_delete_opengl_contexts(device->cs, device->swapchains[0]); @@ -3404,7 +3420,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); -@@ -1076,6 +1237,11 @@ +@@ -1081,6 +1242,11 @@ device->swapchains = NULL; device->swapchain_count = 0; @@ -3416,7 +3432,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1462,6 +1628,16 @@ +@@ -1467,6 +1633,16 @@ TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", light->range, light->falloff, light->theta, light->phi); @@ -3433,7 +3449,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Save away the information. */ object->OriginalParms = *light; -@@ -1541,9 +1717,11 @@ +@@ -1546,9 +1722,11 @@ FIXME("Unrecognized light type %#x.\n", light->type); } @@ -3445,7 +3461,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1616,6 +1794,14 @@ +@@ -1621,6 +1799,14 @@ { if (light_info->glIndex != -1) { @@ -3460,7 +3476,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; } -@@ -1657,11 +1843,23 @@ +@@ -1662,11 +1848,23 @@ WARN("Too many concurrently active lights\n"); return WINED3D_OK; } @@ -3484,7 +3500,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1836,9 +2034,11 @@ +@@ -1841,9 +2039,11 @@ TRACE("device %p, base_index %d.\n", device, base_index); device->update_state->base_vertex_index = base_index; @@ -3496,7 +3512,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) -@@ -1883,7 +2083,11 @@ +@@ -1888,7 +2088,11 @@ || !(texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; surface = surface_from_resource(texture->sub_resources[0]); @@ -3508,7 +3524,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); -@@ -2203,7 +2407,11 @@ +@@ -2208,7 +2412,11 @@ return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx]; } @@ -3520,7 +3536,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { UINT i; -@@ -2236,8 +2444,12 @@ +@@ -2241,8 +2449,12 @@ } else { @@ -3533,7 +3549,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2284,8 +2496,12 @@ +@@ -2289,8 +2501,12 @@ } else { @@ -3546,7 +3562,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2336,8 +2552,13 @@ +@@ -2341,8 +2557,13 @@ memset(device->recording->changed.vertexShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.vertexShaderConstantsF) * vector4f_count); else @@ -3560,7 +3576,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2472,8 +2693,12 @@ +@@ -2477,8 +2698,12 @@ } else { @@ -3573,7 +3589,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2520,8 +2745,12 @@ +@@ -2525,8 +2750,12 @@ } else { @@ -3586,7 +3602,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2573,8 +2802,12 @@ +@@ -2578,8 +2807,12 @@ memset(device->recording->changed.pixelShaderConstantsF + start_register, 1, sizeof(*device->recording->changed.pixelShaderConstantsF) * vector4f_count); else @@ -3599,7 +3615,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2734,6 +2967,7 @@ +@@ -2739,6 +2972,7 @@ return hr; } @@ -3607,7 +3623,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) { FIXME("Waiting for cs.\n"); -@@ -2741,6 +2975,7 @@ +@@ -2746,6 +2980,7 @@ device->cs->ops->finish(device->cs); } @@ -3615,7 +3631,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); -@@ -3226,6 +3461,10 @@ +@@ -3231,6 +3466,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -3626,7 +3642,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3234,6 +3473,15 @@ +@@ -3239,6 +3478,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3642,7 +3658,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3241,8 +3489,10 @@ +@@ -3246,8 +3494,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) { @@ -3653,7 +3669,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); -@@ -3251,12 +3501,19 @@ +@@ -3256,12 +3506,19 @@ WARN("Rects is %p, but rect_count is 0, ignoring clear\n", rects); return WINED3D_OK; } @@ -3673,7 +3689,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"); -@@ -3265,8 +3522,13 @@ +@@ -3270,8 +3527,13 @@ } else if (flags & WINED3DCLEAR_TARGET) { @@ -3687,7 +3703,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; -@@ -3312,6 +3574,9 @@ +@@ -3317,6 +3579,9 @@ enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -3697,7 +3713,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); -@@ -3319,8 +3584,13 @@ +@@ -3324,8 +3589,13 @@ device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -3711,7 +3727,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, -@@ -3343,6 +3613,14 @@ +@@ -3348,6 +3618,14 @@ return WINED3DERR_INVALIDCALL; } @@ -3726,7 +3742,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; -@@ -3359,6 +3637,10 @@ +@@ -3364,6 +3642,10 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { @@ -3737,7 +3753,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) -@@ -3377,6 +3659,15 @@ +@@ -3382,6 +3664,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3753,7 +3769,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; -@@ -3392,6 +3683,7 @@ +@@ -3397,6 +3688,7 @@ } /* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */ @@ -3761,7 +3777,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) { -@@ -3428,6 +3720,88 @@ +@@ -3433,6 +3725,88 @@ { enum wined3d_resource_type type = src_texture->resource.type; unsigned int level_count, i, j, src_size, dst_size, src_skip_levels = 0; @@ -3850,7 +3866,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)); -@@ -3446,7 +3820,13 @@ +@@ -3451,7 +3825,13 @@ } /* Make sure that the destination texture is loaded. */ @@ -3864,7 +3880,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Update every surface level of the texture. */ switch (type) -@@ -3461,7 +3841,16 @@ +@@ -3466,7 +3846,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)); @@ -3881,7 +3897,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } break; } -@@ -3481,7 +3870,16 @@ +@@ -3486,7 +3875,16 @@ i * src_levels + j + src_skip_levels)); dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i * dst_levels + j)); @@ -3898,7 +3914,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } break; -@@ -3491,6 +3889,7 @@ +@@ -3496,6 +3894,7 @@ { for (i = 0; i < level_count; ++i) { @@ -3906,7 +3922,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)), -@@ -3544,6 +3943,25 @@ +@@ -3549,6 +3948,25 @@ } wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture); @@ -3932,7 +3948,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -3593,8 +4011,13 @@ +@@ -3598,8 +4016,13 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -3946,7 +3962,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3693,6 +4116,7 @@ +@@ -3698,6 +4121,7 @@ struct wined3d_surface *src_surface, const RECT *src_rect, struct wined3d_surface *dst_surface, const POINT *dst_point) { @@ -3954,7 +3970,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; -@@ -3700,6 +4124,7 @@ +@@ -3705,6 +4129,7 @@ RECT r, dst_rect; POINT p; @@ -3962,7 +3978,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)); -@@ -3711,6 +4136,7 @@ +@@ -3716,6 +4141,7 @@ return WINED3DERR_INVALIDCALL; } @@ -3970,7 +3986,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"); -@@ -3775,6 +4201,9 @@ +@@ -3780,6 +4206,9 @@ wined3d_cs_emit_update_surface(device->cs, src_surface, src_rect, dst_surface, dst_point); return WINED3D_OK; @@ -3980,7 +3996,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_copy_resource(struct wined3d_device *device, -@@ -3929,7 +4358,17 @@ +@@ -3934,7 +4363,17 @@ unsigned int depth_pitch) { struct wined3d_resource *sub_resource; @@ -3998,7 +4014,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); -@@ -3946,7 +4385,14 @@ +@@ -3951,7 +4390,14 @@ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -4013,7 +4029,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 -@@ -3956,9 +4402,47 @@ +@@ -3961,9 +4407,47 @@ box->left, box->top, box->front, box->right, box->bottom, box->back); return; } @@ -4061,7 +4077,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -3989,8 +4473,14 @@ +@@ -3994,8 +4478,14 @@ rect = &r; } @@ -4076,7 +4092,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, -@@ -4004,6 +4494,7 @@ +@@ -4009,6 +4499,7 @@ return NULL; } @@ -4084,7 +4100,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -4019,6 +4510,22 @@ +@@ -4024,6 +4515,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -4107,7 +4123,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); -@@ -4058,6 +4565,7 @@ +@@ -4063,6 +4570,7 @@ } @@ -4115,7 +4131,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; -@@ -4065,6 +4573,15 @@ +@@ -4070,6 +4578,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -4131,7 +4147,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. */ -@@ -4076,6 +4593,7 @@ +@@ -4081,6 +4598,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4139,7 +4155,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; -@@ -4093,6 +4611,66 @@ +@@ -4098,6 +4616,66 @@ wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) wined3d_rendertarget_view_decref(prev); @@ -4206,7 +4222,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device, -@@ -4113,6 +4691,14 @@ +@@ -4118,6 +4696,14 @@ cursor_image = surface_from_resource(sub_resource); @@ -4221,7 +4237,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", -@@ -4140,6 +4726,13 @@ +@@ -4145,6 +4731,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. */ @@ -4235,7 +4251,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (cursor_image->resource.width == 32 && cursor_image->resource.height == 32) { -@@ -4244,6 +4837,12 @@ +@@ -4249,6 +4842,12 @@ else SetCursor(NULL); } @@ -4248,7 +4264,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return oldVisible; } -@@ -4254,8 +4853,10 @@ +@@ -4259,8 +4858,10 @@ TRACE("device %p.\n", device); @@ -4259,7 +4275,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); -@@ -4263,6 +4864,7 @@ +@@ -4268,6 +4869,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -4267,7 +4283,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4281,6 +4883,37 @@ +@@ -4286,6 +4888,37 @@ context = context_acquire(device, NULL); gl_info = context->gl_info; @@ -4305,7 +4321,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4301,6 +4934,7 @@ +@@ -4306,6 +4939,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4313,7 +4329,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4320,6 +4954,14 @@ +@@ -4325,6 +4959,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -4328,7 +4344,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, -@@ -4336,6 +4978,7 @@ +@@ -4341,6 +4983,7 @@ return hr; } @@ -4336,7 +4352,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)) { -@@ -4346,6 +4989,34 @@ +@@ -4351,6 +4994,34 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -4371,7 +4387,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4364,9 +5035,11 @@ +@@ -4369,9 +5040,11 @@ TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -4383,7 +4399,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"); -@@ -4381,9 +5054,21 @@ +@@ -4386,9 +5059,21 @@ wined3d_texture_decref(device->logo_texture); device->logo_texture = NULL; } @@ -4405,7 +4421,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4392,6 +5077,7 @@ +@@ -4397,6 +5082,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4413,7 +4429,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4401,6 +5087,12 @@ +@@ -4406,6 +5092,12 @@ { wined3d_texture_decref(device->cs->onscreen_depth_stencil->container); device->cs->onscreen_depth_stencil = NULL; @@ -4426,7 +4442,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4413,6 +5105,7 @@ +@@ -4418,6 +5110,7 @@ } } @@ -4434,7 +4450,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 -@@ -4434,6 +5127,7 @@ +@@ -4439,6 +5132,7 @@ } device->cs->ops->finish(device->cs); @@ -4442,7 +4458,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); -@@ -4560,6 +5254,13 @@ +@@ -4565,6 +5259,13 @@ swapchain_desc->multisample_type, swapchain_desc->multisample_quality))) return hr; @@ -4456,7 +4472,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; -@@ -4602,6 +5303,13 @@ +@@ -4607,6 +5308,13 @@ wined3d_device_set_depth_stencil_view(device, device->auto_depth_stencil_view); } @@ -4470,7 +4486,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))) -@@ -4622,12 +5330,20 @@ +@@ -4627,12 +5335,20 @@ } wined3d_cs_emit_reset_state(device->cs); state_cleanup(&device->state); @@ -4491,7 +4507,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; -@@ -4636,6 +5352,7 @@ +@@ -4641,6 +5357,7 @@ } else if (device->back_buffer_view) { @@ -4499,7 +4515,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); -@@ -4651,6 +5368,24 @@ +@@ -4656,6 +5373,24 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; @@ -4524,7 +4540,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4726,6 +5461,10 @@ +@@ -4731,6 +5466,10 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -4535,7 +4551,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c switch (type) { case WINED3D_RTYPE_SURFACE: -@@ -4736,6 +5475,7 @@ +@@ -4741,6 +5480,7 @@ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4543,7 +4559,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); -@@ -4747,6 +5487,19 @@ +@@ -4752,6 +5492,19 @@ { ERR("Surface %p is still in use as depth/stencil buffer.\n", surface); device->state.fb.depth_stencil = NULL; @@ -4563,7 +4579,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } break; -@@ -4909,7 +5662,11 @@ +@@ -4914,7 +5667,11 @@ device->blitter = adapter->blitter; @@ -4575,7 +4591,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); -@@ -5008,6 +5765,7 @@ +@@ -5013,6 +5770,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -4583,7 +4599,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, -@@ -5061,3 +5819,4 @@ +@@ -5066,3 +5824,4 @@ wined3d_device_destroy_bo(device, context, bo); } @@ -6828,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, context, dst_location); +#endif /* STAGING_CSMT */ + else + wined3d_surface_prepare(dst_surface, context, dst_location); - gl_info = context->gl_info; - -@@ -760,9 +1012,15 @@ +@@ -762,9 +1014,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.) */ @@ -6844,10 +6860,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); - 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 @@ +@@ -956,6 +1214,18 @@ return WINED3D_OK; } @@ -6866,7 +6882,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)); -@@ -976,12 +1246,28 @@ +@@ -981,12 +1251,36 @@ if (resource->pool == WINED3D_POOL_DEFAULT) { @@ -6887,15 +6903,23 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + * but we can't set the sysmem INDRAWABLE because when we're rendering the swapchain + * or the depth stencil into an FBO the texture or render buffer will be removed + * and all flags get lost */ -+ surface_prepare_system_memory(surface); -+ memset(surface->resource.heap_memory, 0, surface->resource.size); -+ surface_validate_location(surface, WINED3D_LOCATION_SYSMEM); -+ surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM); ++ if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL) ++ { ++ surface_validate_location(surface, WINED3D_LOCATION_DISCARDED); ++ surface_invalidate_location(surface, ~WINED3D_LOCATION_DISCARDED); ++ } ++ else ++ { ++ surface_prepare_system_memory(surface); ++ memset(surface->resource.heap_memory, 0, surface->resource.size); ++ surface_validate_location(surface, WINED3D_LOCATION_SYSMEM); ++ surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM); ++ } +#endif /* STAGING_CSMT */ /* 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 -@@ -991,10 +1277,21 @@ +@@ -996,10 +1290,21 @@ } else { @@ -6917,7 +6941,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 -@@ -1038,6 +1335,7 @@ +@@ -1043,6 +1348,7 @@ return WINED3DERR_INVALIDCALL; } @@ -6925,7 +6949,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); -@@ -1053,6 +1351,21 @@ +@@ -1058,6 +1364,21 @@ { surface_private_setup, surface_frontbuffer_updated, @@ -6947,7 +6971,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c }; /***************************************************************************** -@@ -1096,6 +1409,7 @@ +@@ -1101,6 +1422,7 @@ return WINED3D_OK; } @@ -6955,7 +6979,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); -@@ -1105,6 +1419,23 @@ +@@ -1110,6 +1432,23 @@ { gdi_surface_private_setup, gdi_surface_frontbuffer_updated, @@ -6979,7 +7003,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 -@@ -1123,7 +1454,11 @@ +@@ -1128,7 +1467,11 @@ return; } @@ -6991,7 +7015,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface->container->resource.format_flags & WINED3DFMT_FLAG_COMPRESSED) { -@@ -1151,6 +1486,7 @@ +@@ -1156,6 +1499,7 @@ void *mem; GLenum gl_format = format->glFormat; GLenum gl_type = format->glType; @@ -6999,7 +7023,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c UINT src_pitch = 0; UINT dst_row_pitch, dst_slice_pitch; -@@ -1159,6 +1495,16 @@ +@@ -1164,6 +1508,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); @@ -7016,7 +7040,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); } -@@ -1245,12 +1591,21 @@ +@@ -1250,12 +1604,21 @@ * won't be released, and doesn't have to be re-read. */ src_data = mem; dst_data = data.addr; @@ -7038,7 +7062,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HeapFree(GetProcessHeap(), 0, mem); -@@ -1374,10 +1729,33 @@ +@@ -1379,10 +1742,33 @@ static BOOL surface_check_block_align(struct wined3d_surface *surface, const struct wined3d_box *box) { @@ -7072,7 +7096,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}; -@@ -1396,7 +1774,11 @@ +@@ -1401,7 +1787,11 @@ UINT update_w, update_h; UINT dst_w, dst_h; RECT r, dst_rect; @@ -7084,7 +7108,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", -@@ -1467,11 +1849,17 @@ +@@ -1472,11 +1862,17 @@ return WINED3DERR_INVALIDCALL; } @@ -7102,7 +7126,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; -@@ -1482,6 +1870,7 @@ +@@ -1487,6 +1883,7 @@ if (update_w == dst_w && update_h == dst_h) wined3d_texture_prepare_texture(dst_surface->container, context, FALSE); else @@ -7110,7 +7134,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); -@@ -1495,6 +1884,21 @@ +@@ -1500,6 +1897,21 @@ wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB); wined3d_resource_invalidate_location(&dst_surface->resource, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -7132,7 +7156,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -1608,6 +2012,7 @@ +@@ -1613,6 +2025,7 @@ if (surface->resource.pool == WINED3D_POOL_SCRATCH) ERR("Not supported on scratch surfaces.\n"); @@ -7140,7 +7164,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"); -@@ -1616,6 +2021,16 @@ +@@ -1621,6 +2034,16 @@ TRACE("Reloading because surface is dirty.\n"); wined3d_resource_load_location(&surface->resource, context, location); @@ -7157,7 +7181,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_evict_sysmem(surface); } -@@ -1698,6 +2113,7 @@ +@@ -1703,6 +2126,7 @@ void CDECL wined3d_surface_preload(struct wined3d_surface *surface) { @@ -7165,7 +7189,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); -@@ -1708,6 +2124,17 @@ +@@ -1713,6 +2137,17 @@ } wined3d_cs_emit_surface_preload(device->cs, surface); @@ -7183,7 +7207,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface) -@@ -1742,10 +2169,28 @@ +@@ -1747,10 +2182,28 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface) { @@ -7212,7 +7236,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) -@@ -1870,6 +2315,7 @@ +@@ -1875,6 +2328,7 @@ { DeleteDC(surface->hDC); DeleteObject(surface->dib.DIBsection); @@ -7220,7 +7244,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; -@@ -1878,6 +2324,15 @@ +@@ -1883,6 +2337,15 @@ surface->resource.locations = 0; wined3d_resource_free_sysmem(&surface->resource); surface->resource.map_heap_memory = NULL; @@ -7236,7 +7260,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c width = texture_resource->width; height = texture_resource->height; -@@ -1903,6 +2358,7 @@ +@@ -1908,6 +2371,7 @@ else surface->flags &= ~SFLAG_NONPOW2; @@ -7244,7 +7268,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; -@@ -1923,6 +2379,27 @@ +@@ -1928,6 +2392,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); @@ -7272,7 +7296,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* The format might be changed to a format that needs conversion. -@@ -1945,11 +2422,19 @@ +@@ -1950,11 +2435,19 @@ if (!valid_location) { @@ -7292,7 +7316,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -2308,6 +2793,7 @@ +@@ -2313,6 +2806,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_surface *source, enum wined3d_format_id to_fmt) { @@ -7300,7 +7324,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; -@@ -2316,6 +2802,13 @@ +@@ -2321,6 +2815,13 @@ struct wined3d_surface *dst; struct wined3d_context *context = NULL; struct wined3d_device *device = source->resource.device; @@ -7314,7 +7338,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c conv = find_converter(source->resource.format->id, to_fmt); if (!conv) -@@ -2339,6 +2832,7 @@ +@@ -2344,6 +2845,7 @@ } dst = surface_from_resource(wined3d_texture_get_sub_resource(ret, 0)); @@ -7322,7 +7346,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); -@@ -2379,6 +2873,32 @@ +@@ -2384,6 +2886,32 @@ if (context) context_release(context); return NULL; @@ -7355,7 +7379,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, -@@ -2446,6 +2966,7 @@ +@@ -2451,6 +2979,7 @@ HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface) { @@ -7363,7 +7387,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HRESULT hr; TRACE("surface %p.\n", surface); -@@ -2456,6 +2977,20 @@ +@@ -2461,6 +2990,20 @@ memset(&surface->lockedRect, 0, sizeof(surface->lockedRect)); return hr; @@ -7384,7 +7408,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, -@@ -2463,6 +2998,21 @@ +@@ -2468,8 +3011,23 @@ { const struct wined3d_format *format = surface->resource.format; unsigned int fmt_flags = surface->container->resource.format_flags; @@ -7393,7 +7417,8 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + struct wined3d_context *context; + const struct wined3d_gl_info *gl_info; + BYTE *base_memory; -+ + +- if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box + TRACE("surface %p, map_desc %p, box %p, flags %#x.\n", + surface, map_desc, box, flags); + @@ -7403,10 +7428,12 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + return WINED3DERR_INVALIDCALL; + } +#endif /* STAGING_CSMT */ - - if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box ++ ++ if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box && !surface_check_block_align(surface, box)) -@@ -2474,6 +3024,13 @@ + { + WARN("Map rect %p is misaligned for %ux%u blocks.\n", +@@ -2479,6 +3037,13 @@ return WINED3DERR_INVALIDCALL; } @@ -7420,7 +7447,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 -@@ -2489,6 +3046,7 @@ +@@ -2494,6 +3059,7 @@ } } @@ -7428,7 +7455,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (box) { surface->lockedRect.left = box->left; -@@ -2570,6 +3128,179 @@ +@@ -2575,6 +3141,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 @@ -7608,7 +7635,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 -@@ -2585,6 +3316,7 @@ +@@ -2590,6 +3329,7 @@ if (device->d3d_initialized) context = context_acquire(device, NULL); @@ -7616,7 +7643,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) -@@ -2610,6 +3342,13 @@ +@@ -2615,6 +3355,13 @@ surface->flags &= ~SFLAG_DCINUSE; wined3d_cs_emit_releasedc(surface->resource.device->cs, surface); @@ -7630,7 +7657,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -2626,9 +3365,14 @@ +@@ -2631,9 +3378,14 @@ int i; BOOL srcIsUpsideDown; struct wined3d_bo_address data; @@ -7645,7 +7672,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface != old_ctx->current_rt) { -@@ -2668,8 +3412,13 @@ +@@ -2673,8 +3425,13 @@ } /* Setup pixel store pack state -- to glReadPixels into the correct place */ @@ -7659,7 +7686,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c checkGLcall("glPixelStorei"); gl_info->gl_ops.gl.p_glReadPixels(0, 0, -@@ -2686,6 +3435,10 @@ +@@ -2691,6 +3448,10 @@ { /* glReadPixels returns the image upside down, and there is no way to prevent this. * Flip the lines in software. */ @@ -7670,7 +7697,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!(row = HeapAlloc(GetProcessHeap(), 0, pitch))) goto error; -@@ -2912,8 +3665,13 @@ +@@ -2917,8 +3678,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. */ @@ -7684,7 +7711,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Uses the hardware to stretch and flip the image */ -@@ -2981,7 +3739,11 @@ +@@ -2986,7 +3752,11 @@ checkGLcall("glEnable(texture_target)"); /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ @@ -7696,7 +7723,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 -@@ -3178,6 +3940,7 @@ +@@ -3183,6 +3953,7 @@ checkGLcall("glDeleteTextures(1, &backup)"); } @@ -7704,7 +7731,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) -@@ -3189,6 +3952,17 @@ +@@ -3194,6 +3965,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); @@ -7722,7 +7749,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Front buffer coordinates are always full screen coordinates, but our GL -@@ -3243,9 +4017,15 @@ +@@ -3248,9 +4030,15 @@ gl_info = context->gl_info; @@ -7738,7 +7765,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 */ -@@ -3288,9 +4068,13 @@ +@@ -3293,9 +4081,13 @@ /* Leave the opengl state valid for blitting */ device->blitter->unset_shader(context->gl_info); @@ -7752,7 +7779,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. */ -@@ -3320,8 +4104,13 @@ +@@ -3325,8 +4117,13 @@ enum wined3d_texture_filter_type filter) { struct wined3d_device *device = dst_surface->resource.device; @@ -7766,7 +7793,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), -@@ -3512,6 +4301,7 @@ +@@ -3517,6 +4314,7 @@ { TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h); @@ -7774,7 +7801,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))) -@@ -3520,6 +4310,15 @@ +@@ -3525,6 +4323,15 @@ surface->ds_current_size.cx = w; surface->ds_current_size.cy = h; surface->resource.locations = location; @@ -7790,7 +7817,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Context activation is done by the caller. */ -@@ -3534,7 +4333,11 @@ +@@ -3539,7 +4346,11 @@ /* TODO: Make this work for modes other than FBO */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return; @@ -7802,31 +7829,23 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { w = surface->ds_current_size.cx; h = surface->ds_current_size.cy; -@@ -3560,7 +4363,11 @@ +@@ -3565,6 +4376,7 @@ 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"); - 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 @@ +@@ -3580,6 +4392,23 @@ { 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; @@ -7842,7 +7861,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; -@@ -3654,9 +4475,13 @@ +@@ -3643,9 +4472,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7856,7 +7875,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) -@@ -3672,9 +4497,13 @@ +@@ -3661,9 +4494,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7870,7 +7889,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 -@@ -3682,6 +4511,7 @@ +@@ -3671,6 +4508,7 @@ ERR("Invalid location (%#x) specified.\n", location); } @@ -7878,7 +7897,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; -@@ -3714,6 +4544,124 @@ +@@ -3703,6 +4541,124 @@ FIXME("Can't load surface %p with location flags %s into sysmem.\n", surface, wined3d_debug_location(surface->resource.locations)); @@ -8003,7 +8022,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Context activation is done by the caller. */ -@@ -3722,12 +4670,14 @@ +@@ -3711,12 +4667,14 @@ { RECT r; @@ -8018,7 +8037,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)) { -@@ -3736,7 +4686,11 @@ +@@ -3725,7 +4683,11 @@ } surface_get_rect(surface, NULL, &r); @@ -8030,7 +8049,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); -@@ -3751,6 +4705,7 @@ +@@ -3740,6 +4702,7 @@ struct wined3d_device *device = surface->resource.device; const struct wined3d_color_key_conversion *conversion; struct wined3d_texture *texture = surface->container; @@ -8038,7 +8057,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; -@@ -3777,6 +4732,24 @@ +@@ -3766,6 +4729,24 @@ } if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_SRGB | WINED3D_LOCATION_TEXTURE_RGB) @@ -8063,7 +8082,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, -@@ -3792,6 +4765,7 @@ +@@ -3781,6 +4762,7 @@ return WINED3D_OK; } @@ -8071,7 +8090,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, -@@ -3799,6 +4773,15 @@ +@@ -3788,6 +4770,15 @@ NULL, surface->resource.usage, surface->resource.pool, surface->resource.format)) { DWORD src_location = surface->resource.locations & WINED3D_LOCATION_RB_RESOLVED ? @@ -8087,7 +8106,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}; -@@ -3813,6 +4796,7 @@ +@@ -3802,6 +4793,7 @@ if (srgb) { @@ -8095,18 +8114,10 @@ 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) { -@@ -3847,15 +4831,55 @@ +@@ -3836,6 +4828,42 @@ width = surface->resource.width; wined3d_resource_get_pitch(&surface->resource, &src_row_pitch, &src_slice_pitch); -- -- format = *texture->resource.format; -- 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) @@ -8143,14 +8154,13 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + width = surface->resource.width; + src_pitch = wined3d_surface_get_pitch(surface); +#endif /* STAGING_CSMT */ -+ -+ format = *texture->resource.format; -+ 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. */ + + format = *texture->resource.format; + if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE))) +@@ -3844,7 +4872,11 @@ + /* Don't use PBOs for converted surfaces. During PBO conversion we look at + * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is + * getting called. */ +#if defined(STAGING_CSMT) if ((format.convert || conversion) && surface->resource.buffer) +#else /* STAGING_CSMT */ @@ -8159,7 +8169,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -3864,6 +4888,7 @@ +@@ -3853,6 +4885,7 @@ else surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; @@ -8167,7 +8177,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); -@@ -3871,6 +4896,14 @@ +@@ -3860,6 +4893,14 @@ } wined3d_resource_get_memory(&surface->resource, surface->resource.locations, &data); @@ -8182,7 +8192,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. */ -@@ -3885,9 +4918,15 @@ +@@ -3874,9 +4915,15 @@ context_release(context); return E_OUTOFMEMORY; } @@ -8198,7 +8208,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c data.addr = mem; } else if (conversion) -@@ -3907,6 +4946,7 @@ +@@ -3896,6 +4943,7 @@ } if (texture->swapchain && texture->swapchain->palette) palette = texture->swapchain->palette; @@ -8206,7 +8216,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; -@@ -3915,6 +4955,16 @@ +@@ -3904,6 +4952,16 @@ wined3d_surface_upload_data(surface, gl_info, &format, &src_rect, src_row_pitch, &dst_point, srgb, wined3d_const_bo_address(&data)); @@ -8223,20 +8233,28 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HeapFree(GetProcessHeap(), 0, mem); -@@ -3926,7 +4976,11 @@ - { - RECT rect = {0, 0, surface->resource.width, surface->resource.height}; +@@ -3917,11 +4975,19 @@ + const RECT rect = {0, 0, surface->resource.width, surface->resource.height}; + DWORD src_location; +#if defined(STAGING_CSMT) - if (!(surface->resource.locations & WINED3D_LOCATION_RB_MULTISAMPLE)) + if (surface->resource.locations & WINED3D_LOCATION_RB_MULTISAMPLE) + src_location = WINED3D_LOCATION_RB_MULTISAMPLE; + else if (surface->resource.locations & WINED3D_LOCATION_RB_RESOLVED) + src_location = WINED3D_LOCATION_RB_RESOLVED; + else if (surface->resource.locations & WINED3D_LOCATION_TEXTURE_SRGB) +#else /* STAGING_CSMT */ -+ if (!(surface->locations & WINED3D_LOCATION_RB_MULTISAMPLE)) ++ if (surface->locations & WINED3D_LOCATION_RB_MULTISAMPLE) ++ src_location = WINED3D_LOCATION_RB_MULTISAMPLE; ++ else if (surface->locations & WINED3D_LOCATION_RB_RESOLVED) ++ src_location = WINED3D_LOCATION_RB_RESOLVED; ++ else if (surface->locations & WINED3D_LOCATION_TEXTURE_SRGB) +#endif /* STAGING_CSMT */ - ERR("Trying to resolve multisampled surface %p, but location WINED3D_LOCATION_RB_MULTISAMPLE not current.\n", - surface); - -@@ -3934,11 +4988,17 @@ - surface, WINED3D_LOCATION_RB_MULTISAMPLE, &rect, surface, WINED3D_LOCATION_RB_RESOLVED, &rect); + src_location = WINED3D_LOCATION_TEXTURE_SRGB; + else /* surface_blt_fbo will load the source location if necessary. */ + src_location = WINED3D_LOCATION_TEXTURE_RGB; +@@ -3930,42 +4996,89 @@ + surface, src_location, &rect, surface, dst_location, &rect); } +#if defined(STAGING_CSMT) @@ -8253,38 +8271,64 @@ 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)); -@@ -3946,6 +5006,7 @@ - if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) - { - if (location == WINED3D_LOCATION_TEXTURE_RGB + +- if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) ++ if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) ++ { ++ if (location == WINED3D_LOCATION_TEXTURE_RGB +#if defined(STAGING_CSMT) - && surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) - { - surface_load_ds_location(surface, context, location); -@@ -3970,6 +5031,46 @@ - ERR("Surface %p does not have any up to date location.\n", surface); - surface->flags |= SFLAG_LOST; - return; -+#else /* STAGING_CSMT */ -+ && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) ++ && surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) + { + surface_load_ds_location(surface, context, location); -+ return WINED3D_OK; ++ return; + } -+ else if (location & surface->locations ++ else if (location & surface->resource.locations + && surface->container->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) + { + /* Already up to date, nothing to do. */ -+ return WINED3D_OK; ++ return; + } + else + { + FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", -+ wined3d_debug_location(surface->locations), wined3d_debug_location(location)); -+ return WINED3DERR_INVALIDCALL; ++ wined3d_debug_location(surface->resource.locations), wined3d_debug_location(location)); ++ return; + } + } + ++ if (!surface->resource.locations) + { +- if (location == WINED3D_LOCATION_TEXTURE_RGB +- && surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) ++ ERR("Surface %p does not have any up to date location.\n", surface); ++ surface->flags |= SFLAG_LOST; ++ return; ++#else /* STAGING_CSMT */ ++ && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) + { + surface_load_ds_location(surface, context, location); +- return; ++ return WINED3D_OK; + } +- else if (location & surface->resource.locations ++ else if (location & surface->locations + && surface->container->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) + { + /* Already up to date, nothing to do. */ +- return; ++ return WINED3D_OK; + } + else + { + FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", +- wined3d_debug_location(surface->resource.locations), wined3d_debug_location(location)); +- return; ++ wined3d_debug_location(surface->locations), wined3d_debug_location(location)); ++ return WINED3DERR_INVALIDCALL; + } + } + +- if (!surface->resource.locations) + if (surface->locations & location) + { + TRACE("Location already up to date.\n"); @@ -8300,15 +8344,16 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + } + + if (!surface->locations) -+ { -+ ERR("Surface %p does not have any up to date location.\n", surface); -+ surface->flags |= SFLAG_LOST; + { + ERR("Surface %p does not have any up to date location.\n", surface); + surface->flags |= SFLAG_LOST; +- return; + return WINED3DERR_DEVICELOST; +#endif /* STAGING_CSMT */ } switch (location) -@@ -3983,7 +5084,11 @@ +@@ -3979,7 +5092,11 @@ case WINED3D_LOCATION_DRAWABLE: if (FAILED(hr = surface_load_drawable(surface, context))) @@ -8320,7 +8365,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -3994,7 +5099,11 @@ +@@ -3991,7 +5108,11 @@ case WINED3D_LOCATION_TEXTURE_SRGB: if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) @@ -8332,7 +8377,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; default: -@@ -4002,12 +5111,21 @@ +@@ -3999,12 +5120,21 @@ break; } @@ -8354,7 +8399,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; } -@@ -4115,6 +5233,7 @@ +@@ -4112,6 +5242,7 @@ const RECT *dst_rect, const struct wined3d_color *color) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8362,7 +8407,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; -@@ -4135,6 +5254,21 @@ +@@ -4132,6 +5263,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); @@ -8384,7 +8429,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4143,6 +5277,7 @@ +@@ -4140,6 +5286,7 @@ const RECT *dst_rect, float depth) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8392,7 +8437,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; -@@ -4158,6 +5293,20 @@ +@@ -4155,6 +5302,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); @@ -8413,7 +8458,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4186,8 +5335,13 @@ +@@ -4183,8 +5344,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); @@ -8427,7 +8472,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } const struct blit_shader ffp_blit = { -@@ -4343,6 +5497,7 @@ +@@ -4340,6 +5506,7 @@ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) { @@ -8435,7 +8480,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; -@@ -4377,6 +5532,28 @@ +@@ -4374,6 +5541,28 @@ wined3d_resource_get_pitch(&dst_surface->resource, &dst_row_pitch, &dst_slice_pitch); src_data = dst_data; src_row_pitch = dst_row_pitch; @@ -8464,7 +8509,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; -@@ -4388,12 +5565,14 @@ +@@ -4385,12 +5574,14 @@ dst_fmt_flags = dst_surface->container->resource.format_flags; if (src_surface) { @@ -8479,7 +8524,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))) -@@ -4404,9 +5583,13 @@ +@@ -4401,9 +5592,13 @@ } src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, 0)); } @@ -8493,7 +8538,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; } -@@ -4416,8 +5599,12 @@ +@@ -4413,8 +5608,12 @@ src_fmt_flags = dst_fmt_flags; } @@ -8506,7 +8551,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } bpp = dst_surface->resource.format->byte_count; -@@ -4428,12 +5615,24 @@ +@@ -4425,12 +5624,24 @@ width = (dst_rect->right - dst_rect->left) * bpp; if (src_surface) @@ -8531,7 +8576,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS) { -@@ -4468,7 +5667,11 @@ +@@ -4465,7 +5676,11 @@ } hr = surface_cpu_blt_compressed(sbase, dbuf, @@ -8543,7 +8588,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format, flags, fx); goto release; } -@@ -4476,7 +5679,11 @@ +@@ -4473,7 +5688,11 @@ /* First, all the 'source-less' blits */ if (flags & WINEDDBLT_COLORFILL) { @@ -8555,7 +8600,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c flags &= ~WINEDDBLT_COLORFILL; } -@@ -4525,6 +5732,7 @@ +@@ -4522,6 +5741,7 @@ for (y = 0; y < dstheight; ++y) { memcpy(dbuf, sbuf, width); @@ -8563,7 +8608,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c sbuf += src_row_pitch; dbuf += dst_row_pitch; } -@@ -4538,6 +5746,21 @@ +@@ -4535,6 +5755,21 @@ { sbuf -= src_row_pitch; dbuf -= dst_row_pitch; @@ -8585,7 +8630,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c memcpy(dbuf, sbuf, width); } } -@@ -4547,8 +5770,13 @@ +@@ -4544,8 +5779,13 @@ for (y = 0; y < dstheight; ++y) { memmove(dbuf, sbuf, width); @@ -8599,7 +8644,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4557,9 +5785,15 @@ +@@ -4554,9 +5794,15 @@ /* Stretching in y direction only. */ for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8615,7 +8660,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4569,6 +5803,7 @@ +@@ -4566,6 +5812,7 @@ int last_sy = -1; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8623,7 +8668,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)) -@@ -4576,6 +5811,15 @@ +@@ -4573,6 +5820,15 @@ /* This source row is the same as last source row - * Copy the already stretched row. */ memcpy(dbuf, dbuf - dst_row_pitch, width); @@ -8639,7 +8684,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4622,6 +5866,7 @@ +@@ -4619,6 +5875,7 @@ } #undef STRETCH_ROW } @@ -8647,7 +8692,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dbuf += dst_row_pitch; last_sy = sy; } -@@ -4630,6 +5875,16 @@ +@@ -4627,6 +5884,16 @@ else { LONG dstyinc = dst_row_pitch, dstxinc = bpp; @@ -8664,7 +8709,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)) -@@ -4679,7 +5934,11 @@ +@@ -4676,7 +5943,11 @@ LONG tmpxy; dTopLeft = dbuf; dTopRight = dbuf + ((dstwidth - 1) * bpp); @@ -8676,7 +8721,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp); if (fx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY) -@@ -4756,6 +6015,7 @@ +@@ -4753,6 +6024,7 @@ flags &= ~(WINEDDBLT_DDFX); } @@ -8684,7 +8729,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c #define COPY_COLORKEY_FX(type) \ do { \ const type *s; \ -@@ -4777,6 +6037,29 @@ +@@ -4774,6 +6046,29 @@ d = (type *)(((BYTE *)d) + dstyinc); \ } \ } while(0) @@ -8714,7 +8759,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c switch (bpp) { -@@ -4795,7 +6078,11 @@ +@@ -4792,7 +6087,11 @@ BYTE *d = dbuf, *dx; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8726,7 +8771,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dx = d; for (x = sx = 0; x < dstwidth; ++x, sx+= xinc) { -@@ -4826,10 +6113,12 @@ +@@ -4823,10 +6122,12 @@ } } @@ -8739,7 +8784,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c error: if (flags && FIXME_ON(d3d_surface)) { -@@ -4837,6 +6126,7 @@ +@@ -4834,6 +6135,7 @@ } release: @@ -8747,7 +8792,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); -@@ -4855,6 +6145,14 @@ +@@ -4852,6 +6154,14 @@ wined3d_texture_decref(src_texture); if (context) context_release(context); @@ -8762,7 +8807,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -4899,6 +6197,7 @@ +@@ -4896,6 +6206,7 @@ cpu_blit_blit_surface, }; @@ -8770,7 +8815,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) -@@ -4906,6 +6205,16 @@ +@@ -4903,6 +6214,16 @@ struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_device *device = dst_surface->resource.device; DWORD src_ds_flags, dst_ds_flags; @@ -8787,7 +8832,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c BOOL scale, convert; static const DWORD simple_blit = WINEDDBLT_ASYNC -@@ -4916,6 +6225,106 @@ +@@ -4913,6 +6234,106 @@ | WINEDDBLT_DEPTHFILL | WINEDDBLT_DONOTWAIT; @@ -8894,7 +8939,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!device->d3d_initialized) { WARN("D3D not initialized, using fallback.\n"); -@@ -4958,8 +6367,13 @@ +@@ -4955,8 +6376,13 @@ } scale = src_surface @@ -8908,7 +8953,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 -@@ -4979,6 +6393,7 @@ +@@ -4976,6 +6402,7 @@ TRACE("Depth fill.\n"); if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) @@ -8916,7 +8961,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))) -@@ -4989,6 +6404,24 @@ +@@ -4986,6 +6413,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; @@ -8941,7 +8986,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -4997,8 +6430,13 @@ +@@ -4994,8 +6439,13 @@ /* In principle this would apply to depth blits as well, but we don't * implement those in the CPU blitter at the moment. */ @@ -8955,7 +9000,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { if (scale) TRACE("Not doing sysmem blit because of scaling.\n"); -@@ -5019,8 +6457,13 @@ +@@ -5016,8 +6466,13 @@ palette, fx->u5.dwFillColor, &color)) goto fallback; @@ -8969,7 +9014,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -5038,8 +6481,13 @@ +@@ -5035,8 +6490,13 @@ color_key = &src_surface->container->async.src_blt_color_key; blit_op = WINED3D_BLIT_OP_COLOR_BLIT_CKEY; } @@ -8983,7 +9028,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { /* Upload */ if (scale) -@@ -5048,6 +6496,7 @@ +@@ -5045,6 +6505,7 @@ TRACE("Not doing upload because of format conversion.\n"); else { @@ -8991,7 +9036,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))) -@@ -5060,6 +6509,19 @@ +@@ -5057,6 +6518,19 @@ context_release(context); } return; @@ -9011,7 +9056,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -5083,6 +6545,7 @@ +@@ -5080,6 +6554,7 @@ wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -9019,7 +9064,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return; } -@@ -5290,6 +6753,53 @@ +@@ -5287,6 +6762,53 @@ wined3d_surface_location_invalidated, wined3d_surface_load_location, }; @@ -9073,7 +9118,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) -@@ -5351,7 +6861,11 @@ +@@ -5348,7 +6870,11 @@ } surface->container = container; @@ -9085,7 +9130,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c list_init(&surface->renderbuffers); list_init(&surface->overlays); -@@ -5383,9 +6897,14 @@ +@@ -5380,9 +6906,14 @@ if (surface->resource.map_binding == WINED3D_LOCATION_DIB) { wined3d_resource_free_sysmem(&surface->resource); @@ -9100,7 +9145,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } return hr; -@@ -5412,7 +6931,11 @@ +@@ -5409,7 +6940,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 deleted file mode 100644 index 13f0383f..00000000 --- a/patches/wined3d-Revert_Prepare_GL_Resources/0001-Revert-wined3d-Prepare-GL-resources-before-calling-c.patch +++ /dev/null @@ -1,255 +0,0 @@ -From 204883cb596e0e0c2b2e1812df5c69247b870e1e 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 | 48 ++++++++++++++++-------------------------- - dlls/wined3d/wined3d_private.h | 4 ++-- - 5 files changed, 37 insertions(+), 55 deletions(-) - -diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 80a9ba7..52533b7 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 170536d..90f923f 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 0a7112c..816bace 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; -@@ -2885,7 +2880,7 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct - context_restore(context, restore_rt); - } - --static void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL multisample) -+void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL multisample) - { - if (multisample) - { -@@ -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 a60919e..16fda97 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -2465,8 +2465,8 @@ 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, - const struct wined3d_surface *rt) DECLSPEC_HIDDEN; - void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, GLint level) DECLSPEC_HIDDEN; --- -2.6.2 - diff --git a/patches/wined3d-Revert_Prepare_GL_Resources/definition b/patches/wined3d-Revert_Prepare_GL_Resources/definition deleted file mode 100644 index 8c3294aa..00000000 --- a/patches/wined3d-Revert_Prepare_GL_Resources/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [!39536] Revert patch to prepare GL resources before calling context_apply_fbo_state diff --git a/staging/changelog b/staging/changelog index 80adc18a..1531a3d6 100644 --- a/staging/changelog +++ b/staging/changelog @@ -1,3 +1,8 @@ +wine-staging (1.8~rc2) unstable; urgency=low + * Removed patch to revert "prepare GLresources before calling + context_apply_fbo_state" commit. + -- Sebastian Lackner Wed, 25 Nov 2015 20:21:46 +0100 + wine-staging (1.8~rc1) unstable; urgency=low * Removed patch to allow dinput EnumDevices callback with broken calling convention (accepted upstream).