diff --git a/patches/ddraw-IDirect3DTexture2_Load/0001-ddraw-Allow-size-and-format-conversions-in-IDirect3D.patch b/patches/ddraw-IDirect3DTexture2_Load/0001-ddraw-Allow-size-and-format-conversions-in-IDirect3D.patch index 56ec51bc..b21ec929 100644 --- a/patches/ddraw-IDirect3DTexture2_Load/0001-ddraw-Allow-size-and-format-conversions-in-IDirect3D.patch +++ b/patches/ddraw-IDirect3DTexture2_Load/0001-ddraw-Allow-size-and-format-conversions-in-IDirect3D.patch @@ -1,4 +1,4 @@ -From 3e9c3ba84739fdd41205e1dd4ea8ad686871defb Mon Sep 17 00:00:00 2001 +From f1ad7b7975ed611a4989986f35ea3695eca0f26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 30 May 2015 02:55:03 +0200 Subject: ddraw: Allow size and format conversions in IDirect3DTexture2::Load. @@ -8,10 +8,10 @@ Subject: ddraw: Allow size and format conversions in IDirect3DTexture2::Load. 1 file changed, 76 insertions(+), 71 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c -index f716cfc..f3bea20 100644 +index 8a10eff..cb71a65 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c -@@ -5048,6 +5048,46 @@ static struct ddraw_surface *get_sub_mimaplevel(struct ddraw_surface *surface) +@@ -5062,6 +5062,46 @@ static struct ddraw_surface *get_sub_mimaplevel(struct ddraw_surface *surface) return impl_from_IDirectDrawSurface7(next_level); } @@ -58,7 +58,7 @@ index f716cfc..f3bea20 100644 /***************************************************************************** * IDirect3DTexture2::Load * -@@ -5081,91 +5121,57 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu +@@ -5095,90 +5135,56 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu wined3d_mutex_lock(); @@ -75,8 +75,7 @@ index f716cfc..f3bea20 100644 - DDSURFACEDESC *src_desc, *dst_desc; + DDSURFACEDESC *src_desc = (DDSURFACEDESC *)&src_surface->surface_desc; - TRACE("Copying surface %p to surface %p (mipmap level %d).\n", - src_surface, dst_surface, src_surface->mipmap_level); + TRACE("Copying surface %p to surface %p.\n", src_surface, dst_surface); - /* Suppress the ALLOCONLOAD flag */ - dst_surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD; @@ -183,7 +182,7 @@ index f716cfc..f3bea20 100644 } if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) -@@ -5178,12 +5184,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu +@@ -5191,12 +5197,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu else dst_surface = NULL; @@ -200,5 +199,5 @@ index f716cfc..f3bea20 100644 wined3d_mutex_unlock(); -- -2.4.2 +2.6.2 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index f5f347fd..460e7c57 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "c715127536a78166e58b165c390a57b704899d29" + echo "99033b14534ffe8ff6c88c8d38a70d398c933b4d" } # Show version information @@ -5669,11 +5669,14 @@ fi # | * makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects, wined3d-DXTn # | # | Modified files: -# | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc +# | * configure.ac, dlls/d3d11/device.c, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc, dlls/wined3d/resource.c, +# | dlls/wined3d/wined3d.spec, include/wine/wined3d.h # | if test "$enable_wined3d_CSMT_Helper" -eq 1; then - patch_apply wined3d-CSMT_Helper/0001-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch + patch_apply wined3d-CSMT_Helper/0001-wined3d-Rename-wined3d_resource_-un-map-to-wined3d_r.patch + patch_apply wined3d-CSMT_Helper/0002-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch ( + echo '+ { "Sebastian Lackner", "wined3d: Rename wined3d_resource_(un)map to wined3d_resource_sub_resource_(un)map.", 1 },'; echo '+ { "Sebastian Lackner", "wined3d: Add second dll with STAGING_CSMT definition set.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/wined3d-CSMT_Helper/0001-wined3d-Rename-wined3d_resource_-un-map-to-wined3d_r.patch b/patches/wined3d-CSMT_Helper/0001-wined3d-Rename-wined3d_resource_-un-map-to-wined3d_r.patch new file mode 100644 index 00000000..168f2f43 --- /dev/null +++ b/patches/wined3d-CSMT_Helper/0001-wined3d-Rename-wined3d_resource_-un-map-to-wined3d_r.patch @@ -0,0 +1,97 @@ +From d28eecc1251b483848ae2bf539ca5398c8575946 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Wed, 4 Nov 2015 19:31:30 +0100 +Subject: wined3d: Rename wined3d_resource_(un)map to + wined3d_resource_sub_resource_(un)map. + +To avoid name conflicts in the CSMT patchset. +--- + dlls/d3d11/device.c | 4 ++-- + dlls/wined3d/resource.c | 4 ++-- + dlls/wined3d/wined3d.spec | 4 ++-- + include/wine/wined3d.h | 6 +++--- + 4 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index ca8b0ef..f5acbff 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -215,7 +215,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_Map(ID3D11DeviceContext + wined3d_resource = wined3d_resource_from_d3d11_resource(resource); + + wined3d_mutex_lock(); +- hr = wined3d_resource_map(wined3d_resource, subresource_idx, ++ hr = wined3d_resource_sub_resource_map(wined3d_resource, subresource_idx, + &map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type)); + wined3d_mutex_unlock(); + +@@ -236,7 +236,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_Unmap(ID3D11DeviceContext + wined3d_resource = wined3d_resource_from_d3d11_resource(resource); + + wined3d_mutex_lock(); +- wined3d_resource_unmap(wined3d_resource, subresource_idx); ++ wined3d_resource_sub_resource_unmap(wined3d_resource, subresource_idx); + wined3d_mutex_unlock(); + } + +diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c +index d466764..74be48d 100644 +--- a/dlls/wined3d/resource.c ++++ b/dlls/wined3d/resource.c +@@ -295,7 +295,7 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st + desc->size = resource->size; + } + +-HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, ++HRESULT CDECL wined3d_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, + struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) + { + TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %p, flags %#x.\n", +@@ -304,7 +304,7 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i + return resource->resource_ops->resource_sub_resource_map(resource, sub_resource_idx, map_desc, box, flags); + } + +-HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx) ++HRESULT CDECL wined3d_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx) + { + TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx); + +diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec +index 7067e08..7c4ea7c 100644 +--- a/dlls/wined3d/wined3d.spec ++++ b/dlls/wined3d/wined3d.spec +@@ -182,10 +182,10 @@ + @ cdecl wined3d_resource_get_desc(ptr ptr) + @ cdecl wined3d_resource_get_parent(ptr) + @ cdecl wined3d_resource_get_priority(ptr) +-@ cdecl wined3d_resource_map(ptr long ptr ptr long) + @ cdecl wined3d_resource_set_parent(ptr ptr) + @ cdecl wined3d_resource_set_priority(ptr long) +-@ cdecl wined3d_resource_unmap(ptr long) ++@ cdecl wined3d_resource_sub_resource_map(ptr long ptr ptr long) ++@ cdecl wined3d_resource_sub_resource_unmap(ptr long) + + @ cdecl wined3d_rendertarget_view_create(ptr ptr ptr ptr ptr) + @ cdecl wined3d_rendertarget_view_create_from_surface(ptr ptr ptr ptr) +diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h +index 9c9258a..d859b6f 100644 +--- a/include/wine/wined3d.h ++++ b/include/wine/wined3d.h +@@ -2422,11 +2422,11 @@ void __cdecl wined3d_resource_get_desc(const struct wined3d_resource *resource, + struct wined3d_resource_desc *desc); + void * __cdecl wined3d_resource_get_parent(const struct wined3d_resource *resource); + DWORD __cdecl wined3d_resource_get_priority(const struct wined3d_resource *resource); +-HRESULT __cdecl wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, +- struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); + void __cdecl wined3d_resource_set_parent(struct wined3d_resource *resource, void *parent); + DWORD __cdecl wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority); +-HRESULT __cdecl wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx); ++HRESULT __cdecl wined3d_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, ++ struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); ++HRESULT __cdecl wined3d_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx); + + HRESULT __cdecl wined3d_rendertarget_view_create(const struct wined3d_rendertarget_view_desc *desc, + struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops, +-- +2.6.2 + diff --git a/patches/wined3d-CSMT_Helper/0001-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch b/patches/wined3d-CSMT_Helper/0002-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch similarity index 100% rename from patches/wined3d-CSMT_Helper/0001-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch rename to patches/wined3d-CSMT_Helper/0002-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch diff --git a/patches/wined3d-CSMT_Main/0001-wined3d-Merge-get_pitch-functions.patch b/patches/wined3d-CSMT_Main/0001-wined3d-Merge-get_pitch-functions.patch index 8b1fbd72..9f41246d 100644 --- a/patches/wined3d-CSMT_Main/0001-wined3d-Merge-get_pitch-functions.patch +++ b/patches/wined3d-CSMT_Main/0001-wined3d-Merge-get_pitch-functions.patch @@ -1,4 +1,4 @@ -From 458932be247371abe50300b9d39acba5efa17e26 Mon Sep 17 00:00:00 2001 +From 429d2f5f7f32f0703b910f27a534cb06d9b6f722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 19 Sep 2013 14:22:24 +0200 Subject: wined3d: Merge get_pitch functions. @@ -12,10 +12,10 @@ Subject: wined3d: Merge get_pitch functions. 5 files changed, 70 insertions(+), 71 deletions(-) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index 1891165..0968cd2 100644 +index 74be48d..7922433 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c -@@ -414,3 +414,34 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) +@@ -430,3 +430,34 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) else resource->draw_binding = WINED3D_LOCATION_TEXTURE_RGB; } @@ -51,7 +51,7 @@ index 1891165..0968cd2 100644 + TRACE("Returning row pitch %u, slice pitch %u.\n", *row_pitch, *slice_pitch); +} diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index a092a9c..9749b77 100644 +index 39a2c3b..2e7f0f8 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -364,6 +364,7 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface) @@ -76,7 +76,7 @@ index a092a9c..9749b77 100644 b_info->bmiHeader.biPlanes = 1; b_info->bmiHeader.biBitCount = format->byte_count * 8; -@@ -1314,14 +1316,14 @@ static void surface_download_data(struct wined3d_surface *surface, const struct +@@ -1330,14 +1332,14 @@ static void surface_download_data(struct wined3d_surface *surface, const struct void *mem; GLenum gl_format = format->glFormat; GLenum gl_type = format->glType; @@ -94,7 +94,7 @@ index a092a9c..9749b77 100644 src_pitch = (src_pitch + alignment - 1) & ~(alignment - 1); mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * surface->pow2Height); } -@@ -1408,12 +1410,12 @@ static void surface_download_data(struct wined3d_surface *surface, const struct +@@ -1424,12 +1426,12 @@ static void surface_download_data(struct wined3d_surface *surface, const struct * won't be released, and doesn't have to be re-read. */ src_data = mem; dst_data = data.addr; @@ -110,7 +110,7 @@ index a092a9c..9749b77 100644 } HeapFree(GetProcessHeap(), 0, mem); -@@ -1575,7 +1577,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1591,7 +1593,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P UINT update_w, update_h; UINT dst_w, dst_h; RECT r, dst_rect; @@ -119,7 +119,7 @@ index a092a9c..9749b77 100644 POINT p; TRACE("dst_surface %p, dst_point %s, src_surface %p, src_rect %s.\n", -@@ -1663,10 +1665,10 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1679,10 +1681,10 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE); surface_get_memory(src_surface, &data, src_surface->locations); @@ -132,7 +132,7 @@ index a092a9c..9749b77 100644 context_release(context); -@@ -1917,21 +1919,10 @@ HRESULT CDECL wined3d_surface_restore(struct wined3d_surface *surface) +@@ -1934,21 +1936,10 @@ HRESULT CDECL wined3d_surface_restore(struct wined3d_surface *surface) DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface) { @@ -158,7 +158,7 @@ index a092a9c..9749b77 100644 } HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y) -@@ -2093,20 +2084,21 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, +@@ -2110,20 +2101,21 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY; valid_location = WINED3D_LOCATION_USER_MEMORY; } @@ -184,16 +184,16 @@ index a092a9c..9749b77 100644 } /* The format might be changed to a format that needs conversion. -@@ -2726,7 +2718,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2749,7 +2741,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) map_desc->row_pitch = surface->resource.width * format->byte_count; else - map_desc->row_pitch = wined3d_surface_get_pitch(surface); + wined3d_resource_get_pitch(&surface->resource, &map_desc->row_pitch, &map_desc->slice_pitch); - map_desc->slice_pitch = 0; + map_desc->slice_pitch = surface->resource.height * map_desc->row_pitch; if (!box) -@@ -2855,6 +2847,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, +@@ -2898,6 +2890,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, int i; BOOL srcIsUpsideDown; struct wined3d_bo_address data; @@ -201,7 +201,7 @@ index a092a9c..9749b77 100644 surface_get_memory(surface, &data, dst_location); -@@ -2896,8 +2889,8 @@ static void read_from_framebuffer(struct wined3d_surface *surface, +@@ -2939,8 +2932,8 @@ static void read_from_framebuffer(struct wined3d_surface *surface, } /* Setup pixel store pack state -- to glReadPixels into the correct place */ @@ -212,7 +212,7 @@ index a092a9c..9749b77 100644 checkGLcall("glPixelStorei"); gl_info->gl_ops.gl.p_glReadPixels(0, 0, -@@ -2914,8 +2907,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, +@@ -2957,8 +2950,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, { /* glReadPixels returns the image upside down, and there is no way to prevent this. * Flip the lines in software. */ @@ -221,7 +221,7 @@ index a092a9c..9749b77 100644 if (!(row = HeapAlloc(GetProcessHeap(), 0, pitch))) goto error; -@@ -4041,7 +4032,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4077,7 +4068,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, struct wined3d_device *device = surface->resource.device; const struct wined3d_color_key_conversion *conversion; struct wined3d_texture *texture = surface->container; @@ -230,7 +230,7 @@ index a092a9c..9749b77 100644 struct wined3d_bo_address data; struct wined3d_format format; POINT dst_point = {0, 0}; -@@ -4126,7 +4117,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4162,7 +4153,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, wined3d_texture_bind_and_dirtify(texture, context, srgb); width = surface->resource.width; @@ -239,7 +239,7 @@ index a092a9c..9749b77 100644 format = *texture->resource.format; if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE))) -@@ -4164,9 +4155,9 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4200,9 +4191,9 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, context_release(context); return E_OUTOFMEMORY; } @@ -251,7 +251,7 @@ index a092a9c..9749b77 100644 data.addr = mem; } else if (conversion) -@@ -4186,14 +4177,14 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4222,14 +4213,14 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, } if (texture->swapchain && texture->swapchain->palette) palette = texture->swapchain->palette; @@ -270,10 +270,10 @@ index a092a9c..9749b77 100644 HeapFree(GetProcessHeap(), 0, mem); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index d5f9591..5232053 100644 +index 4380e5f..6511d2e 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1255,7 +1255,7 @@ static void texture3d_sub_resource_upload_data(struct wined3d_resource *sub_reso +@@ -1269,7 +1269,7 @@ static void texture3d_sub_resource_upload_data(struct wined3d_resource *sub_reso struct wined3d_const_bo_address addr; unsigned int row_pitch, slice_pitch; @@ -283,7 +283,7 @@ index d5f9591..5232053 100644 FIXME("Ignoring row/slice pitch (%u/%u).\n", data->row_pitch, data->slice_pitch); diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c -index 41264e8..afb9e76 100644 +index 0231c23..7be9ff5 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -40,30 +40,6 @@ BOOL volume_prepare_system_memory(struct wined3d_volume *volume) @@ -336,10 +336,10 @@ index 41264e8..afb9e76 100644 if (!box) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 8aa2537..ee14dd1 100644 +index 4c4a58a..17ccabd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2175,6 +2175,7 @@ struct wined3d_resource +@@ -2184,6 +2184,7 @@ struct wined3d_resource UINT size; DWORD priority; void *heap_memory; @@ -347,7 +347,7 @@ index 8aa2537..ee14dd1 100644 struct list resource_list_entry; void *parent; -@@ -2202,6 +2203,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * +@@ -2211,6 +2212,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -356,7 +356,7 @@ index 8aa2537..ee14dd1 100644 GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_HIDDEN; -@@ -2342,7 +2345,6 @@ BOOL volume_prepare_system_memory(struct wined3d_volume *volume) DECLSPEC_HIDDEN +@@ -2348,7 +2351,6 @@ BOOL volume_prepare_system_memory(struct wined3d_volume *volume) DECLSPEC_HIDDEN HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, unsigned int level, struct wined3d_volume **volume) DECLSPEC_HIDDEN; void wined3d_volume_destroy(struct wined3d_volume *volume) DECLSPEC_HIDDEN; @@ -364,7 +364,7 @@ index 8aa2537..ee14dd1 100644 void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *context, BOOL srgb_mode) DECLSPEC_HIDDEN; void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location) DECLSPEC_HIDDEN; -@@ -2395,7 +2397,6 @@ struct wined3d_surface +@@ -2401,7 +2403,6 @@ struct wined3d_surface DWORD flags; @@ -373,5 +373,5 @@ index 8aa2537..ee14dd1 100644 UINT pow2Height; -- -2.6.1 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0009-wined3d-Invalidate-containers-via-callback.patch b/patches/wined3d-CSMT_Main/0009-wined3d-Invalidate-containers-via-callback.patch index 1196c941..f30d0092 100644 --- a/patches/wined3d-CSMT_Main/0009-wined3d-Invalidate-containers-via-callback.patch +++ b/patches/wined3d-CSMT_Main/0009-wined3d-Invalidate-containers-via-callback.patch @@ -1,4 +1,4 @@ -From d1b60dedae0926dd9dd413f721103700624f8da6 Mon Sep 17 00:00:00 2001 +From bc240cf9d9401914b2685b66f21af86aca21bccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 17 Nov 2013 18:44:48 +0100 Subject: wined3d: Invalidate containers via callback. @@ -13,11 +13,11 @@ Subject: wined3d: Invalidate containers via callback. 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 19df398..7adfe79 100644 +index ba4ed5d..638c9b9 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1123,11 +1123,17 @@ static ULONG buffer_resource_decref(struct wined3d_resource *resource) - return wined3d_buffer_decref(buffer_from_resource(resource)); +@@ -1161,6 +1161,11 @@ static HRESULT buffer_resource_sub_resource_unmap(struct wined3d_resource *resou + return WINED3D_OK; } +static void wined3d_buffer_location_invalidated(struct wined3d_resource *resource, DWORD location) @@ -28,17 +28,19 @@ index 19df398..7adfe79 100644 static const struct wined3d_resource_ops buffer_resource_ops = { buffer_resource_incref, - buffer_resource_decref, +@@ -1168,6 +1173,7 @@ static const struct wined3d_resource_ops buffer_resource_ops = buffer_unload, + buffer_resource_sub_resource_map, + buffer_resource_sub_resource_unmap, + wined3d_buffer_location_invalidated, }; static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device *device, diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index e54781f..35a1a14 100644 +index 2a42535..c259eba 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c -@@ -458,4 +458,6 @@ void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWO +@@ -474,4 +474,6 @@ void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWO TRACE("Resource %p, setting %s.\n", resource, wined3d_debug_location(location)); resource->locations &= ~location; TRACE("new location flags are %s.\n", wined3d_debug_location(resource->locations)); @@ -46,11 +48,11 @@ index e54781f..35a1a14 100644 + resource->resource_ops->resource_location_invalidated(resource, location); } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 1d22d49..bbf485f 100644 +index 0d95db3..f5bc72c 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -1219,11 +1219,17 @@ static void surface_unload(struct wined3d_resource *resource) - resource_unload(resource); +@@ -1220,6 +1220,11 @@ static HRESULT surface_resource_sub_resource_unmap(struct wined3d_resource *reso + return WINED3DERR_INVALIDCALL; } +static void wined3d_surface_location_invalidated(struct wined3d_resource *resource, DWORD location) @@ -61,18 +63,20 @@ index 1d22d49..bbf485f 100644 static const struct wined3d_resource_ops surface_resource_ops = { surface_resource_incref, - surface_resource_decref, +@@ -1227,6 +1232,7 @@ static const struct wined3d_resource_ops surface_resource_ops = surface_unload, + surface_resource_sub_resource_map, + surface_resource_sub_resource_unmap, + wined3d_surface_location_invalidated, }; static const struct wined3d_surface_ops surface_ops = diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index bd1bdd7..d4a5f54 100644 +index 2e5276a..520647d 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -969,11 +969,17 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) - wined3d_texture_unload_gl_texture(texture); +@@ -978,6 +978,11 @@ static HRESULT texture2d_resource_sub_resource_unmap(struct wined3d_resource *re + return wined3d_surface_unmap(surface_from_resource(sub_resource)); } +static void wined3d_texture_load_location_invalidated(struct wined3d_resource *resource, DWORD location) @@ -80,17 +84,19 @@ index bd1bdd7..d4a5f54 100644 + ERR("Should not be called on textures.\n"); +} + - static const struct wined3d_resource_ops texture_resource_ops = + static const struct wined3d_resource_ops texture2d_resource_ops = { texture_resource_incref, - texture_resource_decref, +@@ -985,6 +990,7 @@ static const struct wined3d_resource_ops texture2d_resource_ops = wined3d_texture_unload, + texture2d_resource_sub_resource_map, + texture2d_resource_sub_resource_unmap, + wined3d_texture_load_location_invalidated, }; static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc, diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c -index 12b9a3b..01ba73a 100644 +index eefdb06..f150795 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -604,10 +604,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume, @@ -104,8 +110,8 @@ index 12b9a3b..01ba73a 100644 volume->resource.map_count++; -@@ -662,11 +659,20 @@ static ULONG volume_resource_decref(struct wined3d_resource *resource) - return wined3d_texture_decref(volume->container); +@@ -675,6 +672,14 @@ static HRESULT volume_resource_sub_resource_unmap(struct wined3d_resource *resou + return WINED3DERR_INVALIDCALL; } +static void wined3d_volume_location_invalidated(struct wined3d_resource *resource, DWORD location) @@ -119,24 +125,26 @@ index 12b9a3b..01ba73a 100644 static const struct wined3d_resource_ops volume_resource_ops = { volume_resource_incref, - volume_resource_decref, +@@ -682,6 +687,7 @@ static const struct wined3d_resource_ops volume_resource_ops = volume_unload, + volume_resource_sub_resource_map, + volume_resource_sub_resource_unmap, + wined3d_volume_location_invalidated, }; static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_texture *container, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c317b96..25af997 100644 +index 429a093..53e9fe9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2145,6 +2145,7 @@ struct wined3d_resource_ops - ULONG (*resource_incref)(struct wined3d_resource *resource); - ULONG (*resource_decref)(struct wined3d_resource *resource); - void (*resource_unload)(struct wined3d_resource *resource); +@@ -2159,6 +2159,7 @@ struct wined3d_resource_ops + HRESULT (*resource_sub_resource_map)(struct wined3d_resource *resource, unsigned int sub_resource_idx, + struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); + HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx); + void (*resource_location_invalidated)(struct wined3d_resource *resource, DWORD location); }; struct wined3d_resource -- -2.6.0 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0012-wined3d-Move-load_location-into-the-resource.patch b/patches/wined3d-CSMT_Main/0012-wined3d-Move-load_location-into-the-resource.patch index 91b758ff..a1de610f 100644 --- a/patches/wined3d-CSMT_Main/0012-wined3d-Move-load_location-into-the-resource.patch +++ b/patches/wined3d-CSMT_Main/0012-wined3d-Move-load_location-into-the-resource.patch @@ -1,4 +1,4 @@ -From 0dd2ded31943d0729f811330cc2afa0d3b050dc8 Mon Sep 17 00:00:00 2001 +From baafba4da7e88b445e043b45fd1b852c7e0a1f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 3 Oct 2013 12:47:01 +0200 Subject: wined3d: Move load_location into the resource. @@ -16,10 +16,10 @@ and downloading from textures will be delegated to surfaces / volumes. 6 files changed, 91 insertions(+), 36 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 727e8be..3470a89 100644 +index 638c9b9..e1bd034 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1128,12 +1128,20 @@ static void wined3d_buffer_location_invalidated(struct wined3d_resource *resourc +@@ -1166,6 +1166,13 @@ static void wined3d_buffer_location_invalidated(struct wined3d_resource *resourc ERR("Not yet implemented.\n"); } @@ -33,18 +33,19 @@ index 727e8be..3470a89 100644 static const struct wined3d_resource_ops buffer_resource_ops = { buffer_resource_incref, - buffer_resource_decref, - buffer_unload, +@@ -1174,6 +1181,7 @@ static const struct wined3d_resource_ops buffer_resource_ops = + buffer_resource_sub_resource_map, + buffer_resource_sub_resource_unmap, wined3d_buffer_location_invalidated, + wined3d_buffer_load_location, }; static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device *device, diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index 35a1a14..39df397 100644 +index c259eba..bff4997 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c -@@ -461,3 +461,53 @@ void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWO +@@ -477,3 +477,53 @@ void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWO resource->resource_ops->resource_location_invalidated(resource, location); } @@ -99,10 +100,10 @@ index 35a1a14..39df397 100644 + resource->resource_ops->resource_load_location(resource, context, location); +} diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index a59e401..9e46545 100644 +index 34f589b..fed3aaf 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -1227,12 +1227,20 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour +@@ -1228,6 +1228,13 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour wined3d_texture_set_dirty(surface->container); } @@ -116,14 +117,15 @@ index a59e401..9e46545 100644 static const struct wined3d_resource_ops surface_resource_ops = { surface_resource_incref, - surface_resource_decref, - surface_unload, +@@ -1236,6 +1243,7 @@ static const struct wined3d_resource_ops surface_resource_ops = + surface_resource_sub_resource_map, + surface_resource_sub_resource_unmap, wined3d_surface_location_invalidated, + wined3d_surface_load_location, }; static const struct wined3d_surface_ops surface_ops = -@@ -4062,7 +4070,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3941,7 +3949,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co surface->ds_current_size.cy = surface->resource.height; } @@ -132,7 +134,7 @@ index a59e401..9e46545 100644 { switch (location) { -@@ -4394,7 +4402,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4273,7 +4281,7 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte if (WARN_ON(d3d_surface)) { @@ -142,10 +144,10 @@ index a59e401..9e46545 100644 WARN("Operation requires %#x access, but surface only has %#x.\n", required_access, surface->resource.access_flags); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index fe7936d..89f94f3 100644 +index e2df18d..7650f36 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -950,12 +950,20 @@ static void wined3d_texture_load_location_invalidated(struct wined3d_resource *r +@@ -981,6 +981,13 @@ static void wined3d_texture_load_location_invalidated(struct wined3d_resource *r ERR("Should not be called on textures.\n"); } @@ -156,18 +158,19 @@ index fe7936d..89f94f3 100644 + ERR("Should not be called on textures.\n"); +} + - static const struct wined3d_resource_ops texture_resource_ops = + static const struct wined3d_resource_ops texture2d_resource_ops = { texture_resource_incref, - texture_resource_decref, - wined3d_texture_unload, +@@ -989,6 +996,7 @@ static const struct wined3d_resource_ops texture2d_resource_ops = + texture2d_resource_sub_resource_map, + texture2d_resource_sub_resource_unmap, wined3d_texture_load_location_invalidated, + wined3d_texture_load_location, }; static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc, diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c -index 94eb77e..f82347d 100644 +index f150795..82bc3b0 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -137,27 +137,6 @@ static void wined3d_volume_evict_sysmem(struct wined3d_volume *volume) @@ -242,7 +245,7 @@ index 94eb77e..f82347d 100644 context_release(context); wined3d_resource_invalidate_location(&volume->resource, ~WINED3D_LOCATION_SYSMEM); } -@@ -552,7 +527,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, +@@ -519,7 +494,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume, if (flags & WINED3D_MAP_DISCARD) wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_BUFFER); else @@ -251,7 +254,7 @@ index 94eb77e..f82347d 100644 GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo)); -@@ -590,7 +565,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, +@@ -557,7 +532,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume, else if (!(volume->resource.locations & WINED3D_LOCATION_SYSMEM)) { context = context_acquire(device, NULL); @@ -260,28 +263,28 @@ index 94eb77e..f82347d 100644 context_release(context); } base_memory = volume->resource.heap_memory; -@@ -705,6 +680,7 @@ static const struct wined3d_resource_ops volume_resource_ops = - volume_resource_decref, - volume_unload, +@@ -688,6 +663,7 @@ static const struct wined3d_resource_ops volume_resource_ops = + volume_resource_sub_resource_map, + volume_resource_sub_resource_unmap, wined3d_volume_location_invalidated, + wined3d_volume_load_location, }; static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_texture *container, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 936950f..e1e490e 100644 +index 4282508..e970088 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2138,6 +2138,8 @@ struct wined3d_resource_ops - ULONG (*resource_decref)(struct wined3d_resource *resource); - void (*resource_unload)(struct wined3d_resource *resource); +@@ -2160,6 +2160,8 @@ struct wined3d_resource_ops + struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); + HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx); void (*resource_location_invalidated)(struct wined3d_resource *resource, DWORD location); + void (*resource_load_location)(struct wined3d_resource *resource, + struct wined3d_context *context, DWORD location); }; struct wined3d_resource -@@ -2190,17 +2192,20 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * +@@ -2212,17 +2214,20 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -304,5 +307,5 @@ index 936950f..e1e490e 100644 /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16 -- -2.4.5 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0013-wined3d-Replace-surface_load_location-with-resource_.patch b/patches/wined3d-CSMT_Main/0013-wined3d-Replace-surface_load_location-with-resource_.patch index 27de6cf1..96b2aea9 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 38f75a5119e093e6a00849f76406aa0cd4f4b252 Mon Sep 17 00:00:00 2001 +From c733f3af4517be13e6c673cf28fc4df6e09b9f78 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. @@ -8,11 +8,11 @@ FIXME: Check if this patch is complete enough to make sense. dlls/wined3d/context.c | 2 +- dlls/wined3d/device.c | 4 +- dlls/wined3d/drawprim.c | 2 +- - dlls/wined3d/surface.c | 111 +++++++++++++---------------------------- + dlls/wined3d/surface.c | 115 +++++++++++++---------------------------- dlls/wined3d/swapchain.c | 8 +-- dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d_private.h | 2 - - 7 files changed, 44 insertions(+), 87 deletions(-) + 7 files changed, 46 insertions(+), 89 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 8ec2964..4909344 100644 @@ -28,7 +28,7 @@ index 8ec2964..4909344 100644 swapchain_update_draw_bindings(swapchain); context_set_render_offscreen(context, TRUE); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index bb133c4..0d9debe 100644 +index 352efc3..4d7fa53 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 @@ -40,7 +40,7 @@ index bb133c4..0d9debe 100644 else wined3d_surface_prepare(rt, context, rt->container->resource.draw_binding); } -@@ -4007,7 +4007,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4009,7 +4009,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 @@ -63,7 +63,7 @@ index 95245a9..4b01b7d 100644 } else diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 8efb896..acc210d 100644 +index fed3aaf..742ebc3 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -759,7 +759,7 @@ static void surface_unmap(struct wined3d_surface *surface) @@ -108,7 +108,7 @@ index 8efb896..acc210d 100644 wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding); } -@@ -1215,22 +1215,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour +@@ -1228,24 +1228,6 @@ static void wined3d_surface_location_invalidated(struct wined3d_resource *resour wined3d_texture_set_dirty(surface->container); } @@ -124,6 +124,8 @@ index 8efb896..acc210d 100644 - surface_resource_incref, - surface_resource_decref, - surface_unload, +- surface_resource_sub_resource_map, +- surface_resource_sub_resource_unmap, - wined3d_surface_location_invalidated, - wined3d_surface_load_location, -}; @@ -131,7 +133,7 @@ index 8efb896..acc210d 100644 static const struct wined3d_surface_ops surface_ops = { surface_private_setup, -@@ -1684,7 +1668,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1699,7 +1681,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 @@ -140,7 +142,7 @@ index 8efb896..acc210d 100644 wined3d_texture_bind_and_dirtify(dst_surface->container, context, FALSE); surface_get_memory(src_surface, &data, src_surface->resource.locations); -@@ -1817,7 +1801,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte +@@ -1832,7 +1814,7 @@ void surface_load(struct wined3d_surface *surface, struct wined3d_context *conte } TRACE("Reloading because surface is dirty.\n"); @@ -149,7 +151,7 @@ index 8efb896..acc210d 100644 surface_evict_sysmem(surface); } -@@ -2706,7 +2690,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2721,7 +2703,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, if (surface->resource.device->d3d_initialized) context = context_acquire(surface->resource.device, NULL); @@ -158,7 +160,7 @@ index 8efb896..acc210d 100644 if (context) context_release(context); } -@@ -2811,7 +2795,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2826,7 +2808,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) { if (surface->flags & SFLAG_CLIENT) { @@ -167,7 +169,7 @@ index 8efb896..acc210d 100644 surface_release_client_storage(surface); } hr = surface_create_dib_section(surface); -@@ -2827,7 +2811,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +@@ -2842,7 +2824,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) surface->resource.map_binding = WINED3D_LOCATION_DIB; } @@ -176,7 +178,7 @@ index 8efb896..acc210d 100644 wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DIB); if (context) -@@ -2876,7 +2860,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) +@@ -2891,7 +2873,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) if (device->d3d_initialized) context = context_acquire(device, NULL); @@ -185,7 +187,7 @@ index 8efb896..acc210d 100644 wined3d_resource_invalidate_location(&surface->resource, WINED3D_LOCATION_DIB); if (context) context_release(context); -@@ -3513,8 +3497,8 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, +@@ -3528,8 +3510,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 @@ -196,7 +198,7 @@ index 8efb896..acc210d 100644 wined3d_texture_load(src_surface->container, context, FALSE); /* Activate the destination context, set it up for blitting */ -@@ -3934,29 +3918,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3949,29 +3931,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co surface->ds_current_size.cy = surface->resource.height; } @@ -226,7 +228,7 @@ index 8efb896..acc210d 100644 static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD location) { struct wined3d_device *device = surface->resource.device; -@@ -4006,7 +3967,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -4021,7 +3980,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface, } if (surface->resource.locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED)) @@ -235,7 +237,7 @@ index 8efb896..acc210d 100644 /* Download the surface to system memory. */ if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) -@@ -4042,7 +4003,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, +@@ -4057,7 +4016,7 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, } surface_get_rect(surface, NULL, &r); @@ -244,7 +246,7 @@ index 8efb896..acc210d 100644 surface_blt_to_drawable(surface->resource.device, context, WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r); -@@ -4115,7 +4076,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4130,7 +4089,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); @@ -253,7 +255,7 @@ index 8efb896..acc210d 100644 } } else -@@ -4126,7 +4087,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4141,7 +4100,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, /* Performance warning... */ FIXME("Downloading sRGB surface %p to reload it as RGB.\n", surface); surface_prepare_map_memory(surface); @@ -262,7 +264,7 @@ index 8efb896..acc210d 100644 } } -@@ -4135,7 +4096,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4150,7 +4109,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); @@ -271,7 +273,7 @@ index 8efb896..acc210d 100644 } wined3d_texture_prepare_texture(texture, context, srgb); -@@ -4161,7 +4122,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -4176,7 +4135,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; surface_prepare_map_memory(surface); @@ -280,7 +282,7 @@ index 8efb896..acc210d 100644 surface_remove_pbo(surface, gl_info); } -@@ -4229,9 +4190,11 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct +@@ -4244,9 +4203,11 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct surface, WINED3D_LOCATION_RB_MULTISAMPLE, &rect, surface, WINED3D_LOCATION_RB_RESOLVED, &rect); } @@ -294,7 +296,7 @@ index 8efb896..acc210d 100644 HRESULT hr; TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); -@@ -4258,20 +4221,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte +@@ -4273,20 +4234,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte } } @@ -315,7 +317,7 @@ index 8efb896..acc210d 100644 if (!surface->resource.locations) { ERR("Surface %p does not have any up to date location.\n", surface); -@@ -5421,7 +5370,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC +@@ -5436,7 +5383,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); @@ -325,7 +327,7 @@ index 8efb896..acc210d 100644 context_release(context); } return WINED3D_OK; -@@ -5494,6 +5444,15 @@ cpu: +@@ -5509,6 +5457,17 @@ cpu: return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter); } @@ -334,6 +336,8 @@ index 8efb896..acc210d 100644 + surface_resource_incref, + surface_resource_decref, + surface_unload, ++ surface_resource_sub_resource_map, ++ surface_resource_sub_resource_unmap, + wined3d_surface_location_invalidated, + wined3d_surface_load_location, +}; @@ -381,7 +385,7 @@ index 50cd3ea..6ceac57 100644 src_dc = front->hDC; window = swapchain->win_handle; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index b38805e..f067a87 100644 +index 7650f36..7e7df06 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -774,7 +774,7 @@ static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub @@ -394,7 +398,7 @@ index b38805e..f067a87 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 37b37f2..297bdda 100644 +index e970088..c5c1442 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, @@ -407,5 +411,5 @@ index 37b37f2..297bdda 100644 void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; -- -2.6.1 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0034-wined3d-Use-resource_map-for-surface_map.patch b/patches/wined3d-CSMT_Main/0034-wined3d-Use-resource_map-for-surface_map.patch index 78951753..54fb8409 100644 --- a/patches/wined3d-CSMT_Main/0034-wined3d-Use-resource_map-for-surface_map.patch +++ b/patches/wined3d-CSMT_Main/0034-wined3d-Use-resource_map-for-surface_map.patch @@ -1,4 +1,4 @@ -From f37230817cf62ee3f7e6d805107bcf1f455d0d9a Mon Sep 17 00:00:00 2001 +From 4ca448b9c9fb4ed0e94eaa82b98d7677d486a92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 19 Sep 2013 18:00:23 +0200 Subject: wined3d: Use resource_map for surface_map. @@ -10,10 +10,10 @@ Subject: wined3d: Use resource_map for surface_map. 3 files changed, 18 insertions(+), 90 deletions(-) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index e5af445..9c40d42 100644 +index 7743a40..74cb6c1 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c -@@ -867,7 +867,7 @@ HRESULT wined3d_resource_unmap(struct wined3d_resource *resource) +@@ -883,7 +883,7 @@ HRESULT wined3d_resource_unmap(struct wined3d_resource *resource) if (!resource->map_count) { WARN("Trying to unlock an unlocked resource %p.\n", resource); @@ -23,10 +23,10 @@ index e5af445..9c40d42 100644 if (device->d3d_initialized) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 37f9b40..1d77682 100644 +index f00f6c3..3f7f54c 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -2427,28 +2427,18 @@ struct wined3d_surface * CDECL wined3d_surface_from_resource(struct wined3d_reso +@@ -2428,28 +2428,18 @@ struct wined3d_surface * CDECL wined3d_surface_from_resource(struct wined3d_reso HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface) { @@ -60,7 +60,7 @@ index 37f9b40..1d77682 100644 } HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, -@@ -2456,18 +2446,6 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2457,18 +2447,6 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, { const struct wined3d_format *format = surface->resource.format; unsigned int fmt_flags = surface->container->resource.format_flags; @@ -79,7 +79,7 @@ index 37f9b40..1d77682 100644 if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box && !surface_check_block_align(surface, box)) -@@ -2479,11 +2457,6 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2480,11 +2458,6 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, return WINED3DERR_INVALIDCALL; } @@ -91,7 +91,7 @@ index 37f9b40..1d77682 100644 /* 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 -@@ -2499,72 +2472,22 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, +@@ -2500,72 +2473,22 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, } } @@ -130,7 +130,7 @@ index 37f9b40..1d77682 100644 - map_desc->row_pitch = surface->resource.width * format->byte_count; else - wined3d_resource_get_pitch(&surface->resource, &map_desc->row_pitch, &map_desc->slice_pitch); -- map_desc->slice_pitch = 0; +- map_desc->slice_pitch = surface->resource.height * map_desc->row_pitch; - - if (!box) { @@ -171,10 +171,10 @@ index 37f9b40..1d77682 100644 HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c -index 85894d1..43c9092 100644 +index a237bf6..0e97cd1 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c -@@ -423,7 +423,12 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume, +@@ -402,7 +402,12 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume, HRESULT wined3d_volume_unmap(struct wined3d_volume *volume) { @@ -189,5 +189,5 @@ index 85894d1..43c9092 100644 static ULONG volume_resource_incref(struct wined3d_resource *resource) -- -2.6.0 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/0133-wined3d-Clean-up-texture-resources-through-the-cs.patch b/patches/wined3d-CSMT_Main/0133-wined3d-Clean-up-texture-resources-through-the-cs.patch index 67f344ac..49b74412 100644 --- a/patches/wined3d-CSMT_Main/0133-wined3d-Clean-up-texture-resources-through-the-cs.patch +++ b/patches/wined3d-CSMT_Main/0133-wined3d-Clean-up-texture-resources-through-the-cs.patch @@ -1,4 +1,4 @@ -From 4ce0b7d84cd9b320205d4b1626f3486b73e95c03 Mon Sep 17 00:00:00 2001 +From 99c21f03b539568231b746938b4b0cb5ba664720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 6 Oct 2013 16:20:32 +0200 Subject: wined3d: Clean up texture resources through the cs. @@ -10,7 +10,7 @@ Subject: wined3d: Clean up texture resources through the cs. 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 997c7d8..f7ede92 100644 +index 91b76f5..ba8d19e 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -87,6 +87,7 @@ enum wined3d_cs_op @@ -34,7 +34,7 @@ index 997c7d8..f7ede92 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2559,6 +2566,26 @@ void wined3d_cs_emit_surface_cleanup(struct wined3d_cs *cs, struct wined3d_surfa +@@ -2560,6 +2567,26 @@ void wined3d_cs_emit_surface_cleanup(struct wined3d_cs *cs, struct wined3d_surfa cs->ops->submit(cs, sizeof(*op)); } @@ -61,7 +61,7 @@ index 997c7d8..f7ede92 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2624,6 +2651,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2625,6 +2652,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, /* WINED3D_CS_OP_VOLUME_CLEANUP */ wined3d_cs_exec_volume_cleanup, /* WINED3D_CS_OP_SURFACE_CLEANUP */ wined3d_cs_exec_surface_cleanup, @@ -70,7 +70,7 @@ index 997c7d8..f7ede92 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index c94dc5b..63e0668 100644 +index 61ef22e..85abaa4 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -114,17 +114,26 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture) @@ -114,7 +114,7 @@ index c94dc5b..63e0668 100644 } void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) -@@ -419,9 +425,10 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) +@@ -423,9 +429,10 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) if (!refcount) { @@ -127,7 +127,7 @@ index c94dc5b..63e0668 100644 } return refcount; -@@ -1003,6 +1010,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1028,6 +1035,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -135,7 +135,7 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } -@@ -1012,12 +1020,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1037,12 +1045,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -150,7 +150,7 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1038,6 +1048,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi +@@ -1063,6 +1073,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi else { WARN("Attempted to create a NPOT cube texture (edge length %u) without GL support.\n", desc->width); @@ -158,15 +158,15 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1047,6 +1058,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi - surface_flags, device, parent, parent_ops, &texture_resource_ops))) +@@ -1072,6 +1083,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi + surface_flags, device, parent, parent_ops, &texture2d_resource_ops))) { WARN("Failed to initialize texture, returning %#x\n", hr); + HeapFree(GetProcessHeap(), 0, texture); return hr; } -@@ -1109,6 +1121,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1134,6 +1146,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -174,7 +174,7 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } -@@ -1139,6 +1152,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1164,6 +1177,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 else { WARN("Attempted to create a mipmapped NPOT texture without unconditional NPOT support.\n"); @@ -182,7 +182,7 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1151,12 +1165,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -1176,12 +1190,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); @@ -197,15 +197,15 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1165,6 +1181,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - surface_flags, device, parent, parent_ops, &texture_resource_ops))) +@@ -1190,6 +1206,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 + surface_flags, device, parent, parent_ops, &texture2d_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, texture); return hr; } -@@ -1337,12 +1354,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1392,12 +1409,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -220,7 +220,7 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } -@@ -1352,12 +1371,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1407,12 +1426,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -235,7 +235,7 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1385,6 +1406,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -1440,6 +1461,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -243,15 +243,15 @@ index c94dc5b..63e0668 100644 return WINED3DERR_INVALIDCALL; } } -@@ -1394,6 +1416,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct - 0, device, parent, parent_ops, &texture_resource_ops))) +@@ -1449,6 +1471,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct + 0, device, parent, parent_ops, &texture3d_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, texture); return hr; } -@@ -1470,7 +1493,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -1549,7 +1572,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -260,10 +260,10 @@ index c94dc5b..63e0668 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index b40d7d3..a0e9871 100644 +index 55b057c..e5baaa4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2343,6 +2343,7 @@ static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_t +@@ -2393,6 +2393,7 @@ static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_t void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture, const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; @@ -271,7 +271,7 @@ index b40d7d3..a0e9871 100644 void wined3d_texture_bind(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, -@@ -2772,6 +2773,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, +@@ -2827,6 +2828,7 @@ void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs, void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; void wined3d_cs_emit_volume_cleanup(struct wined3d_cs *cs, struct wined3d_volume *volume) DECLSPEC_HIDDEN; void wined3d_cs_emit_surface_cleanup(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN; @@ -280,5 +280,5 @@ index b40d7d3..a0e9871 100644 /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -- -2.4.2 +2.6.2 diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index a5f0f9a5..eba8e340 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -1054,29 +1054,34 @@ diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c static ULONG volume_resource_decref(struct wined3d_resource *resource) { struct wined3d_volume *volume = volume_from_resource(resource); -@@ -436,6 +882,7 @@ - return wined3d_texture_decref(volume->container); +@@ -449,6 +895,7 @@ + return WINED3DERR_INVALIDCALL; } +#if defined(STAGING_CSMT) static void wined3d_volume_location_invalidated(struct wined3d_resource *resource, DWORD location) { struct wined3d_volume *volume = volume_from_resource(resource); -@@ -451,6 +898,13 @@ +@@ -457,6 +904,7 @@ + wined3d_texture_set_dirty(volume->container); + } + ++#endif /* STAGING_CSMT */ + static const struct wined3d_resource_ops volume_resource_ops = + { + volume_resource_incref, +@@ -464,8 +912,10 @@ volume_unload, + volume_resource_sub_resource_map, + volume_resource_sub_resource_unmap, ++#if defined(STAGING_CSMT) wined3d_volume_location_invalidated, wined3d_volume_load_location, -+#else /* STAGING_CSMT */ -+static const struct wined3d_resource_ops volume_resource_ops = -+{ -+ volume_resource_incref, -+ volume_resource_decref, -+ volume_unload, +#endif /* STAGING_CSMT */ }; static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_texture *container, -@@ -482,7 +936,11 @@ +@@ -497,7 +947,11 @@ } volume->texture_level = level; @@ -1088,7 +1093,7 @@ diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c if (desc->pool == WINED3D_POOL_DEFAULT && desc->usage & WINED3DUSAGE_DYNAMIC && gl_info->supported[ARB_PIXEL_BUFFER_OBJECT] -@@ -490,7 +948,9 @@ +@@ -505,7 +959,9 @@ { wined3d_resource_free_sysmem(&volume->resource); volume->resource.map_binding = WINED3D_LOCATION_BUFFER; @@ -1142,7 +1147,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c default: mat._14 = mat._24 = mat._34 = 0.0f; mat._44 = 1.0f; } -@@ -4396,7 +4415,11 @@ +@@ -4325,7 +4344,11 @@ unsigned int i; DWORD ttff; DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2; @@ -1293,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 -@@ -1458,6 +1458,7 @@ +@@ -1448,6 +1448,7 @@ goto out; } @@ -1301,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; -@@ -1466,6 +1467,7 @@ +@@ -1456,6 +1457,7 @@ if (device->context_count) ret->offscreenBuffer = device->contexts[0]->offscreenBuffer; @@ -1309,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) { -@@ -1774,7 +1776,9 @@ +@@ -1764,7 +1766,9 @@ out: device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -1319,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); -@@ -1809,7 +1813,9 @@ +@@ -1799,7 +1803,9 @@ device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); @@ -1329,7 +1334,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2233,6 +2239,7 @@ +@@ -2219,6 +2225,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 */ @@ -1337,7 +1342,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c wined3d_resource_load_location(&context->current_rt->resource, context, WINED3D_LOCATION_TEXTURE_RGB); swapchain->render_to_fbo = TRUE; swapchain_update_draw_bindings(swapchain); -@@ -2247,6 +2254,22 @@ +@@ -2233,6 +2240,22 @@ return context_generate_rt_mask_from_surface(rt); else return context_generate_rt_mask(context->offscreenBuffer); @@ -1360,7 +1365,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } /* Context activation is done by the caller. */ -@@ -2278,7 +2301,11 @@ +@@ -2264,7 +2287,11 @@ } else { @@ -1372,7 +1377,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } cur_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask; -@@ -2325,7 +2352,11 @@ +@@ -2311,7 +2338,11 @@ DWORD rt_mask = 0, *cur_mask; UINT i; @@ -1384,7 +1389,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c || rt_count != context->gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2367,11 +2398,17 @@ +@@ -2353,11 +2384,17 @@ } else { @@ -1402,7 +1407,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2384,7 +2421,11 @@ +@@ -2370,7 +2407,11 @@ } else { @@ -1414,7 +1419,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c rt_count ? wined3d_rendertarget_view_get_surface(rts[0]) : NULL); } -@@ -2419,6 +2460,7 @@ +@@ -2405,6 +2446,7 @@ return TRUE; } @@ -1422,7 +1427,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { struct wined3d_rendertarget_view **rts = state->fb.render_targets; -@@ -2428,6 +2470,18 @@ +@@ -2414,6 +2456,18 @@ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return context_generate_rt_mask_no_fbo(context, wined3d_rendertarget_view_get_surface(rts[0])); @@ -1441,7 +1446,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c else if (!context->render_offscreen) return context_generate_rt_mask_from_surface(wined3d_rendertarget_view_get_surface(rts[0])); -@@ -2450,8 +2504,14 @@ +@@ -2436,8 +2490,14 @@ /* Context activation is done by the caller. */ void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -1456,7 +1461,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -2482,8 +2542,10 @@ +@@ -2468,8 +2528,10 @@ context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -1467,7 +1472,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -2721,12 +2783,22 @@ +@@ -2707,12 +2769,22 @@ /* Context activation is done by the caller. */ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -1490,7 +1495,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c if (rt_mask != *cur_mask) { context_apply_draw_buffers(context, rt_mask); -@@ -2928,7 +3000,11 @@ +@@ -2914,7 +2986,11 @@ { if (state->vertex_declaration->half_float_conv_needed && !stream_info->all_vbo) { @@ -1502,7 +1507,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c context->use_immediate_mode_draw = TRUE; } else -@@ -3103,11 +3179,19 @@ +@@ -3089,11 +3165,19 @@ } /* Context activation is done by the caller. */ @@ -1522,7 +1527,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i; WORD map; -@@ -3140,12 +3224,17 @@ +@@ -3126,12 +3210,17 @@ for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i) { if (map & 1) @@ -1540,7 +1545,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } if (state->index_buffer) { -@@ -3240,7 +3329,11 @@ +@@ -3226,7 +3315,11 @@ if (texture->texture_srgb.name) wined3d_texture_load(texture, context, TRUE); wined3d_texture_load(texture, context, FALSE); @@ -1930,10 +1935,10 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2201,9 +2287,11 @@ - ULONG (*resource_incref)(struct wined3d_resource *resource); - ULONG (*resource_decref)(struct wined3d_resource *resource); - void (*resource_unload)(struct wined3d_resource *resource); +@@ -2204,9 +2290,11 @@ + HRESULT (*resource_sub_resource_map)(struct wined3d_resource *resource, unsigned int sub_resource_idx, + struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); + HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx); +#if defined(STAGING_CSMT) void (*resource_location_invalidated)(struct wined3d_resource *resource, DWORD location); void (*resource_load_location)(struct wined3d_resource *resource, @@ -1942,7 +1947,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_resource -@@ -2228,6 +2316,7 @@ +@@ -2231,6 +2319,7 @@ UINT depth; UINT size; DWORD priority; @@ -1950,7 +1955,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *heap_memory, *map_heap_memory, *user_memory, *bitmap_data; UINT custom_row_pitch, custom_slice_pitch; struct wined3d_gl_bo *buffer, *map_buffer; -@@ -2235,6 +2324,10 @@ +@@ -2238,6 +2327,10 @@ DWORD locations; LONG access_fence; BOOL unmap_dirtify; @@ -1961,7 +1966,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2259,6 +2352,7 @@ +@@ -2262,6 +2355,7 @@ void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -1969,7 +1974,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h DWORD wined3d_resource_access_from_location(DWORD location) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_resource_changed(struct wined3d_resource *resource, -@@ -2307,6 +2401,15 @@ +@@ -2310,6 +2404,15 @@ { while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); } @@ -2306,7 +2311,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /***************************************************************************** * Utility function prototypes -@@ -3238,7 +3468,9 @@ +@@ -3234,7 +3464,9 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; @@ -6195,29 +6200,34 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c surface->flags |= SFLAG_CLIENT; mem = surface->resource.heap_memory; -@@ -986,6 +1056,7 @@ - wined3d_texture_unload_gl_texture(texture); +@@ -994,6 +1064,7 @@ + return wined3d_surface_unmap(surface_from_resource(sub_resource)); } +#if defined(STAGING_CSMT) static void wined3d_texture_load_location_invalidated(struct wined3d_resource *resource, DWORD location) { ERR("Should not be called on textures.\n"); -@@ -1005,6 +1076,13 @@ +@@ -1006,6 +1077,7 @@ + ERR("Should not be called on textures.\n"); + } + ++#endif /* STAGING_CSMT */ + static const struct wined3d_resource_ops texture2d_resource_ops = + { + texture_resource_incref, +@@ -1013,8 +1085,10 @@ wined3d_texture_unload, + texture2d_resource_sub_resource_map, + texture2d_resource_sub_resource_unmap, ++#if defined(STAGING_CSMT) wined3d_texture_load_location_invalidated, wined3d_texture_load_location, -+#else /* STAGING_CSMT */ -+static const struct wined3d_resource_ops texture_resource_ops = -+{ -+ texture_resource_incref, -+ texture_resource_decref, -+ wined3d_texture_unload, +#endif /* STAGING_CSMT */ }; static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc, -@@ -1021,7 +1099,9 @@ +@@ -1031,7 +1105,9 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6227,7 +6237,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1031,6 +1111,7 @@ +@@ -1041,6 +1117,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6235,7 +6245,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1039,6 +1120,14 @@ +@@ -1049,6 +1126,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6250,7 +6260,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1059,7 +1148,9 @@ +@@ -1069,7 +1154,9 @@ else { WARN("Attempted to create a NPOT cube texture (edge length %u) without GL support.\n", desc->width); @@ -6260,8 +6270,8 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1069,7 +1160,9 @@ - surface_flags, device, parent, parent_ops, &texture_resource_ops))) +@@ -1079,7 +1166,9 @@ + surface_flags, device, parent, parent_ops, &texture2d_resource_ops))) { WARN("Failed to initialize texture, returning %#x\n", hr); +#if defined(STAGING_CSMT) @@ -6270,7 +6280,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1132,7 +1225,9 @@ +@@ -1142,7 +1231,9 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6280,7 +6290,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1163,7 +1258,9 @@ +@@ -1173,7 +1264,9 @@ else { WARN("Attempted to create a mipmapped NPOT texture without unconditional NPOT support.\n"); @@ -6290,7 +6300,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1176,6 +1273,7 @@ +@@ -1186,6 +1279,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n"); @@ -6298,7 +6308,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1184,6 +1282,14 @@ +@@ -1194,6 +1288,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6313,8 +6323,8 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1192,7 +1298,9 @@ - surface_flags, device, parent, parent_ops, &texture_resource_ops))) +@@ -1202,7 +1304,9 @@ + surface_flags, device, parent, parent_ops, &texture2d_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); +#if defined(STAGING_CSMT) @@ -6323,7 +6333,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1278,12 +1386,25 @@ +@@ -1288,12 +1392,25 @@ static void texture3d_sub_resource_invalidate_location(struct wined3d_resource *sub_resource, DWORD location) { @@ -6349,7 +6359,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void texture3d_sub_resource_upload_data(struct wined3d_resource *sub_resource, -@@ -1293,7 +1414,11 @@ +@@ -1303,7 +1420,11 @@ struct wined3d_const_bo_address addr; unsigned int row_pitch, slice_pitch; @@ -6361,7 +6371,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (row_pitch != data->row_pitch || slice_pitch != data->slice_pitch) FIXME("Ignoring row/slice pitch (%u/%u).\n", data->row_pitch, data->slice_pitch); -@@ -1318,7 +1443,11 @@ +@@ -1328,7 +1449,11 @@ void *mem = NULL; if (gl_info->supported[APPLE_CLIENT_STORAGE] && !format->convert @@ -6373,7 +6383,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { TRACE("Enabling GL_UNPACK_CLIENT_STORAGE_APPLE for volume %p\n", volume); gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); -@@ -1378,6 +1507,7 @@ +@@ -1405,6 +1530,7 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6381,7 +6391,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1386,6 +1516,14 @@ +@@ -1413,6 +1539,14 @@ { WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); HeapFree(GetProcessHeap(), 0, texture); @@ -6396,7 +6406,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -1395,6 +1533,7 @@ +@@ -1422,6 +1556,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6404,7 +6414,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -1403,6 +1542,14 @@ +@@ -1430,6 +1565,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6419,7 +6429,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1430,7 +1577,9 @@ +@@ -1457,7 +1600,9 @@ { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -6429,8 +6439,8 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -1440,7 +1589,9 @@ - 0, device, parent, parent_ops, &texture_resource_ops))) +@@ -1467,7 +1612,9 @@ + 0, device, parent, parent_ops, &texture3d_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); +#if defined(STAGING_CSMT) @@ -6439,7 +6449,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -1541,6 +1692,9 @@ +@@ -1568,6 +1715,9 @@ if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6923,15 +6933,15 @@ 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 -@@ -1030,6 +1327,7 @@ - resource_unload(resource); +@@ -1043,6 +1340,7 @@ + return WINED3DERR_INVALIDCALL; } +#if defined(STAGING_CSMT) static void wined3d_surface_location_invalidated(struct wined3d_resource *resource, DWORD location) { struct wined3d_surface *surface = surface_from_resource(resource); -@@ -1045,6 +1343,19 @@ +@@ -1058,6 +1356,21 @@ { surface_private_setup, surface_frontbuffer_updated, @@ -6941,6 +6951,8 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + surface_resource_incref, + surface_resource_decref, + surface_unload, ++ surface_resource_sub_resource_map, ++ surface_resource_sub_resource_unmap, +}; + +static const struct wined3d_surface_ops surface_ops = @@ -6951,7 +6963,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c }; /***************************************************************************** -@@ -1088,6 +1399,7 @@ +@@ -1101,6 +1414,7 @@ return WINED3D_OK; } @@ -6959,7 +6971,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); -@@ -1097,6 +1409,23 @@ +@@ -1110,6 +1424,23 @@ { gdi_surface_private_setup, gdi_surface_frontbuffer_updated, @@ -6983,7 +6995,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 -@@ -1115,7 +1444,11 @@ +@@ -1128,7 +1459,11 @@ return; } @@ -6995,7 +7007,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface->container->resource.format_flags & WINED3DFMT_FLAG_COMPRESSED) { -@@ -1143,6 +1476,7 @@ +@@ -1156,6 +1491,7 @@ void *mem; GLenum gl_format = format->glFormat; GLenum gl_type = format->glType; @@ -7003,7 +7015,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c UINT src_pitch = 0; UINT dst_row_pitch, dst_slice_pitch; -@@ -1151,6 +1485,16 @@ +@@ -1164,6 +1500,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); @@ -7020,7 +7032,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); } -@@ -1237,12 +1581,21 @@ +@@ -1250,12 +1596,21 @@ * won't be released, and doesn't have to be re-read. */ src_data = mem; dst_data = data.addr; @@ -7042,7 +7054,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HeapFree(GetProcessHeap(), 0, mem); -@@ -1366,10 +1719,33 @@ +@@ -1379,10 +1734,33 @@ static BOOL surface_check_block_align(struct wined3d_surface *surface, const struct wined3d_box *box) { @@ -7076,7 +7088,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}; -@@ -1388,7 +1764,11 @@ +@@ -1401,7 +1779,11 @@ UINT update_w, update_h; UINT dst_w, dst_h; RECT r, dst_rect; @@ -7088,7 +7100,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", -@@ -1459,11 +1839,17 @@ +@@ -1472,11 +1854,17 @@ return WINED3DERR_INVALIDCALL; } @@ -7106,7 +7118,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; -@@ -1474,6 +1860,7 @@ +@@ -1487,6 +1875,7 @@ if (update_w == dst_w && update_h == dst_h) wined3d_texture_prepare_texture(dst_surface->container, context, FALSE); else @@ -7114,7 +7126,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); -@@ -1487,6 +1874,21 @@ +@@ -1500,6 +1889,21 @@ wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB); wined3d_resource_invalidate_location(&dst_surface->resource, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -7136,7 +7148,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -1600,6 +2002,7 @@ +@@ -1613,6 +2017,7 @@ if (surface->resource.pool == WINED3D_POOL_SCRATCH) ERR("Not supported on scratch surfaces.\n"); @@ -7144,7 +7156,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"); -@@ -1608,6 +2011,16 @@ +@@ -1621,6 +2026,16 @@ TRACE("Reloading because surface is dirty.\n"); wined3d_resource_load_location(&surface->resource, context, location); @@ -7161,7 +7173,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_evict_sysmem(surface); } -@@ -1690,6 +2103,7 @@ +@@ -1703,6 +2118,7 @@ void CDECL wined3d_surface_preload(struct wined3d_surface *surface) { @@ -7169,7 +7181,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); -@@ -1700,6 +2114,17 @@ +@@ -1713,6 +2129,17 @@ } wined3d_cs_emit_surface_preload(device->cs, surface); @@ -7187,7 +7199,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface) -@@ -1734,10 +2159,28 @@ +@@ -1747,10 +2174,28 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface) { @@ -7216,7 +7228,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) -@@ -1862,6 +2305,7 @@ +@@ -1875,6 +2320,7 @@ { DeleteDC(surface->hDC); DeleteObject(surface->dib.DIBsection); @@ -7224,7 +7236,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; -@@ -1870,6 +2314,15 @@ +@@ -1883,6 +2329,15 @@ surface->resource.locations = 0; wined3d_resource_free_sysmem(&surface->resource); surface->resource.map_heap_memory = NULL; @@ -7240,7 +7252,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c width = texture_resource->width; height = texture_resource->height; -@@ -1895,6 +2348,7 @@ +@@ -1908,6 +2363,7 @@ else surface->flags &= ~SFLAG_NONPOW2; @@ -7248,7 +7260,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; -@@ -1915,6 +2369,27 @@ +@@ -1928,6 +2384,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); @@ -7276,7 +7288,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* The format might be changed to a format that needs conversion. -@@ -1937,11 +2412,19 @@ +@@ -1950,11 +2427,19 @@ if (!valid_location) { @@ -7296,7 +7308,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -2300,6 +2783,7 @@ +@@ -2313,6 +2798,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_surface *source, enum wined3d_format_id to_fmt) { @@ -7304,7 +7316,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; -@@ -2308,6 +2792,13 @@ +@@ -2321,6 +2807,13 @@ struct wined3d_surface *dst; struct wined3d_context *context = NULL; struct wined3d_device *device = source->resource.device; @@ -7318,7 +7330,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c conv = find_converter(source->resource.format->id, to_fmt); if (!conv) -@@ -2331,6 +2822,7 @@ +@@ -2344,6 +2837,7 @@ } dst = surface_from_resource(wined3d_texture_get_sub_resource(ret, 0)); @@ -7326,7 +7338,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); -@@ -2371,6 +2863,32 @@ +@@ -2384,6 +2878,32 @@ if (context) context_release(context); return NULL; @@ -7359,7 +7371,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, -@@ -2438,6 +2956,7 @@ +@@ -2451,6 +2971,7 @@ HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface) { @@ -7367,7 +7379,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HRESULT hr; TRACE("surface %p.\n", surface); -@@ -2448,6 +2967,20 @@ +@@ -2461,6 +2982,20 @@ memset(&surface->lockedRect, 0, sizeof(surface->lockedRect)); return hr; @@ -7388,7 +7400,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, -@@ -2455,6 +2988,21 @@ +@@ -2468,6 +3003,21 @@ { const struct wined3d_format *format = surface->resource.format; unsigned int fmt_flags = surface->container->resource.format_flags; @@ -7410,7 +7422,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box && !surface_check_block_align(surface, box)) -@@ -2466,6 +3014,13 @@ +@@ -2479,6 +3029,13 @@ return WINED3DERR_INVALIDCALL; } @@ -7424,7 +7436,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 -@@ -2481,6 +3036,7 @@ +@@ -2494,6 +3051,7 @@ } } @@ -7432,7 +7444,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (box) { surface->lockedRect.left = box->left; -@@ -2562,6 +3118,179 @@ +@@ -2575,6 +3133,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 @@ -7496,7 +7508,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + map_desc->row_pitch = surface->resource.width * format->byte_count; + else + map_desc->row_pitch = wined3d_surface_get_pitch(surface); -+ map_desc->slice_pitch = 0; ++ map_desc->slice_pitch = surface->resource.height * map_desc->row_pitch; + + if (!box) + { @@ -7612,7 +7624,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 -@@ -2577,6 +3306,7 @@ +@@ -2590,6 +3321,7 @@ if (device->d3d_initialized) context = context_acquire(device, NULL); @@ -7620,7 +7632,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) -@@ -2602,6 +3332,13 @@ +@@ -2615,6 +3347,13 @@ surface->flags &= ~SFLAG_DCINUSE; wined3d_cs_emit_releasedc(surface->resource.device->cs, surface); @@ -7634,7 +7646,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -2618,9 +3355,14 @@ +@@ -2631,9 +3370,14 @@ int i; BOOL srcIsUpsideDown; struct wined3d_bo_address data; @@ -7649,7 +7661,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface != old_ctx->current_rt) { -@@ -2660,8 +3402,13 @@ +@@ -2673,8 +3417,13 @@ } /* Setup pixel store pack state -- to glReadPixels into the correct place */ @@ -7663,7 +7675,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c checkGLcall("glPixelStorei"); gl_info->gl_ops.gl.p_glReadPixels(0, 0, -@@ -2678,6 +3425,10 @@ +@@ -2691,6 +3440,10 @@ { /* glReadPixels returns the image upside down, and there is no way to prevent this. * Flip the lines in software. */ @@ -7674,7 +7686,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!(row = HeapAlloc(GetProcessHeap(), 0, pitch))) goto error; -@@ -2904,8 +3655,13 @@ +@@ -2917,8 +3670,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. */ @@ -7688,7 +7700,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Uses the hardware to stretch and flip the image */ -@@ -2973,7 +3729,11 @@ +@@ -2986,7 +3744,11 @@ checkGLcall("glEnable(texture_target)"); /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ @@ -7700,7 +7712,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 -@@ -3170,6 +3930,7 @@ +@@ -3183,6 +3945,7 @@ checkGLcall("glDeleteTextures(1, &backup)"); } @@ -7708,7 +7720,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) -@@ -3181,6 +3942,17 @@ +@@ -3194,6 +3957,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); @@ -7726,7 +7738,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Front buffer coordinates are always full screen coordinates, but our GL -@@ -3235,9 +4007,15 @@ +@@ -3248,9 +4022,15 @@ gl_info = context->gl_info; @@ -7742,7 +7754,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 */ -@@ -3280,9 +4058,13 @@ +@@ -3293,9 +4073,13 @@ /* Leave the opengl state valid for blitting */ device->blitter->unset_shader(context->gl_info); @@ -7756,7 +7768,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. */ -@@ -3312,8 +4094,13 @@ +@@ -3325,8 +4109,13 @@ enum wined3d_texture_filter_type filter) { struct wined3d_device *device = dst_surface->resource.device; @@ -7770,7 +7782,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), -@@ -3504,6 +4291,7 @@ +@@ -3517,6 +4306,7 @@ { TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h); @@ -7778,7 +7790,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))) -@@ -3512,6 +4300,15 @@ +@@ -3525,6 +4315,15 @@ surface->ds_current_size.cx = w; surface->ds_current_size.cy = h; surface->resource.locations = location; @@ -7794,7 +7806,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Context activation is done by the caller. */ -@@ -3526,7 +4323,11 @@ +@@ -3539,7 +4338,11 @@ /* TODO: Make this work for modes other than FBO */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return; @@ -7806,7 +7818,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { w = surface->ds_current_size.cx; h = surface->ds_current_size.cy; -@@ -3552,6 +4353,7 @@ +@@ -3565,6 +4368,7 @@ return; } @@ -7814,7 +7826,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (surface->resource.locations & WINED3D_LOCATION_DISCARDED) { TRACE("Surface was discarded, no need copy data.\n"); -@@ -3567,6 +4369,23 @@ +@@ -3580,6 +4384,23 @@ { FIXME("No up to date depth stencil location.\n"); surface->resource.locations |= location; @@ -7838,7 +7850,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; -@@ -3630,9 +4449,13 @@ +@@ -3643,9 +4464,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7852,7 +7864,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) -@@ -3648,9 +4471,13 @@ +@@ -3661,9 +4486,13 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -7866,7 +7878,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 -@@ -3658,6 +4485,7 @@ +@@ -3671,6 +4500,7 @@ ERR("Invalid location (%#x) specified.\n", location); } @@ -7874,7 +7886,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; -@@ -3690,6 +4518,124 @@ +@@ -3703,6 +4533,124 @@ FIXME("Can't load surface %p with location flags %s into sysmem.\n", surface, wined3d_debug_location(surface->resource.locations)); @@ -7999,7 +8011,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } /* Context activation is done by the caller. */ -@@ -3698,12 +4644,14 @@ +@@ -3711,12 +4659,14 @@ { RECT r; @@ -8014,7 +8026,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)) { -@@ -3712,7 +4660,11 @@ +@@ -3725,7 +4675,11 @@ } surface_get_rect(surface, NULL, &r); @@ -8026,7 +8038,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); -@@ -3727,6 +4679,7 @@ +@@ -3740,6 +4694,7 @@ struct wined3d_device *device = surface->resource.device; const struct wined3d_color_key_conversion *conversion; struct wined3d_texture *texture = surface->container; @@ -8034,7 +8046,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; -@@ -3753,6 +4706,24 @@ +@@ -3766,6 +4721,24 @@ } if (surface->resource.locations & (WINED3D_LOCATION_TEXTURE_SRGB | WINED3D_LOCATION_TEXTURE_RGB) @@ -8059,7 +8071,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, -@@ -3768,6 +4739,7 @@ +@@ -3781,6 +4754,7 @@ return WINED3D_OK; } @@ -8067,7 +8079,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, -@@ -3775,6 +4747,15 @@ +@@ -3788,6 +4762,15 @@ NULL, surface->resource.usage, surface->resource.pool, surface->resource.format)) { DWORD src_location = surface->resource.locations & WINED3D_LOCATION_RB_RESOLVED ? @@ -8083,7 +8095,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}; -@@ -3789,6 +4770,7 @@ +@@ -3802,6 +4785,7 @@ if (srgb) { @@ -8091,10 +8103,15 @@ 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) { -@@ -3823,6 +4805,42 @@ +@@ -3836,15 +4820,55 @@ 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); +- +#else /* STAGING_CSMT */ + if ((surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->resource.map_binding)) + == WINED3D_LOCATION_TEXTURE_RGB) @@ -8131,10 +8148,11 @@ 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))) -@@ -3831,7 +4849,11 @@ ++ ++ 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. */ @@ -8146,7 +8164,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -3840,6 +4862,7 @@ +@@ -3853,6 +4877,7 @@ else surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; @@ -8154,7 +8172,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); -@@ -3847,6 +4870,14 @@ +@@ -3860,6 +4885,14 @@ } wined3d_resource_get_memory(&surface->resource, surface->resource.locations, &data); @@ -8169,7 +8187,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. */ -@@ -3861,9 +4892,15 @@ +@@ -3874,9 +4907,15 @@ context_release(context); return E_OUTOFMEMORY; } @@ -8185,7 +8203,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c data.addr = mem; } else if (conversion) -@@ -3883,6 +4920,7 @@ +@@ -3896,6 +4935,7 @@ } if (texture->swapchain && texture->swapchain->palette) palette = texture->swapchain->palette; @@ -8193,7 +8211,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; -@@ -3891,6 +4929,16 @@ +@@ -3904,6 +4944,16 @@ wined3d_surface_upload_data(surface, gl_info, &format, &src_rect, src_row_pitch, &dst_point, srgb, wined3d_const_bo_address(&data)); @@ -8210,7 +8228,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HeapFree(GetProcessHeap(), 0, mem); -@@ -3902,7 +4950,11 @@ +@@ -3915,7 +4965,11 @@ { RECT rect = {0, 0, surface->resource.width, surface->resource.height}; @@ -8222,7 +8240,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c ERR("Trying to resolve multisampled surface %p, but location WINED3D_LOCATION_RB_MULTISAMPLE not current.\n", surface); -@@ -3910,42 +4962,89 @@ +@@ -3923,11 +4977,17 @@ surface, WINED3D_LOCATION_RB_MULTISAMPLE, &rect, surface, WINED3D_LOCATION_RB_RESOLVED, &rect); } @@ -8240,64 +8258,38 @@ 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)); - -- if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) -+ if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) -+ { -+ if (location == WINED3D_LOCATION_TEXTURE_RGB +@@ -3935,6 +4995,7 @@ + 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->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) + { + surface_load_ds_location(surface, context, location); +@@ -3959,6 +5020,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_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 (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"); @@ -8313,16 +8305,15 @@ 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; -- return; ++ { ++ ERR("Surface %p does not have any up to date location.\n", surface); ++ surface->flags |= SFLAG_LOST; + return WINED3DERR_DEVICELOST; +#endif /* STAGING_CSMT */ } switch (location) -@@ -3959,7 +5058,11 @@ +@@ -3972,7 +5073,11 @@ case WINED3D_LOCATION_DRAWABLE: if (FAILED(hr = surface_load_drawable(surface, context))) @@ -8334,7 +8325,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -3970,7 +5073,11 @@ +@@ -3983,7 +5088,11 @@ case WINED3D_LOCATION_TEXTURE_SRGB: if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) @@ -8346,7 +8337,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; default: -@@ -3978,12 +5085,21 @@ +@@ -3991,12 +5100,21 @@ break; } @@ -8368,7 +8359,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; } -@@ -4091,6 +5207,7 @@ +@@ -4104,6 +5222,7 @@ const RECT *dst_rect, const struct wined3d_color *color) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8376,7 +8367,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; -@@ -4111,6 +5228,21 @@ +@@ -4124,6 +5243,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); @@ -8398,7 +8389,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4119,6 +5251,7 @@ +@@ -4132,6 +5266,7 @@ const RECT *dst_rect, float depth) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; @@ -8406,7 +8397,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; -@@ -4134,6 +5267,20 @@ +@@ -4147,6 +5282,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); @@ -8427,7 +8418,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return WINED3D_OK; } -@@ -4162,8 +5309,13 @@ +@@ -4175,8 +5324,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); @@ -8441,7 +8432,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } const struct blit_shader ffp_blit = { -@@ -4319,6 +5471,7 @@ +@@ -4332,6 +5486,7 @@ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) { @@ -8449,7 +8440,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; -@@ -4353,6 +5506,28 @@ +@@ -4366,6 +5521,28 @@ wined3d_resource_get_pitch(&dst_surface->resource, &dst_row_pitch, &dst_slice_pitch); src_data = dst_data; src_row_pitch = dst_row_pitch; @@ -8478,7 +8469,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; -@@ -4364,12 +5539,14 @@ +@@ -4377,12 +5554,14 @@ dst_fmt_flags = dst_surface->container->resource.format_flags; if (src_surface) { @@ -8493,7 +8484,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))) -@@ -4380,9 +5557,13 @@ +@@ -4393,9 +5572,13 @@ } src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, 0)); } @@ -8507,7 +8498,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; } -@@ -4392,8 +5573,12 @@ +@@ -4405,8 +5588,12 @@ src_fmt_flags = dst_fmt_flags; } @@ -8520,7 +8511,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } bpp = dst_surface->resource.format->byte_count; -@@ -4404,12 +5589,24 @@ +@@ -4417,12 +5604,24 @@ width = (dst_rect->right - dst_rect->left) * bpp; if (src_surface) @@ -8545,7 +8536,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS) { -@@ -4444,7 +5641,11 @@ +@@ -4457,7 +5656,11 @@ } hr = surface_cpu_blt_compressed(sbase, dbuf, @@ -8557,7 +8548,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format, flags, fx); goto release; } -@@ -4452,7 +5653,11 @@ +@@ -4465,7 +5668,11 @@ /* First, all the 'source-less' blits */ if (flags & WINEDDBLT_COLORFILL) { @@ -8569,7 +8560,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c flags &= ~WINEDDBLT_COLORFILL; } -@@ -4501,6 +5706,7 @@ +@@ -4514,6 +5721,7 @@ for (y = 0; y < dstheight; ++y) { memcpy(dbuf, sbuf, width); @@ -8577,7 +8568,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c sbuf += src_row_pitch; dbuf += dst_row_pitch; } -@@ -4514,6 +5720,21 @@ +@@ -4527,6 +5735,21 @@ { sbuf -= src_row_pitch; dbuf -= dst_row_pitch; @@ -8599,7 +8590,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c memcpy(dbuf, sbuf, width); } } -@@ -4523,8 +5744,13 @@ +@@ -4536,8 +5759,13 @@ for (y = 0; y < dstheight; ++y) { memmove(dbuf, sbuf, width); @@ -8613,7 +8604,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4533,9 +5759,15 @@ +@@ -4546,9 +5774,15 @@ /* Stretching in y direction only. */ for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8629,7 +8620,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4545,6 +5777,7 @@ +@@ -4558,6 +5792,7 @@ int last_sy = -1; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8637,7 +8628,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)) -@@ -4552,6 +5785,15 @@ +@@ -4565,6 +5800,15 @@ /* This source row is the same as last source row - * Copy the already stretched row. */ memcpy(dbuf, dbuf - dst_row_pitch, width); @@ -8653,7 +8644,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4598,6 +5840,7 @@ +@@ -4611,6 +5855,7 @@ } #undef STRETCH_ROW } @@ -8661,7 +8652,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dbuf += dst_row_pitch; last_sy = sy; } -@@ -4606,6 +5849,16 @@ +@@ -4619,6 +5864,16 @@ else { LONG dstyinc = dst_row_pitch, dstxinc = bpp; @@ -8678,7 +8669,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)) -@@ -4655,7 +5908,11 @@ +@@ -4668,7 +5923,11 @@ LONG tmpxy; dTopLeft = dbuf; dTopRight = dbuf + ((dstwidth - 1) * bpp); @@ -8690,7 +8681,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp); if (fx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY) -@@ -4732,6 +5989,7 @@ +@@ -4745,6 +6004,7 @@ flags &= ~(WINEDDBLT_DDFX); } @@ -8698,7 +8689,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c #define COPY_COLORKEY_FX(type) \ do { \ const type *s; \ -@@ -4753,6 +6011,29 @@ +@@ -4766,6 +6026,29 @@ d = (type *)(((BYTE *)d) + dstyinc); \ } \ } while(0) @@ -8728,7 +8719,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c switch (bpp) { -@@ -4771,7 +6052,11 @@ +@@ -4784,7 +6067,11 @@ BYTE *d = dbuf, *dx; for (y = sy = 0; y < dstheight; ++y, sy += yinc) { @@ -8740,7 +8731,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dx = d; for (x = sx = 0; x < dstwidth; ++x, sx+= xinc) { -@@ -4802,10 +6087,12 @@ +@@ -4815,10 +6102,12 @@ } } @@ -8753,7 +8744,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c error: if (flags && FIXME_ON(d3d_surface)) { -@@ -4813,6 +6100,7 @@ +@@ -4826,6 +6115,7 @@ } release: @@ -8761,7 +8752,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); -@@ -4831,6 +6119,14 @@ +@@ -4844,6 +6134,14 @@ wined3d_texture_decref(src_texture); if (context) context_release(context); @@ -8776,7 +8767,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -4875,6 +6171,7 @@ +@@ -4888,6 +6186,7 @@ cpu_blit_blit_surface, }; @@ -8784,7 +8775,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) -@@ -4882,6 +6179,16 @@ +@@ -4895,6 +6194,16 @@ struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_device *device = dst_surface->resource.device; DWORD src_ds_flags, dst_ds_flags; @@ -8801,7 +8792,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c BOOL scale, convert; static const DWORD simple_blit = WINEDDBLT_ASYNC -@@ -4892,6 +6199,106 @@ +@@ -4905,6 +6214,106 @@ | WINEDDBLT_DEPTHFILL | WINEDDBLT_DONOTWAIT; @@ -8908,7 +8899,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!device->d3d_initialized) { WARN("D3D not initialized, using fallback.\n"); -@@ -4934,8 +6341,13 @@ +@@ -4947,8 +6356,13 @@ } scale = src_surface @@ -8922,7 +8913,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 -@@ -4955,6 +6367,7 @@ +@@ -4968,6 +6382,7 @@ TRACE("Depth fill.\n"); if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) @@ -8930,7 +8921,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))) -@@ -4965,6 +6378,24 @@ +@@ -4978,6 +6393,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; @@ -8955,7 +8946,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -4973,8 +6404,13 @@ +@@ -4986,8 +6419,13 @@ /* In principle this would apply to depth blits as well, but we don't * implement those in the CPU blitter at the moment. */ @@ -8969,7 +8960,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { if (scale) TRACE("Not doing sysmem blit because of scaling.\n"); -@@ -4995,8 +6431,13 @@ +@@ -5008,8 +6446,13 @@ palette, fx->u5.dwFillColor, &color)) goto fallback; @@ -8983,7 +8974,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -5014,8 +6455,13 @@ +@@ -5027,8 +6470,13 @@ color_key = &src_surface->container->async.src_blt_color_key; blit_op = WINED3D_BLIT_OP_COLOR_BLIT_CKEY; } @@ -8997,7 +8988,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { /* Upload */ if (scale) -@@ -5024,6 +6470,7 @@ +@@ -5037,6 +6485,7 @@ TRACE("Not doing upload because of format conversion.\n"); else { @@ -9005,7 +8996,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))) -@@ -5036,6 +6483,19 @@ +@@ -5049,6 +6498,19 @@ context_release(context); } return; @@ -9025,7 +9016,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -5059,6 +6519,7 @@ +@@ -5072,6 +6534,7 @@ wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -9033,7 +9024,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return; } -@@ -5264,6 +6725,53 @@ +@@ -5279,6 +6742,53 @@ wined3d_surface_location_invalidated, wined3d_surface_load_location, }; @@ -9087,7 +9078,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) -@@ -5325,7 +6833,11 @@ +@@ -5340,7 +6850,11 @@ } surface->container = container; @@ -9099,7 +9090,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c list_init(&surface->renderbuffers); list_init(&surface->overlays); -@@ -5357,9 +6869,14 @@ +@@ -5372,9 +6886,14 @@ if (surface->resource.map_binding == WINED3D_LOCATION_DIB) { wined3d_resource_free_sysmem(&surface->resource); @@ -9114,7 +9105,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } return hr; -@@ -5386,7 +6903,11 @@ +@@ -5401,7 +6920,11 @@ if (FAILED(hr = surface_init(object, container, desc, target, level, layer, flags))) { WARN("Failed to initialize surface, returning %#x.\n", hr); @@ -9614,29 +9605,34 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } } -@@ -1160,6 +1360,7 @@ - return wined3d_buffer_decref(buffer_from_resource(resource)); +@@ -1198,6 +1398,7 @@ + return WINED3D_OK; } +#if defined(STAGING_CSMT) static void wined3d_buffer_location_invalidated(struct wined3d_resource *resource, DWORD location) { ERR("Not yet implemented.\n"); -@@ -1179,6 +1380,13 @@ +@@ -1210,6 +1411,7 @@ + ERR("Not yet implemented.\n"); + } + ++#endif /* STAGING_CSMT */ + static const struct wined3d_resource_ops buffer_resource_ops = + { + buffer_resource_incref, +@@ -1217,8 +1419,10 @@ buffer_unload, + buffer_resource_sub_resource_map, + buffer_resource_sub_resource_unmap, ++#if defined(STAGING_CSMT) wined3d_buffer_location_invalidated, wined3d_buffer_load_location, -+#else /* STAGING_CSMT */ -+static const struct wined3d_resource_ops buffer_resource_ops = -+{ -+ buffer_resource_incref, -+ buffer_resource_decref, -+ buffer_unload, +#endif /* STAGING_CSMT */ }; static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device *device, -@@ -1210,7 +1418,9 @@ +@@ -1250,7 +1454,9 @@ return hr; } buffer->buffer_type_hint = bind_hint; @@ -9646,7 +9642,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory, buffer); -@@ -1226,6 +1436,7 @@ +@@ -1266,6 +1472,7 @@ dynamic_buffer_ok = gl_info->supported[APPLE_FLUSH_BUFFER_RANGE] || gl_info->supported[ARB_MAP_BUFFER_RANGE]; @@ -9654,7 +9650,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c /* Observations show that draw_strided_slow is faster on dynamic VBs than converting + * drawStridedFast (half-life 2 and others). * -@@ -1233,6 +1444,15 @@ +@@ -1273,6 +1480,15 @@ * show that draw_strided_slow is faster than converting + uploading + drawStridedFast. * Therefore do not create a VBO for WINED3DUSAGE_DYNAMIC buffers. */ @@ -9670,7 +9666,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (!gl_info->supported[ARB_VERTEX_BUFFER_OBJECT]) { TRACE("Not creating a vbo because GL_ARB_vertex_buffer is not supported\n"); -@@ -1250,6 +1470,7 @@ +@@ -1290,6 +1506,7 @@ buffer->flags |= WINED3D_BUFFER_CREATEBO; } @@ -9678,7 +9674,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)); if (!buffer->maps) { -@@ -1260,6 +1481,7 @@ +@@ -1300,6 +1517,7 @@ } buffer->maps_size = 1; @@ -9686,7 +9682,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (data) { BYTE *ptr; -@@ -1268,7 +1490,9 @@ +@@ -1308,7 +1526,9 @@ if (FAILED(hr)) { ERR("Failed to map buffer, hr %#x\n", hr); @@ -9696,7 +9692,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_unload(&buffer->resource); resource_cleanup(&buffer->resource); return hr; -@@ -1279,8 +1503,20 @@ +@@ -1319,8 +1539,20 @@ wined3d_buffer_unmap(buffer); } @@ -9717,7 +9713,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c return WINED3D_OK; } -@@ -1389,6 +1625,7 @@ +@@ -1429,6 +1661,7 @@ return WINED3D_OK; } @@ -9725,7 +9721,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) { -@@ -1396,3 +1633,4 @@ +@@ -1436,3 +1669,4 @@ buffer->resource.heap_memory = mem; buffer->flags |= WINED3D_BUFFER_DISCARD; } @@ -9733,7 +9729,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c -@@ -5548,9 +5548,15 @@ +@@ -5528,9 +5528,15 @@ DebugBreak(); } @@ -9802,7 +9798,7 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c context_resource_unloaded(resource->device, resource, resource->type); } -@@ -339,7 +349,11 @@ +@@ -355,7 +365,11 @@ p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1; *p = mem; @@ -9814,7 +9810,7 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c return TRUE; } -@@ -405,7 +419,11 @@ +@@ -421,7 +435,11 @@ return ret; } @@ -9826,7 +9822,7 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c { if (d3d_flags & WINED3D_MAP_READONLY) return GL_READ_ONLY_ARB; -@@ -446,6 +464,7 @@ +@@ -462,6 +480,7 @@ else resource->draw_binding = WINED3D_LOCATION_TEXTURE_RGB; } @@ -9834,7 +9830,7 @@ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c void wined3d_resource_get_pitch(const struct wined3d_resource *resource, UINT *row_pitch, UINT *slice_pitch) -@@ -1024,3 +1043,4 @@ +@@ -1040,3 +1059,4 @@ wined3d_resource_invalidate_location(resource, ~resource->map_binding); }