From f8cd6c9ba1856f021acf569033b7f301c0340f9f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 9 Jan 2017 06:33:31 +0100 Subject: [PATCH] Rebase against 7b38d4f9efd899a68d754b83b1b396929549a973. --- ...HidP_TranslateUsagesToI8042ScanCodes.patch | 88 - .../definition | 1 - ...vapi-Improve-AEV_GetVolumeRange-stub.patch | 36 - ...-AEV_SetMasterVolumeLevel-and-AEV_Ge.patch | 10 +- ...ve-AEV_SetMute-and-AEV_GetMute-stubs.patch | 10 +- patches/patchinstall.sh | 23 +- .../wined3d-CSMT_Main/9999-IfDefined.patch | 1562 +++++++---------- 7 files changed, 611 insertions(+), 1119 deletions(-) delete mode 100644 patches/hid-HidP_TranslateUsagesToI8042ScanCodes/0001-hid-Stub-HidP_TranslateUsagesToI8042ScanCodes.patch delete mode 100644 patches/hid-HidP_TranslateUsagesToI8042ScanCodes/definition delete mode 100644 patches/mmdevapi-AEV_Stubs/0001-mmdevapi-Improve-AEV_GetVolumeRange-stub.patch diff --git a/patches/hid-HidP_TranslateUsagesToI8042ScanCodes/0001-hid-Stub-HidP_TranslateUsagesToI8042ScanCodes.patch b/patches/hid-HidP_TranslateUsagesToI8042ScanCodes/0001-hid-Stub-HidP_TranslateUsagesToI8042ScanCodes.patch deleted file mode 100644 index 27ebec4d..00000000 --- a/patches/hid-HidP_TranslateUsagesToI8042ScanCodes/0001-hid-Stub-HidP_TranslateUsagesToI8042ScanCodes.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 830e882a471628e15ac3e6d14ffc864e2d448153 Mon Sep 17 00:00:00 2001 -From: Aric Stewart -Date: Wed, 14 Oct 2015 10:53:42 -0500 -Subject: hid: Stub HidP_TranslateUsagesToI8042ScanCodes - -My whole patch did not send last time for some reason. Here is the whole patch. - -For Bug 39447 - -Signed-off-by: Aric Stewart ---- - dlls/hid/hid.spec | 2 +- - dlls/hid/hidp.c | 13 +++++++++++++ - include/ddk/hidpi.h | 11 +++++++++++ - 3 files changed, 25 insertions(+), 1 deletion(-) - -diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec -index e416762..76df40d 100644 ---- a/dlls/hid/hid.spec -+++ b/dlls/hid/hid.spec -@@ -39,6 +39,6 @@ - @ stub HidP_SetUsageValue - @ stub HidP_SetUsageValueArray - @ stub HidP_SetUsages --@ stub HidP_TranslateUsagesToI8042ScanCodes -+@ stdcall HidP_TranslateUsagesToI8042ScanCodes(ptr long long ptr ptr ptr) - @ stub HidP_UnsetUsages - @ stub HidP_UsageListDifference -diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c -index 3d7a12e..91d4fbe 100644 ---- a/dlls/hid/hidp.c -+++ b/dlls/hid/hidp.c -@@ -23,6 +23,7 @@ - #include - - #define NONAMELESSUNION -+#include "ntstatus.h" - #define WIN32_NO_STATUS - #include "windef.h" - #include "winbase.h" -@@ -519,3 +520,15 @@ ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePag - } - return count; - } -+ -+NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(PUSAGE ChangedUsageList, ULONG UsageListLength, -+ HIDP_KEYBOARD_DIRECTION KeyAction, -+ PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, -+ PHIDP_INSERT_SCANCODES InsertCodesProcedure, -+ PVOID InsertCodesContext) -+{ -+ ERR("(%p, %i, %i, %p, %p, %p): stub\n", ChangedUsageList, UsageListLength, -+ KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext); -+ -+ return STATUS_NOT_IMPLEMENTED; -+} -diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h -index 4cfac61..a14ff80 100644 ---- a/include/ddk/hidpi.h -+++ b/include/ddk/hidpi.h -@@ -136,6 +136,16 @@ typedef struct _HIDP_CAPS - USHORT NumberFeatureDataIndices; - } HIDP_CAPS, *PHIDP_CAPS; - -+typedef enum _HIDP_KEYBOARD_DIRECTION -+{ -+ HidP_Keyboard_Break, -+ HidP_Keyboard_Make -+} HIDP_KEYBOARD_DIRECTION; -+ -+typedef struct _HIDP_KEYBOARD_MODIFIER_STATE HIDP_KEYBOARD_MODIFIER_STATE, *PHIDP_KEYBOARD_MODIFIER_STATE; -+ -+typedef BOOLEAN (WINAPI *PHIDP_INSERT_SCANCODES)(PVOID Context, PCHAR NewScanCodes, ULONG Length); -+ - NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData); - NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities); - NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); -@@ -144,6 +154,7 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS - NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); - ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData); - NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); -+NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(PUSAGE ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, PVOID InsertCodesContext); - - #ifndef FACILITY_HID_ERROR_CODE - #define FACILITY_HID_ERROR_CODE 0x11 --- -2.6.2 - diff --git a/patches/hid-HidP_TranslateUsagesToI8042ScanCodes/definition b/patches/hid-HidP_TranslateUsagesToI8042ScanCodes/definition deleted file mode 100644 index 524b8069..00000000 --- a/patches/hid-HidP_TranslateUsagesToI8042ScanCodes/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [39447] Implement stub for hid.HidP_TranslateUsagesToI8042ScanCodes diff --git a/patches/mmdevapi-AEV_Stubs/0001-mmdevapi-Improve-AEV_GetVolumeRange-stub.patch b/patches/mmdevapi-AEV_Stubs/0001-mmdevapi-Improve-AEV_GetVolumeRange-stub.patch deleted file mode 100644 index f4caf906..00000000 --- a/patches/mmdevapi-AEV_Stubs/0001-mmdevapi-Improve-AEV_GetVolumeRange-stub.patch +++ /dev/null @@ -1,36 +0,0 @@ -From e88178f705163d00848d550641734f0e06855509 Mon Sep 17 00:00:00 2001 -From: Christian Costa -Date: Sun, 8 Feb 2015 11:32:55 +0100 -Subject: mmdevapi: Improve AEV_GetVolumeRange stub. - ---- - dlls/mmdevapi/audiovolume.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c -index 4cc3226..f174f58 100644 ---- a/dlls/mmdevapi/audiovolume.c -+++ b/dlls/mmdevapi/audiovolume.c -@@ -248,11 +248,16 @@ static HRESULT WINAPI AEV_QueryHardwareSupport(IAudioEndpointVolumeEx *iface, DW - - static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc) - { -- TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc); -+ FIXME("(%p)->(%p,%p,%p): stub\n", iface, mindb, maxdb, inc); -+ - if (!mindb || !maxdb || !inc) - return E_POINTER; -- FIXME("stub\n"); -- return E_NOTIMPL; -+ -+ *mindb = 0.0f; -+ *maxdb = 1.0f; -+ *inc = 0.1f; -+ -+ return S_OK; - } - - static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc) --- -2.2.2 - diff --git a/patches/mmdevapi-AEV_Stubs/0002-mmdevapi-Improve-AEV_SetMasterVolumeLevel-and-AEV_Ge.patch b/patches/mmdevapi-AEV_Stubs/0002-mmdevapi-Improve-AEV_SetMasterVolumeLevel-and-AEV_Ge.patch index b5fdcaf2..0fdddaa1 100644 --- a/patches/mmdevapi-AEV_Stubs/0002-mmdevapi-Improve-AEV_SetMasterVolumeLevel-and-AEV_Ge.patch +++ b/patches/mmdevapi-AEV_Stubs/0002-mmdevapi-Improve-AEV_SetMasterVolumeLevel-and-AEV_Ge.patch @@ -1,4 +1,4 @@ -From 542ba5fc717facafe9de075cec17fa115472bc1b Mon Sep 17 00:00:00 2001 +From 7d87ebc6e74f4e95bb1e136d1592c508e1c30416 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Sun, 8 Feb 2015 11:38:17 +0100 Subject: mmdevapi: Improve AEV_SetMasterVolumeLevel and @@ -9,7 +9,7 @@ Subject: mmdevapi: Improve AEV_SetMasterVolumeLevel and 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c -index e6f94a1..4f915ed 100644 +index a49d2e93db2..81224350c76 100644 --- a/dlls/mmdevapi/audiovolume.c +++ b/dlls/mmdevapi/audiovolume.c @@ -43,6 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi); @@ -57,14 +57,14 @@ index e6f94a1..4f915ed 100644 } static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level) -@@ -288,6 +298,7 @@ HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv) +@@ -288,6 +298,7 @@ HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **pp return E_OUTOFMEMORY; This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl; This->ref = 1; + This->level = 1.0f; - *ppv = (IAudioEndpointVolume*)&This->IAudioEndpointVolumeEx_iface; + *ppv = &This->IAudioEndpointVolumeEx_iface; return S_OK; -- -2.4.2 +2.11.0 diff --git a/patches/mmdevapi-AEV_Stubs/0003-mmdevapi-Improve-AEV_SetMute-and-AEV_GetMute-stubs.patch b/patches/mmdevapi-AEV_Stubs/0003-mmdevapi-Improve-AEV_SetMute-and-AEV_GetMute-stubs.patch index 687190cf..da2724ad 100644 --- a/patches/mmdevapi-AEV_Stubs/0003-mmdevapi-Improve-AEV_SetMute-and-AEV_GetMute-stubs.patch +++ b/patches/mmdevapi-AEV_Stubs/0003-mmdevapi-Improve-AEV_SetMute-and-AEV_GetMute-stubs.patch @@ -1,4 +1,4 @@ -From 320a7201538fd7a1774b6a67713a2fa446791238 Mon Sep 17 00:00:00 2001 +From 40b42abcaa94876785b80b22898bfb5e743891ea Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Tue, 10 Feb 2015 20:12:12 +0100 Subject: mmdevapi: Improve AEV_SetMute and AEV_GetMute stubs. @@ -8,7 +8,7 @@ Subject: mmdevapi: Improve AEV_SetMute and AEV_GetMute stubs. 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c -index 4f915ed..f8655db 100644 +index 81224350c76..38be3ce70ec 100644 --- a/dlls/mmdevapi/audiovolume.c +++ b/dlls/mmdevapi/audiovolume.c @@ -44,6 +44,7 @@ typedef struct AEVImpl { @@ -53,14 +53,14 @@ index 4f915ed..f8655db 100644 } static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount) -@@ -299,6 +309,7 @@ HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv) +@@ -299,6 +309,7 @@ HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **pp This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl; This->ref = 1; This->level = 1.0f; + This->mute = FALSE; - *ppv = (IAudioEndpointVolume*)&This->IAudioEndpointVolumeEx_iface; + *ppv = &This->IAudioEndpointVolumeEx_iface; return S_OK; -- -2.4.2 +2.11.0 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index f21c9550..f106546e 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "b1387f9b18cd7e1ca1ddf54ff8ff6fe32c286f44" + echo "7b38d4f9efd899a68d754b83b1b396929549a973" } # Show version information @@ -138,7 +138,6 @@ patch_enable_all () enable_gdi32_MultiMonitor="$1" enable_gdi32_Symbol_Truetype_Font="$1" enable_hal_KeQueryPerformanceCounter="$1" - enable_hid_HidP_TranslateUsagesToI8042ScanCodes="$1" enable_hnetcfg_INetFwAuthorizedApplication="$1" enable_ieframe_IViewObject_Draw="$1" enable_imagehlp_BindImageEx="$1" @@ -510,9 +509,6 @@ patch_enable () hal-KeQueryPerformanceCounter) enable_hal_KeQueryPerformanceCounter="$2" ;; - hid-HidP_TranslateUsagesToI8042ScanCodes) - enable_hid_HidP_TranslateUsagesToI8042ScanCodes="$2" - ;; hnetcfg-INetFwAuthorizedApplication) enable_hnetcfg_INetFwAuthorizedApplication="$2" ;; @@ -3108,21 +3104,6 @@ if test "$enable_hal_KeQueryPerformanceCounter" -eq 1; then ) >> "$patchlist" fi -# Patchset hid-HidP_TranslateUsagesToI8042ScanCodes -# | -# | This patchset fixes the following Wine bugs: -# | * [#39447] Implement stub for hid.HidP_TranslateUsagesToI8042ScanCodes -# | -# | Modified files: -# | * dlls/hid/hid.spec, dlls/hid/hidp.c, include/ddk/hidpi.h -# | -if test "$enable_hid_HidP_TranslateUsagesToI8042ScanCodes" -eq 1; then - patch_apply hid-HidP_TranslateUsagesToI8042ScanCodes/0001-hid-Stub-HidP_TranslateUsagesToI8042ScanCodes.patch - ( - echo '+ { "Aric Stewart", "hid: Stub HidP_TranslateUsagesToI8042ScanCodes.", 1 },'; - ) >> "$patchlist" -fi - # Patchset hnetcfg-INetFwAuthorizedApplication # | # | Modified files: @@ -3631,11 +3612,9 @@ fi # | * dlls/mmdevapi/audiovolume.c # | if test "$enable_mmdevapi_AEV_Stubs" -eq 1; then - patch_apply mmdevapi-AEV_Stubs/0001-mmdevapi-Improve-AEV_GetVolumeRange-stub.patch patch_apply mmdevapi-AEV_Stubs/0002-mmdevapi-Improve-AEV_SetMasterVolumeLevel-and-AEV_Ge.patch patch_apply mmdevapi-AEV_Stubs/0003-mmdevapi-Improve-AEV_SetMute-and-AEV_GetMute-stubs.patch ( - echo '+ { "Christian Costa", "mmdevapi: Improve AEV_GetVolumeRange stub.", 1 },'; echo '+ { "Christian Costa", "mmdevapi: Improve AEV_SetMasterVolumeLevel and AEV_GetMasterVolumeLevel stubs.", 1 },'; echo '+ { "Christian Costa", "mmdevapi: Improve AEV_SetMute and AEV_GetMute stubs.", 1 },'; ) >> "$patchlist" diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 078c566c..259c8082 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -1023,122 +1023,39 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -2880,197 +2940,971 @@ - /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, - /* WINED3D_CS_OP_SKIP */ wined3d_cs_exec_skip, - /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -- /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, -- /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, -- /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, -- /* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication, -- /* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport, -- /* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect, -- /* WINED3D_CS_OP_SET_RENDERTARGET_VIEW */ wined3d_cs_exec_set_rendertarget_view, -- /* WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW */ wined3d_cs_exec_set_depth_stencil_view, -- /* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration, -- /* WINED3D_CS_OP_SET_STREAM_SOURCE */ wined3d_cs_exec_set_stream_source, -- /* WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ */ wined3d_cs_exec_set_stream_source_freq, -- /* WINED3D_CS_OP_SET_STREAM_OUTPUT */ wined3d_cs_exec_set_stream_output, -- /* WINED3D_CS_OP_SET_INDEX_BUFFER */ wined3d_cs_exec_set_index_buffer, -- /* WINED3D_CS_OP_SET_CONSTANT_BUFFER */ wined3d_cs_exec_set_constant_buffer, -- /* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture, -- /* WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW */ wined3d_cs_exec_set_shader_resource_view, -- /* WINED3D_CS_OP_SET_SAMPLER */ wined3d_cs_exec_set_sampler, -- /* WINED3D_CS_OP_SET_SHADER */ wined3d_cs_exec_set_shader, -- /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state, -- /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state, -- /* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state, -- /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform, -- /* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane, -- /* 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, -- /* 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, -- /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i, -- /* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f, -- /* WINED3D_CS_OP_SET_PS_CONSTS_B */ wined3d_cs_exec_set_ps_consts_b, -- /* WINED3D_CS_OP_SET_PS_CONSTS_I */ wined3d_cs_exec_set_ps_consts_i, -- /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, -- /* 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, -- /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light, -- /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, -- /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, -- /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, -- /* WINED3D_CS_OP_RESOURCE_CHANGED */ wined3d_cs_exec_resource_changed, -- /* WINED3D_CS_OP_RESOURCE_MAP */ wined3d_cs_exec_resource_map, -- /* WINED3D_CS_OP_RESOURCE_UNMAP */ wined3d_cs_exec_resource_unmap, -- /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, -- /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, -- /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, -- /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, -- /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, -- /* WINED3D_CS_OP_UPDATE_SURFACE */ wined3d_cs_exec_update_surface, -- /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, -- /* WINED3D_CS_OP_SURFACE_PRELOAD */ wined3d_cs_exec_surface_preload, -- /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, -- /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, -- /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, -- /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, -- /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, -- /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, -- /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, -- /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, -- /* WINED3D_CS_OP_VOLUME_CLEANUP */ wined3d_cs_exec_volume_cleanup, -- /* WINED3D_CS_OP_SURFACE_CLEANUP */ wined3d_cs_exec_surface_cleanup, -- /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, -- /* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures, -- /* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context, -- /* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts, -- /* WINED3D_CS_OP_GETDC */ wined3d_cs_exec_getdc, -- /* WINED3D_CS_OP_RELEASEDC */ wined3d_cs_exec_releasedc, -- /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, -- /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, --}; -- --static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) +@@ -664,6 +724,18 @@ + wined3d_resource_dec_fence(&swapchain->back_buffers[i]->resource); + + return sizeof(*op); +#else /* STAGING_CSMT */ +static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) - { -- struct wined3d_cs_queue *queue = prio ? &cs->prio_queue : &cs->queue; -- size_t queue_size = sizeof(queue->data) / sizeof(*queue->data); ++{ + const struct wined3d_cs_present *op = data; + struct wined3d_swapchain *swapchain; - -- if (queue_size - size < queue->head) -- { -- struct wined3d_cs_skip *skip; -- size_t nop_size = queue_size - queue->head; ++ + swapchain = op->swapchain; + wined3d_swapchain_set_window(swapchain, op->dst_window_override); - -- skip = _wined3d_cs_mt_require_space(cs, nop_size, prio); -- if (nop_size < sizeof(*skip)) -- { -- skip->opcode = WINED3D_CS_OP_NOP; -- } -- else -- { -- skip->opcode = WINED3D_CS_OP_SKIP; -- skip->size = nop_size; -- } ++ + swapchain->swapchain_ops->swapchain_present(swapchain, + op->src_rect, op->dst_rect, op->dirty_region, op->flags); -+} ++#endif /* STAGING_CSMT */ + } -- if (prio) -- cs->ops->submit_prio(cs, nop_size); -- else -- cs->ops->submit(cs, nop_size); -+void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -+ const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, -+ const RGNDATA *dirty_region, DWORD flags) -+{ -+ struct wined3d_cs_present *op; + void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, +@@ -671,6 +743,7 @@ + const RGNDATA *dirty_region, DWORD flags) + { + struct wined3d_cs_present *op; ++#if defined(STAGING_CSMT) + LONG pending; + unsigned int i; -- assert(!queue->head); -- } +@@ -851,6 +924,63 @@ + struct wined3d_cs_draw *op; + unsigned int i; + const struct wined3d_state *state = &cs->device->state; ++#else /* STAGING_CSMT */ ++ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_PRESENT; + op->dst_window_override = dst_window_override; @@ -1147,47 +1064,26 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + op->dst_rect = dst_rect; + op->dirty_region = dirty_region; + op->flags = flags; - -- while(1) -- { -- LONG head = queue->head; -- LONG tail = *((volatile LONG *)&queue->tail); -- LONG new_pos; -- /* Empty */ -- if (head == tail) -- break; -- /* Head ahead of tail, take care of wrap-around */ -- new_pos = (head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -- if (head > tail && (new_pos || tail)) -- break; -- /* Tail ahead of head, but still enough space */ -- if (new_pos < tail && new_pos) -- break; ++ + cs->ops->submit(cs); +} - -- TRACE("Waiting for free space. Head %u, tail %u, want %u\n", head, tail, -- (unsigned int) size); -- } ++ +static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_clear *op = data; + struct wined3d_device *device; + RECT draw_rect; - -- return &queue->data[queue->head]; ++ + device = cs->device; + wined3d_get_draw_rect(&device->state, &draw_rect); + device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, + &device->fb, op->rect_count, op->rects, &draw_rect, op->flags, + op->color, op->depth, op->stencil); - } - --static inline void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) ++} ++ +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) - { -- return _wined3d_cs_mt_require_space(cs, size, FALSE); ++{ + struct wined3d_cs_clear *op; + + op = cs->ops->require_space(cs, sizeof(*op)); @@ -1200,111 +1096,89 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + op->stencil = stencil; + + cs->ops->submit(cs); - } - --static inline void *wined3d_cs_mt_require_space_prio(struct wined3d_cs *cs, size_t size) ++} ++ +static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) - { -- return _wined3d_cs_mt_require_space(cs, size, TRUE); ++{ + const struct wined3d_cs_draw *op = data; + + draw_primitive(cs->device, op->start_idx, op->index_count, + op->start_instance, op->instance_count, op->indexed); - } - --/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -- * OP itself. */ --static void wined3d_cs_emit_stop(struct wined3d_cs *cs) ++} ++ +void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_count, + UINT start_instance, UINT instance_count, BOOL indexed) - { -- struct wined3d_cs_stop *op; ++{ + struct wined3d_cs_draw *op; ++#endif /* STAGING_CSMT */ -- op = wined3d_cs_mt_require_space(cs, sizeof(*op)); -- op->opcode = WINED3D_CS_OP_STOP; -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_DRAW; -+ op->start_idx = start_idx; -+ op->index_count = index_count; -+ op->start_instance = start_instance; -+ op->instance_count = instance_count; -+ op->indexed = indexed; + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_DRAW; +@@ -860,6 +990,7 @@ + op->instance_count = instance_count; + op->indexed = indexed; -- wined3d_cs_mt_submit(cs, sizeof(*op)); -+ cs->ops->submit(cs); - } ++#if defined(STAGING_CSMT) + if (indexed) + { + wined3d_resource_inc_fence(&state->index_buffer->resource); +@@ -897,6 +1028,17 @@ + cs->state.predicate_value = op->value; --static void wined3d_cs_mt_finish(struct wined3d_cs *cs) -+static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data) - { -- BOOL fence; -- -- if (cs->thread_id == GetCurrentThreadId()) -- { -- static BOOL once; -- if (!once) -- { -- FIXME("flush_and_wait called from cs thread\n"); -- once = TRUE; -- } -- return; -- } -- -- wined3d_cs_emit_fence(cs, &fence); -+ const struct wined3d_cs_set_predication *op = data; - -- /* A busy wait should be fine, we're not supposed to have to wait very -- * long. */ -- while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); -+ cs->state.predicate = op->predicate; -+ cs->state.predicate_value = op->value; - } - --static void wined3d_cs_mt_finish_prio(struct wined3d_cs *cs) -+void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) - { -- BOOL fence; -+ struct wined3d_cs_set_predication *op; - -- if (cs->thread_id == GetCurrentThreadId()) -- { -- static BOOL once; -- if (!once) -- { -- FIXME("flush_and_wait called from cs thread\n"); -- once = TRUE; -- } -- return; -- } -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_PREDICATION; -+ op->predicate = predicate; -+ op->value = value; - -- wined3d_cs_emit_fence_prio(cs, &fence); + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} ++ ++static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data) ++{ ++ const struct wined3d_cs_set_predication *op = data; ++ ++ cs->state.predicate = op->predicate; ++ cs->state.predicate_value = op->value; ++#endif /* STAGING_CSMT */ + } -- /* A busy wait should be fine, we're not supposed to have to wait very -- * long. */ -- while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); + void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) +@@ -908,6 +1050,7 @@ + op->predicate = predicate; + op->value = value; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -920,6 +1063,17 @@ + device_invalidate_state(device, STATE_VIEWPORT); + + return sizeof(*op); ++#else /* STAGING_CSMT */ ++ cs->ops->submit(cs); ++} ++ +static void wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_set_viewport *op = data; + + cs->state.viewport = *op->viewport; + device_invalidate_state(cs->device, STATE_VIEWPORT); ++#endif /* STAGING_CSMT */ } --static const struct wined3d_cs_ops wined3d_cs_mt_ops = -+void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) - { -- wined3d_cs_mt_require_space, -+ struct wined3d_cs_set_viewport *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_VIEWPORT; + void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) +@@ -928,6 +1082,7 @@ + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_VIEWPORT; ++#if defined(STAGING_CSMT) + op->viewport = *viewport; + + cs->ops->submit(cs, sizeof(*op)); +@@ -941,6 +1096,19 @@ + device_invalidate_state(cs->device, STATE_SCISSORRECT); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + op->viewport = viewport; + + cs->ops->submit(cs); @@ -1316,14 +1190,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.scissor_rect = *op->rect; + device_invalidate_state(cs->device, STATE_SCISSORRECT); -+} -+ -+void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -+{ -+ struct wined3d_cs_set_scissor_rect *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -949,6 +1117,7 @@ + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; ++#if defined(STAGING_CSMT) + op->rect = *rect; + + cs->ops->submit(cs, sizeof(*op)); +@@ -962,6 +1131,19 @@ + device_invalidate_state(cs->device, STATE_FRAMEBUFFER); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + op->rect = rect; + + cs->ops->submit(cs); @@ -1335,18 +1218,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.fb->render_targets[op->view_idx] = op->view; + device_invalidate_state(cs->device, STATE_FRAMEBUFFER); -+} -+ -+void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -+ struct wined3d_rendertarget_view *view) -+{ -+ struct wined3d_cs_set_rendertarget_view *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW; -+ op->view_idx = view_idx; -+ op->view = view; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, +@@ -974,6 +1156,7 @@ + op->view_idx = view_idx; + op->view = view; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -984,6 +1167,18 @@ + struct wined3d_rendertarget_view *prev; + + if ((prev = cs->state.fb.depth_stencil)) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1357,13 +1245,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + struct wined3d_rendertarget_view *prev; + + if ((prev = cs->state.fb->depth_stencil)) -+ { -+ struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -+ -+ if (prev_surface && (device->swapchains[0]->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL -+ || prev_surface->flags & SFLAG_DISCARD)) -+ { -+ surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); ++#endif /* STAGING_CSMT */ + { + struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); + +@@ -991,6 +1186,7 @@ + || prev_surface->flags & SFLAG_DISCARD)) + { + surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); ++#if defined(STAGING_CSMT) + if (prev_surface == cs->onscreen_depth_stencil) + { + wined3d_texture_decref(cs->onscreen_depth_stencil->container); +@@ -1000,6 +1196,17 @@ + } + + cs->state.fb.depth_stencil = op->view; ++#else /* STAGING_CSMT */ + if (prev_surface == device->onscreen_depth_stencil) + { + wined3d_texture_decref(device->onscreen_depth_stencil->container); @@ -1373,32 +1271,34 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + } + + cs->fb.depth_stencil = op->view; -+ -+ if (!prev != !op->view) -+ { -+ /* Swapping NULL / non NULL depth stencil affects the depth and tests */ -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_ZENABLE)); -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILENABLE)); -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK)); -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); -+ } -+ else if (prev && (prev->format_flags & WINED3DFMT_FLAG_FLOAT) -+ != (op->view->format_flags & WINED3DFMT_FLAG_FLOAT)) -+ { -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); -+ } -+ -+ device_invalidate_state(device, STATE_FRAMEBUFFER); -+} -+ -+void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -+{ -+ struct wined3d_cs_set_depth_stencil_view *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; -+ op->view = view; -+ ++#endif /* STAGING_CSMT */ + + if (!prev != !op->view) + { +@@ -1016,8 +1223,10 @@ + } + + device_invalidate_state(device, STATE_FRAMEBUFFER); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) +@@ -1028,6 +1237,7 @@ + op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; + op->view = view; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1039,6 +1249,17 @@ + device_invalidate_state(cs->device, STATE_VDECL); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1408,255 +1308,196 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.vertex_declaration = op->declaration; + device_invalidate_state(cs->device, STATE_VDECL); -+} -+ -+void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -+{ -+ struct wined3d_cs_set_vertex_declaration *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; -+ op->declaration = declaration; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) +@@ -1049,10 +1270,17 @@ + op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; + op->declaration = declaration; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_stream_source *op = data; -+ struct wined3d_stream_state *stream; -+ struct wined3d_buffer *prev; -+ -+ stream = &cs->state.streams[op->stream_idx]; -+ prev = stream->buffer; -+ stream->buffer = op->buffer; -+ stream->offset = op->offset; -+ stream->stride = op->stride; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+ -+ device_invalidate_state(cs->device, STATE_STREAMSRC); -+} -+ -+void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -+ struct wined3d_buffer *buffer, UINT offset, UINT stride) -+{ -+ struct wined3d_cs_set_stream_source *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE; -+ op->stream_idx = stream_idx; -+ op->buffer = buffer; -+ op->offset = offset; -+ op->stride = stride; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_stream_source *op = data; + struct wined3d_stream_state *stream; +@@ -1070,8 +1298,10 @@ + InterlockedDecrement(&prev->resource.bind_count); + + device_invalidate_state(cs->device, STATE_STREAMSRC); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -1086,10 +1316,17 @@ + op->offset = offset; + op->stride = stride; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_stream_source_freq *op = data; -+ struct wined3d_stream_state *stream; -+ -+ stream = &cs->state.streams[op->stream_idx]; -+ stream->frequency = op->frequency; -+ stream->flags = op->flags; -+ -+ device_invalidate_state(cs->device, STATE_STREAMSRC); -+} -+ -+void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -+{ -+ struct wined3d_cs_set_stream_source_freq *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ; -+ op->stream_idx = stream_idx; -+ op->frequency = frequency; -+ op->flags = flags; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_stream_source_freq *op = data; + struct wined3d_stream_state *stream; +@@ -1099,8 +1336,10 @@ + stream->flags = op->flags; + + device_invalidate_state(cs->device, STATE_STREAMSRC); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) +@@ -1113,10 +1352,17 @@ + op->frequency = frequency; + op->flags = flags; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_stream_output *op = data; -+ struct wined3d_stream_output *stream; -+ struct wined3d_buffer *prev; -+ -+ stream = &cs->state.stream_output[op->stream_idx]; -+ prev = stream->buffer; -+ stream->buffer = op->buffer; -+ stream->offset = op->offset; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+} -+ -+void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -+ struct wined3d_buffer *buffer, UINT offset) -+{ -+ struct wined3d_cs_set_stream_output *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_STREAM_OUTPUT; -+ op->stream_idx = stream_idx; -+ op->buffer = buffer; -+ op->offset = offset; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_stream_output *op = data; + struct wined3d_stream_output *stream; +@@ -1131,8 +1377,10 @@ + InterlockedIncrement(&op->buffer->resource.bind_count); + if (prev) + InterlockedDecrement(&prev->resource.bind_count); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -1146,10 +1394,17 @@ + op->buffer = buffer; + op->offset = offset; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_index_buffer *op = data; -+ struct wined3d_buffer *prev; -+ -+ prev = cs->state.index_buffer; -+ cs->state.index_buffer = op->buffer; -+ cs->state.index_format = op->format_id; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+ -+ device_invalidate_state(cs->device, STATE_INDEXBUFFER); -+} -+ -+void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -+ enum wined3d_format_id format_id) -+{ -+ struct wined3d_cs_set_index_buffer *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_INDEX_BUFFER; -+ op->buffer = buffer; -+ op->format_id = format_id; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_index_buffer *op = data; + struct wined3d_buffer *prev; +@@ -1164,8 +1419,10 @@ + InterlockedDecrement(&prev->resource.bind_count); + + device_invalidate_state(cs->device, STATE_INDEXBUFFER); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, +@@ -1178,10 +1435,17 @@ + op->buffer = buffer; + op->format_id = format_id; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_constant_buffer *op = data; -+ struct wined3d_buffer *prev; -+ -+ prev = cs->state.cb[op->type][op->cb_idx]; -+ cs->state.cb[op->type][op->cb_idx] = op->buffer; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+ -+ device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); -+} -+ -+void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -+ UINT cb_idx, struct wined3d_buffer *buffer) -+{ -+ struct wined3d_cs_set_constant_buffer *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_CONSTANT_BUFFER; -+ op->type = type; -+ op->cb_idx = cb_idx; -+ op->buffer = buffer; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_constant_buffer *op = data; + struct wined3d_buffer *prev; +@@ -1195,7 +1459,9 @@ + InterlockedDecrement(&prev->resource.bind_count); + + device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); ++#if defined(STAGING_CSMT) + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, +@@ -1209,10 +1475,17 @@ + op->cb_idx = cb_idx; + op->buffer = buffer; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -+ const struct wined3d_cs_set_texture *op = data; -+ struct wined3d_texture *prev; -+ BOOL old_use_color_key = FALSE, new_use_color_key = FALSE; -+ -+ prev = cs->state.textures[op->stage]; -+ cs->state.textures[op->stage] = op->texture; -+ -+ if (op->texture) -+ { -+ const struct wined3d_format *new_format = op->texture->resource.format; -+ const struct wined3d_format *old_format = prev ? prev->resource.format : NULL; -+ unsigned int old_fmt_flags = prev ? prev->resource.format_flags : 0; -+ unsigned int new_fmt_flags = op->texture->resource.format_flags; -+ -+ if (InterlockedIncrement(&op->texture->resource.bind_count) == 1) -+ op->texture->sampler = op->stage; -+ -+ if (!prev || op->texture->target != prev->target -+ || !is_same_fixup(new_format->color_fixup, old_format->color_fixup) -+ || (new_fmt_flags & WINED3DFMT_FLAG_SHADOW) != (old_fmt_flags & WINED3DFMT_FLAG_SHADOW)) -+ device_invalidate_state(cs->device, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL)); -+ -+ if (!prev && op->stage < d3d_info->limits.ffp_blend_stages) -+ { -+ /* The source arguments for color and alpha ops have different -+ * meanings when a NULL texture is bound, so the COLOR_OP and -+ * ALPHA_OP have to be dirtified. */ -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_COLOR_OP)); -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_ALPHA_OP)); -+ } -+ -+ if (!op->stage && op->texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT) -+ new_use_color_key = TRUE; -+ } -+ -+ if (prev) -+ { -+ if (InterlockedDecrement(&prev->resource.bind_count) && prev->sampler == op->stage) -+ { -+ unsigned int i; -+ -+ /* Search for other stages the texture is bound to. Shouldn't -+ * happen if applications bind textures to a single stage only. */ -+ TRACE("Searching for other stages the texture is bound to.\n"); -+ for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) -+ { -+ if (cs->state.textures[i] == prev) -+ { -+ TRACE("Texture is also bound to stage %u.\n", i); -+ prev->sampler = i; -+ break; -+ } -+ } -+ } -+ -+ if (!op->texture && op->stage < d3d_info->limits.ffp_blend_stages) -+ { -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_COLOR_OP)); -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_ALPHA_OP)); -+ } -+ -+ if (!op->stage && prev->async.color_key_flags & WINED3D_CKEY_SRC_BLT) -+ old_use_color_key = TRUE; -+ } -+ -+ device_invalidate_state(cs->device, STATE_SAMPLER(op->stage)); -+ -+ if (new_use_color_key != old_use_color_key) -+ device_invalidate_state(cs->device, STATE_RENDER(WINED3D_RS_COLORKEYENABLE)); -+ -+ if (new_use_color_key) -+ device_invalidate_state(cs->device, STATE_COLOR_KEY); -+} -+ -+void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -+{ -+ struct wined3d_cs_set_texture *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_TEXTURE; -+ op->stage = stage; -+ op->texture = texture; ++#endif /* STAGING_CSMT */ + { + const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; + const struct wined3d_cs_set_texture *op = data; +@@ -1287,8 +1560,10 @@ + + if (new_use_color_key) + device_invalidate_state(cs->device, STATE_COLOR_KEY); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) +@@ -1299,6 +1574,7 @@ + op->opcode = WINED3D_CS_OP_SET_TEXTURE; + op->stage = stage; + op->texture = texture; ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1310,6 +1586,18 @@ + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + + cs->ops->submit(cs); +} @@ -1667,19 +1508,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.shader_resource_view[op->type][op->view_idx] = op->view; + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); -+} -+ -+void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -+ UINT view_idx, struct wined3d_shader_resource_view *view) -+{ -+ struct wined3d_cs_set_shader_resource_view *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW; -+ op->type = type; -+ op->view_idx = view_idx; -+ op->view = view; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, +@@ -1323,6 +1611,7 @@ + op->view_idx = view_idx; + op->view = view; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1334,6 +1623,17 @@ + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1689,19 +1534,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.sampler[op->type][op->sampler_idx] = op->sampler; + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); -+} -+ -+void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -+ UINT sampler_idx, struct wined3d_sampler *sampler) -+{ -+ struct wined3d_cs_set_sampler *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SAMPLER; -+ op->type = type; -+ op->sampler_idx = sampler_idx; -+ op->sampler = sampler; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, +@@ -1347,6 +1647,7 @@ + op->sampler_idx = sampler_idx; + op->sampler = sampler; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1359,6 +1660,18 @@ + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1712,17 +1561,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->state.shader[op->type] = op->shader; + device_invalidate_state(cs->device, STATE_SHADER(op->type)); + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); -+} -+ -+void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -+{ -+ struct wined3d_cs_set_shader *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SHADER; -+ op->type = type; -+ op->shader = shader; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) +@@ -1370,6 +1683,7 @@ + op->type = type; + op->shader = shader; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1441,6 +1755,17 @@ + device_invalidate_state(cs->device, STATE_RENDER(op->state)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1732,17 +1587,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.render_states[op->state] = op->value; + device_invalidate_state(cs->device, STATE_RENDER(op->state)); -+} -+ -+void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -+{ -+ struct wined3d_cs_set_render_state *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_RENDER_STATE; -+ op->state = state; -+ op->value = value; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) +@@ -1452,6 +1777,7 @@ + op->state = state; + op->value = value; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1579,6 +1905,17 @@ + device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1752,19 +1613,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.texture_states[op->stage][op->state] = op->value; + device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); -+} -+ -+void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -+ enum wined3d_texture_stage_state state, DWORD value) -+{ -+ struct wined3d_cs_set_texture_state *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE; -+ op->stage = stage; -+ op->state = state; -+ op->value = value; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1592,6 +1929,7 @@ + op->state = state; + op->value = value; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1603,6 +1941,17 @@ + device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1774,19 +1639,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.sampler_states[op->sampler_idx][op->state] = op->value; + device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); -+} -+ -+void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -+ enum wined3d_sampler_state state, DWORD value) -+{ -+ struct wined3d_cs_set_sampler_state *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE; -+ op->sampler_idx = sampler_idx; -+ op->state = state; -+ op->value = value; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1616,6 +1965,7 @@ + op->state = state; + op->value = value; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1628,6 +1978,18 @@ + device_invalidate_state(cs->device, STATE_TRANSFORM(op->state)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1797,16 +1666,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->state.transforms[op->state] = *op->matrix; + if (op->state < WINED3D_TS_WORLD_MATRIX(cs->device->adapter->d3d_info.limits.ffp_vertex_blend_matrices)) + device_invalidate_state(cs->device, STATE_TRANSFORM(op->state)); -+} -+ -+void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -+ const struct wined3d_matrix *matrix) -+{ -+ struct wined3d_cs_set_transform *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_TRANSFORM; -+ op->state = state; ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, +@@ -1638,6 +2000,7 @@ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_TRANSFORM; + op->state = state; ++#if defined(STAGING_CSMT) + op->matrix = *matrix; + + cs->ops->submit(cs, sizeof(*op)); +@@ -1651,6 +2014,19 @@ + device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + op->matrix = matrix; + + cs->ops->submit(cs); @@ -1818,100 +1694,56 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.clip_planes[op->plane_idx] = *op->plane; + device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx)); -+} -+ -+void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -+{ -+ struct wined3d_cs_set_clip_plane *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE; -+ op->plane_idx = plane_idx; ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) +@@ -1660,12 +2036,21 @@ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE; + op->plane_idx = plane_idx; ++#if defined(STAGING_CSMT) + op->plane = *plane; + + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + op->plane = plane; + + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_color_key *op = data; -+ struct wined3d_texture *texture = op->texture; -+ -+ if (op->set) -+ { -+ switch (op->flags) -+ { -+ case WINED3D_CKEY_DST_BLT: -+ texture->async.dst_blt_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_DST_BLT; -+ break; -+ -+ case WINED3D_CKEY_DST_OVERLAY: -+ texture->async.dst_overlay_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_DST_OVERLAY; -+ break; -+ -+ case WINED3D_CKEY_SRC_BLT: -+ if (texture == cs->state.textures[0]) -+ { -+ device_invalidate_state(cs->device, STATE_COLOR_KEY); -+ if (!(texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT)) -+ device_invalidate_state(cs->device, STATE_RENDER(WINED3D_RS_COLORKEYENABLE)); -+ } -+ -+ texture->async.src_blt_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_SRC_BLT; -+ break; -+ -+ case WINED3D_CKEY_SRC_OVERLAY: -+ texture->async.src_overlay_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_SRC_OVERLAY; -+ break; -+ } -+ } -+ else -+ { -+ switch (op->flags) -+ { -+ case WINED3D_CKEY_DST_BLT: -+ texture->async.color_key_flags &= ~WINED3D_CKEY_DST_BLT; -+ break; -+ -+ case WINED3D_CKEY_DST_OVERLAY: -+ texture->async.color_key_flags &= ~WINED3D_CKEY_DST_OVERLAY; -+ break; -+ -+ case WINED3D_CKEY_SRC_BLT: -+ if (texture == cs->state.textures[0] && texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT) -+ device_invalidate_state(cs->device, STATE_RENDER(WINED3D_RS_COLORKEYENABLE)); -+ -+ texture->async.color_key_flags &= ~WINED3D_CKEY_SRC_BLT; -+ break; -+ -+ case WINED3D_CKEY_SRC_OVERLAY: -+ texture->async.color_key_flags &= ~WINED3D_CKEY_SRC_OVERLAY; -+ break; -+ } -+ } -+} -+ -+void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -+ WORD flags, const struct wined3d_color_key *color_key) -+{ -+ struct wined3d_cs_set_color_key *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_COLOR_KEY; -+ op->texture = texture; -+ op->flags = flags; -+ if (color_key) -+ { -+ op->color_key = *color_key; -+ op->set = 1; -+ } -+ else -+ op->set = 0; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_color_key *op = data; + struct wined3d_texture *texture = op->texture; +@@ -1726,8 +2111,10 @@ + break; + } + } ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, +@@ -1747,6 +2134,7 @@ + else + op->set = 0; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1758,6 +2146,17 @@ + device_invalidate_state(cs->device, STATE_MATERIAL); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1921,14 +1753,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.material = *op->material; + device_invalidate_state(cs->device, STATE_MATERIAL); -+} -+ -+void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -+{ -+ struct wined3d_cs_set_material *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_MATERIAL; ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) +@@ -1766,6 +2165,7 @@ + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_MATERIAL; ++#if defined(STAGING_CSMT) + op->material = *material; + + cs->ops->submit(cs, sizeof(*op)); +@@ -1783,6 +2183,23 @@ + ERR("Failed to initialize CS state, hr %#x.\n", hr); + + return sizeof(struct wined3d_cs_reset_state); ++#else /* STAGING_CSMT */ + op->material = material; + + cs->ops->submit(cs); @@ -1944,217 +1785,41 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + 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); -+} -+ -+void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -+{ -+ struct wined3d_cs_reset_state *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_RESET_STATE; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1792,6 +2209,7 @@ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_RESET_STATE; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -2880,6 +3298,13 @@ + /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, + /* WINED3D_CS_OP_SKIP */ wined3d_cs_exec_skip, + /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = +{ +#endif /* STAGING_CSMT */ -+ /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, -+ /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, -+ /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, -+ /* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication, -+ /* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport, -+ /* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect, -+ /* WINED3D_CS_OP_SET_RENDERTARGET_VIEW */ wined3d_cs_exec_set_rendertarget_view, -+ /* WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW */ wined3d_cs_exec_set_depth_stencil_view, -+ /* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration, -+ /* WINED3D_CS_OP_SET_STREAM_SOURCE */ wined3d_cs_exec_set_stream_source, -+ /* WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ */ wined3d_cs_exec_set_stream_source_freq, -+ /* WINED3D_CS_OP_SET_STREAM_OUTPUT */ wined3d_cs_exec_set_stream_output, -+ /* WINED3D_CS_OP_SET_INDEX_BUFFER */ wined3d_cs_exec_set_index_buffer, -+ /* WINED3D_CS_OP_SET_CONSTANT_BUFFER */ wined3d_cs_exec_set_constant_buffer, -+ /* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture, -+ /* WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW */ wined3d_cs_exec_set_shader_resource_view, -+ /* WINED3D_CS_OP_SET_SAMPLER */ wined3d_cs_exec_set_sampler, -+ /* WINED3D_CS_OP_SET_SHADER */ wined3d_cs_exec_set_shader, -+ /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state, -+ /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state, -+ /* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state, -+ /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform, -+ /* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane, -+ /* 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, + /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, + /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, + /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, +@@ -2906,6 +3331,7 @@ + /* 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, +#if defined(STAGING_CSMT) -+ /* 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, -+ /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i, -+ /* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f, -+ /* WINED3D_CS_OP_SET_PS_CONSTS_B */ wined3d_cs_exec_set_ps_consts_b, -+ /* WINED3D_CS_OP_SET_PS_CONSTS_I */ wined3d_cs_exec_set_ps_consts_i, -+ /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, -+ /* 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, -+ /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light, -+ /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, -+ /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, -+ /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, -+ /* WINED3D_CS_OP_RESOURCE_CHANGED */ wined3d_cs_exec_resource_changed, -+ /* WINED3D_CS_OP_RESOURCE_MAP */ wined3d_cs_exec_resource_map, -+ /* WINED3D_CS_OP_RESOURCE_UNMAP */ wined3d_cs_exec_resource_unmap, -+ /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, -+ /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, -+ /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, -+ /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, -+ /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, -+ /* WINED3D_CS_OP_UPDATE_SURFACE */ wined3d_cs_exec_update_surface, -+ /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, -+ /* WINED3D_CS_OP_SURFACE_PRELOAD */ wined3d_cs_exec_surface_preload, -+ /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, -+ /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, -+ /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, -+ /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, -+ /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, -+ /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, -+ /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, -+ /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, -+ /* WINED3D_CS_OP_VOLUME_CLEANUP */ wined3d_cs_exec_volume_cleanup, -+ /* WINED3D_CS_OP_SURFACE_CLEANUP */ wined3d_cs_exec_surface_cleanup, -+ /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, -+ /* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures, -+ /* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context, -+ /* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts, -+ /* WINED3D_CS_OP_GETDC */ wined3d_cs_exec_getdc, -+ /* WINED3D_CS_OP_RELEASEDC */ wined3d_cs_exec_releasedc, -+ /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, -+ /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, -+}; -+ -+static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) -+{ -+ struct wined3d_cs_queue *queue = prio ? &cs->prio_queue : &cs->queue; -+ size_t queue_size = sizeof(queue->data) / sizeof(*queue->data); -+ -+ if (queue_size - size < queue->head) -+ { -+ struct wined3d_cs_skip *skip; -+ size_t nop_size = queue_size - queue->head; -+ -+ skip = _wined3d_cs_mt_require_space(cs, nop_size, prio); -+ if (nop_size < sizeof(*skip)) -+ { -+ skip->opcode = WINED3D_CS_OP_NOP; -+ } -+ else -+ { -+ skip->opcode = WINED3D_CS_OP_SKIP; -+ skip->size = nop_size; -+ } -+ -+ if (prio) -+ cs->ops->submit_prio(cs, nop_size); -+ else -+ cs->ops->submit(cs, nop_size); -+ -+ assert(!queue->head); -+ } -+ -+ while(1) -+ { -+ LONG head = queue->head; -+ LONG tail = *((volatile LONG *)&queue->tail); -+ LONG new_pos; -+ /* Empty */ -+ if (head == tail) -+ break; -+ /* Head ahead of tail, take care of wrap-around */ -+ new_pos = (head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -+ if (head > tail && (new_pos || tail)) -+ break; -+ /* Tail ahead of head, but still enough space */ -+ if (new_pos < tail && new_pos) -+ break; -+ -+ TRACE("Waiting for free space. Head %u, tail %u, want %u\n", head, tail, -+ (unsigned int) size); -+ } -+ -+ return &queue->data[queue->head]; -+} -+ -+static inline void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) -+{ -+ return _wined3d_cs_mt_require_space(cs, size, FALSE); -+} -+ -+static inline void *wined3d_cs_mt_require_space_prio(struct wined3d_cs *cs, size_t size) -+{ -+ return _wined3d_cs_mt_require_space(cs, size, TRUE); -+} -+ -+/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -+ * OP itself. */ -+static void wined3d_cs_emit_stop(struct wined3d_cs *cs) -+{ -+ struct wined3d_cs_stop *op; -+ -+ op = wined3d_cs_mt_require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_STOP; -+ -+ wined3d_cs_mt_submit(cs, sizeof(*op)); -+} -+ -+static void wined3d_cs_mt_finish(struct wined3d_cs *cs) -+{ -+ BOOL fence; -+ -+ if (cs->thread_id == GetCurrentThreadId()) -+ { -+ static BOOL once; -+ if (!once) -+ { -+ FIXME("flush_and_wait called from cs thread\n"); -+ once = TRUE; -+ } -+ return; -+ } -+ -+ wined3d_cs_emit_fence(cs, &fence); -+ -+ /* A busy wait should be fine, we're not supposed to have to wait very -+ * long. */ -+ while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); -+} -+ -+static void wined3d_cs_mt_finish_prio(struct wined3d_cs *cs) -+{ -+ BOOL fence; -+ -+ if (cs->thread_id == GetCurrentThreadId()) -+ { -+ static BOOL once; -+ if (!once) -+ { -+ FIXME("flush_and_wait called from cs thread\n"); -+ once = TRUE; -+ } -+ return; -+ } -+ -+ wined3d_cs_emit_fence_prio(cs, &fence); -+ -+ /* A busy wait should be fine, we're not supposed to have to wait very -+ * long. */ -+ while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); -+} -+ -+static const struct wined3d_cs_ops wined3d_cs_mt_ops = -+{ -+ wined3d_cs_mt_require_space, - wined3d_cs_mt_require_space_prio, - wined3d_cs_mt_submit, - wined3d_cs_mt_submit_prio, -@@ -3293,5 +4127,80 @@ + /* 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, + /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i, +@@ -3293,5 +3719,80 @@ ERR("Closing event failed.\n"); } @@ -3720,7 +3385,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c -@@ -5632,9 +5632,15 @@ +@@ -5675,9 +5675,15 @@ DebugBreak(); } @@ -5921,11 +5586,10 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, -@@ -2446,7 +2989,22 @@ +@@ -2446,6 +2989,21 @@ { const struct wined3d_format *format = surface->resource.format; unsigned int fmt_flags = surface->container->resource.format_flags; -- +#if !defined(STAGING_CSMT) + struct wined3d_device *device = surface->resource.device; + struct wined3d_context *context; @@ -5941,10 +5605,9 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + return WINED3DERR_INVALIDCALL; + } +#endif /* STAGING_CSMT */ -+ + if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box && !surface_check_block_align(surface, box)) - { @@ -2457,6 +3015,13 @@ return WINED3DERR_INVALIDCALL; } @@ -6764,7 +6427,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c src_location = WINED3D_LOCATION_TEXTURE_SRGB; else /* surface_blt_fbo will load the source location if necessary. */ src_location = WINED3D_LOCATION_TEXTURE_RGB; -@@ -3910,41 +4975,87 @@ +@@ -3910,11 +4975,17 @@ surface, src_location, &rect, surface, dst_location, &rect); } @@ -6782,62 +6445,38 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c HRESULT hr; TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); - +@@ -3922,6 +4993,7 @@ if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { -- if (location == WINED3D_LOCATION_TEXTURE_RGB -- && surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) -+ if (location == WINED3D_LOCATION_TEXTURE_RGB + if (location == WINED3D_LOCATION_TEXTURE_RGB +#if defined(STAGING_CSMT) -+ && surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) + && surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) + { + surface_load_ds_location(surface, context, location); +@@ -3945,6 +5017,45 @@ + { + ERR("Surface %p does not have any up to date location.\n", surface); + return; ++#else /* STAGING_CSMT */ ++ && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) + { + surface_load_ds_location(surface, context, location); -+ return; ++ return WINED3D_OK; + } -+ else if (location & surface->resource.locations ++ else if (location & surface->locations + && surface->container->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) + { + /* Already up to date, nothing to do. */ -+ return; ++ return WINED3D_OK; + } + else + { + FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", -+ wined3d_debug_location(surface->resource.locations), wined3d_debug_location(location)); -+ return; ++ wined3d_debug_location(surface->locations), wined3d_debug_location(location)); ++ return WINED3DERR_INVALIDCALL; + } + } + -+ if (!surface->resource.locations) -+ { -+ ERR("Surface %p does not have any up to date location.\n", surface); -+ return; -+#else /* STAGING_CSMT */ -+ && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) - { - surface_load_ds_location(surface, context, location); -- return; -+ return WINED3D_OK; - } -- else if (location & surface->resource.locations -+ else if (location & surface->locations - && surface->container->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) - { - /* Already up to date, nothing to do. */ -- return; -+ return WINED3D_OK; - } - else - { - FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", -- wined3d_debug_location(surface->resource.locations), wined3d_debug_location(location)); -- return; -+ wined3d_debug_location(surface->locations), wined3d_debug_location(location)); -+ return WINED3DERR_INVALIDCALL; - } - } - -- if (!surface->resource.locations) + if (surface->locations & location) + { + TRACE("Location already up to date.\n"); @@ -6853,9 +6492,8 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + } + + if (!surface->locations) - { - ERR("Surface %p does not have any up to date location.\n", surface); -- return; ++ { ++ ERR("Surface %p does not have any up to date location.\n", surface); + return WINED3DERR_INVALIDCALL; +#endif /* STAGING_CSMT */ } @@ -9419,7 +9057,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target, struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN; void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, -@@ -2062,7 +2121,11 @@ +@@ -2086,7 +2145,11 @@ struct wined3d_state { DWORD flags; @@ -9431,7 +9069,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]; -@@ -2107,6 +2170,7 @@ +@@ -2131,6 +2194,7 @@ DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; @@ -9439,7 +9077,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_gl_bo { GLuint name; -@@ -2115,6 +2179,7 @@ +@@ -2139,6 +2203,7 @@ UINT size; }; @@ -9447,7 +9085,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 -@@ -2170,11 +2235,23 @@ +@@ -2194,11 +2259,23 @@ struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -9471,7 +9109,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; -@@ -2185,6 +2262,9 @@ +@@ -2209,6 +2286,9 @@ UINT xScreenSpace; UINT yScreenSpace; UINT cursorWidth, cursorHeight; @@ -9481,7 +9119,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HCURSOR hardwareCursor; /* The Wine logo texture */ -@@ -2216,6 +2296,7 @@ +@@ -2240,6 +2320,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; @@ -9489,7 +9127,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, -@@ -2227,6 +2308,11 @@ +@@ -2251,6 +2332,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; @@ -9501,7 +9139,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) { -@@ -2246,9 +2332,11 @@ +@@ -2270,9 +2356,11 @@ HRESULT (*resource_sub_resource_map)(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); HRESULT (*resource_sub_resource_unmap)(struct wined3d_resource *resource, unsigned int sub_resource_idx); @@ -9513,7 +9151,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_resource -@@ -2273,6 +2361,7 @@ +@@ -2297,6 +2385,7 @@ UINT depth; UINT size; DWORD priority; @@ -9521,7 +9159,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *heap_memory, *map_heap_memory, *user_memory, *bitmap_data; UINT custom_row_pitch, custom_slice_pitch; struct wined3d_gl_bo *buffer, *map_buffer; -@@ -2280,6 +2369,10 @@ +@@ -2304,6 +2393,10 @@ DWORD locations; LONG access_fence; BOOL unmap_dirtify; @@ -9532,7 +9170,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2304,6 +2397,7 @@ +@@ -2328,6 +2421,7 @@ void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -9540,7 +9178,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h DWORD wined3d_resource_access_from_location(DWORD location) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_resource_changed(struct wined3d_resource *resource, -@@ -2352,6 +2446,15 @@ +@@ -2376,6 +2470,15 @@ { while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); } @@ -9556,7 +9194,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 -@@ -2436,7 +2539,9 @@ +@@ -2460,7 +2563,9 @@ void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture, const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; @@ -9566,7 +9204,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_bind(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, -@@ -2470,9 +2575,16 @@ +@@ -2494,9 +2599,16 @@ struct wined3d_resource resource; struct wined3d_texture *container; @@ -9583,7 +9221,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; static inline struct wined3d_volume *volume_from_resource(struct wined3d_resource *resource) -@@ -2480,6 +2592,7 @@ +@@ -2504,6 +2616,7 @@ return CONTAINING_RECORD(resource, struct wined3d_volume, resource); } @@ -9591,7 +9229,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, unsigned int level, struct wined3d_volume **volume) DECLSPEC_HIDDEN; void wined3d_volume_destroy(struct wined3d_volume *volume) DECLSPEC_HIDDEN; -@@ -2495,6 +2608,27 @@ +@@ -2519,6 +2632,27 @@ struct wined3d_surface_dib { HBITMAP DIBsection; @@ -9619,7 +9257,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT bitmap_size; }; -@@ -2520,7 +2654,11 @@ +@@ -2544,7 +2678,11 @@ struct wined3d_surface_ops { HRESULT (*surface_private_setup)(struct wined3d_surface *surface); @@ -9631,7 +9269,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_surface -@@ -2528,12 +2666,26 @@ +@@ -2552,12 +2690,26 @@ struct wined3d_resource resource; const struct wined3d_surface_ops *surface_ops; struct wined3d_texture *container; @@ -9658,7 +9296,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; GLenum texture_target; -@@ -2577,11 +2729,22 @@ +@@ -2601,11 +2753,22 @@ GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN; void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; @@ -9681,7 +9319,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; -@@ -2593,6 +2756,7 @@ +@@ -2617,6 +2780,7 @@ const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch) DECLSPEC_HIDDEN; HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point, struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN; @@ -9689,7 +9327,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN; -@@ -2607,6 +2771,17 @@ +@@ -2631,6 +2795,17 @@ void wined3d_surface_cleanup_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void wined3d_surface_getdc_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void wined3d_surface_releasedc_cs(struct wined3d_surface *surface) DECLSPEC_HIDDEN; @@ -9707,7 +9345,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; -@@ -2628,8 +2803,10 @@ +@@ -2652,8 +2827,10 @@ GLuint name; }; @@ -9718,7 +9356,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; -@@ -2658,8 +2835,10 @@ +@@ -2682,8 +2859,10 @@ BOOL half_float_conv_needed; }; @@ -9729,7 +9367,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]; -@@ -2727,6 +2906,7 @@ +@@ -2751,6 +2930,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -9737,7 +9375,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2777,6 +2957,32 @@ +@@ -2801,6 +2981,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; @@ -9770,7 +9408,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; -@@ -2826,6 +3032,7 @@ +@@ -2850,6 +3056,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; @@ -9778,7 +9416,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, UINT start_register, const float *constants, UINT vector4f_count, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, UINT start_register, -@@ -2889,6 +3096,7 @@ +@@ -2913,6 +3120,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int depth_pitch) DECLSPEC_HIDDEN; @@ -9786,7 +9424,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 -@@ -2903,8 +3111,12 @@ +@@ -2927,8 +3135,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -9799,7 +9437,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -2918,12 +3130,16 @@ +@@ -2942,12 +3154,16 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -9816,7 +9454,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 */ -@@ -2950,7 +3166,9 @@ +@@ -2974,7 +3190,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -9826,7 +9464,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -2975,11 +3193,15 @@ +@@ -2999,11 +3217,15 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -9842,7 +9480,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3018,8 +3240,10 @@ +@@ -3042,8 +3264,10 @@ return surface_from_resource(resource); } @@ -9853,7 +9491,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -3032,8 +3256,12 @@ +@@ -3056,8 +3280,12 @@ struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, @@ -9866,7 +9504,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_swapchain -@@ -3073,8 +3301,10 @@ +@@ -3097,8 +3325,10 @@ HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -9877,7 +9515,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /***************************************************************************** * Utility function prototypes -@@ -3277,7 +3507,9 @@ +@@ -3301,7 +3531,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;