diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 8c01b4cc..321c409b 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,13 +51,13 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "f7ac364b0c06bbe7a1ef5b715f2be46b5e6c04d4" + echo "aa475ce23fa295a8f5d0fa120d7b3dac1a5a41b5" } # Show version information version() { - echo "Wine Staging 1.9.10" + echo "Wine Staging 1.9.11 (unreleased)" echo "Copyright (C) 2014-2016 the Wine Staging project authors." echo "" echo "Patchset to be applied on upstream Wine:" @@ -385,7 +385,6 @@ patch_enable_all () enable_wininet_Cleanup="$1" enable_wininet_HttpOpenRequestW="$1" enable_wininet_InternetCrackUrlW="$1" - enable_wininet_InternetReadFile="$1" enable_wininet_Internet_Settings="$1" enable_wininet_ParseX509EncodedCertificateForListBoxEntry="$1" enable_winmm_Delay_Import_Depends="$1" @@ -1334,9 +1333,6 @@ patch_enable () wininet-InternetCrackUrlW) enable_wininet_InternetCrackUrlW="$2" ;; - wininet-InternetReadFile) - enable_wininet_InternetReadFile="$2" - ;; wininet-Internet_Settings) enable_wininet_Internet_Settings="$2" ;; @@ -7372,7 +7368,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then patch_apply wined3d-CSMT_Main/0002-wined3d-Start-to-move-surface-volume_load_location-i.patch patch_apply wined3d-CSMT_Main/0003-wined3d-Call-texture_load_location-instead-of-surfac.patch patch_apply wined3d-CSMT_Main/0004-wined3d-Share-surface-and-volume-system-memory-loadi.patch - patch_apply wined3d-CSMT_Main/0005-wined3d-Discard-the-backbuffer-in-discard-presents.patch patch_apply wined3d-CSMT_Main/0006-wined3d-Don-t-call-the-public-map-function-in-surfac.patch patch_apply wined3d-CSMT_Main/0007-wined3d-Don-t-call-the-public-map-function-in-surfac.patch patch_apply wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch @@ -7507,7 +7502,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then echo '+ { "Stefan Dösinger", "wined3d: Start to move surface/volume_load_location into the texture.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Call texture_load_location instead of surface_load_location.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Share surface and volume system memory loading code.", 1 },'; - echo '+ { "Stefan Dösinger", "wined3d: Discard the backbuffer in discard presents.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Don'\''t call the public map function in surface_convert_format.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Don'\''t call the public map function in surface_cpu_blt.", 1 },'; echo '+ { "Stefan Dösinger", "wined3d: Move the framebuffer into wined3d_state.", 1 },'; @@ -7907,21 +7901,6 @@ if test "$enable_wininet_InternetCrackUrlW" -eq 1; then ) >> "$patchlist" fi -# Patchset wininet-InternetReadFile -# | -# | This patchset fixes the following Wine bugs: -# | * [#40536] Return synchronously from InternetReadFile if there is no more data to read -# | -# | Modified files: -# | * dlls/wininet/http.c -# | -if test "$enable_wininet_InternetReadFile" -eq 1; then - patch_apply wininet-InternetReadFile/0001-wininet-Return-synchronously-from-InternetReadFile-i.patch - ( - echo '+ { "Sebastian Lackner", "wininet: Return synchronously from InternetReadFile if there is no more data to read.", 1 },'; - ) >> "$patchlist" -fi - # Patchset wininet-Internet_Settings # | # | Modified files: diff --git a/patches/wined3d-CSMT_Main/0001-wined3d-Make-surface_load_location-return-nothing.patch b/patches/wined3d-CSMT_Main/0001-wined3d-Make-surface_load_location-return-nothing.patch index 3440337d..a070cbac 100644 --- a/patches/wined3d-CSMT_Main/0001-wined3d-Make-surface_load_location-return-nothing.patch +++ b/patches/wined3d-CSMT_Main/0001-wined3d-Make-surface_load_location-return-nothing.patch @@ -1,4 +1,4 @@ -From 5d3739d94ccb7e4a7bfaebf33cdb399a0707f9e7 Mon Sep 17 00:00:00 2001 +From e5634d551d285a969917899fd21fe5754a418d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 29 Oct 2015 15:41:59 +0100 Subject: wined3d: Make surface_load_location return nothing. @@ -11,10 +11,10 @@ FIXME: I guess Henri disagrees. 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index e0d7c80..3435d17 100644 +index d084ffe..ea3c6f0 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3035,7 +3035,7 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi +@@ -3188,7 +3188,7 @@ 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. */ @@ -23,7 +23,7 @@ index e0d7c80..3435d17 100644 { unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface); struct wined3d_texture *texture = surface->container; -@@ -3053,7 +3053,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3206,7 +3206,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co || (surface->ds_current_size.cx == surface_w && surface->ds_current_size.cy == surface_h))) { TRACE("Location (%#x) is already up to date.\n", location); @@ -32,7 +32,7 @@ index e0d7c80..3435d17 100644 } if (WARN_ON(d3d)) -@@ -3091,7 +3091,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3244,7 +3244,7 @@ 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)); @@ -41,7 +41,7 @@ index e0d7c80..3435d17 100644 } switch (location) -@@ -3104,7 +3104,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3257,7 +3257,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_DRAWABLE: if (FAILED(hr = surface_load_drawable(surface, context))) @@ -50,7 +50,7 @@ index e0d7c80..3435d17 100644 break; case WINED3D_LOCATION_RB_RESOLVED: -@@ -3116,7 +3116,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co +@@ -3269,7 +3269,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_TEXTURE_SRGB: if (FAILED(hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB))) @@ -59,7 +59,7 @@ index e0d7c80..3435d17 100644 break; default: -@@ -3133,7 +3133,7 @@ done: +@@ -3286,7 +3286,7 @@ done: surface->ds_current_size.cy = surface_h; } @@ -69,7 +69,7 @@ index e0d7c80..3435d17 100644 static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 3a03bb6..fcea428 100644 +index 4d63568..f126d23 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1353,7 +1353,8 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int @@ -83,10 +83,10 @@ index 3a03bb6..fcea428 100644 /* Context activation is done by the caller. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 274f620..d5fa2f0 100644 +index df7dfcc..19bc68e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2708,7 +2708,7 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru +@@ -2710,7 +2710,7 @@ 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; @@ -94,7 +94,7 @@ index 274f620..d5fa2f0 100644 +void surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; - void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, + void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, -- 2.8.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 1bd24e49..3358a97f 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 e9556c0ee5a1e3ca28cfe317b63affa2ec99141d Mon Sep 17 00:00:00 2001 +From 7720d0dce434a561ff6c6c6e3d0ac3787691f851 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. @@ -18,10 +18,10 @@ moving allocation of all locations (including sysmem) there. 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 114422b..d6a36c9 100644 +index e741969..49e1c56 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -2379,7 +2379,6 @@ static void context_validate_onscreen_formats(struct wined3d_context *context, +@@ -2442,7 +2442,6 @@ static void context_validate_onscreen_formats(struct wined3d_context *context, { /* Onscreen surfaces are always in a swapchain */ struct wined3d_swapchain *swapchain = context->current_rt.texture->swapchain; @@ -29,7 +29,7 @@ index 114422b..d6a36c9 100644 if (context->render_offscreen || !depth_stencil) return; if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->format)) return; -@@ -2390,8 +2389,8 @@ static void context_validate_onscreen_formats(struct wined3d_context *context, +@@ -2453,8 +2452,8 @@ static void context_validate_onscreen_formats(struct wined3d_context *context, WARN("Depth stencil format is not supported by WGL, rendering the backbuffer in an FBO\n"); /* The currently active context is the necessary context to access the swapchain's onscreen buffers */ @@ -41,7 +41,7 @@ index 114422b..d6a36c9 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 312c8c1..8f5122a 100644 +index 0964da8..66cd8c1 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,10 +134,10 @@ index f65a00d..df840f3 100644 if (swapchain->render_to_fbo) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 465fb05..619105f 100644 +index c5c1114..cf98940 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -317,7 +317,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) +@@ -322,7 +322,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 @@ -219,10 +219,10 @@ index 465fb05..619105f 100644 + 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 0f2dd36..0f540db 100644 +index d51d465..9a5989d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2580,6 +2580,8 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size +@@ -2584,6 +2584,8 @@ 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; @@ -230,7 +230,7 @@ index 0f2dd36..0f540db 100644 + struct wined3d_context *context, DWORD location); void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; - void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN; + void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0005-wined3d-Discard-the-backbuffer-in-discard-presents.patch b/patches/wined3d-CSMT_Main/0005-wined3d-Discard-the-backbuffer-in-discard-presents.patch deleted file mode 100644 index dca798cf..00000000 --- a/patches/wined3d-CSMT_Main/0005-wined3d-Discard-the-backbuffer-in-discard-presents.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 25903b870407e8368508fd002f15c509fdd9a66b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Thu, 19 Sep 2013 13:09:58 +0200 -Subject: wined3d: Discard the backbuffer in discard presents. - ---- - dlls/wined3d/swapchain.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index a02fdf0..9a36e38 100644 ---- a/dlls/wined3d/swapchain.c -+++ b/dlls/wined3d/swapchain.c -@@ -608,6 +608,17 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, - * up to date and hope WGL flipped front and back buffers and read this data into - * the FBO. Don't bother about this for now. */ - -+ switch (swapchain->desc.swap_effect) -+ { -+ case WINED3D_SWAP_EFFECT_DISCARD: -+ wined3d_texture_validate_location(swapchain->back_buffers[swapchain->desc.backbuffer_count - 1], -+ 0, WINED3D_LOCATION_DISCARDED); -+ break; -+ -+ default: -+ break; -+ } -+ - if (fb->depth_stencil) - { - struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(fb->depth_stencil); --- -2.8.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 da033925..c0d35943 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 67ac088653e272f9d0b28a2fe764229a054ff579 Mon Sep 17 00:00:00 2001 +From d077ec3e4fbc53758d89e7d71598498c8057a2f3 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 @@ -6,24 +6,24 @@ Subject: wined3d: Move the framebuffer into wined3d_state --- dlls/wined3d/arb_program_shader.c | 4 +- dlls/wined3d/context.c | 20 +++++-- - dlls/wined3d/cs.c | 21 ++----- - dlls/wined3d/device.c | 113 +++++++++++++++++--------------------- + dlls/wined3d/cs.c | 22 ++++--- + dlls/wined3d/device.c | 122 +++++++++++++++++--------------------- dlls/wined3d/drawprim.c | 2 +- dlls/wined3d/glsl_shader.c | 2 +- dlls/wined3d/shader.c | 2 +- dlls/wined3d/state.c | 24 ++++---- - dlls/wined3d/stateblock.c | 45 +++++++++++++-- + dlls/wined3d/stateblock.c | 48 +++++++++++++-- dlls/wined3d/surface.c | 2 +- dlls/wined3d/swapchain.c | 2 +- dlls/wined3d/utils.c | 4 +- - dlls/wined3d/wined3d_private.h | 46 ++++++++++++---- - 13 files changed, 166 insertions(+), 121 deletions(-) + dlls/wined3d/wined3d_private.h | 46 ++++++++++---- + 13 files changed, 180 insertions(+), 120 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index 266f5f5..75ce927 100644 +index d67bb5e..f6097b0 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c -@@ -703,7 +703,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, +@@ -704,7 +704,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, { const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL]; const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; @@ -32,7 +32,7 @@ index 266f5f5..75ce927 100644 /* Load DirectX 9 float constants for pixel shader */ priv->highest_dirty_ps_const = shader_arb_load_constants_f(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB, -@@ -4731,7 +4731,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context +@@ -4732,7 +4732,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context } else { @@ -129,7 +129,7 @@ index 49e1c56..a67aeca 100644 WORD map; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 2e5a3a6..3150f25 100644 +index ea4778c..3150f25 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -286,7 +286,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) @@ -168,35 +168,42 @@ index 2e5a3a6..3150f25 100644 if (!prev != !op->view) { -@@ -1003,7 +1003,7 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +@@ -999,11 +999,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; ++ HRESULT hr; state_cleanup(&cs->state); memset(&cs->state, 0, sizeof(cs->state)); -- if (FAILED(hr = state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info, +- state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info, +- WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT); + if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info, - WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) - ERR("Failed to initialize CS state, hr %#x.\n", hr); ++ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) ++ ERR("Failed to initialize CS state, hr %#x.\n", hr); } -@@ -1086,17 +1086,9 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) + + void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1084,16 +1086,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; - if (!(cs->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(*cs->fb.render_targets) * gl_info->limits.buffers))) -- { -- HeapFree(GetProcessHeap(), 0, cs); -- return NULL; -- } -- -- if (FAILED(state_init(&cs->state, &cs->fb, gl_info, &device->adapter->d3d_info, + if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info, - WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) ++ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) { -- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets); HeapFree(GetProcessHeap(), 0, cs); return NULL; } -@@ -1117,7 +1109,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) + +- state_init(&cs->state, &cs->fb, gl_info, &device->adapter->d3d_info, +- WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT); +- + cs->ops = &wined3d_cs_st_ops; + cs->device = device; + +@@ -1110,7 +1109,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) void wined3d_cs_destroy(struct wined3d_cs *cs) { state_cleanup(&cs->state); @@ -205,7 +212,7 @@ index 2e5a3a6..3150f25 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 4be5c0c..66e4b1e 100644 +index f2aadf6..d4a8d35 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -974,7 +974,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi @@ -317,7 +324,7 @@ index 4be5c0c..66e4b1e 100644 device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -2032,7 +2010,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -2055,7 +2033,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) || !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; @@ -326,7 +333,7 @@ index 4be5c0c..66e4b1e 100644 return; if (src_view->resource->type == WINED3D_RTYPE_BUFFER) { -@@ -3389,6 +3367,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3412,6 +3390,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -335,7 +342,7 @@ index 4be5c0c..66e4b1e 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); -@@ -3400,7 +3380,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3423,7 +3403,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -344,7 +351,7 @@ index 4be5c0c..66e4b1e 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3409,8 +3389,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3432,8 +3412,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -355,7 +362,7 @@ index 4be5c0c..66e4b1e 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3752,8 +3732,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3775,8 +3755,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -366,7 +373,7 @@ index 4be5c0c..66e4b1e 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4211,20 +4191,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4234,20 +4214,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -390,7 +397,7 @@ index 4be5c0c..66e4b1e 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4264,13 +4245,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4287,13 +4268,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -406,7 +413,7 @@ index 4be5c0c..66e4b1e 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. */ -@@ -4282,18 +4263,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4305,18 +4286,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -428,7 +435,7 @@ index 4be5c0c..66e4b1e 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4656,10 +4638,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4679,10 +4661,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -440,7 +447,7 @@ index 4be5c0c..66e4b1e 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4668,6 +4649,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4691,6 +4672,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -452,16 +459,18 @@ index 4be5c0c..66e4b1e 100644 if (device->onscreen_depth_stencil) { wined3d_texture_decref(device->onscreen_depth_stencil->container); -@@ -4891,7 +4877,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4914,30 +4900,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); -- if (FAILED(hr = state_init(&device->state, &device->fb, &device->adapter->gl_info, +- state_init(&device->state, &device->fb, &device->adapter->gl_info, +- &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT); + if (FAILED(hr = state_init(&device->state, &device->adapter->gl_info, - &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) - ERR("Failed to initialize device state, hr %#x.\n", hr); ++ &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ++ ERR("Failed to initialize device state, hr %#x.\n", hr); device->update_state = &device->state; -@@ -4900,22 +4886,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, + + device_init_swapchain_state(device, swapchain); } else if (device->back_buffer_view) { @@ -489,7 +498,7 @@ index 4be5c0c..66e4b1e 100644 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -5007,11 +4992,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5029,11 +5015,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -503,15 +512,21 @@ index 4be5c0c..66e4b1e 100644 ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5147,7 +5132,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5169,8 +5155,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; -- if (FAILED(hr = state_init(&device->state, &device->fb, &adapter->gl_info, +- state_init(&device->state, &device->fb, &adapter->gl_info, +- &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT); + if (FAILED(hr = state_init(&device->state, &adapter->gl_info, - &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) - { - ERR("Failed to initialize device state, hr %#x.\n", hr); ++ &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ++ { ++ ERR("Failed to initialize device state, hr %#x.\n", hr); ++ goto err; ++ } + device->update_state = &device->state; + + if (!(device->cs = wined3d_cs_create(device))) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 83fe4c3..67d0fea 100644 --- a/dlls/wined3d/drawprim.c @@ -526,7 +541,7 @@ index 83fe4c3..67d0fea 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 f8c4a99..5c7edaa 100644 +index c42668d..fdfe17d 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1442,7 +1442,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context @@ -539,10 +554,10 @@ index f8c4a99..5c7edaa 100644 0.0f, 0.0f, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index 8f8b727..0ee045f 100644 +index f8c335c..461bbd0 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2887,7 +2887,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 +@@ -2888,7 +2888,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. */ @@ -552,7 +567,7 @@ index 8f8b727..0ee045f 100644 static unsigned int warned = 0; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c -index 44962fa..99389cf 100644 +index fc97a95..67aae67 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_ @@ -564,7 +579,7 @@ index 44962fa..99389cf 100644 { TRACE("No Z buffer - disabling depth test\n"); zenable = WINED3D_ZB_FALSE; -@@ -373,14 +373,14 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st +@@ -382,14 +382,14 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st GLenum srcBlend, dstBlend; unsigned int rt_fmt_flags; @@ -582,7 +597,7 @@ index 44962fa..99389cf 100644 /* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific * blending parameters to work. */ -@@ -814,7 +814,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ +@@ -823,7 +823,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ GLint depthFail_ccw; /* No stencil test without a stencil buffer. */ @@ -591,7 +606,7 @@ index 44962fa..99389cf 100644 { gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST); checkGLcall("glDisable GL_STENCIL_TEST"); -@@ -910,7 +910,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ +@@ -919,7 +919,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) { @@ -600,7 +615,7 @@ index 44962fa..99389cf 100644 const struct wined3d_gl_info *gl_info = context->gl_info; GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK)); -@@ -924,7 +924,7 @@ static void state_stencilwrite2s(struct wined3d_context *context, const struct w +@@ -933,7 +933,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) { @@ -609,7 +624,7 @@ index 44962fa..99389cf 100644 const struct wined3d_gl_info *gl_info = context->gl_info; gl_info->gl_ops.gl.p_glStencilMask(mask); -@@ -1662,7 +1662,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 +@@ -1671,7 +1671,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]) { @@ -618,7 +633,7 @@ index 44962fa..99389cf 100644 float scale; union -@@ -4563,8 +4563,8 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine +@@ -4572,8 +4572,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) { @@ -629,7 +644,7 @@ index 44962fa..99389cf 100644 const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; unsigned int width, height; -@@ -4750,7 +4750,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st +@@ -4759,7 +4759,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st } else { @@ -638,7 +653,7 @@ index 44962fa..99389cf 100644 UINT height; UINT width; -@@ -4818,7 +4818,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state +@@ -4827,7 +4827,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); @@ -648,10 +663,10 @@ index 44962fa..99389cf 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 036d594..0507a06 100644 +index 2b45d9c..849e749 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c -@@ -464,6 +464,7 @@ void state_unbind_resources(struct wined3d_state *state) +@@ -430,6 +430,7 @@ void state_unbind_resources(struct wined3d_state *state) struct wined3d_texture *texture; struct wined3d_buffer *buffer; struct wined3d_shader *shader; @@ -659,7 +674,7 @@ index 036d594..0507a06 100644 unsigned int i, j; if ((decl = state->vertex_declaration)) -@@ -540,6 +541,31 @@ void state_unbind_resources(struct wined3d_state *state) +@@ -506,6 +507,31 @@ void state_unbind_resources(struct wined3d_state *state) } } } @@ -691,19 +706,20 @@ index 036d594..0507a06 100644 } void state_cleanup(struct wined3d_state *state) -@@ -567,6 +593,7 @@ void state_cleanup(struct wined3d_state *state) - - HeapFree(GetProcessHeap(), 0, state->vs_consts_f); - HeapFree(GetProcessHeap(), 0, state->ps_consts_f); +@@ -530,6 +556,8 @@ void state_cleanup(struct wined3d_state *state) + HeapFree(GetProcessHeap(), 0, light); + } + } ++ + HeapFree(GetProcessHeap(), 0, state->fb.render_targets); } ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock) -@@ -1296,14 +1323,12 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d +@@ -1254,32 +1282,42 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d } } --HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, +-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) +HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, @@ -716,42 +732,42 @@ index 036d594..0507a06 100644 for (i = 0; i < LIGHTMAP_SIZE; i++) { -@@ -1321,6 +1346,15 @@ HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, - return E_OUTOFMEMORY; + list_init(&state->light_map[i]); } + if (!(state->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(*state->fb.render_targets) * gl_info->limits.buffers))) -+ { -+ HeapFree(GetProcessHeap(), 0, state->ps_consts_f); -+ HeapFree(GetProcessHeap(), 0, state->vs_consts_f); + return E_OUTOFMEMORY; -+ } ++ + state->fb.rt_size = gl_info->limits.buffers; + if (flags & WINED3D_STATE_INIT_DEFAULT) state_init_default(state, gl_info); ++ ++ return WINED3D_OK; + } -@@ -1331,12 +1365,13 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, + static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, struct wined3d_device *device, enum wined3d_stateblock_type type) { - HRESULT hr; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; ++ HRESULT hr; stateblock->ref = 1; stateblock->device = device; - -- if (FAILED(hr = state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0))) +- state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0); ++ + if (FAILED(hr = state_init(&stateblock->state, gl_info, d3d_info, 0))) - return hr; ++ return hr; - if (FAILED(hr = stateblock_allocate_shader_constants(stateblock))) + if (type == WINED3D_SBT_RECORDED) + return WINED3D_OK; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 4746c5a..ca394f7 100644 +index c974e1a..5873a4b 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -2421,7 +2421,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE +@@ -2574,7 +2574,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; @@ -761,10 +777,10 @@ index 4746c5a..ca394f7 100644 struct wined3d_texture *src_texture; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index 9a36e38..31768cf 100644 +index df1155c..e69dadd 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c -@@ -477,7 +477,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, +@@ -481,7 +481,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, DWORD flags) { struct wined3d_surface *back_buffer = swapchain->back_buffers[0]->sub_resources[0].u.surface; @@ -796,10 +812,10 @@ index 70a4b03..3d158ec 100644 || !state->render_states[WINED3D_RS_CLIPPLANEENABLE]) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index eb58d81..f38e1aa 100644 +index aabfde6..acdd37d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1315,6 +1315,36 @@ struct wined3d_timestamp_query +@@ -1318,6 +1318,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; @@ -836,7 +852,7 @@ index eb58d81..f38e1aa 100644 struct wined3d_context { const struct wined3d_gl_info *gl_info; -@@ -1329,6 +1359,7 @@ struct wined3d_context +@@ -1332,6 +1362,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 */ @@ -844,7 +860,7 @@ index eb58d81..f38e1aa 100644 struct wined3d_swapchain *swapchain; struct -@@ -1436,12 +1467,6 @@ struct wined3d_context +@@ -1439,12 +1470,6 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; @@ -857,7 +873,7 @@ index eb58d81..f38e1aa 100644 typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -2191,7 +2216,7 @@ struct wined3d_stream_state +@@ -2194,7 +2219,7 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -866,7 +882,7 @@ index eb58d81..f38e1aa 100644 struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2294,7 +2319,6 @@ struct wined3d_device +@@ -2297,7 +2322,6 @@ struct wined3d_device struct wine_rb_tree samplers; /* Render Target Support */ @@ -874,11 +890,11 @@ index eb58d81..f38e1aa 100644 struct wined3d_surface *onscreen_depth_stencil; struct wined3d_rendertarget_view *auto_depth_stencil_view; -@@ -2834,9 +2858,8 @@ struct wined3d_stateblock +@@ -2836,9 +2860,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; --HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, +-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; +HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, @@ -886,7 +902,7 @@ index eb58d81..f38e1aa 100644 void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; struct wined3d_cs_ops -@@ -2849,7 +2872,6 @@ struct wined3d_cs +@@ -2851,7 +2874,6 @@ struct wined3d_cs { const struct wined3d_cs_ops *ops; struct wined3d_device *device; diff --git a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch index f4e0e2d9..d2bba109 100644 --- a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch +++ b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch @@ -1,16 +1,16 @@ -From a44c6b3931bc99c58e0f29bbb33c0cddc0616df1 Mon Sep 17 00:00:00 2001 +From ddb85bfb8372c694e661d3eb8c955057916a85a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Oct 2013 15:30:26 +0200 Subject: wined3d: Give the cs its own state --- - dlls/wined3d/cs.c | 108 +++++++++++++++++++++++++++++++++++------ - dlls/wined3d/device.c | 3 ++ - dlls/wined3d/wined3d_private.h | 4 +- - 3 files changed, 99 insertions(+), 16 deletions(-) + dlls/wined3d/cs.c | 92 +++++++++++++++++++++++++++++++++++------- + dlls/wined3d/device.c | 3 ++ + dlls/wined3d/wined3d_private.h | 4 +- + 3 files changed, 83 insertions(+), 16 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index fe96c38..9ec6258 100644 +index fe96c38..55cd5d6 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -63,6 +63,7 @@ enum wined3d_cs_op @@ -21,7 +21,7 @@ index fe96c38..9ec6258 100644 WINED3D_CS_OP_STOP, }; -@@ -273,6 +274,13 @@ struct wined3d_cs_reset_state +@@ -273,6 +274,12 @@ struct wined3d_cs_reset_state enum wined3d_cs_op opcode; }; @@ -29,13 +29,12 @@ index fe96c38..9ec6258 100644 +{ + enum wined3d_cs_op opcode; + struct wined3d_state state; -+ float vs_consts_f[256 * 4], ps_consts_f[256 * 4]; +}; + /* 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) { -@@ -437,7 +445,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -437,7 +444,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]); device = cs->device; @@ -44,7 +43,7 @@ index fe96c38..9ec6258 100644 device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, &cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags, &op->color, op->depth, op->stencil); -@@ -466,7 +474,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -466,7 +473,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_draw *op = data; @@ -53,7 +52,7 @@ index fe96c38..9ec6258 100644 op->start_instance, op->instance_count, op->indexed); return sizeof(*op); -@@ -899,6 +907,72 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -899,6 +906,57 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -62,13 +61,7 @@ index fe96c38..9ec6258 100644 + +static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const void *data) +{ -+ const struct wined3d_adapter *adapter = cs->device->adapter; + const struct wined3d_cs_stateblock *op = data; -+ UINT num_vs_consts_f = sizeof(op->vs_consts_f) / sizeof(*op->vs_consts_f) / 4; -+ UINT num_ps_consts_f = sizeof(op->ps_consts_f) / sizeof(*op->ps_consts_f) / 4; -+ -+ num_vs_consts_f = min(num_vs_consts_f, adapter->d3d_info.limits.vs_uniform_count); -+ num_ps_consts_f = min(num_ps_consts_f, adapter->d3d_info.limits.ps_uniform_count); + + /* Don't memcpy the entire struct, we'll remove single items as we add dedicated + * ops for setting states */ @@ -79,11 +72,11 @@ index fe96c38..9ec6258 100644 + + memcpy(cs->state.vs_consts_b, op->state.vs_consts_b, sizeof(cs->state.vs_consts_b)); + memcpy(cs->state.vs_consts_i, op->state.vs_consts_i, sizeof(cs->state.vs_consts_i)); -+ memcpy(cs->state.vs_consts_f, op->state.vs_consts_f, sizeof(*cs->state.vs_consts_f) * num_vs_consts_f); ++ memcpy(cs->state.vs_consts_f, op->state.vs_consts_f, sizeof(cs->state.vs_consts_f)); + + memcpy(cs->state.ps_consts_b, op->state.ps_consts_b, sizeof(cs->state.ps_consts_b)); + memcpy(cs->state.ps_consts_i, op->state.ps_consts_i, sizeof(cs->state.ps_consts_i)); -+ memcpy(cs->state.ps_consts_f, op->state.ps_consts_f, sizeof(*cs->state.ps_consts_f) * num_ps_consts_f); ++ memcpy(cs->state.ps_consts_f, op->state.ps_consts_f, sizeof(cs->state.ps_consts_f)); + + memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights)); + @@ -92,14 +85,7 @@ index fe96c38..9ec6258 100644 + +void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct wined3d_state *state) +{ -+ const struct wined3d_device *device = cs->device; -+ const struct wined3d_adapter *adapter = device->adapter; + struct wined3d_cs_stateblock *op; -+ UINT num_vs_consts_f = sizeof(op->vs_consts_f) / sizeof(*op->vs_consts_f) / 4; -+ UINT num_ps_consts_f = sizeof(op->ps_consts_f) / sizeof(*op->ps_consts_f) / 4; -+ -+ num_vs_consts_f = min(num_vs_consts_f, adapter->d3d_info.limits.vs_uniform_count); -+ num_ps_consts_f = min(num_ps_consts_f, adapter->d3d_info.limits.ps_uniform_count); + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_STATEBLOCK; @@ -112,13 +98,11 @@ index fe96c38..9ec6258 100644 + + memcpy(op->state.vs_consts_b, state->vs_consts_b, sizeof(op->state.vs_consts_b)); + memcpy(op->state.vs_consts_i, state->vs_consts_i, sizeof(op->state.vs_consts_i)); -+ op->state.vs_consts_f = (struct wined3d_vec4 *)op->vs_consts_f; -+ memcpy(op->state.vs_consts_f, state->vs_consts_f, sizeof(*op->state.vs_consts_f) * num_vs_consts_f); ++ memcpy(op->state.vs_consts_f, state->vs_consts_f, sizeof(op->state.vs_consts_f)); + + memcpy(op->state.ps_consts_b, state->ps_consts_b, sizeof(op->state.ps_consts_b)); + memcpy(op->state.ps_consts_i, state->ps_consts_i, sizeof(op->state.ps_consts_i)); -+ op->state.ps_consts_f = (struct wined3d_vec4 *)op->ps_consts_f; -+ memcpy(op->state.ps_consts_f, state->ps_consts_f, sizeof(*op->state.ps_consts_f) * num_ps_consts_f); ++ memcpy(op->state.ps_consts_f, state->ps_consts_f, sizeof(op->state.ps_consts_f)); + + /* FIXME: This is not ideal. CS is still running synchronously, so this is ok. + * It will go away soon anyway. */ @@ -126,7 +110,7 @@ index fe96c38..9ec6258 100644 cs->ops->submit(cs); } -@@ -1249,6 +1323,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1249,6 +1307,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, @@ -134,7 +118,7 @@ index fe96c38..9ec6258 100644 }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -@@ -1338,7 +1413,7 @@ done: +@@ -1338,7 +1397,7 @@ done: struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -143,7 +127,7 @@ index fe96c38..9ec6258 100644 if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; -@@ -1346,8 +1421,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1346,8 +1405,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) { @@ -153,7 +137,7 @@ index fe96c38..9ec6258 100644 } cs->ops = &wined3d_cs_st_ops; -@@ -1356,16 +1430,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1356,16 +1414,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) cs->data_size = WINED3D_INITIAL_CS_SIZE; if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size))) { @@ -172,7 +156,7 @@ index fe96c38..9ec6258 100644 } if (wined3d_settings.cs_multithreaded) -@@ -1378,15 +1449,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1378,15 +1433,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL))) { ERR("Failed to create wined3d command stream thread.\n"); @@ -201,10 +185,10 @@ index fe96c38..9ec6258 100644 void wined3d_cs_destroy(struct wined3d_cs *cs) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 42ffdb4..24325fd 100644 +index ccc773b..46cf23a 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -3479,6 +3479,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT +@@ -3502,6 +3502,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT device_invalidate_state(device, STATE_BASEVERTEXINDEX); } @@ -212,7 +196,7 @@ index 42ffdb4..24325fd 100644 wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); return WINED3D_OK; -@@ -3522,6 +3523,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic +@@ -3545,6 +3546,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic device_invalidate_state(device, STATE_BASEVERTEXINDEX); } @@ -220,7 +204,7 @@ index 42ffdb4..24325fd 100644 wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); return WINED3D_OK; -@@ -3533,6 +3535,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3556,6 +3558,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n", device, start_idx, index_count, start_instance, instance_count); @@ -229,10 +213,10 @@ index 42ffdb4..24325fd 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 973c512..6e138b8 100644 +index 22f4b63..1a5f8fc 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2872,7 +2872,7 @@ struct wined3d_cs_block +@@ -2874,7 +2874,7 @@ struct wined3d_cs_block { struct list entry; UINT pos; @@ -241,7 +225,7 @@ index 973c512..6e138b8 100644 }; struct wined3d_cs_ops -@@ -2913,6 +2913,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -2915,6 +2915,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch b/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch index ee4ec18d..e6034e55 100644 --- a/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch +++ b/patches/wined3d-CSMT_Main/0015-wined3d-Send-float-constant-updates-through-the-comm.patch @@ -1,16 +1,16 @@ -From 0bb6efaf5e52ba55d1207e313fc3bd53a8a57a33 Mon Sep 17 00:00:00 2001 +From e316999cb425711836f63f85a78f13bcc458643e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 20 Aug 2013 15:12:26 +0200 Subject: wined3d: Send float constant updates through the command stream --- - dlls/wined3d/cs.c | 92 +++++++++++++++++++++++++++++++++--------- - dlls/wined3d/device.c | 6 ++- - dlls/wined3d/wined3d_private.h | 2 + - 3 files changed, 78 insertions(+), 22 deletions(-) + dlls/wined3d/cs.c | 76 +++++++++++++++++++++++++++++++++++++++--- + dlls/wined3d/device.c | 6 ++-- + dlls/wined3d/wined3d_private.h | 2 ++ + 3 files changed, 78 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 9ec6258..ef4341c 100644 +index 55cd5d6..ef4341c 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -64,6 +64,8 @@ enum wined3d_cs_op @@ -22,77 +22,45 @@ index 9ec6258..ef4341c 100644 WINED3D_CS_OP_STOP, }; -@@ -278,7 +280,13 @@ struct wined3d_cs_stateblock - { - enum wined3d_cs_op opcode; +@@ -280,6 +282,13 @@ struct wined3d_cs_stateblock struct wined3d_state state; -- float vs_consts_f[256 * 4], ps_consts_f[256 * 4]; -+}; -+ + }; + +struct wined3d_cs_set_consts_f +{ + enum wined3d_cs_op opcode; + UINT start_register, vector4f_count; + struct wined3d_vec4 constants; - }; - ++}; ++ /* FIXME: The list synchronization probably isn't particularly fast. */ -@@ -912,13 +920,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined - - static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const void *data) + static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block) { -- const struct wined3d_adapter *adapter = cs->device->adapter; - const struct wined3d_cs_stateblock *op = data; -- UINT num_vs_consts_f = sizeof(op->vs_consts_f) / sizeof(*op->vs_consts_f) / 4; -- UINT num_ps_consts_f = sizeof(op->ps_consts_f) / sizeof(*op->ps_consts_f) / 4; -- -- num_vs_consts_f = min(num_vs_consts_f, adapter->d3d_info.limits.vs_uniform_count); -- num_ps_consts_f = min(num_ps_consts_f, adapter->d3d_info.limits.ps_uniform_count); - - /* Don't memcpy the entire struct, we'll remove single items as we add dedicated - * ops for setting states */ -@@ -929,11 +931,9 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi +@@ -922,11 +931,9 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi memcpy(cs->state.vs_consts_b, op->state.vs_consts_b, sizeof(cs->state.vs_consts_b)); memcpy(cs->state.vs_consts_i, op->state.vs_consts_i, sizeof(cs->state.vs_consts_i)); -- memcpy(cs->state.vs_consts_f, op->state.vs_consts_f, sizeof(*cs->state.vs_consts_f) * num_vs_consts_f); +- memcpy(cs->state.vs_consts_f, op->state.vs_consts_f, sizeof(cs->state.vs_consts_f)); memcpy(cs->state.ps_consts_b, op->state.ps_consts_b, sizeof(cs->state.ps_consts_b)); memcpy(cs->state.ps_consts_i, op->state.ps_consts_i, sizeof(cs->state.ps_consts_i)); -- memcpy(cs->state.ps_consts_f, op->state.ps_consts_f, sizeof(*cs->state.ps_consts_f) * num_ps_consts_f); +- memcpy(cs->state.ps_consts_f, op->state.ps_consts_f, sizeof(cs->state.ps_consts_f)); memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights)); -@@ -942,14 +942,7 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi - - void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct wined3d_state *state) - { -- const struct wined3d_device *device = cs->device; -- const struct wined3d_adapter *adapter = device->adapter; - struct wined3d_cs_stateblock *op; -- UINT num_vs_consts_f = sizeof(op->vs_consts_f) / sizeof(*op->vs_consts_f) / 4; -- UINT num_ps_consts_f = sizeof(op->ps_consts_f) / sizeof(*op->ps_consts_f) / 4; -- -- num_vs_consts_f = min(num_vs_consts_f, adapter->d3d_info.limits.vs_uniform_count); -- num_ps_consts_f = min(num_ps_consts_f, adapter->d3d_info.limits.ps_uniform_count); - - op = cs->ops->require_space(cs, sizeof(*op)); - op->opcode = WINED3D_CS_OP_STATEBLOCK; -@@ -962,13 +955,9 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win +@@ -948,11 +955,9 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win memcpy(op->state.vs_consts_b, state->vs_consts_b, sizeof(op->state.vs_consts_b)); memcpy(op->state.vs_consts_i, state->vs_consts_i, sizeof(op->state.vs_consts_i)); -- op->state.vs_consts_f = (struct wined3d_vec4 *)op->vs_consts_f; -- memcpy(op->state.vs_consts_f, state->vs_consts_f, sizeof(*op->state.vs_consts_f) * num_vs_consts_f); +- memcpy(op->state.vs_consts_f, state->vs_consts_f, sizeof(op->state.vs_consts_f)); memcpy(op->state.ps_consts_b, state->ps_consts_b, sizeof(op->state.ps_consts_b)); memcpy(op->state.ps_consts_i, state->ps_consts_i, sizeof(op->state.ps_consts_i)); -- op->state.ps_consts_f = (struct wined3d_vec4 *)op->ps_consts_f; -- memcpy(op->state.ps_consts_f, state->ps_consts_f, sizeof(*op->state.ps_consts_f) * num_ps_consts_f); +- memcpy(op->state.ps_consts_f, state->ps_consts_f, sizeof(op->state.ps_consts_f)); /* FIXME: This is not ideal. CS is still running synchronously, so this is ok. * It will go away soon anyway. */ -@@ -1048,6 +1037,67 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1032,6 +1037,67 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -160,7 +128,7 @@ index 9ec6258..ef4341c 100644 static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_render_state *op = data; -@@ -1324,6 +1374,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1308,6 +1374,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock, @@ -170,12 +138,12 @@ index 9ec6258..ef4341c 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 24325fd..681ba4e 100644 +index 46cf23a..241b450 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -2472,7 +2472,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, - memset(&device->recording->changed.vertexShaderConstantsF[start_idx], 1, - count * sizeof(*device->recording->changed.vertexShaderConstantsF)); +@@ -2495,7 +2495,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, + memset(&device->recording->changed.vs_consts_f[start_idx], 1, + count * sizeof(*device->recording->changed.vs_consts_f)); else - device->shader_backend->shader_update_float_vertex_constants(device, start_idx, count); + wined3d_cs_emit_set_consts_f(device->cs, start_idx, constants, count, @@ -183,9 +151,9 @@ index 24325fd..681ba4e 100644 return WINED3D_OK; } -@@ -2700,7 +2701,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, - memset(&device->recording->changed.pixelShaderConstantsF[start_idx], 1, - count * sizeof(*device->recording->changed.pixelShaderConstantsF)); +@@ -2723,7 +2724,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, + memset(&device->recording->changed.ps_consts_f[start_idx], 1, + count * sizeof(*device->recording->changed.ps_consts_f)); else - device->shader_backend->shader_update_float_pixel_constants(device, start_idx, count); + wined3d_cs_emit_set_consts_f(device->cs, start_idx, constants, count, @@ -194,10 +162,10 @@ index 24325fd..681ba4e 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 6e138b8..29cf744 100644 +index 1a5f8fc..125fb6d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2949,6 +2949,8 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -2951,6 +2951,8 @@ 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; diff --git a/patches/wined3d-CSMT_Main/0020-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch b/patches/wined3d-CSMT_Main/0020-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch index 542dd6dc..dacee353 100644 --- a/patches/wined3d-CSMT_Main/0020-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch +++ b/patches/wined3d-CSMT_Main/0020-wined3d-Pass-the-depth-stencil-to-swapchain-present.patch @@ -1,4 +1,4 @@ -From 063fecf5696baafe17b111d015659fbc5474671c Mon Sep 17 00:00:00 2001 +From d37e6ad06898282c5cf0e9665afad8ce5b1d8016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 4 Apr 2013 14:52:24 +0200 Subject: wined3d: Pass the depth stencil to swapchain->present @@ -26,10 +26,10 @@ index c4cf1ad..423ef22 100644 return sizeof(*op); } diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c -index 7b0f1ec..f05af99 100644 +index 178e634..6ee5501 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c -@@ -474,10 +474,10 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct +@@ -478,10 +478,10 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct } static void swapchain_gl_present(struct wined3d_swapchain *swapchain, @@ -42,9 +42,9 @@ index 7b0f1ec..f05af99 100644 const struct wined3d_gl_info *gl_info; struct wined3d_texture *logo_texture; struct wined3d_context *context; -@@ -621,15 +621,15 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, - break; - } +@@ -617,15 +617,15 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, + wined3d_texture_validate_location(swapchain->back_buffers[swapchain->desc.backbuffer_count - 1], + 0, WINED3D_LOCATION_DISCARDED); - if (fb->depth_stencil) + if (depth_stencil) @@ -61,7 +61,7 @@ index 7b0f1ec..f05af99 100644 if (ds == swapchain->device->onscreen_depth_stencil) { wined3d_texture_decref(swapchain->device->onscreen_depth_stencil->container); -@@ -704,7 +704,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai +@@ -700,7 +700,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai } static void swapchain_gdi_present(struct wined3d_swapchain *swapchain, @@ -72,7 +72,7 @@ index 7b0f1ec..f05af99 100644 struct wined3d_surface *front, *back; HBITMAP bitmap; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 51aaefd..4ee571e 100644 +index 8c31ffd..54bb128 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3079,7 +3079,8 @@ struct wined3d_shader_resource_view diff --git a/patches/wined3d-CSMT_Main/0025-wined3d-Send-int-constant-updates-through-the-comman.patch b/patches/wined3d-CSMT_Main/0025-wined3d-Send-int-constant-updates-through-the-comman.patch index a2fa5d8b..cabb1aa4 100644 --- a/patches/wined3d-CSMT_Main/0025-wined3d-Send-int-constant-updates-through-the-comman.patch +++ b/patches/wined3d-CSMT_Main/0025-wined3d-Send-int-constant-updates-through-the-comman.patch @@ -1,16 +1,16 @@ -From bd25fc1277b13ce1474ef65b95945cca69cfee48 Mon Sep 17 00:00:00 2001 +From f62f9c0774759bd920543c3603d6b65ba77347a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 10 Apr 2013 14:20:47 +0200 Subject: wined3d: Send int constant updates through the command stream --- - dlls/wined3d/cs.c | 76 ++++++++++++++++++++++++++++++++++++++---- + dlls/wined3d/cs.c | 74 ++++++++++++++++++++++++++++++++++++++---- dlls/wined3d/device.c | 6 ++-- dlls/wined3d/wined3d_private.h | 2 ++ - 3 files changed, 76 insertions(+), 8 deletions(-) + 3 files changed, 74 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index f1fc4b9..86a8603 100644 +index f1fc4b9..e8d7b9a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -66,8 +66,10 @@ enum wined3d_cs_op @@ -24,21 +24,22 @@ index f1fc4b9..86a8603 100644 WINED3D_CS_OP_GLFINISH, WINED3D_CS_OP_SET_BASE_VERTEX_INDEX, WINED3D_CS_OP_SET_PRIMITIVE_TYPE, -@@ -301,6 +303,13 @@ struct wined3d_cs_set_consts_b +@@ -301,6 +303,14 @@ struct wined3d_cs_set_consts_b BOOL constants[1]; }; +struct wined3d_cs_set_consts_i +{ + enum wined3d_cs_op opcode; -+ UINT start_register, vector4i_count; -+ int constants[4]; ++ unsigned int start_idx; ++ unsigned int count; ++ struct wined3d_ivec4 constants[1]; +}; + struct wined3d_cs_finish { enum wined3d_cs_op opcode; -@@ -969,9 +978,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi +@@ -969,9 +979,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi /* Don't memcpy the entire struct, we'll remove single items as we add dedicated * ops for setting states */ @@ -48,7 +49,7 @@ index f1fc4b9..86a8603 100644 memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights)); -@@ -987,9 +993,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win +@@ -987,9 +994,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win /* Don't memcpy the entire struct, we'll remove single items as we add dedicated * ops for setting states */ @@ -58,7 +59,7 @@ index f1fc4b9..86a8603 100644 /* FIXME: This is not ideal. CS is still running synchronously, so this is ok. * It will go away soon anyway. */ -@@ -1211,6 +1214,65 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, +@@ -1211,6 +1215,62 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, cs->ops->submit(cs); } @@ -67,12 +68,11 @@ index f1fc4b9..86a8603 100644 + const struct wined3d_cs_set_consts_i *op = data; + struct wined3d_device *device = cs->device; + -+ memcpy(&cs->state.vs_consts_i[op->start_register * 4], op->constants, -+ sizeof(*cs->state.vs_consts_i) * 4 * op->vector4i_count); ++ memcpy(&cs->state.vs_consts_i[op->start_idx], op->constants, sizeof(op->constants[0]) * op->count); + + device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_VS_I); + -+ return sizeof(*op) + sizeof(op->constants) * (op->vector4i_count - 1); ++ return sizeof(*op) + sizeof(op->constants[0]) * (op->count - 1); +} + +static UINT wined3d_cs_exec_set_ps_consts_i(struct wined3d_cs *cs, const void *data) @@ -80,21 +80,19 @@ index f1fc4b9..86a8603 100644 + const struct wined3d_cs_set_consts_i *op = data; + struct wined3d_device *device = cs->device; + -+ memcpy(&cs->state.ps_consts_i[op->start_register * 4], op->constants, -+ sizeof(*cs->state.ps_consts_i) * 4 * op->vector4i_count); ++ memcpy(&cs->state.ps_consts_i[op->start_idx], op->constants, sizeof(op->constants[0]) * op->count); + + device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_PS_I); + -+ return sizeof(*op) + sizeof(op->constants) * (op->vector4i_count - 1); ++ return sizeof(*op) + sizeof(op->constants[0]) * (op->count - 1); +} + -+void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, UINT start_register, -+ const int *constants, UINT vector4i_count, enum wined3d_shader_type type) ++void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, ++ const struct wined3d_ivec4 *constants, enum wined3d_shader_type type) +{ + struct wined3d_cs_set_consts_i *op; -+ UINT extra_space = vector4i_count - 1; + -+ op = cs->ops->require_space(cs, sizeof(*op) + sizeof(op->constants) * extra_space); ++ op = cs->ops->require_space(cs, sizeof(*op) + sizeof(op->constants[0]) * (count - 1)); + switch (type) + { + case WINED3D_SHADER_TYPE_PIXEL: @@ -114,9 +112,9 @@ index f1fc4b9..86a8603 100644 + case WINED3D_SHADER_TYPE_COUNT: + break; + } -+ op->start_register = start_register; -+ op->vector4i_count = vector4i_count; -+ memcpy(op->constants, constants, sizeof(op->constants) * vector4i_count); ++ op->start_idx = start_idx; ++ op->count = count; ++ memcpy(op->constants, constants, sizeof(op->constants[0]) * count); + + cs->ops->submit(cs); +} @@ -124,7 +122,7 @@ index f1fc4b9..86a8603 100644 static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_texture_state *op = data; -@@ -1538,8 +1600,10 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1538,8 +1598,10 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock, /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b, @@ -136,39 +134,39 @@ index f1fc4b9..86a8603 100644 /* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index, /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 70cc2af..34d03ef 100644 +index f961e3d..b1a3b02 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -2411,7 +2411,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, +@@ -2436,7 +2436,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, } else { - device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_VS_I); -+ wined3d_cs_emit_set_consts_i(device->cs, start_register, constants, -+ vector4i_count, WINED3D_SHADER_TYPE_VERTEX); ++ wined3d_cs_emit_set_consts_i(device->cs, start_idx, count, ++ constants, WINED3D_SHADER_TYPE_VERTEX); } return WINED3D_OK; -@@ -2640,7 +2641,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, +@@ -2667,7 +2668,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, } else { - device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_PS_I); -+ wined3d_cs_emit_set_consts_i(device->cs, start_register, constants, -+ vector4i_count, WINED3D_SHADER_TYPE_PIXEL); ++ wined3d_cs_emit_set_consts_i(device->cs, start_idx, count, ++ constants, WINED3D_SHADER_TYPE_PIXEL); } return WINED3D_OK; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 263925f..04d17b1 100644 +index 684a4c3..b14db6d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2952,6 +2952,8 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, co UINT vector4f_count, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, const BOOL *constants, UINT bool_count, enum wined3d_shader_type type) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, UINT start_register, -+ const int *constants, UINT vector4i_count, enum wined3d_shader_type type) DECLSPEC_HIDDEN; ++void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, ++ unsigned int count, const struct wined3d_ivec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, UINT base_vertex_index) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0030-wined3d-Send-blits-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0030-wined3d-Send-blits-through-the-command-stream.patch index 08981911..5d239ed0 100644 --- a/patches/wined3d-CSMT_Main/0030-wined3d-Send-blits-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0030-wined3d-Send-blits-through-the-command-stream.patch @@ -1,4 +1,4 @@ -From b4d0f97a8a6e5a86d4e3fd1cf416da6521492dbc Mon Sep 17 00:00:00 2001 +From 769cd7807af62078c543e9ac9cc27783322f295c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 29 Apr 2013 18:49:53 +0200 Subject: wined3d: Send blits through the command stream. @@ -26,7 +26,7 @@ index a308311..0c64b31 100644 * supported as offscreen plain surfaces and do not support D3DUSAGE_RENDERTARGET * when created as texture. */ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 03bf85e..6cbf83e 100644 +index e526a33..0372843 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -74,6 +74,7 @@ enum wined3d_cs_op @@ -37,7 +37,7 @@ index 03bf85e..6cbf83e 100644 WINED3D_CS_OP_STOP, }; -@@ -335,6 +336,18 @@ struct wined3d_cs_set_light_enable +@@ -336,6 +337,18 @@ struct wined3d_cs_set_light_enable BOOL enable; }; @@ -56,7 +56,7 @@ index 03bf85e..6cbf83e 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) { -@@ -1490,6 +1503,9 @@ static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data) +@@ -1488,6 +1501,9 @@ static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data) struct wined3d_device *device = cs->device; struct wined3d_context *context; @@ -66,7 +66,7 @@ index 03bf85e..6cbf83e 100644 context = context_acquire(device, NULL); context->gl_info->gl_ops.gl.p_glFinish(); context_release(context); -@@ -1701,6 +1717,38 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab +@@ -1699,6 +1715,38 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab cs->ops->submit(cs); } @@ -105,7 +105,7 @@ index 03bf85e..6cbf83e 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -1741,6 +1789,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1739,6 +1787,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type, /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light, /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, @@ -113,7 +113,7 @@ index 03bf85e..6cbf83e 100644 }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -@@ -1819,6 +1868,7 @@ static DWORD WINAPI wined3d_cs_run(void *thread_param) +@@ -1817,6 +1866,7 @@ static DWORD WINAPI wined3d_cs_run(void *thread_param) TRACE("Started.\n"); @@ -122,10 +122,10 @@ index 03bf85e..6cbf83e 100644 { struct wined3d_cs_block *block; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index ba1e795..3423e83 100644 +index 44692a9..d6fab5d 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3962,7 +3962,7 @@ const struct blit_shader cpu_blit = { +@@ -4116,7 +4116,7 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -134,7 +134,7 @@ index ba1e795..3423e83 100644 struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -3972,9 +3972,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4126,9 +4126,8 @@ 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; @@ -146,7 +146,7 @@ index ba1e795..3423e83 100644 DWORD src_ds_flags, dst_ds_flags; BOOL scale, convert; -@@ -3987,91 +3986,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4141,91 +4140,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -243,7 +243,7 @@ index ba1e795..3423e83 100644 } if (!device->d3d_initialized) -@@ -4096,11 +4021,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4250,11 +4175,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -255,7 +255,7 @@ index ba1e795..3423e83 100644 dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -4136,22 +4056,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4290,22 +4210,16 @@ 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)) @@ -281,7 +281,7 @@ index ba1e795..3423e83 100644 } } else -@@ -4187,7 +4101,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4341,7 +4255,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -290,7 +290,7 @@ index ba1e795..3423e83 100644 } else { -@@ -4230,7 +4144,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4384,7 +4298,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst context, dst_texture->resource.draw_binding); context_release(context); } @@ -299,7 +299,7 @@ index ba1e795..3423e83 100644 } } } -@@ -4254,7 +4168,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4408,7 +4322,7 @@ 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; @@ -308,7 +308,7 @@ index ba1e795..3423e83 100644 } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4275,7 +4189,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4429,7 +4343,7 @@ 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); @@ -317,7 +317,7 @@ index ba1e795..3423e83 100644 } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4285,7 +4199,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4439,7 +4353,7 @@ 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); @@ -326,7 +326,7 @@ index ba1e795..3423e83 100644 } } } -@@ -4293,11 +4207,142 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4447,9 +4361,140 @@ 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))) @@ -469,10 +469,8 @@ index ba1e795..3423e83 100644 + + return WINED3D_OK; } - - /* Context activation is done by the caller. Context may be NULL in diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 925a326..a248e24 100644 +index 523185b..d1e521c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2746,6 +2746,9 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P 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 04316136..965fd0ed 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 2e09b2b8c2b0821eb9ef55547d9600855d079228 Mon Sep 17 00:00:00 2001 +From a48f1245857c50591d0ddc367e191b5857c80b2b 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 @@ -116,7 +116,7 @@ index fd4a0ce..75e679c 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 f368777..14ac300 100644 +index c3d5037..6ff5815 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1580,6 +1580,63 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) @@ -344,10 +344,10 @@ index f368777..14ac300 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 3b8ad5e..c3bfd58 100644 +index 1a4d740..8253934 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2606,6 +2606,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -2607,6 +2607,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); @@ -355,7 +355,7 @@ index 3b8ad5e..c3bfd58 100644 + 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_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN; + void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; @@ -2614,6 +2616,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, diff --git a/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch b/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch index f999f50b..26c399e1 100644 --- a/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch +++ b/patches/wined3d-CSMT_Main/0037-wined3d-Replace-the-linked-lists-with-a-ringbuffer.patch @@ -1,4 +1,4 @@ -From 774388227ccae6455516e892dcd30c5376d7f152 Mon Sep 17 00:00:00 2001 +From 9371749a7b3da74f0f0899fecc86f02bbf132ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 4 Jul 2013 23:33:14 +0200 Subject: wined3d: Replace the linked lists with a ringbuffer @@ -9,7 +9,7 @@ Subject: wined3d: Replace the linked lists with a ringbuffer 2 files changed, 161 insertions(+), 222 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 75e679c..1c29500 100644 +index 070b937..bbabc3b 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -22,20 +22,10 @@ @@ -35,7 +35,7 @@ index 75e679c..1c29500 100644 WINED3D_CS_OP_FENCE, WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, -@@ -379,99 +369,30 @@ struct wined3d_cs_texture_unmap +@@ -380,99 +370,30 @@ struct wined3d_cs_texture_unmap unsigned int sub_resource_idx; }; @@ -149,7 +149,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_fence(struct wined3d_cs *cs, const void *data) -@@ -492,14 +413,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) +@@ -493,14 +414,14 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_FENCE; op->signalled = signalled; @@ -166,7 +166,7 @@ index 75e679c..1c29500 100644 /* A busy wait should be fine, we're not supposed to have to wait very * long. */ -@@ -538,7 +459,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -539,7 +460,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw pending = InterlockedIncrement(&cs->pending_presents); @@ -175,7 +175,7 @@ index 75e679c..1c29500 100644 while (pending > 1) pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0); -@@ -564,8 +485,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -565,8 +486,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { struct wined3d_cs_clear *op; @@ -186,7 +186,7 @@ index 75e679c..1c29500 100644 op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -574,7 +495,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -575,7 +496,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * op->rect_count = rect_count; memcpy(op->rects, rects, sizeof(*rects) * rect_count); @@ -195,7 +195,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) -@@ -615,7 +536,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun +@@ -616,7 +537,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun op->instance_count = instance_count; op->indexed = indexed; @@ -204,7 +204,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data) -@@ -637,7 +558,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -638,7 +559,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query op->predicate = predicate; op->value = value; @@ -213,7 +213,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data) -@@ -658,7 +579,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -659,7 +580,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -222,7 +222,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data) -@@ -679,7 +600,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -680,7 +601,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -231,7 +231,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) -@@ -702,7 +623,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -703,7 +624,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v op->view_idx = view_idx; op->view = view; @@ -240,7 +240,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data) -@@ -756,7 +677,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -757,7 +678,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -249,7 +249,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data) -@@ -777,7 +698,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -778,7 +699,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -258,7 +258,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) -@@ -814,7 +735,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -815,7 +736,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, op->offset = offset; op->stride = stride; @@ -267,7 +267,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) -@@ -841,7 +762,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -842,7 +763,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i op->frequency = frequency; op->flags = flags; @@ -276,7 +276,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) -@@ -874,7 +795,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -875,7 +796,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, op->buffer = buffer; op->offset = offset; @@ -285,7 +285,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) -@@ -906,7 +827,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -907,7 +828,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff op->buffer = buffer; op->format_id = format_id; @@ -294,7 +294,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) -@@ -937,7 +858,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -938,7 +859,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha op->cb_idx = cb_idx; op->buffer = buffer; @@ -303,7 +303,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) -@@ -1029,7 +950,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1030,7 +951,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -312,7 +312,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data) -@@ -1053,7 +974,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1054,7 +975,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 op->view_idx = view_idx; op->view = view; @@ -321,7 +321,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) -@@ -1077,7 +998,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1078,7 +999,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -330,7 +330,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) -@@ -1100,7 +1021,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1101,7 +1022,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type op->type = type; op->shader = shader; @@ -339,7 +339,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_vs_consts_f(struct wined3d_cs *cs, const void *data) -@@ -1136,8 +1057,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, +@@ -1137,8 +1058,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, { struct wined3d_cs_set_consts_f *op; UINT extra_space = vector4f_count - 1; @@ -350,7 +350,7 @@ index 75e679c..1c29500 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1161,7 +1083,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, +@@ -1162,7 +1084,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, op->vector4f_count = vector4f_count; memcpy(&op->constants, constants, sizeof(*constants) * vector4f_count); @@ -359,7 +359,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data) -@@ -1183,8 +1105,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1184,8 +1106,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render op->state = state; op->value = value; @@ -370,7 +370,7 @@ index 75e679c..1c29500 100644 static UINT wined3d_cs_exec_set_vs_consts_b(struct wined3d_cs *cs, const void *data) { -@@ -1217,8 +1139,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, +@@ -1218,8 +1140,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, { struct wined3d_cs_set_consts_b *op; UINT extra_space = bool_count - 1; @@ -381,7 +381,7 @@ index 75e679c..1c29500 100644 switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1242,7 +1165,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, +@@ -1243,7 +1166,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, op->bool_count = bool_count; memcpy(op->constants, constants, sizeof(op->constants) * bool_count); @@ -390,27 +390,27 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_vs_consts_i(struct wined3d_cs *cs, const void *data) -@@ -1276,8 +1199,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, UINT start_register, +@@ -1274,8 +1197,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, + const struct wined3d_ivec4 *constants, enum wined3d_shader_type type) { struct wined3d_cs_set_consts_i *op; - UINT extra_space = vector4i_count - 1; -+ size_t size = sizeof(*op) + sizeof(op->constants) * extra_space; ++ size_t size = sizeof(*op) + sizeof(op->constants[0]) * (count - 1); -- op = cs->ops->require_space(cs, sizeof(*op) + sizeof(op->constants) * extra_space); +- op = cs->ops->require_space(cs, sizeof(*op) + sizeof(op->constants[0]) * (count - 1)); + op = cs->ops->require_space(cs, size); switch (type) { case WINED3D_SHADER_TYPE_PIXEL: -@@ -1301,7 +1225,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, UINT start_register, - op->vector4i_count = vector4i_count; - memcpy(op->constants, constants, sizeof(op->constants) * vector4i_count); +@@ -1299,7 +1223,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx, + op->count = count; + memcpy(op->constants, constants, sizeof(op->constants[0]) * count); - cs->ops->submit(cs); + cs->ops->submit(cs, size); } static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data) -@@ -1325,7 +1249,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1323,7 +1247,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, op->state = state; op->value = value; @@ -419,7 +419,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data) -@@ -1349,7 +1273,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1347,7 +1271,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, op->state = state; op->value = value; @@ -428,7 +428,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) -@@ -1373,7 +1297,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1371,7 +1295,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform op->state = state; op->matrix = *matrix; @@ -437,7 +437,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data) -@@ -1395,7 +1319,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1393,7 +1317,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const op->plane_idx = plane_idx; op->plane = *plane; @@ -446,7 +446,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) -@@ -1480,7 +1404,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1478,7 +1402,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -455,7 +455,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data) -@@ -1501,7 +1425,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1499,7 +1423,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -464,7 +464,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) -@@ -1525,7 +1449,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1523,7 +1447,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -473,7 +473,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data) -@@ -1551,7 +1475,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -1549,7 +1473,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_GLFINISH; @@ -482,7 +482,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_base_vertex_index(struct wined3d_cs *cs, const void *data) -@@ -1573,7 +1497,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, +@@ -1571,7 +1495,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, op->opcode = WINED3D_CS_OP_SET_BASE_VERTEX_INDEX; op->base_vertex_index = base_vertex_index; @@ -491,7 +491,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data) -@@ -1599,7 +1523,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -1597,7 +1521,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE; op->gl_primitive_type = primitive_type; @@ -500,7 +500,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) -@@ -1656,7 +1580,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light +@@ -1654,7 +1578,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light op->opcode = WINED3D_CS_OP_SET_LIGHT; op->light = *light; @@ -509,7 +509,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data) -@@ -1745,7 +1669,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab +@@ -1743,7 +1667,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab op->idx = idx; op->enable = enable; @@ -518,7 +518,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) -@@ -1777,7 +1701,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -1775,7 +1699,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf if (fx) op->fx = *fx; @@ -527,7 +527,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) -@@ -1810,7 +1734,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -1808,7 +1732,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge op->stencil = stencil; op->blitter = blitter; @@ -536,7 +536,7 @@ index 75e679c..1c29500 100644 } static UINT wined3d_cs_exec_texture_map(struct wined3d_cs *cs, const void *data) -@@ -1835,12 +1759,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture +@@ -1833,12 +1757,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture op->flags = flags; op->mem = &ret; @@ -552,7 +552,7 @@ index 75e679c..1c29500 100644 return ret; } -@@ -1863,11 +1789,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture +@@ -1861,11 +1787,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture op->texture = texture; op->sub_resource_idx = sub_resource_idx; @@ -567,7 +567,7 @@ index 75e679c..1c29500 100644 /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, -@@ -1912,42 +1840,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1910,42 +1838,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, }; @@ -650,7 +650,7 @@ index 75e679c..1c29500 100644 }; /* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -@@ -1959,9 +1904,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) +@@ -1957,9 +1902,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) op = wined3d_cs_mt_require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_STOP; @@ -690,7 +690,7 @@ index 75e679c..1c29500 100644 void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) { -@@ -1985,31 +1959,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, +@@ -1983,31 +1957,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, static DWORD WINAPI wined3d_cs_run(void *thread_param) { struct wined3d_cs *cs = thread_param; @@ -737,7 +737,7 @@ index 75e679c..1c29500 100644 } done: -@@ -2034,25 +2009,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2032,25 +2007,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) cs->ops = &wined3d_cs_st_ops; cs->device = device; @@ -763,7 +763,7 @@ index 75e679c..1c29500 100644 if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL))) { ERR("Failed to create wined3d command stream thread.\n"); -@@ -2064,12 +2024,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2062,12 +2022,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) err: if (cs) @@ -776,7 +776,7 @@ index 75e679c..1c29500 100644 HeapFree(GetProcessHeap(), 0, cs); return NULL; } -@@ -2088,17 +2043,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -2086,17 +2041,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) CloseHandle(cs->thread); if (ret != WAIT_OBJECT_0) ERR("Wait failed (%#x).\n", ret); @@ -795,7 +795,7 @@ index 75e679c..1c29500 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c3bfd58..697e674 100644 +index 999c770..195ffb3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -31,6 +31,7 @@ diff --git a/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch b/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch index ce0a6397..a433f51c 100644 --- a/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch +++ b/patches/wined3d-CSMT_Main/0117-wined3d-Send-getdc-and-releasedc-through-the-command.patch @@ -1,14 +1,14 @@ -From aacc15190afbbc0c2802e876066e0d84f83e7d8d Mon Sep 17 00:00:00 2001 +From 242374f346ff9108cd2d450f2fe79d7d1d48752b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 16 Mar 2014 14:13:42 +0100 Subject: wined3d: Send getdc and releasedc through the command stream. Another hacky patch to avoid using GL outside the worker thread. --- - dlls/wined3d/cs.c | 57 ++++++++++++++++++++++++++++ - dlls/wined3d/texture.c | 84 ++++++++++++++++++++++++------------------ - dlls/wined3d/wined3d_private.h | 8 ++++ - 3 files changed, 114 insertions(+), 35 deletions(-) + dlls/wined3d/cs.c | 57 +++++++++++++++++++++++++++++ + dlls/wined3d/texture.c | 82 ++++++++++++++++++++++++------------------ + dlls/wined3d/wined3d_private.h | 8 +++++ + 3 files changed, 113 insertions(+), 34 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 6de25ab..3208c35 100644 @@ -100,7 +100,7 @@ index 6de25ab..3208c35 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 44d38f8..4b0cc31 100644 +index 7b27fd5..4b6c1d8 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -2677,13 +2677,39 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct @@ -155,25 +155,17 @@ index 44d38f8..4b0cc31 100644 - wined3d_cs_emit_glfinish(device->cs); - device->cs->ops->finish(device->cs); - } +- +- if (device->d3d_initialized) +- context = context_acquire(device, NULL); + wined3d_cs_emit_get_dc(device->cs, texture, sub_resource_idx); + if (FAILED(texture->dc_hr)) + return texture->dc_hr; -+ -+ *dc = surface->dc; -+ TRACE("Returning dc %p.\n", *dc); - -- if (device->d3d_initialized) -- context = context_acquire(device, NULL); -+ return WINED3D_OK; -+} - wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding); - wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); -+void wined3d_texture_release_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) -+{ -+ struct wined3d_device *device = texture->resource.device; -+ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; -+ struct wined3d_surface *surface = sub_resource->u.surface; ++ *dc = surface->dc; ++ TRACE("Returning dc %p.\n", *dc); - if (!surface->dc) - hr = wined3d_surface_create_dc(surface); @@ -181,26 +173,34 @@ index 44d38f8..4b0cc31 100644 - context_release(context); - if (FAILED(hr)) - return WINED3DERR_INVALIDCALL; -+ if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D)) -+ wined3d_surface_destroy_dc(surface); ++ return WINED3D_OK; ++} -+ --sub_resource->map_count; -+ if (!--texture->resource.map_count && texture->update_map_binding) -+ wined3d_texture_update_map_binding(texture); - if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) +- if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) - texture->flags |= WINED3D_TEXTURE_DC_IN_USE; - ++texture->resource.map_count; - ++sub_resource->map_count; -- ++void wined3d_texture_release_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) ++{ ++ struct wined3d_device *device = texture->resource.device; ++ struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx]; ++ struct wined3d_surface *surface = sub_resource->u.surface; + - *dc = surface->dc; - TRACE("Returning dc %p.\n", *dc); -- ++ if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D)) ++ wined3d_surface_destroy_dc(surface); + - return hr; ++ --sub_resource->map_count; ++ if (!--texture->resource.map_count && texture->update_map_binding) ++ wined3d_texture_update_map_binding(texture); ++ if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) + texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -2760,15 +2781,8 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -2760,14 +2781,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -212,17 +212,15 @@ index 44d38f8..4b0cc31 100644 - wined3d_texture_update_map_binding(texture); - if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) - texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; -- + wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx); -+ + return WINED3D_OK; } - diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 5a4f71b..2ae0f2c 100644 +index 496f521..38ab06c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2537,6 +2537,7 @@ struct wined3d_texture +@@ -2538,6 +2538,7 @@ struct wined3d_texture DWORD flags; GLenum target; DWORD update_map_binding; @@ -230,7 +228,7 @@ index 5a4f71b..2ae0f2c 100644 GLuint rb_multisample; GLuint rb_resolved; -@@ -2632,6 +2633,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture, +@@ -2633,6 +2634,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture, BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; void wined3d_texture_cleanup(struct wined3d_texture *texture) DECLSPEC_HIDDEN; @@ -238,15 +236,15 @@ index 5a4f71b..2ae0f2c 100644 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, struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN; -@@ -2651,6 +2653,8 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int +@@ -2652,6 +2654,8 @@ void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int 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; - void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; void wined3d_texture_set_swapchain(struct wined3d_texture *texture, + struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -3061,6 +3065,10 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu void wined3d_cs_emit_sampler_destroy(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; void wined3d_cs_emit_shader_resource_view_destroy(struct wined3d_cs *cs, diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 3501de3d..494fc790 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -46,7 +46,7 @@ diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c -@@ -703,7 +703,11 @@ +@@ -704,7 +704,11 @@ { const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL]; const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; @@ -58,7 +58,7 @@ diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader /* Load DirectX 9 float constants for pixel shader */ priv->highest_dirty_ps_const = shader_arb_load_constants_f(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB, -@@ -4731,7 +4735,11 @@ +@@ -4732,7 +4736,11 @@ } else { @@ -70,7 +70,7 @@ diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader shader_arb_ps_local_constants(compiled, context, state, rt_height); } -@@ -7964,11 +7972,16 @@ +@@ -7950,11 +7958,16 @@ /* Leave the opengl state valid for blitting */ arbfp_blit_unset(context->gl_info); @@ -741,7 +741,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -649,6 +659,23 @@ +@@ -650,6 +660,23 @@ struct wined3d_cs_present *op; LONG pending; unsigned int i; @@ -765,7 +765,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_PRESENT; -@@ -658,6 +685,7 @@ +@@ -659,6 +686,7 @@ op->dst_rect = *dst_rect; op->flags = flags; @@ -773,7 +773,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_resource_inc_fence(&swapchain->front_buffer->resource); for (i = 0; i < swapchain->desc.backbuffer_count; i++) wined3d_resource_inc_fence(&swapchain->back_buffers[i]->resource); -@@ -715,6 +743,30 @@ +@@ -716,6 +744,30 @@ unsigned int i; op = cs->ops->require_space(cs, size); @@ -804,7 +804,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -723,6 +775,7 @@ +@@ -724,6 +776,7 @@ op->rect_count = rect_count; memcpy(op->rects, rects, sizeof(*rects) * rect_count); @@ -812,7 +812,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (flags & WINED3DCLEAR_TARGET) { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++) -@@ -813,6 +866,23 @@ +@@ -814,6 +867,23 @@ struct wined3d_cs_draw *op; unsigned int i; const struct wined3d_state *state = &cs->device->state; @@ -836,7 +836,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_DRAW; -@@ -822,6 +892,7 @@ +@@ -823,6 +893,7 @@ op->instance_count = instance_count; op->indexed = indexed; @@ -844,7 +844,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (indexed) { wined3d_resource_inc_fence(&state->index_buffer->resource); -@@ -859,6 +930,17 @@ +@@ -860,6 +931,17 @@ cs->state.predicate_value = op->value; return sizeof(*op); @@ -862,7 +862,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -870,6 +952,7 @@ +@@ -871,6 +953,7 @@ op->predicate = predicate; op->value = value; @@ -870,7 +870,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -881,6 +964,17 @@ +@@ -882,6 +965,17 @@ device_invalidate_state(cs->device, STATE_VIEWPORT); return sizeof(*op); @@ -888,7 +888,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -891,6 +985,7 @@ +@@ -892,6 +986,7 @@ op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -896,7 +896,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -902,6 +997,17 @@ +@@ -903,6 +998,17 @@ device_invalidate_state(cs->device, STATE_SCISSORRECT); return sizeof(*op); @@ -914,7 +914,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -912,6 +1018,7 @@ +@@ -913,6 +1019,7 @@ op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -922,7 +922,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -923,6 +1030,17 @@ +@@ -924,6 +1031,17 @@ device_invalidate_state(cs->device, STATE_FRAMEBUFFER); return sizeof(*op); @@ -940,7 +940,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -935,6 +1053,7 @@ +@@ -936,6 +1054,7 @@ op->view_idx = view_idx; op->view = view; @@ -948,7 +948,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -945,6 +1064,18 @@ +@@ -946,6 +1065,18 @@ struct wined3d_rendertarget_view *prev; if ((prev = cs->state.fb.depth_stencil)) @@ -967,7 +967,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -952,6 +1083,7 @@ +@@ -953,6 +1084,7 @@ || prev_surface->container->flags & WINED3D_TEXTURE_DISCARD)) { surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); @@ -975,7 +975,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (prev_surface == cs->onscreen_depth_stencil) { wined3d_texture_decref(cs->onscreen_depth_stencil->container); -@@ -961,6 +1093,17 @@ +@@ -962,6 +1094,17 @@ } cs->state.fb.depth_stencil = op->view; @@ -993,7 +993,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -977,8 +1120,10 @@ +@@ -978,8 +1121,10 @@ } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1004,7 +1004,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -989,6 +1134,7 @@ +@@ -990,6 +1135,7 @@ op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -1012,7 +1012,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1000,6 +1146,17 @@ +@@ -1001,6 +1147,17 @@ device_invalidate_state(cs->device, STATE_VDECL); return sizeof(*op); @@ -1030,7 +1030,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -1010,10 +1167,17 @@ +@@ -1011,10 +1168,17 @@ op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -1048,7 +1048,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -1031,8 +1195,10 @@ +@@ -1032,8 +1196,10 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1059,7 +1059,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -1047,10 +1213,17 @@ +@@ -1048,10 +1214,17 @@ op->offset = offset; op->stride = stride; @@ -1077,7 +1077,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -1060,8 +1233,10 @@ +@@ -1061,8 +1234,10 @@ stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1088,7 +1088,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -1074,10 +1249,17 @@ +@@ -1075,10 +1250,17 @@ op->frequency = frequency; op->flags = flags; @@ -1106,7 +1106,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -1092,8 +1274,10 @@ +@@ -1093,8 +1275,10 @@ InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -1117,7 +1117,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -1107,10 +1291,17 @@ +@@ -1108,10 +1292,17 @@ op->buffer = buffer; op->offset = offset; @@ -1135,7 +1135,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -1125,8 +1316,10 @@ +@@ -1126,8 +1317,10 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -1146,7 +1146,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -1139,10 +1332,17 @@ +@@ -1140,10 +1333,17 @@ op->buffer = buffer; op->format_id = format_id; @@ -1164,7 +1164,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -1156,7 +1356,9 @@ +@@ -1157,7 +1357,9 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -1174,7 +1174,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1170,10 +1372,17 @@ +@@ -1171,10 +1373,17 @@ op->cb_idx = cb_idx; op->buffer = buffer; @@ -1192,7 +1192,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -1250,8 +1459,10 @@ +@@ -1251,8 +1460,10 @@ if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1203,7 +1203,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -1262,6 +1473,7 @@ +@@ -1263,6 +1474,7 @@ op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -1211,7 +1211,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1273,6 +1485,18 @@ +@@ -1274,6 +1486,18 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1230,7 +1230,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1286,6 +1510,7 @@ +@@ -1287,6 +1511,7 @@ op->view_idx = view_idx; op->view = view; @@ -1238,7 +1238,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1297,6 +1522,17 @@ +@@ -1298,6 +1523,17 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1256,7 +1256,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1310,6 +1546,7 @@ +@@ -1311,6 +1547,7 @@ op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -1264,7 +1264,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1322,6 +1559,18 @@ +@@ -1323,6 +1560,18 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1283,7 +1283,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -1333,6 +1582,7 @@ +@@ -1334,6 +1583,7 @@ op->type = type; op->shader = shader; @@ -1291,7 +1291,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1406,6 +1656,17 @@ +@@ -1407,6 +1657,17 @@ device_invalidate_state(cs->device, STATE_RENDER(op->state)); return sizeof(*op); @@ -1309,7 +1309,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -1417,6 +1678,7 @@ +@@ -1418,6 +1679,7 @@ op->state = state; op->value = value; @@ -1317,7 +1317,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1548,6 +1810,17 @@ +@@ -1546,6 +1808,17 @@ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); return sizeof(*op); @@ -1335,7 +1335,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1561,6 +1834,7 @@ +@@ -1559,6 +1832,7 @@ op->state = state; op->value = value; @@ -1343,7 +1343,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1572,6 +1846,17 @@ +@@ -1570,6 +1844,17 @@ device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); return sizeof(*op); @@ -1361,7 +1361,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1585,6 +1870,7 @@ +@@ -1583,6 +1868,7 @@ op->state = state; op->value = value; @@ -1369,7 +1369,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1597,6 +1883,18 @@ +@@ -1595,6 +1881,18 @@ device_invalidate_state(cs->device, STATE_TRANSFORM(op->state)); return sizeof(*op); @@ -1388,7 +1388,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1609,6 +1907,7 @@ +@@ -1607,6 +1905,7 @@ op->state = state; op->matrix = *matrix; @@ -1396,7 +1396,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1620,6 +1919,17 @@ +@@ -1618,6 +1917,17 @@ device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx)); return sizeof(*op); @@ -1414,7 +1414,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -1631,10 +1941,17 @@ +@@ -1629,10 +1939,17 @@ op->plane_idx = plane_idx; op->plane = *plane; @@ -1432,7 +1432,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1695,8 +2012,10 @@ +@@ -1693,8 +2010,10 @@ break; } } @@ -1443,7 +1443,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1716,6 +2035,7 @@ +@@ -1714,6 +2033,7 @@ else op->set = 0; @@ -1451,7 +1451,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1727,6 +2047,17 @@ +@@ -1725,6 +2045,17 @@ device_invalidate_state(cs->device, STATE_MATERIAL); return sizeof(*op); @@ -1469,7 +1469,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1737,6 +2068,7 @@ +@@ -1735,6 +2066,7 @@ op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -1477,7 +1477,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1752,6 +2084,21 @@ +@@ -1750,6 +2082,19 @@ ERR("Failed to initialize CS state, hr %#x.\n", hr); return sizeof(struct wined3d_cs_reset_state); @@ -1488,18 +1488,16 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +{ + struct wined3d_adapter *adapter = cs->device->adapter; -+ HRESULT hr; + + state_cleanup(&cs->state); + memset(&cs->state, 0, sizeof(cs->state)); -+ if (FAILED(hr = state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info, -+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) -+ ERR("Failed to initialize CS state, hr %#x.\n", hr); ++ state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info, ++ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT); +#endif /* STAGING_CSMT */ } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1761,6 +2108,7 @@ +@@ -1759,6 +2104,7 @@ op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -1507,7 +1505,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -3210,5 +3558,111 @@ +@@ -3208,5 +3554,106 @@ ERR("Closing event failed.\n"); } @@ -1590,13 +1588,8 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + return NULL; + } + -+ if (FAILED(state_init(&cs->state, &cs->fb, gl_info, &device->adapter->d3d_info, -+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) -+ { -+ HeapFree(GetProcessHeap(), 0, cs->fb.render_targets); -+ HeapFree(GetProcessHeap(), 0, cs); -+ return NULL; -+ } ++ state_init(&cs->state, &cs->fb, gl_info, &device->adapter->d3d_info, ++ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT); + + cs->ops = &wined3d_cs_st_ops; + cs->device = device; @@ -1812,10 +1805,10 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; +#if defined(STAGING_CSMT) - struct wined3d_swapchain *swapchain = NULL; ++ struct wined3d_swapchain *swapchain = NULL; +#else /* STAGING_CSMT */ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -+ struct wined3d_swapchain *swapchain = NULL; + struct wined3d_swapchain *swapchain = NULL; + struct wined3d_context *context; +#endif /* STAGING_CSMT */ DWORD clear_flags = 0; @@ -2111,22 +2104,22 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2391,8 +2643,12 @@ +@@ -2393,8 +2645,12 @@ } else { +#if defined(STAGING_CSMT) - wined3d_cs_emit_set_consts_i(device->cs, start_register, constants, - vector4i_count, WINED3D_SHADER_TYPE_VERTEX); + wined3d_cs_emit_set_consts_i(device->cs, start_idx, count, + constants, WINED3D_SHADER_TYPE_VERTEX); +#else /* STAGING_CSMT */ + device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_VS_I); +#endif /* STAGING_CSMT */ } return WINED3D_OK; -@@ -2437,8 +2693,12 @@ - memset(&device->recording->changed.vertexShaderConstantsF[start_idx], 1, - count * sizeof(*device->recording->changed.vertexShaderConstantsF)); +@@ -2439,8 +2695,12 @@ + memset(&device->recording->changed.vs_consts_f[start_idx], 1, + count * sizeof(*device->recording->changed.vs_consts_f)); else +#if defined(STAGING_CSMT) wined3d_cs_emit_set_consts_f(device->cs, start_idx, constants, count, @@ -2137,7 +2130,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2573,8 +2833,12 @@ +@@ -2575,8 +2835,12 @@ } else { @@ -2150,22 +2143,22 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2621,8 +2885,12 @@ +@@ -2625,8 +2889,12 @@ } else { +#if defined(STAGING_CSMT) - wined3d_cs_emit_set_consts_i(device->cs, start_register, constants, - vector4i_count, WINED3D_SHADER_TYPE_PIXEL); + wined3d_cs_emit_set_consts_i(device->cs, start_idx, count, + constants, WINED3D_SHADER_TYPE_PIXEL); +#else /* STAGING_CSMT */ + device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_PS_I); +#endif /* STAGING_CSMT */ } return WINED3D_OK; -@@ -2668,8 +2936,12 @@ - memset(&device->recording->changed.pixelShaderConstantsF[start_idx], 1, - count * sizeof(*device->recording->changed.pixelShaderConstantsF)); +@@ -2672,8 +2940,12 @@ + memset(&device->recording->changed.ps_consts_f[start_idx], 1, + count * sizeof(*device->recording->changed.ps_consts_f)); else +#if defined(STAGING_CSMT) wined3d_cs_emit_set_consts_f(device->cs, start_idx, constants, count, @@ -2176,7 +2169,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2829,6 +3101,7 @@ +@@ -2833,6 +3105,7 @@ return hr; } @@ -2184,7 +2177,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) { FIXME("Waiting for cs.\n"); -@@ -2836,6 +3109,7 @@ +@@ -2840,6 +3113,7 @@ device->cs->ops->finish(device->cs); } @@ -2192,7 +2185,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_device_get_transform(device, WINED3D_TS_VIEW, &view_mat); wined3d_device_get_transform(device, WINED3D_TS_PROJECTION, &proj_mat); wined3d_device_get_transform(device, WINED3D_TS_WORLD_MATRIX(0), &world_mat); -@@ -3321,6 +3595,10 @@ +@@ -3325,6 +3599,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -2203,7 +2196,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3329,6 +3607,15 @@ +@@ -3333,6 +3611,15 @@ return WINED3DERR_INVALIDCALL; } @@ -2219,7 +2212,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3336,8 +3623,10 @@ +@@ -3340,8 +3627,10 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -2230,7 +2223,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c 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); -@@ -3349,7 +3638,11 @@ +@@ -3353,7 +3642,11 @@ if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -2242,7 +2235,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3358,8 +3651,13 @@ +@@ -3362,8 +3655,13 @@ } else if (flags & WINED3DCLEAR_TARGET) { @@ -2256,7 +2249,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3405,6 +3703,9 @@ +@@ -3409,6 +3707,9 @@ enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -2266,7 +2259,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type)); gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); -@@ -3412,8 +3713,13 @@ +@@ -3416,8 +3717,13 @@ device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -2280,7 +2273,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device, -@@ -3436,6 +3742,14 @@ +@@ -3440,6 +3746,14 @@ return WINED3DERR_INVALIDCALL; } @@ -2295,7 +2288,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); return WINED3D_OK; -@@ -3452,6 +3766,10 @@ +@@ -3456,6 +3770,10 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { @@ -2306,7 +2299,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count); if (!device->state.index_buffer) -@@ -3470,6 +3788,15 @@ +@@ -3474,6 +3792,15 @@ return WINED3DERR_INVALIDCALL; } @@ -2322,7 +2315,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); return WINED3D_OK; -@@ -3484,6 +3811,7 @@ +@@ -3488,6 +3815,7 @@ wined3d_cs_emit_draw(device->cs, start_idx, index_count, start_instance, instance_count, TRUE); } @@ -2330,7 +2323,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Context activation is done by the caller. */ static void wined3d_device_update_texture_3d(struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_level, -@@ -3494,6 +3822,36 @@ +@@ -3498,6 +3826,36 @@ TRACE("context %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n", context, src_texture, src_level, dst_texture, level_count); @@ -2367,7 +2360,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); -@@ -3501,6 +3859,7 @@ +@@ -3505,6 +3863,7 @@ for (i = 0; i < level_count; ++i) { @@ -2375,7 +2368,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_texture_get_memory(src_texture, src_level + i, &data, src_texture->resource.map_binding, FALSE); -@@ -3578,6 +3937,34 @@ +@@ -3582,6 +3941,34 @@ unsigned int src_size, dst_size, src_skip_levels = 0; unsigned int layer_count; enum wined3d_resource_type type; @@ -2410,7 +2403,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); -@@ -3614,6 +4001,7 @@ +@@ -3618,6 +4005,7 @@ return WINED3DERR_INVALIDCALL; } @@ -2418,7 +2411,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* FIXME: This isn't necessary for 2D textures, but currently surface_upload_from_surface * rejects mismatching formats, and we can't report the error back after dispatching the * call. */ -@@ -3656,6 +4044,65 @@ +@@ -3660,6 +4048,65 @@ wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture); return WINED3D_OK; @@ -2484,7 +2477,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) -@@ -3703,8 +4150,13 @@ +@@ -3707,8 +4154,13 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -2498,7 +2491,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3893,7 +4345,9 @@ +@@ -3897,7 +4349,9 @@ struct wined3d_texture *dst_texture, *src_texture; RECT dst_rect, src_rect; HRESULT hr; @@ -2508,7 +2501,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", -@@ -3981,6 +4435,7 @@ +@@ -3985,6 +4439,7 @@ if (src_box) { @@ -2516,7 +2509,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if ((src_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) && !wined3d_texture_check_block_align(src_texture, src_sub_resource_idx % src_texture->level_count, src_box)) -@@ -3989,6 +4444,7 @@ +@@ -3993,6 +4448,7 @@ return WINED3DERR_INVALIDCALL; } @@ -2524,7 +2517,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 -@@ -4002,6 +4458,7 @@ +@@ -4006,6 +4462,7 @@ SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), dst_y + (src_rect.bottom - src_rect.top)); @@ -2532,7 +2525,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) { dst_box.left = dst_rect.left; -@@ -4019,6 +4476,7 @@ +@@ -4023,6 +4480,7 @@ } } @@ -2540,18 +2533,18 @@ 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); -@@ -4031,7 +4489,18 @@ +@@ -4035,7 +4493,18 @@ unsigned int depth_pitch) { struct wined3d_texture_sub_resource *sub_resource; +#if defined(STAGING_CSMT) - struct wined3d_texture *texture; ++ struct wined3d_texture *texture; +#else /* STAGING_CSMT */ + const struct wined3d_gl_info *gl_info; + struct wined3d_const_bo_address addr; + unsigned int width, height, level; + struct wined3d_context *context; -+ struct wined3d_texture *texture; + struct wined3d_texture *texture; + struct wined3d_surface *surface; + POINT dst_point; + RECT src_rect; @@ -2559,7 +2552,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); -@@ -4065,6 +4534,7 @@ +@@ -4069,6 +4538,7 @@ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -2567,7 +2560,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box) { -@@ -4074,6 +4544,18 @@ +@@ -4078,6 +4548,18 @@ width = wined3d_texture_get_level_width(texture, level); height = wined3d_texture_get_level_height(texture, level); @@ -2586,7 +2579,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) -@@ -4081,9 +4563,46 @@ +@@ -4085,9 +4567,46 @@ WARN("Invalid box %s specified.\n", debug_box(box)); return; } @@ -2633,7 +2626,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4092,8 +4611,13 @@ +@@ -4096,8 +4615,13 @@ { const struct blit_shader *blitter; struct wined3d_resource *resource; @@ -2647,7 +2640,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); -@@ -4132,8 +4656,15 @@ +@@ -4136,8 +4660,15 @@ return WINED3DERR_INVALIDCALL; } @@ -2663,7 +2656,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, -@@ -4147,6 +4678,7 @@ +@@ -4151,6 +4682,7 @@ return NULL; } @@ -2671,7 +2664,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -4162,6 +4694,22 @@ +@@ -4166,6 +4698,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -2694,7 +2687,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); -@@ -4201,6 +4749,7 @@ +@@ -4205,6 +4753,7 @@ } @@ -2702,7 +2695,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c prev = fb->render_targets[view_idx]; if (view == prev) return WINED3D_OK; -@@ -4208,6 +4757,15 @@ +@@ -4212,6 +4761,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -2718,7 +2711,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. */ -@@ -4219,6 +4777,7 @@ +@@ -4223,6 +4781,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -2726,7 +2719,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_fb_state *fb = &device->state.fb; struct wined3d_rendertarget_view *prev; -@@ -4232,6 +4791,20 @@ +@@ -4236,6 +4795,20 @@ } if ((fb->depth_stencil = view)) @@ -2747,7 +2740,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) -@@ -4453,8 +5026,10 @@ +@@ -4457,8 +5030,10 @@ TRACE("device %p.\n", device); @@ -2758,7 +2751,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); -@@ -4462,6 +5037,7 @@ +@@ -4466,6 +5041,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -2766,7 +2759,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4480,6 +5056,36 @@ +@@ -4484,6 +5060,36 @@ context = context_acquire(device, NULL); gl_info = context->gl_info; @@ -2803,7 +2796,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4501,6 +5107,7 @@ +@@ -4505,6 +5111,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -2811,7 +2804,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4519,6 +5126,14 @@ +@@ -4523,6 +5130,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -2826,7 +2819,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, -@@ -4535,6 +5150,7 @@ +@@ -4539,6 +5154,7 @@ return hr; } @@ -2834,7 +2827,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); if (FAILED(hr)) { -@@ -4545,6 +5161,33 @@ +@@ -4549,6 +5165,33 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -2868,7 +2861,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4564,12 +5207,14 @@ +@@ -4568,12 +5211,14 @@ TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -2883,7 +2876,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"); -@@ -4589,9 +5234,16 @@ +@@ -4593,9 +5238,16 @@ wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -2900,7 +2893,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4600,6 +5252,7 @@ +@@ -4604,6 +5256,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -2908,7 +2901,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4609,6 +5262,12 @@ +@@ -4613,6 +5266,12 @@ { wined3d_texture_decref(device->cs->onscreen_depth_stencil->container); device->cs->onscreen_depth_stencil = NULL; @@ -2921,31 +2914,27 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4828,7 +5487,11 @@ +@@ -4832,6 +5491,7 @@ if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); +#if defined(STAGING_CSMT) if (FAILED(hr = state_init(&device->state, &device->adapter->gl_info, -+#else /* STAGING_CSMT */ -+ if (FAILED(hr = state_init(&device->state, &device->fb, &device->adapter->gl_info, -+#endif /* STAGING_CSMT */ &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); - device->update_state = &device->state; -@@ -4837,6 +5500,7 @@ - } - else if (device->back_buffer_view) - { -+#if defined(STAGING_CSMT) - struct wined3d_state *state = &device->state; - - wined3d_device_set_rendertarget_view(device, 0, device->back_buffer_view, FALSE); -@@ -4852,6 +5516,24 @@ +@@ -4856,6 +5516,32 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; +#else /* STAGING_CSMT */ ++ state_init(&device->state, &device->fb, &device->adapter->gl_info, ++ &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT); ++ device->update_state = &device->state; ++ ++ device_init_swapchain_state(device, swapchain); ++ } ++ else if (device->back_buffer_view) ++ { + struct wined3d_rendertarget_view *view = device->back_buffer_view; + struct wined3d_state *state = &device->state; + @@ -2966,7 +2955,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4859,7 +5541,11 @@ +@@ -4863,7 +5549,11 @@ { if (reset_state) hr = create_primary_opengl_context(device, swapchain); @@ -2978,7 +2967,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 -@@ -4939,6 +5625,7 @@ +@@ -4943,6 +5633,7 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -2986,7 +2975,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource) -@@ -4946,6 +5633,17 @@ +@@ -4950,6 +5641,17 @@ } if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource) @@ -3004,19 +2993,25 @@ 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) -@@ -5081,7 +5779,11 @@ +@@ -5085,12 +5787,17 @@ device->blitter = adapter->blitter; +#if defined(STAGING_CSMT) if (FAILED(hr = state_init(&device->state, &adapter->gl_info, -+#else /* STAGING_CSMT */ -+ if (FAILED(hr = state_init(&device->state, &device->fb, &adapter->gl_info, -+#endif /* STAGING_CSMT */ &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) { ERR("Failed to initialize device state, hr %#x.\n", hr); -@@ -5180,6 +5882,7 @@ + goto err; + } ++#else /* STAGING_CSMT */ ++ state_init(&device->state, &device->fb, &adapter->gl_info, ++ &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT); ++#endif /* STAGING_CSMT */ + device->update_state = &device->state; + + if (!(device->cs = wined3d_cs_create(device))) +@@ -5184,6 +5891,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -3024,7 +3019,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Context activation is done by the caller */ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage, -@@ -5233,3 +5936,4 @@ +@@ -5237,3 +5945,4 @@ wined3d_device_destroy_bo(device, context, bo); } @@ -3870,7 +3865,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2309,7 +2309,11 @@ +@@ -2310,7 +2310,11 @@ string_buffer_free(&buffer); } @@ -3882,7 +3877,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c { HeapFree(GetProcessHeap(), 0, shader->output_signature.elements); HeapFree(GetProcessHeap(), 0, shader->input_signature.elements); -@@ -2578,10 +2582,16 @@ +@@ -2579,10 +2583,16 @@ if (!refcount) { @@ -3899,7 +3894,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c } return refcount; -@@ -2888,7 +2898,11 @@ +@@ -2889,7 +2899,11 @@ UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -4052,7 +4047,7 @@ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c -@@ -464,7 +464,9 @@ +@@ -430,7 +430,9 @@ struct wined3d_texture *texture; struct wined3d_buffer *buffer; struct wined3d_shader *shader; @@ -4062,7 +4057,7 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c unsigned int i, j; if ((decl = state->vertex_declaration)) -@@ -541,6 +543,7 @@ +@@ -507,6 +509,7 @@ } } } @@ -4070,7 +4065,7 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c if (state->fb.depth_stencil) { -@@ -566,6 +569,7 @@ +@@ -532,6 +535,7 @@ } } } @@ -4078,17 +4073,18 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c } void state_cleanup(struct wined3d_state *state) -@@ -593,7 +597,9 @@ - - HeapFree(GetProcessHeap(), 0, state->vs_consts_f); - HeapFree(GetProcessHeap(), 0, state->ps_consts_f); +@@ -556,8 +560,10 @@ + HeapFree(GetProcessHeap(), 0, light); + } + } +#if defined(STAGING_CSMT) + HeapFree(GetProcessHeap(), 0, state->fb.render_targets); +#endif /* STAGING_CSMT */ } ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock) -@@ -1061,8 +1067,13 @@ +@@ -1007,8 +1013,13 @@ gl_primitive_type = stateblock->state.gl_primitive_type; prev = device->update_state->gl_primitive_type; device->update_state->gl_primitive_type = gl_primitive_type; @@ -4102,7 +4098,7 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c } if (stateblock->changed.indices) -@@ -1320,6 +1331,7 @@ +@@ -1266,6 +1277,7 @@ state->sampler_states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0; /* TODO: Vertex offset in the presampled displacement map. */ state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0; @@ -4110,15 +4106,15 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c state->textures[i] = NULL; } -@@ -1337,6 +1349,19 @@ - unsigned int i; +@@ -1313,6 +1325,37 @@ - state->flags = flags; + if (FAILED(hr = state_init(&stateblock->state, gl_info, d3d_info, 0))) + return hr; +#else /* STAGING_CSMT */ + } +} + -+HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, ++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) +{ @@ -4126,49 +4122,28 @@ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c + + state->flags = flags; + state->fb = fb; -+#endif /* STAGING_CSMT */ - - for (i = 0; i < LIGHTMAP_SIZE; i++) - { -@@ -1354,6 +1379,7 @@ - return E_OUTOFMEMORY; - } - -+#if defined(STAGING_CSMT) - if (!(state->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(*state->fb.render_targets) * gl_info->limits.buffers))) - { -@@ -1363,6 +1389,7 @@ - } - state->fb.rt_size = gl_info->limits.buffers; - -+#endif /* STAGING_CSMT */ - if (flags & WINED3D_STATE_INIT_DEFAULT) - state_init_default(state, gl_info); - -@@ -1373,6 +1400,7 @@ - struct wined3d_device *device, enum wined3d_stateblock_type type) - { - HRESULT hr; -+#if defined(STAGING_CSMT) - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; - -@@ -1380,6 +1408,14 @@ - stateblock->device = device; - - if (FAILED(hr = state_init(&stateblock->state, gl_info, d3d_info, 0))) -+#else /* STAGING_CSMT */ ++ ++ for (i = 0; i < LIGHTMAP_SIZE; i++) ++ { ++ list_init(&state->light_map[i]); ++ } ++ ++ if (flags & WINED3D_STATE_INIT_DEFAULT) ++ state_init_default(state, gl_info); ++} ++ ++static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, ++ struct wined3d_device *device, enum wined3d_stateblock_type type) ++{ + const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; + + stateblock->ref = 1; + stateblock->device = device; -+ -+ if (FAILED(hr = state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0))) ++ state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0); +#endif /* STAGING_CSMT */ - return hr; - if (FAILED(hr = stateblock_allocate_shader_constants(stateblock))) + if (type == WINED3D_SBT_RECORDED) + return WINED3D_OK; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -5228,7 +5203,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return; cpu: -@@ -4505,6 +5031,13 @@ +@@ -4505,4 +5031,11 @@ flags, fx, filter); return WINED3D_OK; @@ -5240,8 +5215,6 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + src_texture, src_sub_resource_idx, &src_box, flags, fx, filter); +#endif /* STAGING_CSMT */ } - - /* Context activation is done by the caller. Context may be NULL in diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -5367,15 +5340,15 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c /* call wglSwapBuffers through the gl table to avoid confusing the Steam overlay */ gl_info->gl_ops.wgl.p_wglSwapBuffers(context->hdc); -@@ -618,6 +660,7 @@ - * up to date and hope WGL flipped front and back buffers and read this data into - * the FBO. Don't bother about this for now. */ +@@ -621,6 +663,7 @@ + wined3d_texture_validate_location(swapchain->back_buffers[swapchain->desc.backbuffer_count - 1], + 0, WINED3D_LOCATION_DISCARDED); +#if defined(STAGING_CSMT) - switch (swapchain->desc.swap_effect) + if (depth_stencil) { - case WINED3D_SWAP_EFFECT_DISCARD: -@@ -642,6 +685,21 @@ + struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(depth_stencil); +@@ -634,6 +677,21 @@ { wined3d_texture_decref(swapchain->device->cs->onscreen_depth_stencil->container); swapchain->device->cs->onscreen_depth_stencil = NULL; @@ -5397,7 +5370,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c } } } -@@ -651,12 +709,21 @@ +@@ -643,12 +701,21 @@ static void swapchain_gl_frontbuffer_updated(struct wined3d_swapchain *swapchain) { @@ -5419,7 +5392,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c context_release(context); SetRectEmpty(&swapchain->front_buffer_update); } -@@ -712,8 +779,12 @@ +@@ -704,8 +771,12 @@ } static void swapchain_gdi_present(struct wined3d_swapchain *swapchain, @@ -5432,7 +5405,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c { struct wined3d_surface *front, *back; HBITMAP bitmap; -@@ -824,6 +895,7 @@ +@@ -816,6 +887,7 @@ *quality = 0; } @@ -5440,7 +5413,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c HRESULT swapchain_create_context_cs(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { const struct wined3d_adapter *adapter = device->adapter; -@@ -887,6 +959,7 @@ +@@ -879,6 +951,7 @@ return WINED3D_OK; } @@ -5448,7 +5421,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) { -@@ -1004,9 +1077,67 @@ +@@ -996,9 +1069,67 @@ if (!(device->wined3d->flags & WINED3D_NO3D)) { @@ -5516,7 +5489,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c } if (swapchain->desc.backbuffer_count > 0) -@@ -1333,7 +1464,9 @@ +@@ -1325,7 +1456,9 @@ enum wined3d_multisample_type multisample_type, unsigned int multisample_quality) { BOOL update_desc = FALSE; @@ -5526,7 +5499,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c TRACE("swapchain %p, buffer_count %u, width %u, height %u, format %s, " "multisample_type %#x, multisample_quality %#x.\n", -@@ -1345,9 +1478,11 @@ +@@ -1337,9 +1470,11 @@ if (buffer_count && buffer_count != swapchain->desc.backbuffer_count) FIXME("Cannot change the back buffer count yet.\n"); @@ -5551,7 +5524,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } void wined3d_texture_validate_location(struct wined3d_texture *texture, -@@ -182,7 +184,11 @@ +@@ -187,7 +189,11 @@ } void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, @@ -5563,7 +5536,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c { struct wined3d_texture_sub_resource *sub_resource; -@@ -193,10 +199,14 @@ +@@ -198,10 +204,14 @@ if (locations & WINED3D_LOCATION_BUFFER) { data->addr = NULL; @@ -5578,7 +5551,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return; } if (locations & WINED3D_LOCATION_USER_MEMORY) -@@ -207,10 +217,14 @@ +@@ -212,10 +222,14 @@ } if (locations & WINED3D_LOCATION_SYSMEM) { @@ -5593,7 +5566,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c data->addr += sub_resource->offset; data->buffer_object = 0; return; -@@ -296,6 +310,7 @@ +@@ -301,6 +315,7 @@ /* Context activation is done by the caller. */ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture, @@ -5601,7 +5574,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int sub_resource_idx, struct wined3d_context *context) { struct wined3d_gl_bo *buffer = texture->sub_resources[sub_resource_idx].buffer; -@@ -312,6 +327,20 @@ +@@ -317,6 +332,20 @@ TRACE("Deleted buffer object %u for texture %p, sub-resource %u.\n", name, texture, sub_resource_idx); @@ -5622,7 +5595,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) -@@ -328,10 +357,17 @@ +@@ -333,10 +362,17 @@ for (i = 0; i < sub_count; ++i) { if (texture->sub_resources[i].locations == texture->resource.map_binding @@ -5640,7 +5613,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) -@@ -399,6 +435,7 @@ +@@ -404,6 +440,7 @@ resource_unload(&texture->resource); } @@ -5648,7 +5621,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void wined3d_texture_cleanup(struct wined3d_texture *texture) { unsigned int sub_count = texture->level_count * texture->layer_count; -@@ -435,6 +472,42 @@ +@@ -440,6 +477,42 @@ texture->texture_ops->texture_cleanup_sub_resources(texture); wined3d_texture_unload_gl_texture(texture); HeapFree(GetProcessHeap(), 0, texture); @@ -6509,7 +6482,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -4268,7 +4268,11 @@ +@@ -4276,7 +4276,11 @@ float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -6521,7 +6494,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c 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; -@@ -5066,7 +5070,11 @@ +@@ -5074,7 +5078,11 @@ break; } } @@ -6808,7 +6781,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -1277,8 +1281,10 @@ +@@ -1280,8 +1284,10 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -6819,7 +6792,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; union wined3d_gl_query_object -@@ -1314,6 +1320,7 @@ +@@ -1317,6 +1323,7 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -6827,7 +6800,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT64 timestamp; }; -@@ -1349,6 +1356,12 @@ +@@ -1352,6 +1359,12 @@ for (i = 0; i < min(dst->rt_size, src->rt_size); i++) dst->render_targets[i] = src->render_targets[i]; } @@ -6840,7 +6813,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context { -@@ -1364,7 +1377,9 @@ +@@ -1367,7 +1380,9 @@ DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -6850,7 +6823,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_swapchain *swapchain; struct -@@ -1472,6 +1487,14 @@ +@@ -1475,6 +1490,14 @@ GLuint dummy_arbfp_prog; }; @@ -6865,7 +6838,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -1610,7 +1633,11 @@ +@@ -1613,7 +1636,11 @@ void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN; void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN; @@ -6877,7 +6850,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; -@@ -2221,7 +2248,11 @@ +@@ -2224,7 +2251,11 @@ struct wined3d_state { DWORD flags; @@ -6889,7 +6862,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]; -@@ -2266,6 +2297,7 @@ +@@ -2269,6 +2300,7 @@ DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; @@ -6897,7 +6870,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_gl_bo { GLuint name; -@@ -2274,6 +2306,7 @@ +@@ -2277,6 +2309,7 @@ UINT size; }; @@ -6905,7 +6878,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 -@@ -2326,11 +2359,23 @@ +@@ -2329,11 +2362,23 @@ struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -6929,7 +6902,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; -@@ -2377,6 +2422,7 @@ +@@ -2380,6 +2425,7 @@ UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -6937,7 +6910,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, -@@ -2388,6 +2434,11 @@ +@@ -2391,6 +2437,11 @@ void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -6949,7 +6922,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) { -@@ -2431,9 +2482,14 @@ +@@ -2434,9 +2485,14 @@ UINT depth; UINT size; DWORD priority; @@ -6964,7 +6937,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2459,7 +2515,9 @@ +@@ -2462,7 +2518,9 @@ const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -6974,7 +6947,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; -@@ -2467,6 +2525,7 @@ +@@ -2470,6 +2528,7 @@ DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN; void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -6982,7 +6955,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline void wined3d_resource_inc_fence(struct wined3d_resource *resource) { InterlockedIncrement(&resource->access_fence); -@@ -2482,6 +2541,7 @@ +@@ -2485,6 +2544,7 @@ while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); } @@ -6990,7 +6963,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16 -@@ -2539,7 +2599,9 @@ +@@ -2542,7 +2602,9 @@ DWORD flags; GLenum target; DWORD update_map_binding; @@ -7000,7 +6973,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; -@@ -2577,8 +2639,12 @@ +@@ -2580,8 +2642,12 @@ unsigned int map_count; DWORD locations; @@ -7013,7 +6986,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2629,6 +2695,7 @@ +@@ -2632,6 +2698,7 @@ 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; @@ -7021,7 +6994,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_gl_bo *swap_buffer, void *swap_heap_memory) DECLSPEC_HIDDEN; -@@ -2639,6 +2706,13 @@ +@@ -2642,6 +2709,13 @@ 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, struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN; @@ -7035,7 +7008,7 @@ 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, -@@ -2649,6 +2723,7 @@ +@@ -2652,6 +2726,7 @@ 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; @@ -7043,14 +7016,13 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h 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, -@@ -2665,6 +2740,16 @@ +@@ -2667,6 +2742,15 @@ 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; +#else /* STAGING_CSMT */ +void wined3d_texture_prepare_texture(struct wined3d_texture *texture, + struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; -+void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN; +void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; +void wined3d_texture_set_swapchain(struct wined3d_texture *texture, + struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7060,7 +7032,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; -@@ -2782,7 +2867,11 @@ +@@ -2784,7 +2868,11 @@ 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; @@ -7071,8 +7043,8 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +#endif /* STAGING_CSMT */ struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; - void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, -@@ -2797,9 +2886,11 @@ + void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, +@@ -2797,9 +2885,11 @@ 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; @@ -7084,7 +7056,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; -@@ -2814,12 +2905,14 @@ +@@ -2814,12 +2904,14 @@ GLuint name; }; @@ -7099,7 +7071,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; -@@ -2848,8 +2941,10 @@ +@@ -2848,8 +2940,10 @@ BOOL half_float_conv_needed; }; @@ -7110,7 +7082,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_saved_states { DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1]; -@@ -2917,6 +3012,7 @@ +@@ -2917,6 +3011,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -7118,12 +7090,12 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2967,6 +3063,32 @@ +@@ -2967,6 +3062,32 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; +#else /* STAGING_CSMT */ -+HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, ++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; +void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -7151,7 +7123,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; -@@ -3015,6 +3137,7 @@ +@@ -3015,6 +3136,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; @@ -7159,7 +7131,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, const struct wined3d_vec4 *constants, UINT vector4f_count, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, -@@ -3082,6 +3205,7 @@ +@@ -3082,6 +3204,7 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7167,7 +7139,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3096,8 +3220,12 @@ +@@ -3096,8 +3219,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -7180,7 +7152,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -3111,12 +3239,16 @@ +@@ -3111,12 +3238,16 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -7197,7 +7169,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 */ -@@ -3143,7 +3275,9 @@ +@@ -3143,7 +3274,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -7207,7 +7179,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3168,6 +3302,7 @@ +@@ -3168,6 +3301,7 @@ 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; @@ -7215,7 +7187,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, -@@ -3177,6 +3312,13 @@ +@@ -3177,6 +3311,13 @@ void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; @@ -7229,7 +7201,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3209,8 +3351,10 @@ +@@ -3209,8 +3350,10 @@ return texture->sub_resources[view->sub_resource_idx].u.surface; } @@ -7240,7 +7212,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -3220,6 +3364,7 @@ +@@ -3220,6 +3363,7 @@ const struct wined3d_parent_ops *parent_ops; }; @@ -7248,7 +7220,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; struct wined3d_swapchain_ops -@@ -3227,6 +3372,12 @@ +@@ -3227,6 +3371,12 @@ void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, DWORD flags, struct wined3d_rendertarget_view *depth_stencil); @@ -7261,7 +7233,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swaphchain); }; -@@ -3262,8 +3413,10 @@ +@@ -3262,8 +3412,10 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7272,7 +7244,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -@@ -3471,7 +3624,9 @@ +@@ -3472,7 +3624,9 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; diff --git a/patches/wininet-Cleanup/0004-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch b/patches/wininet-Cleanup/0004-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch index 74751a9b..26b391dd 100644 --- a/patches/wininet-Cleanup/0004-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch +++ b/patches/wininet-Cleanup/0004-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch @@ -1,4 +1,4 @@ -From b5601ae74c8c528a2c636587a7b8678dfb717b5a Mon Sep 17 00:00:00 2001 +From a283ad7a863862caf312843950b88bdfd9faeacc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 16 May 2015 00:24:35 +0200 Subject: wininet: Strip filename if no path is set in cookie. @@ -11,7 +11,7 @@ be a bit less strict in the test. 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c -index edea9f8..f7c8f76 100644 +index c44156c..7281512 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -764,10 +764,18 @@ static void HTTP_ProcessCookies( http_request_t *request ) @@ -33,13 +33,12 @@ index edea9f8..f7c8f76 100644 EnterCriticalSection( &request->headers_section ); while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, szSet_Cookie, numCookies++, FALSE)) != -1) -@@ -789,11 +797,12 @@ static void HTTP_ProcessCookies( http_request_t *request ) - continue; +@@ -786,10 +794,11 @@ static void HTTP_ProcessCookies( http_request_t *request ) + name = substr(setCookieHeader->lpszValue, data - setCookieHeader->lpszValue); data++; -- set_cookie(request->server->name, request->path, name, data, INTERNET_COOKIE_HTTPONLY); -+ set_cookie(request->server->name, path, name, data, INTERNET_COOKIE_HTTPONLY); - heap_free(name); +- set_cookie(substrz(request->server->name), substrz(request->path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); ++ set_cookie(substrz(request->server->name), substrz(path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); } LeaveCriticalSection( &request->headers_section ); @@ -48,10 +47,10 @@ index edea9f8..f7c8f76 100644 static void strip_spaces(LPWSTR start) diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c -index 1a82aba..ff76e9f 100644 +index b3826bb..910a0b4 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c -@@ -2217,7 +2217,7 @@ static DWORD CALLBACK server_thread(LPVOID param) +@@ -2226,7 +2226,7 @@ static DWORD CALLBACK server_thread(LPVOID param) } if (strstr(buffer, "/testC")) { @@ -60,7 +59,7 @@ index 1a82aba..ff76e9f 100644 send(c, okmsg, sizeof okmsg-1, 0); else send(c, notokmsg, sizeof notokmsg-1, 0); -@@ -3159,7 +3159,7 @@ static void test_header_override(int port) +@@ -3196,7 +3196,7 @@ static void test_header_override(int port) ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed\n"); @@ -69,7 +68,7 @@ index 1a82aba..ff76e9f 100644 InternetCloseHandle(req); req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); -@@ -3168,7 +3168,7 @@ static void test_header_override(int port) +@@ -3205,7 +3205,7 @@ static void test_header_override(int port) ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed\n"); @@ -79,5 +78,5 @@ index 1a82aba..ff76e9f 100644 InternetCloseHandle(req); InternetSetCookieA("http://test.local", "foo", "bar"); -- -2.4.3 +2.8.0 diff --git a/patches/wininet-InternetReadFile/0001-wininet-Return-synchronously-from-InternetReadFile-i.patch b/patches/wininet-InternetReadFile/0001-wininet-Return-synchronously-from-InternetReadFile-i.patch deleted file mode 100644 index 0e4c0932..00000000 --- a/patches/wininet-InternetReadFile/0001-wininet-Return-synchronously-from-InternetReadFile-i.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 85a6e4977cf307dff5ebefa93bb08bc10c9cfb16 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Wed, 11 May 2016 23:25:18 +0200 -Subject: wininet: Return synchronously from InternetReadFile if there is no - more data to read. - -Similar to 87fffa1ebfb71fe7a34aa989fa88f85409dbb62f. - -Signed-off-by: Sebastian Lackner ---- - dlls/wininet/http.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c -index 646619b..c7d857e 100644 ---- a/dlls/wininet/http.c -+++ b/dlls/wininet/http.c -@@ -3242,7 +3242,7 @@ static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW - - if (TryEnterCriticalSection( &req->read_section )) - { -- if (get_avail_data(req)) -+ if (get_avail_data(req) || end_of_read_data(req)) - { - res = HTTPREQ_Read(req, buffer, size, read); - LeaveCriticalSection( &req->read_section ); --- -2.8.0 - diff --git a/patches/wininet-InternetReadFile/definition b/patches/wininet-InternetReadFile/definition deleted file mode 100644 index 4b500565..00000000 --- a/patches/wininet-InternetReadFile/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [40536] Return synchronously from InternetReadFile if there is no more data to read diff --git a/staging/VERSION b/staging/VERSION index 0871e00e..e709d360 100644 --- a/staging/VERSION +++ b/staging/VERSION @@ -1 +1 @@ -Wine Staging 1.9.10 +Wine Staging 1.9.11 (unreleased)