From b5a323aaa3ed1ecb09b2fcbe19099770e9c15517 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 2 Aug 2016 03:35:23 +0200 Subject: [PATCH] Rebase against 7aadb08212a5269ebefcb100cf567f7cf7aa0a7c. --- ...i32-Remove-unnecessary-debug-channel.patch | 26 - ...6-winetest-Remove-duplicate-if-check.patch | 26 - patches/patchinstall.sh | 14 +- ...nd-dll-with-STAGING_CSMT-definition-.patch | 15 +- ...-move-surface-volume_load_location-i.patch | 96 +-- ...rface-and-volume-system-memory-loadi.patch | 110 +-- ...e-the-framebuffer-into-wined3d_state.patch | 127 ++- ...ture-maps-through-the-command-stream.patch | 51 +- ...-update_texture-calls-through-the-CS.patch | 12 +- ...ck-the-src-volume-in-device_update_v.patch | 21 +- ...2-wined3d-Wrap-GL-BOs-in-a-structure.patch | 24 +- ...parate-resource-map-and-draw-buffers.patch | 80 +- .../wined3d-CSMT_Main/9999-IfDefined.patch | 731 ++++++++---------- ...extremely-noisy-FIXME-in-wined3d_tex.patch | 10 +- 14 files changed, 587 insertions(+), 756 deletions(-) delete mode 100644 patches/Compiler_Warnings/0003-gdi32-Remove-unnecessary-debug-channel.patch delete mode 100644 patches/Compiler_Warnings/0016-winetest-Remove-duplicate-if-check.patch diff --git a/patches/Compiler_Warnings/0003-gdi32-Remove-unnecessary-debug-channel.patch b/patches/Compiler_Warnings/0003-gdi32-Remove-unnecessary-debug-channel.patch deleted file mode 100644 index 636678c3..00000000 --- a/patches/Compiler_Warnings/0003-gdi32-Remove-unnecessary-debug-channel.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 450d33400036663b5a0e21fce38a7c449409b4d3 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 30 Jul 2016 23:55:09 +0200 -Subject: gdi32: Remove unnecessary debug channel. - ---- - dlls/gdi32/enhmfdrv/dc.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c -index 64c6136..91fde55 100644 ---- a/dlls/gdi32/enhmfdrv/dc.c -+++ b/dlls/gdi32/enhmfdrv/dc.c -@@ -21,9 +21,6 @@ - - #include - #include "enhmfdrv/enhmetafiledrv.h" --#include "wine/debug.h" -- --WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile); - - /* get the emf physdev from the path physdev */ - static inline PHYSDEV get_emfdev( PHYSDEV path ) --- -2.9.0 - diff --git a/patches/Compiler_Warnings/0016-winetest-Remove-duplicate-if-check.patch b/patches/Compiler_Warnings/0016-winetest-Remove-duplicate-if-check.patch deleted file mode 100644 index 9c71baa2..00000000 --- a/patches/Compiler_Warnings/0016-winetest-Remove-duplicate-if-check.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ced83fdea5e467009d8a4220fab97fb2e7e4e008 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sun, 31 Jul 2016 00:02:13 +0200 -Subject: winetest: Remove duplicate if check. - ---- - programs/winetest/gui.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c -index a8bcf05..2948d7e 100644 ---- a/programs/winetest/gui.c -+++ b/programs/winetest/gui.c -@@ -547,8 +547,7 @@ report (enum report_type t, ...) - } - - va_start (ap, t); -- if (t < sizeof text_funcs / sizeof text_funcs[0] && -- t < sizeof GUI_funcs / sizeof GUI_funcs[0]) ret = funcs[t](ap); -+ if (t < sizeof text_funcs / sizeof text_funcs[0]) ret = funcs[t](ap); - else report (R_WARNING, "unimplemented report type: %d", t); - va_end (ap); - return ret; --- -2.9.0 - diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index cbda3b3c..b3a922c9 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "0f2a776a59006a15fb84a2a51237d3484f136966" + echo "7aadb08212a5269ebefcb100cf567f7cf7aa0a7c" } # Show version information @@ -2330,19 +2330,18 @@ fi # | * dlls/amstream/mediastreamfilter.c, dlls/comctl32/listview.c, dlls/d2d1/brush.c, dlls/d2d1/geometry.c, dlls/d3d11/view.c, # | dlls/d3d8/texture.c, dlls/d3d9/tests/visual.c, dlls/d3d9/texture.c, dlls/ddraw/viewport.c, dlls/dsound/primary.c, # | dlls/dwrite/layout.c, dlls/dwrite/tests/analyzer.c, dlls/dwrite/tests/font.c, dlls/dwrite/tests/layout.c, -# | dlls/gdi32/enhmfdrv/dc.c, dlls/mshtml/script.c, dlls/msvcirt/tests/msvcirt.c, dlls/msxml3/schema.c, -# | dlls/netapi32/netapi32.c, dlls/ole32/tests/compobj.c, dlls/oleaut32/oleaut.c, dlls/oleaut32/tests/safearray.c, -# | dlls/rpcrt4/cstub.c, dlls/rpcrt4/tests/ndr_marshall.c, dlls/scrrun/tests/dictionary.c, dlls/shell32/tests/appbar.c, +# | dlls/mshtml/script.c, dlls/msvcirt/tests/msvcirt.c, dlls/msxml3/schema.c, dlls/netapi32/netapi32.c, +# | dlls/ole32/tests/compobj.c, dlls/oleaut32/oleaut.c, dlls/oleaut32/tests/safearray.c, dlls/rpcrt4/cstub.c, +# | dlls/rpcrt4/tests/ndr_marshall.c, dlls/scrrun/tests/dictionary.c, dlls/shell32/tests/appbar.c, # | dlls/shell32/tests/shelldispatch.c, dlls/shell32/tests/shellole.c, dlls/shlwapi/tests/ordinal.c, # | dlls/user32/tests/input.c, dlls/user32/tests/menu.c, dlls/vbscript/vbdisp.c, dlls/winealsa.drv/mmdevdrv.c, # | dlls/wined3d/glsl_shader.c, dlls/winhttp/tests/winhttp.c, dlls/wshom.ocx/tests/wshom.c, dlls/xaudio2_7/compat.c, # | dlls/xaudio2_7/x3daudio.c, include/d3dtypes.h, include/wine/list.h, include/wine/rbtree.h, include/winnt.h, -# | programs/winetest/gui.c, server/request.c, server/sock.c, tools/makedep.c +# | server/request.c, server/sock.c, tools/makedep.c # | if test "$enable_Compiler_Warnings" -eq 1; then patch_apply Compiler_Warnings/0001-comctl32-Avoid-misleading-indentation-warnings.patch patch_apply Compiler_Warnings/0002-dwrite-tests-Avoid-misleading-indentation-warnings.patch - patch_apply Compiler_Warnings/0003-gdi32-Remove-unnecessary-debug-channel.patch patch_apply Compiler_Warnings/0004-mshtml-Avoid-misleading-indentation-warnings.patch patch_apply Compiler_Warnings/0005-msvcirt-tests-Avoid-misleading-indentation-warnings.patch patch_apply Compiler_Warnings/0006-oleaut32-tests-Avoid-misleading-indentation-warnings.patch @@ -2355,7 +2354,6 @@ if test "$enable_Compiler_Warnings" -eq 1; then patch_apply Compiler_Warnings/0013-wshom.ocx-tests-Avoid-misleading-indentation-warning.patch patch_apply Compiler_Warnings/0014-xaudio2_7-Only-declare-debug-channel-when-needed.patch patch_apply Compiler_Warnings/0015-include-Avoid-shift-overflow-warning.patch - patch_apply Compiler_Warnings/0016-winetest-Remove-duplicate-if-check.patch patch_apply Compiler_Warnings/0017-server-Workaround-duplicate-condition-warning-of-GCC.patch patch_apply Compiler_Warnings/0018-Appease-the-blessed-version-of-gcc-4.5-when-Werror-i.patch patch_apply Compiler_Warnings/0019-dsound-Avoid-implicit-cast-of-interface-pointer.patch @@ -2374,7 +2372,6 @@ if test "$enable_Compiler_Warnings" -eq 1; then ( echo '+ { "Sebastian Lackner", "comctl32: Avoid misleading indentation warnings.", 1 },'; echo '+ { "Sebastian Lackner", "dwrite/tests: Avoid misleading indentation warnings.", 1 },'; - echo '+ { "Sebastian Lackner", "gdi32: Remove unnecessary debug channel.", 1 },'; echo '+ { "Sebastian Lackner", "mshtml: Avoid misleading indentation warnings.", 1 },'; echo '+ { "Sebastian Lackner", "msvcirt/tests: Avoid misleading indentation warnings.", 1 },'; echo '+ { "Sebastian Lackner", "oleaut32/tests: Avoid misleading indentation warnings.", 1 },'; @@ -2387,7 +2384,6 @@ if test "$enable_Compiler_Warnings" -eq 1; then echo '+ { "Sebastian Lackner", "wshom.ocx/tests: Avoid misleading indentation warnings.", 1 },'; echo '+ { "Sebastian Lackner", "xaudio2_7: Only declare debug channel when needed.", 1 },'; echo '+ { "Sebastian Lackner", "include: Avoid shift overflow warning.", 1 },'; - echo '+ { "Sebastian Lackner", "winetest: Remove duplicate if check.", 1 },'; echo '+ { "Sebastian Lackner", "server: Workaround duplicate condition warning of GCC 6.", 1 },'; echo '+ { "Erich E. Hoover", "Appease the blessed version of gcc (4.5) when -Werror is enabled.", 1 },'; echo '+ { "Sebastian Lackner", "dsound: Avoid implicit cast of interface pointer.", 1 },'; diff --git a/patches/wined3d-CSMT_Helper/0001-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch b/patches/wined3d-CSMT_Helper/0001-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch index 03795041..81a24ec2 100644 --- a/patches/wined3d-CSMT_Helper/0001-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch +++ b/patches/wined3d-CSMT_Helper/0001-wined3d-Add-second-dll-with-STAGING_CSMT-definition-.patch @@ -1,13 +1,13 @@ -From 437012ece4738ad5cea694b2a6c2759927074ebe Mon Sep 17 00:00:00 2001 +From 77b33ddf4f55a309c42a137f4a27c3f8726e7442 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 14 Dec 2014 20:49:28 +0100 Subject: wined3d: Add second dll with STAGING_CSMT definition set. --- configure.ac | 1 + - dlls/wined3d-csmt/Makefile.in | 38 ++++++++++++++++++++++++++++++++++++++ + dlls/wined3d-csmt/Makefile.in | 37 +++++++++++++++++++++++++++++++++++++ dlls/wined3d-csmt/version.rc | 27 +++++++++++++++++++++++++++ - 3 files changed, 66 insertions(+) + 3 files changed, 65 insertions(+) create mode 100644 dlls/wined3d-csmt/Makefile.in create mode 100644 dlls/wined3d-csmt/version.rc @@ -25,10 +25,10 @@ index e5fb209..7394424 100644 WINE_CONFIG_DLL(winejoystick.drv) diff --git a/dlls/wined3d-csmt/Makefile.in b/dlls/wined3d-csmt/Makefile.in new file mode 100644 -index 0000000..3a401a0 +index 0000000..bf064ed --- /dev/null +++ b/dlls/wined3d-csmt/Makefile.in -@@ -0,0 +1,38 @@ +@@ -0,0 +1,37 @@ +EXTRADEFS = -DSTAGING_CSMT +MODULE = wined3d-csmt.dll +IMPORTS = uuid opengl32 user32 gdi32 advapi32 @@ -63,13 +63,12 @@ index 0000000..3a401a0 + utils.c \ + vertexdeclaration.c \ + view.c \ -+ volume.c \ + wined3d_main.c + +RC_SRCS = version.rc diff --git a/dlls/wined3d-csmt/version.rc b/dlls/wined3d-csmt/version.rc new file mode 100644 -index 0000000..0439375 +index 0000000..2fa8710 --- /dev/null +++ b/dlls/wined3d-csmt/version.rc @@ -0,0 +1,27 @@ @@ -101,5 +100,5 @@ index 0000000..0439375 + +#include "wine/wine_common_ver.rc" -- -2.1.3 +2.9.0 diff --git a/patches/wined3d-CSMT_Main/0002-wined3d-Start-to-move-surface-volume_load_location-i.patch b/patches/wined3d-CSMT_Main/0002-wined3d-Start-to-move-surface-volume_load_location-i.patch index f035e730..26bbf76c 100644 --- a/patches/wined3d-CSMT_Main/0002-wined3d-Start-to-move-surface-volume_load_location-i.patch +++ b/patches/wined3d-CSMT_Main/0002-wined3d-Start-to-move-surface-volume_load_location-i.patch @@ -1,4 +1,4 @@ -From d85d4d230b8d8d5fc13ef101272a53ccad04d4c1 Mon Sep 17 00:00:00 2001 +From f35c5d6bcd2b0d61a70da8a55b7c6bda4510fd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 29 Oct 2015 17:33:23 +0100 Subject: wined3d: Start to move surface/volume_load_location into the texture. @@ -13,9 +13,9 @@ moving allocation of all locations (including sysmem) there. dlls/wined3d/device.c | 11 ++++++----- dlls/wined3d/drawprim.c | 10 +++++----- dlls/wined3d/swapchain.c | 7 ++++--- - dlls/wined3d/texture.c | 21 +++++++++++++++------ + dlls/wined3d/texture.c | 3 ++- dlls/wined3d/wined3d_private.h | 2 ++ - 6 files changed, 34 insertions(+), 22 deletions(-) + 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 085ed03..20d7868 100644 @@ -41,7 +41,7 @@ index 085ed03..20d7868 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 a5a3fc4..b3ecf33 100644 +index 0031f79..a9cbadb 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -324,14 +324,15 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c @@ -134,46 +134,19 @@ index 9596735..ea52af6 100644 if (swapchain->render_to_fbo) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 17140aa..4ef9e88 100644 +index 8cb8274..8939660 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -352,7 +352,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) - for (i = 0; i < sub_count; ++i) - { - if (texture->sub_resources[i].locations == texture->resource.map_binding -- && !texture->texture_ops->texture_load_location(texture, i, context, map_binding)) -+ && !wined3d_texture_load_location(texture, i, context, map_binding)) - ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding)); - if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER) - wined3d_texture_remove_buffer_object(texture, i, context->gl_info); -@@ -914,7 +914,7 @@ void wined3d_texture_load(struct wined3d_texture *texture, - TRACE("Reloading because of color key value change.\n"); - for (i = 0; i < sub_count; i++) - { -- if (!texture->texture_ops->texture_load_location(texture, i, context, texture->resource.map_binding)) -+ if (!wined3d_texture_load_location(texture, i, context, texture->resource.map_binding)) - ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); - else - wined3d_texture_invalidate_location(texture, i, ~texture->resource.map_binding); -@@ -932,7 +932,7 @@ void wined3d_texture_load(struct wined3d_texture *texture, - /* Reload the surfaces if the texture is marked dirty. */ - for (i = 0; i < sub_count; ++i) - { -- if (!texture->texture_ops->texture_load_location(texture, i, context, -+ if (!wined3d_texture_load_location(texture, i, context, - srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB)) - ERR("Failed to load location (srgb %#x).\n", srgb); - } -@@ -1413,7 +1413,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, - WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); +@@ -176,7 +176,7 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture, - context = context_acquire(texture->resource.device, NULL); -- if (!texture->texture_ops->texture_load_location(texture, sub_resource_idx, -+ if (!wined3d_texture_load_location(texture, sub_resource_idx, - context, texture->resource.map_binding)) - { - ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); -@@ -1434,6 +1434,7 @@ static void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigne + /* Context activation is done by the caller. Context may be NULL in + * WINED3D_NO3D mode. */ +-static BOOL wined3d_texture_load_location(struct wined3d_texture *texture, ++BOOL wined3d_texture_load_location(struct wined3d_texture *texture, + unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) + { + return texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location); +@@ -1441,6 +1441,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s context, data, row_pitch, slice_pitch); } @@ -181,45 +154,8 @@ index 17140aa..4ef9e88 100644 static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch) -@@ -1592,7 +1593,7 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) - struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[i]; - - if (resource->pool != WINED3D_POOL_DEFAULT -- && texture->texture_ops->texture_load_location(texture, i, context, resource->map_binding)) -+ && wined3d_texture_load_location(texture, i, context, resource->map_binding)) - { - wined3d_texture_invalidate_location(texture, i, ~resource->map_binding); - } -@@ -1711,7 +1712,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour - { - if (resource->usage & WINED3DUSAGE_DYNAMIC) - WARN_(d3d_perf)("Mapping a dynamic texture without WINED3D_MAP_DISCARD.\n"); -- ret = texture->texture_ops->texture_load_location(texture, -+ ret = wined3d_texture_load_location(texture, - sub_resource_idx, context, texture->resource.map_binding); - } - -@@ -2073,6 +2074,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - return WINED3D_OK; - } - -+/* Context activation is done by the caller. */ - static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, - const struct wined3d_context *context, const struct wined3d_const_bo_address *data, - unsigned int row_pitch, unsigned int slice_pitch) -@@ -2883,3 +2885,10 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign - - return WINED3D_OK; - } -+ -+/* Context activation is done by the caller. Context may be NULL. */ -+BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, -+ struct wined3d_context *context, DWORD location) -+{ -+ return texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location); -+} diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1873a79..7fd8ae0 100644 +index 12fc7de..bbfb1f6 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2761,6 +2761,8 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size @@ -227,7 +163,7 @@ index 1873a79..7fd8ae0 100644 BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; +BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, -+ struct wined3d_context *context, DWORD location); ++ struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0004-wined3d-Share-surface-and-volume-system-memory-loadi.patch b/patches/wined3d-CSMT_Main/0004-wined3d-Share-surface-and-volume-system-memory-loadi.patch index c6ec3211..c19bf8c5 100644 --- a/patches/wined3d-CSMT_Main/0004-wined3d-Share-surface-and-volume-system-memory-loadi.patch +++ b/patches/wined3d-CSMT_Main/0004-wined3d-Share-surface-and-volume-system-memory-loadi.patch @@ -1,4 +1,4 @@ -From 8a19a2579927f3b47f3c894af877a2d810c01c6a Mon Sep 17 00:00:00 2001 +From 2b5e06e34805da8a6c3f9f16415ec7f026c247d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 18 Nov 2015 08:31:14 +0000 Subject: wined3d: Share surface and volume system memory loading code. @@ -156,7 +156,7 @@ index 105fcb5..2933b82 100644 } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 8975155..634314b 100644 +index f4c50d2..5bbeab6 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -80,27 +80,6 @@ GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) @@ -187,54 +187,8 @@ index 8975155..634314b 100644 static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture) { struct wined3d_texture_sub_resource *sub_resource; -@@ -2182,37 +2161,15 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in - struct wined3d_context *context, DWORD location) - { - struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; -- DWORD required_access = wined3d_resource_access_from_location(location); - - TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n", - texture, sub_resource_idx, context, wined3d_debug_location(location)); - - TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations)); - -- if ((sub_resource->locations & location) == location) -- { -- TRACE("Location(s) already up to date.\n"); -- return TRUE; -- } -- -- if ((texture->resource.access_flags & required_access) != required_access) -- { -- ERR("Operation requires %#x access, but volume only has %#x.\n", -- required_access, texture->resource.access_flags); -- return FALSE; -- } -- - if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, location)) - return FALSE; - -- if (sub_resource->locations & WINED3D_LOCATION_DISCARDED) -- { -- TRACE("Volume previously discarded, nothing to do.\n"); -- wined3d_texture_validate_location(texture, sub_resource_idx, location); -- wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED); -- goto done; -- } -- - switch (location) - { - case WINED3D_LOCATION_TEXTURE_RGB: -@@ -2295,7 +2252,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in - return FALSE; - } - --done: - wined3d_texture_validate_location(texture, sub_resource_idx, location); - - return TRUE; -@@ -2906,9 +2862,132 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign - return WINED3D_OK; +@@ -174,12 +153,135 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture, + sub_resource_idx, texture); } +static BOOL wined3d_texture_copy_sysmem_location(struct wined3d_texture *texture, @@ -299,9 +253,10 @@ index 8975155..634314b 100644 + } +} + - /* Context activation is done by the caller. Context may be NULL. */ - BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, - struct wined3d_context *context, DWORD location) + /* Context activation is done by the caller. Context may be NULL in + * WINED3D_NO3D mode. */ + BOOL wined3d_texture_load_location(struct wined3d_texture *texture, + unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) { - return texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location); + BOOL ret; @@ -367,6 +322,55 @@ index 8975155..634314b 100644 + } + return ret; } + + /* Context activation is done by the caller. */ +@@ -2209,7 +2311,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in + struct wined3d_context *context, DWORD location) + { + struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; +- DWORD required_access = wined3d_resource_access_from_location(location); + unsigned int row_pitch, slice_pitch; + + TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n", +@@ -2217,30 +2318,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in + + TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations)); + +- if ((sub_resource->locations & location) == location) +- { +- TRACE("Location(s) already up to date.\n"); +- return TRUE; +- } +- +- if ((texture->resource.access_flags & required_access) != required_access) +- { +- ERR("Operation requires %#x access, but volume only has %#x.\n", +- required_access, texture->resource.access_flags); +- return FALSE; +- } +- + if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, location)) + return FALSE; + +- if (sub_resource->locations & WINED3D_LOCATION_DISCARDED) +- { +- TRACE("Volume previously discarded, nothing to do.\n"); +- wined3d_texture_validate_location(texture, sub_resource_idx, location); +- wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED); +- goto done; +- } +- + switch (location) + { + case WINED3D_LOCATION_TEXTURE_RGB: +@@ -2325,7 +2405,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in + return FALSE; + } + +-done: + wined3d_texture_validate_location(texture, sub_resource_idx, location); + + return TRUE; -- 2.9.0 diff --git a/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch index 7f0ee21d..3bb94d37 100644 --- a/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch +++ b/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch @@ -1,4 +1,4 @@ -From 56b000bf2a5d8a0d47d5fd06d51f737cafdb9933 Mon Sep 17 00:00:00 2001 +From c1c29e14d5b9efe39db225334885e4b4703ff72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 20 Dec 2012 13:09:17 +0100 Subject: wined3d: Move the framebuffer into wined3d_state @@ -7,7 +7,7 @@ Subject: wined3d: Move the framebuffer into wined3d_state dlls/wined3d/arb_program_shader.c | 4 +- dlls/wined3d/context.c | 19 ++++-- dlls/wined3d/cs.c | 50 ++++++++-------- - dlls/wined3d/device.c | 122 +++++++++++++++++--------------------- + dlls/wined3d/device.c | 121 ++++++++++++++++++-------------------- dlls/wined3d/drawprim.c | 2 +- dlls/wined3d/glsl_shader.c | 2 +- dlls/wined3d/shader.c | 2 +- @@ -16,11 +16,11 @@ Subject: wined3d: Move the framebuffer into wined3d_state dlls/wined3d/surface.c | 2 +- dlls/wined3d/swapchain.c | 2 +- dlls/wined3d/utils.c | 4 +- - dlls/wined3d/wined3d_private.h | 46 ++++++++++---- - 13 files changed, 192 insertions(+), 134 deletions(-) + dlls/wined3d/wined3d_private.h | 46 +++++++++++---- + 13 files changed, 192 insertions(+), 133 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index 2de6577..fdd981a 100644 +index 3f551b6..05ce745 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -704,7 +704,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, @@ -42,7 +42,7 @@ index 2de6577..fdd981a 100644 } diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 20d7868..d8d6ce0 100644 +index 8b12a39..8946676 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1699,6 +1699,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, @@ -128,10 +128,10 @@ index 20d7868..d8d6ce0 100644 WORD map; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 5931569..0f2156b 100644 +index 6569b97..0553d4a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -313,19 +313,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -328,19 +328,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) state = &device->state; wined3d_get_draw_rect(state, &draw_rect); device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, @@ -155,7 +155,7 @@ index 5931569..0f2156b 100644 } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -348,12 +348,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -363,12 +363,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -171,7 +171,7 @@ index 5931569..0f2156b 100644 cs->ops->submit(cs); } -@@ -391,11 +391,11 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -406,11 +406,11 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -187,7 +187,7 @@ index 5931569..0f2156b 100644 for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -452,11 +452,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i +@@ -467,11 +467,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i } for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i) { @@ -203,7 +203,7 @@ index 5931569..0f2156b 100644 for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { if (!(shader = state->shader[i])) -@@ -544,7 +544,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v +@@ -559,7 +559,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v { const struct wined3d_cs_set_rendertarget_view *op = data; @@ -212,7 +212,7 @@ index 5931569..0f2156b 100644 device_invalidate_state(cs->device, STATE_FRAMEBUFFER); } -@@ -567,7 +567,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -582,7 +582,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const struct wined3d_device *device = cs->device; struct wined3d_rendertarget_view *prev; @@ -221,7 +221,7 @@ index 5931569..0f2156b 100644 { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -583,7 +583,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -598,7 +598,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } } @@ -230,7 +230,7 @@ index 5931569..0f2156b 100644 if (!prev != !op->view) { -@@ -1152,11 +1152,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1187,11 +1187,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) { struct wined3d_adapter *adapter = cs->device->adapter; @@ -246,7 +246,7 @@ index 5931569..0f2156b 100644 } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1257,15 +1259,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1314,15 +1316,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; @@ -264,7 +264,7 @@ index 5931569..0f2156b 100644 cs->ops = &wined3d_cs_st_ops; cs->device = device; -@@ -1273,7 +1273,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1330,7 +1330,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size))) { state_cleanup(&cs->state); @@ -272,7 +272,7 @@ index 5931569..0f2156b 100644 HeapFree(GetProcessHeap(), 0, cs); return NULL; } -@@ -1284,7 +1283,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1341,7 +1340,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) void wined3d_cs_destroy(struct wined3d_cs *cs) { state_cleanup(&cs->state); @@ -281,7 +281,7 @@ index 5931569..0f2156b 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 4d0ff2e..602398e 100644 +index 98a934c..6e118dc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -987,7 +987,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi @@ -402,7 +402,7 @@ index 4d0ff2e..602398e 100644 return; if (src_view->resource->type == WINED3D_RTYPE_BUFFER) { -@@ -3441,6 +3419,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3467,6 +3445,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -411,7 +411,7 @@ index 4d0ff2e..602398e 100644 TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, debug_color(color), depth, stencil); -@@ -3452,7 +3432,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3478,7 +3458,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -420,7 +420,7 @@ index 4d0ff2e..602398e 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3461,8 +3441,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3487,8 +3467,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -431,7 +431,7 @@ index 4d0ff2e..602398e 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3778,8 +3758,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3804,8 +3784,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -442,7 +442,7 @@ index 4d0ff2e..602398e 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4237,20 +4217,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4263,20 +4243,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -466,7 +466,7 @@ index 4d0ff2e..602398e 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4290,13 +4271,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4313,13 +4294,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -482,7 +482,7 @@ index 4d0ff2e..602398e 100644 wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4308,18 +4289,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4331,18 +4312,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -504,7 +504,7 @@ index 4d0ff2e..602398e 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4682,10 +4664,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4705,10 +4687,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -516,7 +516,7 @@ index 4d0ff2e..602398e 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4694,6 +4675,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4717,6 +4698,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -528,7 +528,7 @@ index 4d0ff2e..602398e 100644 if (device->onscreen_depth_stencil) { wined3d_texture_decref(device->onscreen_depth_stencil->container); -@@ -4919,30 +4905,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4942,27 +4928,28 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -558,16 +558,13 @@ index 4d0ff2e..602398e 100644 + state->viewport.height = swapchain->desc.backbuffer_height; wined3d_cs_emit_set_viewport(device->cs, &state->viewport); - state->scissor_rect.top = 0; - state->scissor_rect.left = 0; -- state->scissor_rect.right = view->width; -- state->scissor_rect.bottom = view->height; -+ state->scissor_rect.right = swapchain->desc.backbuffer_width; -+ state->scissor_rect.bottom = swapchain->desc.backbuffer_height; +- SetRect(&state->scissor_rect, 0, 0, view->width, view->height); ++ SetRect(&state->scissor_rect, 0, 0, ++ swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height); wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -5032,11 +5018,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5052,11 +5039,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -581,7 +578,7 @@ index 4d0ff2e..602398e 100644 ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5172,8 +5158,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5192,8 +5179,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -610,7 +607,7 @@ index dd82654..dd0f1d9 100644 struct wined3d_event_query *ib_query = NULL; struct wined3d_stream_info si_emulated; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c -index 6b1ac34..c35bf0e 100644 +index d13f429..f8f0b8d 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1495,7 +1495,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context @@ -623,10 +620,10 @@ index 6b1ac34..c35bf0e 100644 0.0f, 0.0f, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index 08cee35..fbad000 100644 +index 28d5972..37594b2 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -3057,7 +3057,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 +@@ -3066,7 +3066,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -636,10 +633,10 @@ index 08cee35..fbad000 100644 static unsigned int warned = 0; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c -index ea8bd40..50cf6cd 100644 +index 50b82e9..c08af26 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c -@@ -105,7 +105,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ +@@ -152,7 +152,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ const struct wined3d_gl_info *gl_info = context->gl_info; /* No z test without depth stencil buffers */ @@ -648,7 +645,7 @@ index ea8bd40..50cf6cd 100644 { TRACE("No Z buffer - disabling depth test\n"); zenable = WINED3D_ZB_FALSE; -@@ -382,14 +382,14 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st +@@ -429,14 +429,14 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st GLenum srcBlend, dstBlend; unsigned int rt_fmt_flags; @@ -666,7 +663,7 @@ index ea8bd40..50cf6cd 100644 /* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific * blending parameters to work. */ -@@ -823,7 +823,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ +@@ -870,7 +870,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ GLint depthFail_ccw; /* No stencil test without a stencil buffer. */ @@ -675,7 +672,7 @@ index ea8bd40..50cf6cd 100644 { gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST); checkGLcall("glDisable GL_STENCIL_TEST"); -@@ -919,7 +919,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ +@@ -966,7 +966,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ static void state_stencilwrite2s(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -684,7 +681,7 @@ index ea8bd40..50cf6cd 100644 const struct wined3d_gl_info *gl_info = context->gl_info; GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK)); -@@ -933,7 +933,7 @@ static void state_stencilwrite2s(struct wined3d_context *context, const struct w +@@ -980,7 +980,7 @@ static void state_stencilwrite2s(struct wined3d_context *context, const struct w static void state_stencilwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -693,7 +690,7 @@ index ea8bd40..50cf6cd 100644 const struct wined3d_gl_info *gl_info = context->gl_info; gl_info->gl_ops.gl.p_glStencilMask(mask); -@@ -1671,7 +1671,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 +@@ -1718,7 +1718,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS] || state->render_states[WINED3D_RS_DEPTHBIAS]) { @@ -702,7 +699,7 @@ index ea8bd40..50cf6cd 100644 float scale; union -@@ -4580,8 +4580,8 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine +@@ -4632,8 +4632,8 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -713,7 +710,7 @@ index ea8bd40..50cf6cd 100644 const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; unsigned int width, height; -@@ -4767,7 +4767,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st +@@ -4819,7 +4819,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st } else { @@ -722,7 +719,7 @@ index ea8bd40..50cf6cd 100644 UINT height; UINT width; -@@ -4835,7 +4835,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state +@@ -4884,7 +4884,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); @@ -732,7 +729,7 @@ index ea8bd40..50cf6cd 100644 else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c -index bb15995..08f5ed5 100644 +index 2fbfa2c..bb3c0cc 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -430,6 +430,7 @@ void state_unbind_resources(struct wined3d_state *state) @@ -832,10 +829,10 @@ index bb15995..08f5ed5 100644 if (type == WINED3D_SBT_RECORDED) return WINED3D_OK; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 0caf753..7b55e25 100644 +index af7a92a..1b32ad0 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -2570,7 +2570,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -2568,7 +2568,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE { struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; @@ -858,10 +855,10 @@ index cf3cb95..783a174 100644 struct wined3d_texture *logo_texture; struct wined3d_context *context; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c -index e1a7952..1c5b55c 100644 +index 93b610d..288c82e 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -4481,7 +4481,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w +@@ -4498,7 +4498,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -870,7 +867,7 @@ index e1a7952..1c5b55c 100644 state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE; float z_scale = zenable ? 2.0f : 0.0f; float z_offset = zenable ? -1.0f : 0.0f; -@@ -5278,7 +5278,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d +@@ -5295,7 +5295,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d break; } } @@ -880,10 +877,10 @@ index e1a7952..1c5b55c 100644 || !state->render_states[WINED3D_RS_CLIPPLANEENABLE]) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 39d3759..a4ea193 100644 +index 63534ce..5e6cbda 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1405,6 +1405,36 @@ struct wined3d_timestamp_query +@@ -1450,6 +1450,36 @@ struct wined3d_timestamp_query void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; @@ -920,7 +917,7 @@ index 39d3759..a4ea193 100644 struct wined3d_context { const struct wined3d_gl_info *gl_info; -@@ -1419,6 +1449,7 @@ struct wined3d_context +@@ -1464,6 +1494,7 @@ struct wined3d_context DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -928,7 +925,7 @@ index 39d3759..a4ea193 100644 struct wined3d_swapchain *swapchain; struct -@@ -1526,12 +1557,6 @@ struct wined3d_context +@@ -1572,12 +1603,6 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; @@ -941,7 +938,7 @@ index 39d3759..a4ea193 100644 typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -2296,7 +2321,7 @@ struct wined3d_stream_state +@@ -2353,7 +2378,7 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -950,7 +947,7 @@ index 39d3759..a4ea193 100644 struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2400,7 +2425,6 @@ struct wined3d_device +@@ -2458,7 +2483,6 @@ struct wined3d_device struct wine_rb_tree samplers; /* Render Target Support */ @@ -958,7 +955,7 @@ index 39d3759..a4ea193 100644 struct wined3d_surface *onscreen_depth_stencil; struct wined3d_rendertarget_view *auto_depth_stencil_view; -@@ -2952,9 +2976,8 @@ struct wined3d_stateblock +@@ -3001,9 +3025,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -970,7 +967,7 @@ index 39d3759..a4ea193 100644 void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; struct wined3d_cs_ops -@@ -2967,7 +2990,6 @@ struct wined3d_cs +@@ -3016,7 +3039,6 @@ struct wined3d_cs { const struct wined3d_cs_ops *ops; struct wined3d_device *device; @@ -979,5 +976,5 @@ index 39d3759..a4ea193 100644 size_t data_size; -- -2.8.0 +2.9.0 diff --git a/patches/wined3d-CSMT_Main/0035-wined3d-send-texture-maps-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0035-wined3d-send-texture-maps-through-the-command-stream.patch index 4f2b4c4e..0551f9f4 100644 --- a/patches/wined3d-CSMT_Main/0035-wined3d-send-texture-maps-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0035-wined3d-send-texture-maps-through-the-command-stream.patch @@ -1,4 +1,4 @@ -From 68607b84ae0cdb73a2cb49ce37057187492a8d61 Mon Sep 17 00:00:00 2001 +From 590b2e4bdbc7f4dd6719a3172a439294d64b4c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 3 Apr 2016 19:34:19 +0100 Subject: wined3d: send texture maps through the command stream @@ -6,15 +6,15 @@ Subject: wined3d: send texture maps through the command stream Slow version only. Good enough to dodge some Nvidia bugs in the ddraw tests. --- dlls/wined3d/cs.c | 73 +++++++++++++++++ - dlls/wined3d/texture.c | 173 +++++++++++++++++++++-------------------- + dlls/wined3d/texture.c | 172 +++++++++++++++++++++-------------------- dlls/wined3d/wined3d_private.h | 8 ++ - 3 files changed, 168 insertions(+), 86 deletions(-) + 3 files changed, 168 insertions(+), 85 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 8496d42..904f304 100644 +index 737c39a..0fc98be 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -77,6 +77,8 @@ enum wined3d_cs_op +@@ -79,6 +79,8 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_LIGHT_ENABLE, WINED3D_CS_OP_BLT, WINED3D_CS_OP_CLEAR_RTV, @@ -23,7 +23,7 @@ index 8496d42..904f304 100644 WINED3D_CS_OP_STOP, }; -@@ -374,6 +376,22 @@ struct wined3d_cs_clear_rtv +@@ -389,6 +391,22 @@ struct wined3d_cs_clear_rtv const struct blit_shader *blitter; }; @@ -46,7 +46,7 @@ index 8496d42..904f304 100644 /* FIXME: The list synchronization probably isn't particularly fast. */ static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block) { -@@ -1966,6 +1984,59 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -2025,6 +2043,59 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge cs->ops->submit(cs); } @@ -106,7 +106,7 @@ index 8496d42..904f304 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -2009,6 +2080,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2070,6 +2141,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, @@ -116,10 +116,10 @@ index 8496d42..904f304 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index debafc4..e239282 100644 +index 43615c38..d7e68ba 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1648,6 +1648,63 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1750,6 +1750,63 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_unload_gl_texture(texture); } @@ -183,7 +183,7 @@ index debafc4..e239282 100644 static HRESULT texture_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) { -@@ -1655,13 +1712,9 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1757,13 +1814,9 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour struct wined3d_texture_sub_resource *sub_resource; struct wined3d_device *device = resource->device; unsigned int fmt_flags = resource->format_flags; @@ -197,7 +197,7 @@ index debafc4..e239282 100644 TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", resource, sub_resource_idx, map_desc, debug_box(box), flags); -@@ -1706,54 +1759,9 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1808,53 +1861,9 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour return WINED3DERR_INVALIDCALL; } @@ -228,8 +228,7 @@ index debafc4..e239282 100644 - { - if (resource->usage & WINED3DUSAGE_DYNAMIC) - WARN_(d3d_perf)("Mapping a dynamic texture without WINED3D_MAP_DISCARD.\n"); -- ret = wined3d_texture_load_location(texture, -- sub_resource_idx, context, texture->resource.map_binding); +- ret = wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding); - } - - if (!ret) @@ -253,7 +252,7 @@ index debafc4..e239282 100644 if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) { -@@ -1789,17 +1797,6 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1890,17 +1899,6 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour } } @@ -271,7 +270,7 @@ index debafc4..e239282 100644 ++resource->map_count; ++sub_resource->map_count; -@@ -1809,14 +1806,38 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1910,14 +1908,38 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour return WINED3D_OK; } @@ -314,7 +313,7 @@ index debafc4..e239282 100644 TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx); -@@ -1832,27 +1853,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1933,27 +1955,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso return WINEDDERR_NOTLOCKED; } @@ -344,28 +343,28 @@ index debafc4..e239282 100644 --sub_resource->map_count; if (!--resource->map_count && texture->update_map_binding) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 426c10d..ed0eabc 100644 +index 924c8aa..64b874f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2769,6 +2769,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -2784,6 +2784,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, - struct wined3d_context *context, DWORD location); + struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; +void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, + DWORD flags) DECLSPEC_HIDDEN; void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; -@@ -2776,6 +2778,8 @@ void wined3d_texture_set_swapchain(struct wined3d_texture *texture, +@@ -2791,6 +2793,8 @@ void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_texture_unmap_bo_address(const struct wined3d_bo_address *data, const struct wined3d_gl_info *gl_info, GLenum binding) DECLSPEC_HIDDEN; +void wined3d_texture_unmap_internal(struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; - void wined3d_texture_validate_location(struct wined3d_texture *texture, - unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; - -@@ -3134,6 +3138,10 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf + void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, + const struct wined3d_context *context, const struct wined3d_const_bo_address *data, + unsigned int row_pitch, unsigned int slice_pitch) DECLSPEC_HIDDEN; +@@ -3143,6 +3147,10 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil, const struct blit_shader *blitter) DECLSPEC_HIDDEN; @@ -377,5 +376,5 @@ index 426c10d..ed0eabc 100644 /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ -- -2.8.0 +2.9.0 diff --git a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch index eea074da..20edc64f 100644 --- a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch @@ -1,4 +1,4 @@ -From 50cab9c747626e21eb7e80343da79a9004a1b505 Mon Sep 17 00:00:00 2001 +From 614b05bd7947d8178fbdf3193641c3675608dbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 1 Aug 2013 00:33:48 +0200 Subject: wined3d: Send update_texture calls through the CS @@ -11,7 +11,7 @@ FIXME: This logic duplication is ugly. 3 files changed, 137 insertions(+), 82 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 67e2c13..8e56772 100644 +index b056e22..4611f41 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -72,6 +72,7 @@ enum wined3d_cs_op @@ -76,7 +76,7 @@ index 67e2c13..8e56772 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index d458747..99118f2 100644 +index 1735f85..de927cc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3558,34 +3558,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device @@ -130,7 +130,7 @@ index d458747..99118f2 100644 data.buffer_object = 0; data.addr = src.data; - wined3d_volume_upload_data(dst_texture, i, context, &data); + wined3d_texture_upload_data(dst_texture, i, context, &data, src.row_pitch, src.slice_pitch); wined3d_texture_invalidate_location(dst_texture, i, ~WINED3D_LOCATION_TEXTURE_RGB); - if (FAILED(hr = wined3d_resource_unmap(&src_texture->resource, src_level + i))) @@ -319,7 +319,7 @@ index d458747..99118f2 100644 HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index cdcf620..75f2983 100644 +index 06fe9cb..e468abb 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2533,6 +2533,8 @@ void device_resource_add(struct wined3d_device *device, struct wined3d_resource @@ -331,7 +331,7 @@ index cdcf620..75f2983 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -3153,6 +3155,8 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture +@@ -3156,6 +3158,8 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0057-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch b/patches/wined3d-CSMT_Main/0057-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch index f6d7c8c1..811b51ee 100644 --- a/patches/wined3d-CSMT_Main/0057-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch +++ b/patches/wined3d-CSMT_Main/0057-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch @@ -1,4 +1,4 @@ -From ef69918c044a527e154a919c829076bc19689925 Mon Sep 17 00:00:00 2001 +From 1feae0a25e88a0f7f7c51f1cd2f9484e0927f558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 29 Aug 2013 22:25:14 +0200 Subject: wined3d: Don't lock the src volume in device_update_volume @@ -13,24 +13,25 @@ FIXME 2: Loading the src location might be nice, or even better, responding to unexpected src locs. In theory it should be in SYSMEM since its a sysmem texture. --- - dlls/wined3d/device.c | 15 ++++----------- - 1 file changed, 4 insertions(+), 11 deletions(-) + dlls/wined3d/device.c | 18 +++++++----------- + 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 955f061..12e87e1 100644 +index de927cc..896e7a1 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -3496,8 +3496,7 @@ static void wined3d_device_update_texture_3d(struct wined3d_context *context, +@@ -3563,8 +3563,8 @@ static void wined3d_device_update_texture_3d(struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_level, struct wined3d_texture *dst_texture, unsigned int level_count) { - struct wined3d_const_bo_address data; - struct wined3d_map_desc src; ++ unsigned int row_pitch, slice_pitch; + struct wined3d_bo_address data; unsigned int i; TRACE("context %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n", -@@ -3509,17 +3508,11 @@ static void wined3d_device_update_texture_3d(struct wined3d_context *context, +@@ -3576,17 +3576,13 @@ static void wined3d_device_update_texture_3d(struct wined3d_context *context, for (i = 0; i < level_count; ++i) { @@ -39,11 +40,13 @@ index 955f061..12e87e1 100644 - return; + wined3d_texture_get_memory(src_texture, src_level + i, &data, + src_texture->resource.map_binding); ++ wined3d_texture_get_pitch(src_texture, src_level + i, &row_pitch, &slice_pitch); - data.buffer_object = 0; - data.addr = src.data; -- wined3d_volume_upload_data(dst_texture, i, context, &data); -+ wined3d_volume_upload_data(dst_texture, i, context, wined3d_const_bo_address(&data)); +- wined3d_texture_upload_data(dst_texture, i, context, &data, src.row_pitch, src.slice_pitch); ++ wined3d_texture_upload_data(dst_texture, i, context, wined3d_const_bo_address(&data), ++ row_pitch, slice_pitch); wined3d_texture_invalidate_location(dst_texture, i, ~WINED3D_LOCATION_TEXTURE_RGB); - - if (FAILED(wined3d_resource_unmap(&src_texture->resource, src_level + i))) @@ -52,5 +55,5 @@ index 955f061..12e87e1 100644 } -- -2.8.0 +2.9.0 diff --git a/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch b/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch index 38253b18..e8d76d00 100644 --- a/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch +++ b/patches/wined3d-CSMT_Main/0072-wined3d-Wrap-GL-BOs-in-a-structure.patch @@ -1,4 +1,4 @@ -From e8dd35793f2b32afab25f6acd46422aac1aa69d6 Mon Sep 17 00:00:00 2001 +From ef8df8ff00cb4cc235b01ee452f806824ef00b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 30 Aug 2013 17:00:35 +0200 Subject: wined3d: Wrap GL BOs in a structure @@ -13,10 +13,10 @@ them for DISCARD maps. 4 files changed, 91 insertions(+), 32 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 0b393ca..cf60d3d 100644 +index 5562b31..928fcda 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -5267,3 +5267,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5270,3 +5270,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -87,7 +87,7 @@ index 444237e..46f79db 100644 TRACE("Removing the pbo attached to surface %p.\n", surface); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index fffc2e1..102f022 100644 +index d98503d..d0acd74 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -206,7 +206,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su @@ -204,7 +204,7 @@ index fffc2e1..102f022 100644 return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1620,8 +1613,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1592,8 +1585,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -215,7 +215,7 @@ index fffc2e1..102f022 100644 if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -2214,7 +2207,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2188,7 +2181,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -223,8 +223,8 @@ index fffc2e1..102f022 100644 + struct wined3d_const_bo_address data = {sub_resource->buffer->name, NULL}; wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); - wined3d_volume_upload_data(texture, sub_resource_idx, context, &data); -@@ -2259,7 +2252,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in + wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); +@@ -2234,7 +2227,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -234,10 +234,10 @@ index fffc2e1..102f022 100644 if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 66a1061..b89b7d7 100644 +index f84b267..76be9c5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2426,6 +2426,14 @@ struct wined3d_state +@@ -2427,6 +2427,14 @@ struct wined3d_state struct wined3d_rasterizer_state *rasterizer_state; }; @@ -252,7 +252,7 @@ index 66a1061..b89b7d7 100644 #define WINED3D_UNMAPPED_STAGE ~0U /* Multithreaded flag. Removed from the public header to signal that -@@ -2534,6 +2542,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D +@@ -2535,6 +2543,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN; @@ -264,7 +264,7 @@ index 66a1061..b89b7d7 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2721,7 +2734,7 @@ struct wined3d_texture +@@ -2722,7 +2735,7 @@ struct wined3d_texture unsigned int map_count; DWORD locations; diff --git a/patches/wined3d-CSMT_Main/0073-wined3d-Separate-resource-map-and-draw-buffers.patch b/patches/wined3d-CSMT_Main/0073-wined3d-Separate-resource-map-and-draw-buffers.patch index 0c82794c..79e0e5ce 100644 --- a/patches/wined3d-CSMT_Main/0073-wined3d-Separate-resource-map-and-draw-buffers.patch +++ b/patches/wined3d-CSMT_Main/0073-wined3d-Separate-resource-map-and-draw-buffers.patch @@ -1,4 +1,4 @@ -From 309cfa9faf4718572d8720468b11c386f69b6e82 Mon Sep 17 00:00:00 2001 +From 9feb9ed51972175002f84d899915fe57a82d509d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 30 Aug 2013 17:06:29 +0200 Subject: wined3d: Separate resource map and draw buffers @@ -11,20 +11,20 @@ Subject: wined3d: Separate resource map and draw buffers 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 62d64f6..47bd8c9 100644 +index 928fcda..92f9034 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -3509,7 +3509,7 @@ static void wined3d_device_update_texture_3d(struct wined3d_context *context, +@@ -3577,7 +3577,7 @@ static void wined3d_device_update_texture_3d(struct wined3d_context *context, for (i = 0; i < level_count; ++i) { wined3d_texture_get_memory(src_texture, src_level + i, &data, - src_texture->resource.map_binding); + src_texture->resource.map_binding, FALSE); + wined3d_texture_get_pitch(src_texture, src_level + i, &row_pitch, &slice_pitch); - wined3d_volume_upload_data(dst_texture, i, context, wined3d_const_bo_address(&data)); - wined3d_texture_invalidate_location(dst_texture, i, ~WINED3D_LOCATION_TEXTURE_RGB); + wined3d_texture_upload_data(dst_texture, i, context, wined3d_const_bo_address(&data), diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 9fbd0db..465710f 100644 +index 46f79db..4b2cdad 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -324,7 +324,7 @@ void wined3d_surface_destroy_dc(struct wined3d_surface *surface) @@ -45,7 +45,7 @@ index 9fbd0db..465710f 100644 desc.pMemory = wined3d_texture_map_bo_address(&data, texture->sub_resources[sub_resource_idx].size, gl_info, GL_PIXEL_UNPACK_BUFFER, 0); -@@ -812,7 +812,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct +@@ -808,7 +808,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct } } @@ -54,7 +54,7 @@ index 9fbd0db..465710f 100644 if (texture->flags & WINED3D_TEXTURE_COND_NP2_EMULATED) { -@@ -1214,7 +1214,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1210,7 +1210,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE); wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &data, @@ -63,7 +63,7 @@ index 9fbd0db..465710f 100644 wined3d_texture_get_pitch(src_texture, src_surface->texture_level, &src_row_pitch, &src_slice_pitch); wined3d_surface_upload_data(dst_surface, gl_info, src_format, src_rect, -@@ -1609,7 +1609,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1758,7 +1758,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr wined3d_texture_load_location(src_texture, sub_resource_idx, context, src_texture->resource.map_binding); wined3d_texture_get_memory(src_texture, sub_resource_idx, &src_bo_addr, @@ -72,7 +72,7 @@ index 9fbd0db..465710f 100644 src_data = wined3d_texture_map_bo_address(&src_bo_addr, src_texture->sub_resources[sub_resource_idx].size, context->gl_info, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READONLY); -@@ -1622,7 +1622,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1771,7 +1771,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr wined3d_texture_prepare_location(dst_texture, 0, context, dst_texture->resource.map_binding); wined3d_texture_get_memory(dst_texture, 0, &dst_bo_addr, @@ -81,7 +81,7 @@ index 9fbd0db..465710f 100644 dst_data = wined3d_texture_map_bo_address(&dst_bo_addr, dst_texture->sub_resources[0].size, context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0); -@@ -1751,7 +1751,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, +@@ -1900,7 +1900,7 @@ static void read_from_framebuffer(struct wined3d_surface *surface, BOOL srcIsUpsideDown; struct wined3d_bo_address data; @@ -90,7 +90,7 @@ index 9fbd0db..465710f 100644 restore_rt = context_get_rt_surface(old_ctx); if (restore_rt != surface) -@@ -2941,7 +2941,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3088,7 +3088,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, wined3d_texture_set_map_binding(texture, WINED3D_LOCATION_SYSMEM); } @@ -99,7 +99,7 @@ index 9fbd0db..465710f 100644 if (format.convert) { /* This code is entered for texture formats which need a fixup. */ -@@ -3432,7 +3432,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3579,7 +3579,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int same_sub_resource = TRUE; wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_bo_addr, @@ -108,7 +108,7 @@ index 9fbd0db..465710f 100644 dst_map.data = wined3d_texture_map_bo_address(&dst_bo_addr, dst_texture->sub_resources[dst_sub_resource_idx].size, context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0); -@@ -3468,7 +3468,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3615,7 +3615,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int wined3d_texture_get_pitch(src_texture, src_sub_resource_idx % src_texture->level_count, &src_map.row_pitch, &src_map.slice_pitch); wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &src_bo_addr, @@ -117,7 +117,7 @@ index 9fbd0db..465710f 100644 src_map.data = wined3d_texture_map_bo_address(&src_bo_addr, src_texture->sub_resources[src_sub_resource_idx].size, context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0); -@@ -3483,7 +3483,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3630,7 +3630,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int } wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_bo_addr, @@ -127,10 +127,22 @@ index 9fbd0db..465710f 100644 dst_texture->sub_resources[dst_sub_resource_idx].size, context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index bd415eb..ad4e93f 100644 +index afb1738..729863c 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -181,7 +181,7 @@ void wined3d_texture_unmap_bo_address(const struct wined3d_bo_address *data, +@@ -163,9 +163,9 @@ static BOOL wined3d_texture_copy_sysmem_location(struct wined3d_texture *texture + + wined3d_texture_prepare_location(texture, sub_resource_idx, context, location); + +- wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location); ++ wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location, FALSE); + wined3d_texture_get_memory(texture, sub_resource_idx, &src, +- texture->sub_resources[sub_resource_idx].locations); ++ texture->sub_resources[sub_resource_idx].locations, FALSE); + + if (dst.buffer_object) + { +@@ -326,7 +326,7 @@ void wined3d_texture_unmap_bo_address(const struct wined3d_bo_address *data, } void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, @@ -139,7 +151,7 @@ index bd415eb..ad4e93f 100644 { struct wined3d_texture_sub_resource *sub_resource; -@@ -192,7 +192,10 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su +@@ -337,7 +337,10 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su if (locations & WINED3D_LOCATION_BUFFER) { data->addr = NULL; @@ -151,7 +163,7 @@ index bd415eb..ad4e93f 100644 return; } if (locations & WINED3D_LOCATION_USER_MEMORY) -@@ -294,8 +297,13 @@ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture +@@ -439,8 +442,13 @@ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture struct wined3d_gl_bo *buffer = texture->sub_resources[sub_resource_idx].buffer; GLuint name = buffer->name; @@ -165,7 +177,7 @@ index bd415eb..ad4e93f 100644 wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_BUFFER); TRACE("Deleted buffer object %u for texture %p, sub-resource %u.\n", -@@ -405,6 +413,10 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -628,6 +636,10 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) for (i = 0; i < sub_count; ++i) { @@ -176,7 +188,7 @@ index bd415eb..ad4e93f 100644 if (!(buffer = texture->sub_resources[i].buffer)) continue; -@@ -417,6 +429,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -640,6 +652,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) wined3d_device_release_bo(device, buffer, context); texture->sub_resources[i].buffer = NULL; @@ -184,7 +196,7 @@ index bd415eb..ad4e93f 100644 } if (context) context_release(context); -@@ -1090,6 +1103,7 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur +@@ -1322,6 +1335,7 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur sub_resource->buffer = wined3d_device_get_bo(texture->resource.device, sub_resource->size, GL_STREAM_DRAW, GL_PIXEL_UNPACK_BUFFER, context); @@ -192,7 +204,7 @@ index bd415eb..ad4e93f 100644 TRACE("Created buffer object %u for texture %p, sub-resource %u.\n", sub_resource->buffer->name, texture, sub_resource_idx); -@@ -1609,7 +1623,7 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -1779,7 +1793,7 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY))) sub_resource->unmap_dirtify = TRUE; @@ -201,7 +213,7 @@ index bd415eb..ad4e93f 100644 data = wined3d_texture_map_bo_address(&bo_data, sub_resource->size, context->gl_info, GL_PIXEL_UNPACK_BUFFER, flags); -@@ -1743,7 +1757,7 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in +@@ -1913,7 +1927,7 @@ void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned in if (texture->resource.device->d3d_initialized) context = context_acquire(texture->resource.device, NULL); @@ -210,23 +222,11 @@ index bd415eb..ad4e93f 100644 wined3d_texture_unmap_bo_address(&data, context->gl_info, GL_PIXEL_UNPACK_BUFFER); if (context) -@@ -2682,9 +2696,9 @@ static BOOL wined3d_texture_copy_sysmem_location(struct wined3d_texture *texture - - wined3d_texture_prepare_location(texture, sub_resource_idx, context, location); - -- wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location); -+ wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location, FALSE); - wined3d_texture_get_memory(texture, sub_resource_idx, &src, -- texture->sub_resources[sub_resource_idx].locations); -+ texture->sub_resources[sub_resource_idx].locations, FALSE); - - if (dst.buffer_object) - { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 55b96ee..611b8b0 100644 +index c56e454..cbcb923 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2573,7 +2573,7 @@ struct wined3d_texture +@@ -2735,7 +2735,7 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -235,7 +235,7 @@ index 55b96ee..611b8b0 100644 BOOL unmap_dirtify; } sub_resources[1]; }; -@@ -2631,7 +2631,7 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, +@@ -2793,7 +2793,7 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, @@ -245,5 +245,5 @@ index 55b96ee..611b8b0 100644 unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_texture_invalidate_location(struct wined3d_texture *texture, -- -2.8.0 +2.9.0 diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index f2714f1d..948380ea 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -257,7 +257,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_mark_used(buffer); if (!buffer->buffer_object) -@@ -934,10 +996,22 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte +@@ -932,10 +994,22 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) { @@ -280,7 +280,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer) -@@ -951,9 +1025,34 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -949,9 +1023,34 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN { LONG count; BYTE *base; @@ -315,7 +315,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture * fill rate test seems to depend on this. When we map a buffer with -@@ -961,7 +1060,11 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -959,7 +1058,11 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN * previous contents of the buffer. The r600g driver only does this when * the buffer is currently in use, while the proprietary NVIDIA driver * appears to do this unconditionally. */ @@ -327,7 +327,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; -@@ -972,17 +1075,34 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -970,17 +1073,34 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN * being uploaded in that case. Two such applications are Port Royale * and Darkstar One. */ if (flags & WINED3D_MAP_DISCARD) @@ -362,7 +362,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -1028,11 +1148,14 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1026,11 +1146,14 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN buffer_get_sysmem(buffer, context); } TRACE("New pointer is %p.\n", buffer->resource.heap_memory); @@ -377,7 +377,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (flags & WINED3D_MAP_DISCARD) buffer->flags |= WINED3D_BUFFER_DISCARD; -@@ -1041,6 +1164,43 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1039,6 +1162,43 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.heap_memory; @@ -421,7 +421,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c *data = base + offset; TRACE("Returning memory at %p (base %p, offset %u).\n", *data, base, offset); -@@ -1103,17 +1263,25 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) +@@ -1101,17 +1261,25 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) } GL_EXTCALL(glUnmapBuffer(buffer->buffer_type_hint)); @@ -447,7 +447,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, -@@ -1305,6 +1473,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1303,6 +1471,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device return hr; } buffer->buffer_type_hint = bind_hint; @@ -457,7 +457,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); -@@ -1340,6 +1511,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1338,6 +1509,11 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->flags |= WINED3D_BUFFER_USE_BO; } @@ -469,7 +469,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) { ERR("Out of memory.\n"); -@@ -1467,3 +1643,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, +@@ -1465,3 +1641,12 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, return WINED3D_OK; } @@ -4181,11 +4181,12 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_const_bo_address data; struct wined3d_context *context; struct wined3d_map_desc src; -@@ -3617,6 +3865,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3617,6 +3865,14 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, } context = context_acquire(device, NULL); +#else /* STAGING_CSMT */ ++ unsigned int row_pitch, slice_pitch; + struct wined3d_bo_address data; + unsigned int i; + @@ -4195,7 +4196,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3624,6 +3879,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3624,6 +3880,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, for (i = 0; i < level_count; ++i) { @@ -4203,15 +4204,17 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_resource_map(&src_texture->resource, src_level + i, &src, NULL, WINED3D_MAP_READONLY))) goto done; -@@ -3640,16 +3896,92 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3640,16 +3897,94 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, done: context_release(context); return hr; +#else /* STAGING_CSMT */ + wined3d_texture_get_memory(src_texture, src_level + i, &data, + src_texture->resource.map_binding, FALSE); ++ wined3d_texture_get_pitch(src_texture, src_level + i, &row_pitch, &slice_pitch); + -+ wined3d_volume_upload_data(dst_texture, i, context, wined3d_const_bo_address(&data)); ++ wined3d_texture_upload_data(dst_texture, i, context, wined3d_const_bo_address(&data), ++ row_pitch, slice_pitch); + wined3d_texture_invalidate_location(dst_texture, i, ~WINED3D_LOCATION_TEXTURE_RGB); + } +} @@ -4296,7 +4299,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3686,6 +4018,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3686,6 +4021,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } @@ -4304,7 +4307,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c level_count = min(wined3d_texture_get_level_count(src_texture), wined3d_texture_get_level_count(dst_texture)); -@@ -3708,9 +4041,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3708,9 +4044,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, context_release(context); /* Update every surface level of the texture. */ @@ -4326,7 +4329,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { unsigned int src_levels = src_texture->level_count; unsigned int dst_levels = dst_texture->level_count; -@@ -3743,6 +4088,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3743,6 +4091,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, FIXME("Unsupported texture type %#x.\n", type); return WINED3DERR_INVALIDCALL; } @@ -4365,7 +4368,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3790,8 +4167,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3790,8 +4170,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -4379,7 +4382,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3980,6 +4362,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -3980,6 +4365,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev struct wined3d_texture *dst_texture, *src_texture; RECT dst_rect, src_rect; HRESULT hr; @@ -4389,7 +4392,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -4067,6 +4452,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4067,6 +4455,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev if (src_box) { @@ -4406,7 +4409,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); } else -@@ -4080,6 +4475,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4080,6 +4478,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), dst_y + (src_rect.bottom - src_rect.top)); @@ -4432,7 +4435,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) WARN("Failed to blit, hr %#x.\n", hr); -@@ -4092,6 +4506,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4092,6 +4509,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str unsigned int depth_pitch) { struct wined3d_texture_sub_resource *sub_resource; @@ -4440,7 +4443,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c const struct wined3d_gl_info *gl_info; struct wined3d_const_bo_address addr; unsigned int width, height, level; -@@ -4100,6 +4515,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4100,6 +4518,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str struct wined3d_surface *surface; POINT dst_point; RECT src_rect; @@ -4450,7 +4453,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch); -@@ -4133,6 +4551,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4133,6 +4554,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -4458,7 +4461,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c surface = sub_resource->u.surface; level = sub_resource_idx % texture->level_count; -@@ -4143,6 +4562,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4143,6 +4565,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str src_rect.top = 0; if (box) { @@ -4476,7 +4479,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box->left >= box->right || box->right > width || box->top >= box->bottom || box->bottom > height || box->front >= box->back) -@@ -4150,6 +4580,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4150,6 +4583,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str WARN("Invalid box %s specified.\n", debug_box(box)); return; } @@ -4484,7 +4487,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c src_rect.right = box->right - box->left; src_rect.bottom = box->bottom - box->top; -@@ -4184,6 +4615,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4184,6 +4618,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); @@ -4496,7 +4499,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4192,8 +4628,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4192,8 +4631,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi { const struct blit_shader *blitter; struct wined3d_resource *resource; @@ -4510,7 +4513,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n", device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil); -@@ -4232,10 +4673,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4232,10 +4676,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3DERR_INVALIDCALL; } @@ -4526,7 +4529,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4249,20 +4695,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4249,20 +4698,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -4558,7 +4561,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4302,13 +4759,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4299,13 +4759,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -4580,7 +4583,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4320,18 +4785,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4317,18 +4785,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4610,7 +4613,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4553,6 +5029,10 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4550,6 +5029,10 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) TRACE("device %p.\n", device); @@ -4621,7 +4624,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Checking resource %p for eviction.\n", resource); -@@ -4560,6 +5040,7 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4557,6 +5040,7 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -4629,7 +4632,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c resource->resource_ops->resource_unload(resource); } } -@@ -4571,10 +5052,20 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4568,10 +5052,20 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { struct wined3d_resource *resource, *cursor; @@ -4650,7 +4653,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -4584,11 +5075,17 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d +@@ -4581,11 +5075,17 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d resource->resource_ops->resource_unload(resource); } @@ -4668,7 +4671,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); -@@ -4609,12 +5106,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d +@@ -4606,12 +5106,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4699,7 +4702,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4631,6 +5146,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4628,6 +5146,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru return hr; } @@ -4707,7 +4710,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Recreate the primary swapchain's context */ swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); if (!swapchain->context) -@@ -4643,10 +5159,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4640,10 +5159,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; if (!(context = context_create(swapchain, target, swapchain->ds_format))) @@ -4723,7 +4726,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HeapFree(GetProcessHeap(), 0, swapchain->context); return E_FAIL; } -@@ -4656,6 +5177,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru +@@ -4653,6 +5177,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru create_dummy_textures(device, context); create_default_samplers(device); context_release(context); @@ -4736,7 +4739,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4675,6 +5202,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4672,6 +5202,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -4751,7 +4754,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { ERR("Failed to get the first implicit swapchain.\n"); -@@ -4694,10 +5229,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4691,10 +5229,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -4768,7 +4771,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4706,10 +5247,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4703,10 +5247,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4791,7 +4794,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4931,30 +5484,52 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4928,27 +5484,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -4826,25 +4829,21 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c +#if !defined(STAGING_CSMT) state->viewport.width = view->width; state->viewport.height = view->height; + wined3d_cs_emit_set_viewport(device->cs, &state->viewport); + + SetRect(&state->scissor_rect, 0, 0, view->width, view->height); +#else /* STAGING_CSMT */ + state->viewport.width = swapchain->desc.backbuffer_width; + state->viewport.height = swapchain->desc.backbuffer_height; -+#endif /* STAGING_CSMT */ - wined3d_cs_emit_set_viewport(device->cs, &state->viewport); - - state->scissor_rect.top = 0; - state->scissor_rect.left = 0; -+#if !defined(STAGING_CSMT) - state->scissor_rect.right = view->width; - state->scissor_rect.bottom = view->height; -+#else /* STAGING_CSMT */ -+ state->scissor_rect.right = swapchain->desc.backbuffer_width; -+ state->scissor_rect.bottom = swapchain->desc.backbuffer_height; ++ wined3d_cs_emit_set_viewport(device->cs, &state->viewport); ++ ++ SetRect(&state->scissor_rect, 0, 0, ++ swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height); +#endif /* STAGING_CSMT */ wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4962,7 +5537,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4956,7 +5533,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = create_primary_opengl_context(device, swapchain); @@ -4856,7 +4855,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* All done. There is no need to reload resources or shaders, this will happen automatically on the -@@ -5044,11 +5623,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5038,11 +5619,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4876,7 +4875,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5184,8 +5771,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5178,8 +5767,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -4894,7 +4893,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state = &device->state; if (!(device->cs = wined3d_cs_create(device))) -@@ -5279,3 +5875,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5273,3 +5871,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -5761,7 +5760,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context, unsigned int *width, unsigned int *height) { -@@ -319,7 +326,11 @@ void wined3d_surface_destroy_dc(struct wined3d_surface *surface) +@@ -317,7 +324,11 @@ void wined3d_surface_destroy_dc(struct wined3d_surface *surface) gl_info = context->gl_info; } @@ -5773,7 +5772,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_unmap_bo_address(&data, gl_info, GL_PIXEL_UNPACK_BUFFER); if (context) -@@ -355,7 +366,11 @@ HRESULT wined3d_surface_create_dc(struct wined3d_surface *surface) +@@ -353,7 +364,11 @@ HRESULT wined3d_surface_create_dc(struct wined3d_surface *surface) gl_info = context->gl_info; } @@ -5785,7 +5784,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c desc.pMemory = wined3d_texture_map_bo_address(&data, texture->sub_resources[sub_resource_idx].size, gl_info, GL_PIXEL_UNPACK_BUFFER, 0); -@@ -450,9 +465,17 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device, +@@ -448,9 +463,17 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device, /* Make sure the locations are up-to-date. Loading the destination * surface isn't required if the entire surface is overwritten. */ @@ -5803,7 +5802,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c else wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location); -@@ -546,9 +569,17 @@ static void surface_blt_fbo(const struct wined3d_device *device, +@@ -544,9 +567,17 @@ static void surface_blt_fbo(const struct wined3d_device *device, * surface isn't required if the entire surface is overwritten. (And is * in fact harmful if we're being called by surface_load_location() with * the purpose of loading the destination surface.) */ @@ -5821,7 +5820,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c else wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, old_ctx, dst_location); -@@ -619,7 +650,12 @@ static void surface_blt_fbo(const struct wined3d_device *device, +@@ -617,7 +648,12 @@ static void surface_blt_fbo(const struct wined3d_device *device, dst_rect.left, dst_rect.top, dst_rect.right, dst_rect.bottom, GL_COLOR_BUFFER_BIT, gl_filter); checkGLcall("glBlitFramebuffer()"); @@ -5834,7 +5833,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c && dst_texture->swapchain->front_buffer == dst_texture)) gl_info->gl_ops.gl.p_glFlush(); -@@ -708,8 +744,12 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const +@@ -706,8 +742,12 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const { struct wined3d_resource *resource = &surface->container->resource; struct wined3d_device *device = resource->device; @@ -5847,7 +5846,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct blit_shader *blitter; HRESULT hr; -@@ -720,6 +760,7 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const +@@ -718,6 +758,7 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const return WINED3DERR_INVALIDCALL; } @@ -5855,7 +5854,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c view_desc.format_id = resource->format->id; view_desc.u.texture.level_idx = surface->texture_level; view_desc.u.texture.layer_idx = surface->texture_layer; -@@ -733,6 +774,19 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const +@@ -731,6 +772,19 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const hr = blitter->depth_fill(device, view, rect, WINED3DCLEAR_ZBUFFER, depth, 0); wined3d_rendertarget_view_decref(view); @@ -5875,7 +5874,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -797,7 +851,11 @@ static void surface_download_data(struct wined3d_surface *surface, const struct +@@ -795,7 +849,11 @@ static void surface_download_data(struct wined3d_surface *surface, const struct } } @@ -5887,7 +5886,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (texture->flags & WINED3D_TEXTURE_COND_NP2_EMULATED) { -@@ -1175,9 +1233,22 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1173,9 +1231,22 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P return WINED3DERR_INVALIDCALL; } @@ -5910,7 +5909,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c context = context_acquire(dst_texture->resource.device, NULL); gl_info = context->gl_info; -@@ -1188,11 +1259,19 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -1186,11 +1257,19 @@ 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_texture, context, FALSE); else @@ -5930,7 +5929,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_get_pitch(src_texture, src_surface->texture_level, &src_row_pitch, &src_slice_pitch); wined3d_surface_upload_data(dst_surface, gl_info, src_format, src_rect, -@@ -1693,11 +1772,22 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1691,11 +1770,22 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr { unsigned int texture_level = sub_resource_idx % src_texture->level_count; const struct wined3d_format *src_format = src_texture->resource.format; @@ -5953,7 +5952,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (!(conv = find_converter(src_format->id, dst_format->id)) && (!device->d3d_initialized || !is_identity_fixup(src_format->color_fixup) || src_format->convert -@@ -1727,6 +1817,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1725,6 +1815,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr return NULL; } @@ -5961,7 +5960,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c memset(&src_map, 0, sizeof(src_map)); if (FAILED(wined3d_resource_map(&src_texture->resource, sub_resource_idx, &src_map, NULL, WINED3D_MAP_READONLY))) -@@ -1751,10 +1842,51 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1749,10 +1840,51 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr conv->convert(src_map.data, dst_map.data, src_map.row_pitch, dst_map.row_pitch, desc.width, desc.height); wined3d_resource_unmap(&dst_texture->resource, 0); @@ -6013,7 +6012,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c RECT src_rect = {0, 0, desc.width, desc.height}; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; -@@ -1767,16 +1899,40 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr +@@ -1765,16 +1897,40 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr wined3d_texture_prepare_texture(dst_texture, context, FALSE); wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE); wined3d_surface_upload_data(dst_texture->sub_resources[0].u.surface, gl_info, src_format, @@ -6054,7 +6053,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, -@@ -1854,7 +2010,11 @@ static void read_from_framebuffer(struct wined3d_surface *surface, +@@ -1852,7 +2008,11 @@ static void read_from_framebuffer(struct wined3d_surface *surface, BOOL srcIsUpsideDown; struct wined3d_bo_address data; @@ -6066,7 +6065,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c restore_rt = context_get_rt_surface(old_ctx); if (restore_rt != surface) -@@ -2381,7 +2541,13 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st +@@ -2379,7 +2539,13 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st checkGLcall("glDeleteTextures(1, &backup)"); } @@ -6080,7 +6079,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. */ context_release(context); -@@ -2446,9 +2612,15 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, +@@ -2444,9 +2610,15 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, gl_info = context->gl_info; @@ -6096,7 +6095,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_load(src_texture, context, FALSE); /* Activate the destination context, set it up for blitting */ -@@ -2491,8 +2663,16 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, +@@ -2489,8 +2661,16 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, /* Leave the opengl state valid for blitting */ device->blitter->unset_shader(context->gl_info); @@ -6113,7 +6112,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. */ if (restore_rt) -@@ -2503,8 +2683,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2501,8 +2681,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st { struct wined3d_resource *resource = &s->container->resource; struct wined3d_device *device = resource->device; @@ -6126,7 +6125,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct blit_shader *blitter; HRESULT hr; -@@ -2515,6 +2699,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2513,6 +2697,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st return WINED3DERR_INVALIDCALL; } @@ -6134,7 +6133,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c view_desc.format_id = resource->format->id; view_desc.u.texture.level_idx = s->texture_level; view_desc.u.texture.layer_idx = s->texture_layer; -@@ -2528,6 +2713,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2526,6 +2711,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st hr = blitter->color_fill(device, view, rect, color); wined3d_rendertarget_view_decref(view); @@ -6154,7 +6153,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2538,7 +2736,11 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -2536,7 +2734,11 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE { struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; @@ -6166,7 +6165,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_texture *src_texture; -@@ -2839,7 +3041,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win +@@ -2837,7 +3039,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -6180,7 +6179,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) -@@ -2856,7 +3064,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win +@@ -2854,7 +3062,13 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -6194,7 +6193,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 -@@ -2865,6 +3079,7 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win +@@ -2863,6 +3077,7 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win } } @@ -6202,7 +6201,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c static DWORD resource_access_from_location(DWORD location) { switch (location) -@@ -2926,6 +3141,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD +@@ -2924,6 +3139,7 @@ static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD memcpy(dst.addr, src.addr, sub_resource->size); } @@ -6210,7 +6209,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Context activation is done by the caller. */ static void surface_load_sysmem(struct wined3d_surface *surface, struct wined3d_context *context, DWORD dst_location) -@@ -2938,6 +3154,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -2936,6 +3152,7 @@ static void surface_load_sysmem(struct wined3d_surface *surface, wined3d_texture_prepare_location(texture, sub_resource_idx, context, dst_location); sub_resource = &texture->sub_resources[sub_resource_idx]; @@ -6218,7 +6217,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (sub_resource->locations & surface_simple_locations) { surface_copy_simple_location(surface, dst_location); -@@ -2946,6 +3163,11 @@ static void surface_load_sysmem(struct wined3d_surface *surface, +@@ -2944,6 +3161,11 @@ static void surface_load_sysmem(struct wined3d_surface *surface, if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED)) surface_load_location(surface, context, WINED3D_LOCATION_TEXTURE_RGB); @@ -6230,7 +6229,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c /* Download the surface to system memory. */ if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) -@@ -2983,7 +3205,12 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, +@@ -2981,7 +3203,12 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface, } surface_get_rect(surface, NULL, &r); @@ -6243,7 +6242,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_blt_to_drawable(texture->resource.device, context, WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r); -@@ -3060,7 +3287,12 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3058,7 +3285,12 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, == WINED3D_LOCATION_TEXTURE_RGB) { FIXME_(d3d_perf)("Downloading RGB surface %p to reload it as sRGB.\n", surface); @@ -6256,7 +6255,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -3069,7 +3301,12 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3067,7 +3299,12 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, == WINED3D_LOCATION_TEXTURE_SRGB) { FIXME_(d3d_perf)("Downloading sRGB surface %p to reload it as RGB.\n", surface); @@ -6269,7 +6268,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } -@@ -3077,7 +3314,11 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3075,7 +3312,11 @@ 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... */ @@ -6281,7 +6280,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } wined3d_texture_prepare_texture(texture, context, srgb); -@@ -3091,15 +3332,27 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, +@@ -3089,15 +3330,27 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, /* 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. */ @@ -6309,7 +6308,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. */ -@@ -3182,16 +3435,23 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi +@@ -3180,16 +3433,23 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi } /* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */ @@ -6333,7 +6332,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c surface_w = wined3d_texture_get_level_width(texture, surface->texture_level); surface_h = wined3d_texture_get_level_height(texture, surface->texture_level); -@@ -3226,6 +3486,9 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3224,6 +3484,9 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED); return surface_load_location(surface, context, location); } @@ -6343,7 +6342,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { -@@ -3238,7 +3501,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3236,7 +3499,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", wined3d_debug_location(sub_resource->locations), wined3d_debug_location(location)); @@ -6355,7 +6354,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } switch (location) -@@ -3251,7 +3518,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3249,7 +3516,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_DRAWABLE: if (FAILED(hr = surface_load_drawable(surface, context))) @@ -6367,7 +6366,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -3263,7 +3534,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3261,7 +3532,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_TEXTURE_SRGB: if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) @@ -6379,7 +6378,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c break; default: -@@ -3272,6 +3547,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3270,6 +3545,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co } done: @@ -6387,7 +6386,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c wined3d_texture_validate_location(texture, sub_resource_idx, location); if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) -@@ -3281,6 +3557,9 @@ done: +@@ -3279,6 +3555,9 @@ done: } return WINED3D_OK; @@ -6397,7 +6396,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; } -@@ -3612,16 +3891,41 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3610,16 +3889,41 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int const BYTE *sbuf; BYTE *dbuf; int x, y; @@ -6439,7 +6438,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_map = dst_map; src_format = dst_texture->resource.format; dst_format = src_format; -@@ -3646,7 +3950,20 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3644,7 +3948,20 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int src_texture = converted_texture; src_sub_resource_idx = 0; } @@ -6460,7 +6459,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_format = src_texture->resource.format; src_fmt_flags = src_texture->resource.format_flags; } -@@ -3656,7 +3973,17 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3654,7 +3971,17 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int src_fmt_flags = dst_fmt_flags; } @@ -6478,7 +6477,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } bpp = dst_format->byte_count; -@@ -3670,12 +3997,18 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int +@@ -3668,12 +3995,18 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int sbase = (BYTE *)src_map.data + ((src_box->top / src_format->block_height) * src_map.row_pitch) + ((src_box->left / src_format->block_width) * src_format->block_byte_count); @@ -6497,7 +6496,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS) { -@@ -4068,16 +4401,42 @@ do { \ +@@ -4066,16 +4399,42 @@ do { \ } } @@ -6540,7 +6539,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -4122,7 +4481,11 @@ const struct blit_shader cpu_blit = { +@@ -4120,7 +4479,11 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -6552,7 +6551,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -4132,9 +4495,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4130,9 +4493,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; struct wined3d_swapchain *src_swapchain, *dst_swapchain; @@ -6567,7 +6566,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c DWORD src_ds_flags, dst_ds_flags; BOOL scale, convert; -@@ -4147,6 +4515,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4145,6 +4513,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -6575,7 +6574,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, fx %p, filter %s.\n", dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter)); -@@ -4164,10 +4533,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4162,10 +4531,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fx->src_color_key.color_space_high_value); } @@ -6588,7 +6587,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (dst_texture->sub_resources[dst_sub_resource_idx].map_count -@@ -4225,6 +4596,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4223,6 +4594,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (!once++) FIXME("Can't handle WINED3D_BLT_DO_NOT_WAIT flag.\n"); flags &= ~WINED3D_BLT_DO_NOT_WAIT; @@ -6604,7 +6603,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (!device->d3d_initialized) -@@ -4249,11 +4629,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4247,11 +4627,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -6618,7 +6617,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -4289,13 +4671,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4287,13 +4669,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst TRACE("Depth fill.\n"); if (!surface_convert_depth_to_float(dst_surface, fx->fill_color, &depth)) @@ -6640,7 +6639,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_ds_flags != dst_ds_flags) { WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -@@ -4305,6 +4695,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4303,6 +4693,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) return WINED3D_OK; @@ -6652,7 +6651,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -4340,7 +4735,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4338,7 +4733,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -6664,7 +6663,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4379,10 +4778,18 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4377,10 +4776,18 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (!wined3d_resource_is_offscreen(&dst_texture->resource)) { struct wined3d_context *context = context_acquire(device, dst_surface); @@ -6683,7 +6682,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4406,7 +4813,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4404,7 +4811,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -6695,7 +6694,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4427,7 +4838,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4425,7 +4836,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding); @@ -6707,7 +6706,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4437,7 +4852,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4435,7 +4850,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst { blitter->blit_surface(device, blit_op, filter, src_surface, src_rect, dst_surface, dst_rect, color_key); @@ -6719,7 +6718,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4445,9 +4864,156 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4443,9 +4862,156 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fallback: /* Special cases for render targets. */ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) @@ -7212,7 +7211,152 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void wined3d_texture_validate_location(struct wined3d_texture *texture, -@@ -216,7 +221,11 @@ void wined3d_texture_unmap_bo_address(const struct wined3d_bo_address *data, +@@ -174,12 +179,144 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture, + sub_resource_idx, texture); + } + ++#if !defined(STAGING_CSMT) + /* Context activation is done by the caller. Context may be NULL in + * WINED3D_NO3D mode. */ + static BOOL wined3d_texture_load_location(struct wined3d_texture *texture, + unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) + { + return texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location); ++#else /* STAGING_CSMT */ ++static BOOL wined3d_texture_copy_sysmem_location(struct wined3d_texture *texture, ++ unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) ++{ ++ struct wined3d_device *device = texture->resource.device; ++ const struct wined3d_gl_info *gl_info; ++ struct wined3d_bo_address dst, src; ++ UINT size = texture->sub_resources[sub_resource_idx].size; ++ ++ wined3d_texture_prepare_location(texture, sub_resource_idx, context, location); ++ ++ wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location, FALSE); ++ wined3d_texture_get_memory(texture, sub_resource_idx, &src, ++ texture->sub_resources[sub_resource_idx].locations, FALSE); ++ ++ if (dst.buffer_object) ++ { ++ context = context_acquire(device, NULL); ++ gl_info = context->gl_info; ++ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, dst.buffer_object)); ++ GL_EXTCALL(glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, size, src.addr)); ++ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0)); ++ checkGLcall("Upload PBO"); ++ context_release(context); ++ return TRUE; ++ } ++ if (src.buffer_object) ++ { ++ context = context_acquire(device, NULL); ++ gl_info = context->gl_info; ++ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, src.buffer_object)); ++ GL_EXTCALL(glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0, size, dst.addr)); ++ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0)); ++ checkGLcall("Download PBO"); ++ context_release(context); ++ return TRUE; ++ } ++ memcpy(dst.addr, src.addr, size); ++ return TRUE; ++} ++ ++static DWORD resource_access_from_location(DWORD location) ++{ ++ switch (location) ++ { ++ case WINED3D_LOCATION_SYSMEM: ++ case WINED3D_LOCATION_USER_MEMORY: ++ case WINED3D_LOCATION_BUFFER: ++ return WINED3D_RESOURCE_ACCESS_CPU; ++ ++ case WINED3D_LOCATION_DRAWABLE: ++ case WINED3D_LOCATION_TEXTURE_SRGB: ++ case WINED3D_LOCATION_TEXTURE_RGB: ++ case WINED3D_LOCATION_RB_MULTISAMPLE: ++ case WINED3D_LOCATION_RB_RESOLVED: ++ return WINED3D_RESOURCE_ACCESS_GPU; ++ ++ default: ++ FIXME("Unhandled location %#x.\n", location); ++ return 0; ++ } ++} ++ ++/* Context activation is done by the caller. Context may be NULL in ++ * WINED3D_NO3D mode. */ ++BOOL wined3d_texture_load_location(struct wined3d_texture *texture, ++ unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) ++{ ++ BOOL ret; ++ DWORD current = texture->sub_resources[sub_resource_idx].locations; ++ struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface; ++ unsigned int sub_resource_w, sub_resource_h; ++ ++ TRACE("Texture %p, sub_resource %u, location %s.\n", texture, sub_resource_idx, ++ wined3d_debug_location(location)); ++ ++ sub_resource_w = wined3d_texture_get_level_width(texture, sub_resource_idx % texture->level_count); ++ sub_resource_h = wined3d_texture_get_level_height(texture, sub_resource_idx % texture->level_count); ++ ++ if ((current & location) && (!(surface && (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)) ++ || (surface->ds_current_size.cx == sub_resource_w ++ && surface->ds_current_size.cy == sub_resource_h))) ++ { ++ TRACE("Location (%#x) is already up to date.\n", location); ++ return TRUE; ++ } ++ ++ if (WARN_ON(d3d)) ++ { ++ DWORD required_access = resource_access_from_location(location); ++ if ((texture->resource.access_flags & required_access) != required_access) ++ WARN("Operation requires %#x access, but texture only has %#x.\n", ++ required_access, texture->resource.access_flags); ++ } ++ ++ if (!current) ++ { ++ ERR("Texture %p, sub resource %u does not have any up to date location.\n", texture, sub_resource_idx); ++ wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED); ++ wined3d_texture_load_location(texture, sub_resource_idx, context, location); ++ return TRUE; ++ } ++ ++ if (texture->sub_resources[sub_resource_idx].locations & WINED3D_LOCATION_DISCARDED) ++ { ++ wined3d_texture_prepare_location(texture, sub_resource_idx, context, location); ++ ret = TRUE; ++ } ++ else ++ { ++ static const DWORD sysmem_locations = WINED3D_LOCATION_SYSMEM | WINED3D_LOCATION_USER_MEMORY ++ | WINED3D_LOCATION_BUFFER; ++ ++ if ((location & sysmem_locations) && (current & sysmem_locations)) ++ ret = wined3d_texture_copy_sysmem_location(texture, sub_resource_idx, context, location); ++ else ++ ret = texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location); ++ } ++ ++ if (ret) ++ { ++ wined3d_texture_validate_location(texture, sub_resource_idx, location); ++ ++ if (surface && texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) ++ { ++ surface->ds_current_size.cx = sub_resource_w; ++ surface->ds_current_size.cy = sub_resource_h; ++ } ++ } ++ return ret; ++#endif /* STAGING_CSMT */ + } + + /* Context activation is done by the caller. */ +@@ -224,7 +361,11 @@ void wined3d_texture_unmap_bo_address(const struct wined3d_bo_address *data, } void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, @@ -7224,7 +7368,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { struct wined3d_texture_sub_resource *sub_resource; -@@ -227,7 +236,14 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su +@@ -235,7 +376,14 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su if (locations & WINED3D_LOCATION_BUFFER) { data->addr = NULL; @@ -7239,7 +7383,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return; } if (locations & WINED3D_LOCATION_USER_MEMORY) -@@ -238,7 +254,14 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su +@@ -246,7 +394,14 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su } if (locations & WINED3D_LOCATION_SYSMEM) { @@ -7254,7 +7398,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c data->addr += sub_resource->offset; data->buffer_object = 0; return; -@@ -324,6 +347,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc +@@ -332,6 +487,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc /* Context activation is done by the caller. */ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture, @@ -7262,7 +7406,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info) { GLuint *buffer_object; -@@ -336,6 +360,24 @@ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture +@@ -344,6 +500,24 @@ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture TRACE("Deleted buffer object %u for texture %p, sub-resource %u.\n", *buffer_object, texture, sub_resource_idx); @@ -7287,25 +7431,19 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) -@@ -352,10 +394,17 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) - for (i = 0; i < sub_count; ++i) - { - if (texture->sub_resources[i].locations == texture->resource.map_binding -+#if !defined(STAGING_CSMT) - && !texture->texture_ops->texture_load_location(texture, i, context, map_binding)) +@@ -363,7 +537,11 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) + && !wined3d_texture_load_location(texture, i, context, map_binding)) ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding)); if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER) ++#if !defined(STAGING_CSMT) wined3d_texture_remove_buffer_object(texture, i, context->gl_info); +#else /* STAGING_CSMT */ -+ && !wined3d_texture_load_location(texture, i, context, map_binding)) -+ ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding)); -+ if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER) + wined3d_texture_remove_buffer_object(texture, i, context); +#endif /* STAGING_CSMT */ } if (context) -@@ -512,28 +561,51 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -520,28 +698,51 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) unsigned int sub_count = texture->level_count * texture->layer_count; struct wined3d_device *device = texture->resource.device; struct wined3d_context *context = NULL; @@ -7357,7 +7495,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) context_release(context); -@@ -836,6 +908,12 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) +@@ -844,6 +1045,12 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) static void wined3d_texture_cleanup_sync(struct wined3d_texture *texture) { wined3d_texture_sub_resources_destroyed(texture); @@ -7370,7 +7508,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c resource_cleanup(&texture->resource); wined3d_resource_wait_idle(&texture->resource); wined3d_texture_cleanup(texture); -@@ -863,6 +941,15 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) +@@ -871,6 +1078,15 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) { wined3d_texture_sub_resources_destroyed(texture); texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent); @@ -7386,31 +7524,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c resource_cleanup(&texture->resource); wined3d_cs_emit_destroy_object(texture->resource.device->cs, wined3d_texture_destroy_object, texture); } -@@ -914,7 +1001,11 @@ void wined3d_texture_load(struct wined3d_texture *texture, - TRACE("Reloading because of color key value change.\n"); - for (i = 0; i < sub_count; i++) - { -+#if !defined(STAGING_CSMT) - if (!texture->texture_ops->texture_load_location(texture, i, context, texture->resource.map_binding)) -+#else /* STAGING_CSMT */ -+ if (!wined3d_texture_load_location(texture, i, context, texture->resource.map_binding)) -+#endif /* STAGING_CSMT */ - ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); - else - wined3d_texture_invalidate_location(texture, i, ~texture->resource.map_binding); -@@ -932,7 +1023,11 @@ void wined3d_texture_load(struct wined3d_texture *texture, - /* Reload the surfaces if the texture is marked dirty. */ - for (i = 0; i < sub_count; ++i) - { -+#if !defined(STAGING_CSMT) - if (!texture->texture_ops->texture_load_location(texture, i, context, -+#else /* STAGING_CSMT */ -+ if (!wined3d_texture_load_location(texture, i, context, -+#endif /* STAGING_CSMT */ - srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB)) - ERR("Failed to load location (srgb %#x).\n", srgb); - } -@@ -941,10 +1036,15 @@ void wined3d_texture_load(struct wined3d_texture *texture, +@@ -949,10 +1165,15 @@ void wined3d_texture_load(struct wined3d_texture *texture, void CDECL wined3d_texture_preload(struct wined3d_texture *texture) { @@ -7426,7 +7540,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) -@@ -1007,6 +1107,15 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) +@@ -1015,6 +1236,15 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) if (texture->lod != lod) { @@ -7442,7 +7556,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->lod = lod; texture->texture_rgb.base_level = ~0u; -@@ -1127,7 +1236,14 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1135,7 +1365,14 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } if (device->d3d_initialized) @@ -7457,7 +7571,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c sub_resource = &texture->sub_resources[0]; surface = sub_resource->u.surface; -@@ -1138,6 +1254,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1146,6 +1383,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT } wined3d_resource_free_sysmem(&texture->resource); @@ -7467,7 +7581,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((texture->row_pitch = pitch)) texture->slice_pitch = height * pitch; -@@ -1194,18 +1313,31 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1202,18 +1442,31 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT wined3d_texture_invalidate_location(texture, 0, ~valid_location); if (create_dib) @@ -7499,7 +7613,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->buffer_object) return; -@@ -1217,6 +1349,25 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur +@@ -1225,6 +1478,25 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur TRACE("Created buffer object %u for texture %p, sub-resource %u.\n", sub_resource->buffer_object, texture, sub_resource_idx); @@ -7525,7 +7639,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_force_reload(struct wined3d_texture *texture) -@@ -1334,6 +1485,9 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1342,6 +1614,9 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned ERR("Failed to allocate system memory.\n"); return FALSE; } @@ -7535,7 +7649,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_USER_MEMORY: -@@ -1342,7 +1496,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1350,7 +1625,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned return TRUE; case WINED3D_LOCATION_BUFFER: @@ -7547,19 +7661,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1413,7 +1571,11 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, - WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); - - context = context_acquire(texture->resource.device, NULL); -+#if !defined(STAGING_CSMT) - if (!texture->texture_ops->texture_load_location(texture, sub_resource_idx, -+#else /* STAGING_CSMT */ -+ if (!wined3d_texture_load_location(texture, sub_resource_idx, -+#endif /* STAGING_CSMT */ - context, texture->resource.map_binding)) - { - ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); -@@ -1434,6 +1596,9 @@ static void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigne +@@ -1441,6 +1720,9 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s context, data, row_pitch, slice_pitch); } @@ -7569,7 +7671,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch) -@@ -1453,7 +1618,12 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int +@@ -1460,7 +1742,12 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) { @@ -7582,19 +7684,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } /* Context activation is done by the caller. */ -@@ -1591,7 +1761,11 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) - struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[i]; - - if (resource->pool != WINED3D_POOL_DEFAULT -+#if !defined(STAGING_CSMT) - && texture->texture_ops->texture_load_location(texture, i, context, resource->map_binding)) -+#else /* STAGING_CSMT */ -+ && wined3d_texture_load_location(texture, i, context, resource->map_binding)) -+#endif /* STAGING_CSMT */ - { - wined3d_texture_invalidate_location(texture, i, ~resource->map_binding); - } -@@ -1606,8 +1780,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1613,8 +1900,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -7608,7 +7698,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -1632,6 +1811,89 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -1639,6 +1931,89 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_unload_gl_texture(texture); } @@ -7698,7 +7788,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static HRESULT texture_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) { -@@ -1639,6 +1901,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1646,6 +2021,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour struct wined3d_texture_sub_resource *sub_resource; struct wined3d_device *device = resource->device; unsigned int fmt_flags = resource->format_flags; @@ -7706,7 +7796,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c const struct wined3d_gl_info *gl_info = NULL; struct wined3d_context *context = NULL; struct wined3d_texture *texture; -@@ -1646,6 +1909,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1653,6 +2029,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour unsigned int texture_level; BYTE *base_memory; BOOL ret; @@ -7718,7 +7808,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n", resource, sub_resource_idx, map_desc, debug_box(box), flags); -@@ -1692,14 +1960,20 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1699,14 +2080,20 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour flags = wined3d_resource_sanitize_map_flags(resource, flags); @@ -7739,7 +7829,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("WINED3D_MAP_DISCARD flag passed, marking %s as up to date.\n", wined3d_debug_location(texture->resource.map_binding)); if ((ret = wined3d_texture_prepare_location(texture, sub_resource_idx, -@@ -1731,6 +2005,24 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1737,6 +2124,24 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour if (context) context_release(context); @@ -7764,7 +7854,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH) { -@@ -1766,6 +2058,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1772,6 +2177,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour } } @@ -7772,7 +7862,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (texture->swapchain && texture->swapchain->front_buffer == texture) { RECT *r = &texture->swapchain->front_buffer_update; -@@ -1777,6 +2070,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1783,6 +2189,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour TRACE("Mapped front buffer %s.\n", wine_dbgstr_rect(r)); } @@ -7780,7 +7870,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c ++resource->map_count; ++sub_resource->map_count; -@@ -1786,14 +2080,71 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour +@@ -1792,14 +2199,71 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour return WINED3D_OK; } @@ -7852,7 +7942,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx); -@@ -1809,6 +2160,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1815,6 +2279,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso return WINEDDERR_NOTLOCKED; } @@ -7860,7 +7950,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) { context = context_acquire(device, NULL); -@@ -1829,6 +2181,15 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso +@@ -1835,6 +2300,15 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso else if (resource->format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) { FIXME("Depth / stencil buffer locking is not implemented.\n"); @@ -7876,7 +7966,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } --sub_resource->map_count; -@@ -2060,11 +2421,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2066,11 +2540,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -7900,26 +7990,17 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } } } -@@ -2072,6 +2445,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 - return WINED3D_OK; - } - -+#if defined(STAGING_CSMT) -+/* Context activation is done by the caller. */ -+#endif /* STAGING_CSMT */ - static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, - const struct wined3d_context *context, const struct wined3d_const_bo_address *data, - unsigned int row_pitch, unsigned int slice_pitch) -@@ -2148,13 +2524,16 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2207,7 +2693,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in struct wined3d_context *context, DWORD location) { struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; +#if !defined(STAGING_CSMT) DWORD required_access = wined3d_resource_access_from_location(location); +#endif /* STAGING_CSMT */ + unsigned int row_pitch, slice_pitch; TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n", - texture, sub_resource_idx, context, wined3d_debug_location(location)); +@@ -2215,6 +2703,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations)); @@ -7927,7 +8008,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((sub_resource->locations & location) == location) { TRACE("Location(s) already up to date.\n"); -@@ -2168,9 +2547,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2228,9 +2717,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7939,7 +8020,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_DISCARDED) { TRACE("Volume previously discarded, nothing to do.\n"); -@@ -2179,6 +2560,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2239,6 +2730,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in goto done; } @@ -7947,7 +8028,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c switch (location) { case WINED3D_LOCATION_TEXTURE_RGB: -@@ -2193,7 +2575,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2254,7 +2746,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -7958,8 +8039,8 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c +#endif /* STAGING_CSMT */ wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); - wined3d_volume_upload_data(texture, sub_resource_idx, context, &data); -@@ -2238,7 +2624,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in + wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); +@@ -2300,7 +2796,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -7971,7 +8052,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -2261,7 +2651,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2323,7 +2823,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in return FALSE; } @@ -7981,7 +8062,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_validate_location(texture, sub_resource_idx, location); return TRUE; -@@ -2436,6 +2828,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct +@@ -2498,6 +3000,9 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct if (wined3d_texture_use_pbo(texture, gl_info)) { wined3d_resource_free_sysmem(&texture->resource); @@ -7991,7 +8072,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->resource.map_binding = WINED3D_LOCATION_BUFFER; } -@@ -2795,13 +3190,47 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -2854,13 +3359,47 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -8039,7 +8120,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -2819,6 +3248,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -2878,6 +3417,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) return WINED3DERR_INVALIDCALL; @@ -8047,7 +8128,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) context = context_acquire(device, NULL); -@@ -2841,6 +3271,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -2900,6 +3440,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i TRACE("Returning dc %p.\n", *dc); return hr; @@ -8080,7 +8161,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -2871,6 +3327,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -2930,6 +3496,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -8088,7 +8169,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D)) wined3d_surface_destroy_dc(surface); -@@ -2879,6 +3336,141 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -2938,6 +3505,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign wined3d_texture_update_map_binding(texture); if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; @@ -8098,138 +8179,6 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3D_OK; } -+#if defined(STAGING_CSMT) -+ -+static BOOL wined3d_texture_copy_sysmem_location(struct wined3d_texture *texture, -+ unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) -+{ -+ struct wined3d_device *device = texture->resource.device; -+ const struct wined3d_gl_info *gl_info; -+ struct wined3d_bo_address dst, src; -+ UINT size = texture->sub_resources[sub_resource_idx].size; -+ -+ wined3d_texture_prepare_location(texture, sub_resource_idx, context, location); -+ -+ wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location, FALSE); -+ wined3d_texture_get_memory(texture, sub_resource_idx, &src, -+ texture->sub_resources[sub_resource_idx].locations, FALSE); -+ -+ if (dst.buffer_object) -+ { -+ context = context_acquire(device, NULL); -+ gl_info = context->gl_info; -+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, dst.buffer_object)); -+ GL_EXTCALL(glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, size, src.addr)); -+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0)); -+ checkGLcall("Upload PBO"); -+ context_release(context); -+ return TRUE; -+ } -+ if (src.buffer_object) -+ { -+ context = context_acquire(device, NULL); -+ gl_info = context->gl_info; -+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, src.buffer_object)); -+ GL_EXTCALL(glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0, size, dst.addr)); -+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0)); -+ checkGLcall("Download PBO"); -+ context_release(context); -+ return TRUE; -+ } -+ memcpy(dst.addr, src.addr, size); -+ return TRUE; -+} -+ -+static DWORD resource_access_from_location(DWORD location) -+{ -+ switch (location) -+ { -+ case WINED3D_LOCATION_SYSMEM: -+ case WINED3D_LOCATION_USER_MEMORY: -+ case WINED3D_LOCATION_BUFFER: -+ return WINED3D_RESOURCE_ACCESS_CPU; -+ -+ case WINED3D_LOCATION_DRAWABLE: -+ case WINED3D_LOCATION_TEXTURE_SRGB: -+ case WINED3D_LOCATION_TEXTURE_RGB: -+ case WINED3D_LOCATION_RB_MULTISAMPLE: -+ case WINED3D_LOCATION_RB_RESOLVED: -+ return WINED3D_RESOURCE_ACCESS_GPU; -+ -+ default: -+ FIXME("Unhandled location %#x.\n", location); -+ return 0; -+ } -+} -+ -+/* Context activation is done by the caller. Context may be NULL. */ -+BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, -+ struct wined3d_context *context, DWORD location) -+{ -+ BOOL ret; -+ DWORD current = texture->sub_resources[sub_resource_idx].locations; -+ struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface; -+ unsigned int sub_resource_w, sub_resource_h; -+ -+ TRACE("Texture %p, sub_resource %u, location %s.\n", texture, sub_resource_idx, -+ wined3d_debug_location(location)); -+ -+ sub_resource_w = wined3d_texture_get_level_width(texture, sub_resource_idx % texture->level_count); -+ sub_resource_h = wined3d_texture_get_level_height(texture, sub_resource_idx % texture->level_count); -+ -+ if ((current & location) && (!(surface && (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)) -+ || (surface->ds_current_size.cx == sub_resource_w -+ && surface->ds_current_size.cy == sub_resource_h))) -+ { -+ TRACE("Location (%#x) is already up to date.\n", location); -+ return TRUE; -+ } -+ -+ if (WARN_ON(d3d)) -+ { -+ DWORD required_access = resource_access_from_location(location); -+ if ((texture->resource.access_flags & required_access) != required_access) -+ WARN("Operation requires %#x access, but texture only has %#x.\n", -+ required_access, texture->resource.access_flags); -+ } -+ -+ if (!current) -+ { -+ ERR("Texture %p, sub resource %u does not have any up to date location.\n", texture, sub_resource_idx); -+ wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED); -+ wined3d_texture_load_location(texture, sub_resource_idx, context, location); -+ return TRUE; -+ } -+ -+ if (texture->sub_resources[sub_resource_idx].locations & WINED3D_LOCATION_DISCARDED) -+ { -+ wined3d_texture_prepare_location(texture, sub_resource_idx, context, location); -+ ret = TRUE; -+ } -+ else -+ { -+ static const DWORD sysmem_locations = WINED3D_LOCATION_SYSMEM | WINED3D_LOCATION_USER_MEMORY -+ | WINED3D_LOCATION_BUFFER; -+ -+ if ((location & sysmem_locations) && (current & sysmem_locations)) -+ ret = wined3d_texture_copy_sysmem_location(texture, sub_resource_idx, context, location); -+ else -+ ret = texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location); -+ } -+ -+ if (ret) -+ { -+ wined3d_texture_validate_location(texture, sub_resource_idx, location); -+ -+ if (surface && texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) -+ { -+ surface->ds_current_size.cx = sub_resource_w; -+ surface->ds_current_size.cy = sub_resource_h; -+ } -+ } -+ return ret; -+} -+#endif /* STAGING_CSMT */ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -8423,7 +8372,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN; BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2350,7 +2408,11 @@ struct wined3d_stream_state +@@ -2353,7 +2411,11 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -8435,7 +8384,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2397,6 +2459,16 @@ struct wined3d_state +@@ -2400,6 +2462,16 @@ struct wined3d_state struct wined3d_rasterizer_state *rasterizer_state; }; @@ -8452,7 +8401,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #define WINED3D_UNMAPPED_STAGE ~0U /* Multithreaded flag. Removed from the public header to signal that -@@ -2449,16 +2521,21 @@ struct wined3d_device +@@ -2452,16 +2524,21 @@ struct wined3d_device struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -8474,7 +8423,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; -@@ -2505,9 +2582,23 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2508,9 +2585,23 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -8498,7 +8447,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2551,7 +2642,11 @@ struct wined3d_resource +@@ -2554,7 +2645,11 @@ struct wined3d_resource UINT depth; UINT size; DWORD priority; @@ -8510,7 +8459,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct list resource_list_entry; LONG access_count; -@@ -2659,6 +2754,9 @@ struct wined3d_texture +@@ -2662,6 +2757,9 @@ struct wined3d_texture DWORD flags; GLenum target; DWORD update_map_binding; @@ -8520,7 +8469,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; -@@ -2695,7 +2793,12 @@ struct wined3d_texture +@@ -2698,7 +2796,12 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -8533,7 +8482,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2746,11 +2849,23 @@ void wined3d_texture_bind(struct wined3d_texture *texture, +@@ -2749,11 +2852,23 @@ 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, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -8557,20 +8506,20 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_texture_invalidate_location(struct wined3d_texture *texture, -@@ -2761,13 +2876,28 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size +@@ -2764,13 +2879,28 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; +#if !defined(STAGING_CSMT) - void wined3d_texture_prepare_texture(struct wined3d_texture *texture, - struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; -+#else /* STAGING_CSMT */ -+BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, -+ struct wined3d_context *context, DWORD location); -+void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, -+ DWORD flags) DECLSPEC_HIDDEN; +void wined3d_texture_prepare_texture(struct wined3d_texture *texture, + struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; ++#else /* STAGING_CSMT */ ++BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, ++ struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; ++void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, ++ DWORD flags) DECLSPEC_HIDDEN; + void wined3d_texture_prepare_texture(struct wined3d_texture *texture, + struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; +void wined3d_texture_release_dc_cs(struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ @@ -8583,10 +8532,10 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +void wined3d_texture_unmap_internal(struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; +#endif /* STAGING_CSMT */ - void wined3d_texture_validate_location(struct wined3d_texture *texture, - unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; - -@@ -2876,7 +3006,11 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru + void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, + const struct wined3d_context *context, const struct wined3d_const_bo_address *data, + unsigned int row_pitch, unsigned int slice_pitch) DECLSPEC_HIDDEN; +@@ -2879,7 +3009,11 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -8598,7 +8547,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, -@@ -2887,6 +3021,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -2890,6 +3024,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -8610,7 +8559,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -2901,6 +3040,12 @@ struct wined3d_sampler +@@ -2904,6 +3043,12 @@ struct wined3d_sampler GLuint name; }; @@ -8623,7 +8572,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -2996,6 +3141,7 @@ struct wined3d_stateblock +@@ -2999,6 +3144,7 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -8631,7 +8580,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; -@@ -3009,29 +3155,74 @@ enum wined3d_push_constants +@@ -3012,29 +3158,74 @@ enum wined3d_push_constants WINED3D_PUSH_CONSTANTS_PS_I, WINED3D_PUSH_CONSTANTS_VS_B, WINED3D_PUSH_CONSTANTS_PS_B, @@ -8706,7 +8655,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; -@@ -3085,12 +3276,66 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -3088,12 +3279,66 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; @@ -8773,7 +8722,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ -@@ -3117,6 +3362,9 @@ struct wined3d_buffer +@@ -3120,6 +3365,9 @@ struct wined3d_buffer GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -8783,7 +8732,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3141,11 +3389,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co +@@ -3144,11 +3392,19 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -8803,7 +8752,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3207,7 +3463,12 @@ struct wined3d_unordered_access_view +@@ -3210,7 +3466,12 @@ struct wined3d_unordered_access_view struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -8816,7 +8765,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3243,6 +3504,10 @@ struct wined3d_swapchain +@@ -3246,6 +3507,10 @@ struct wined3d_swapchain void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch b/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch index 1ed5274a..90166d68 100644 --- a/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch +++ b/patches/wined3d-Silence_FIXMEs/0006-wined3d-Silence-extremely-noisy-FIXME-in-wined3d_tex.patch @@ -1,4 +1,4 @@ -From b8c44cd1d2f029251cf05c9620b4cdc52b1e43fd Mon Sep 17 00:00:00 2001 +From 0a7d13f672cea0839dade4d06a332c024bea9a24 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 21 Mar 2016 18:27:59 +0100 Subject: wined3d: Silence extremely noisy FIXME in @@ -9,10 +9,10 @@ Subject: wined3d: Silence extremely noisy FIXME in 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index c8a7695..33b2204 100644 +index 1f0a97a..2d8df58 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1230,7 +1230,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1418,7 +1418,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, sub_resource_idx = layer * texture->level_count; if (dirty_region) @@ -20,7 +20,7 @@ index c8a7695..33b2204 100644 + WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); context = context_acquire(texture->resource.device, NULL); - if (!texture->texture_ops->texture_load_location(texture, sub_resource_idx, + if (!wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding)) -- -2.7.1 +2.9.0