diff --git a/patches/msi-Dummy_Thread/0001-msi-Create-dummy-thread-to-initialize-COM-for-custom.patch b/patches/msi-Dummy_Thread/0001-msi-Create-dummy-thread-to-initialize-COM-for-custom.patch index 6d6183e2..e09264ba 100644 --- a/patches/msi-Dummy_Thread/0001-msi-Create-dummy-thread-to-initialize-COM-for-custom.patch +++ b/patches/msi-Dummy_Thread/0001-msi-Create-dummy-thread-to-initialize-COM-for-custom.patch @@ -1,4 +1,4 @@ -From 8d9234d5f431aedceaa46b3123671c283e50ff93 Mon Sep 17 00:00:00 2001 +From 898e62a33f525084b08d5a3be634e7fcb4661f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Jun 2017 16:18:09 +0200 Subject: msi: Create dummy thread to initialize COM for custom actions. @@ -8,7 +8,7 @@ Subject: msi: Create dummy thread to initialize COM for custom actions. 1 file changed, 48 insertions(+) diff --git a/dlls/msi/action.c b/dlls/msi/action.c -index fef076f96c5..d8b097d62f8 100644 +index 64e01c48f57..d804323ff58 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -158,6 +158,13 @@ static const WCHAR szValidateProductID[] = @@ -24,8 +24,8 @@ index fef076f96c5..d8b097d62f8 100644 + static INT ui_actionstart(MSIPACKAGE *package, LPCWSTR action, LPCWSTR description, LPCWSTR template) { - MSIRECORD *row = MSI_CreateRecord(3); -@@ -7910,6 +7917,42 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) + WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', +@@ -7860,6 +7867,42 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) return rc; } @@ -68,7 +68,7 @@ index fef076f96c5..d8b097d62f8 100644 /**************************************************** * TOP level entry points *****************************************************/ -@@ -7921,6 +7964,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, +@@ -7871,6 +7914,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, static const WCHAR szAction[] = {'A','C','T','I','O','N',0}; static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0}; WCHAR *reinstall, *remove, *patch, *productcode; @@ -76,7 +76,7 @@ index fef076f96c5..d8b097d62f8 100644 BOOL ui_exists; UINT rc; -@@ -7986,6 +8030,8 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, +@@ -7936,6 +7980,8 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, msi_adjust_privilege_properties( package ); msi_set_context( package ); @@ -85,7 +85,7 @@ index fef076f96c5..d8b097d62f8 100644 productcode = msi_dup_property( package->db, szProductCode ); if (strcmpiW( productcode, package->ProductCode )) { -@@ -8034,6 +8080,8 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, +@@ -7984,6 +8030,8 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, /* finish up running custom actions */ ACTION_FinishCustomActions(package); diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 7937739e..8edc412e 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "7aa4a25bd3d23b57ff990a151296dddb337a5767" + echo "52fbaeb2c44e585cacd7f0b57e902dfbcf54d09b" } # Show version information @@ -9608,17 +9608,12 @@ fi # | * [#43405] Implement copying structure count of UAV # | # | Modified files: -# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/buffer.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, -# | dlls/wined3d/view.c, dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_private.h, include/wine/wined3d.h +# | * dlls/d3d11/device.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/view.c # | if test "$enable_wined3d_UAV_Counters" -eq 1; then - patch_apply wined3d-UAV_Counters/0001-wined3d-Implement-support-for-setting-uav-counters.patch - patch_apply wined3d-UAV_Counters/0002-wined3d-Create-atomic-counter-when-uav-is-initialize.patch - patch_apply wined3d-UAV_Counters/0003-wined3d-Implement-copying-structure-count-of-uav.patch + patch_apply wined3d-UAV_Counters/0001-wined3d-Remaining-UAV-counter-changes.patch ( - printf '%s\n' '+ { "Józef Kucia", "wined3d: Implement support for setting uav counters.", 1 },'; - printf '%s\n' '+ { "Józef Kucia", "wined3d: Create atomic counter when uav is initialized with WINED3D_VIEW_BUFFER_APPEND.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "wined3d: Implement copying structure count of uav.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Remaining UAV counter changes.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch b/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch index 5a8d2fde..110575a8 100644 --- a/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch +++ b/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch @@ -1,4 +1,4 @@ -From c2675926347686e6a56f4925abb72568ddf8e3c4 Mon Sep 17 00:00:00 2001 +From c75bb981aac00d8530bf9d38dc7c433370105d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 20 Feb 2017 00:27:25 +0100 Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource. @@ -10,10 +10,10 @@ Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource. 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 4314a4807a8..b8710137a3c 100644 +index dbe80c8306e..fd0a5c1d99a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -405,6 +405,7 @@ struct wined3d_cs_update_sub_resource +@@ -398,6 +398,7 @@ struct wined3d_cs_update_sub_resource unsigned int sub_resource_idx; struct wined3d_box box; struct wined3d_sub_resource_data data; @@ -21,7 +21,7 @@ index 4314a4807a8..b8710137a3c 100644 }; struct wined3d_cs_add_dirty_texture_region -@@ -2164,6 +2165,51 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2241,6 +2242,51 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r unsigned int slice_pitch) { struct wined3d_cs_update_sub_resource *op; @@ -73,7 +73,7 @@ index 4314a4807a8..b8710137a3c 100644 op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP); op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; -@@ -2177,8 +2223,6 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2254,8 +2300,6 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r wined3d_resource_acquire(resource); cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP); @@ -82,8 +82,8 @@ index 4314a4807a8..b8710137a3c 100644 cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP); } -@@ -2481,6 +2525,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_COPY_STRUCTURE_COUNT */ wined3d_cs_exec_copy_structure_count, +@@ -2557,6 +2601,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource, }; +static BOOL wined3d_cs_st_check_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) @@ -94,7 +94,7 @@ index 4314a4807a8..b8710137a3c 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (size > (cs->data_size - cs->end)) -@@ -2534,6 +2583,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2610,6 +2659,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_st_ops = { @@ -102,7 +102,7 @@ index 4314a4807a8..b8710137a3c 100644 wined3d_cs_st_require_space, wined3d_cs_st_submit, wined3d_cs_st_finish, -@@ -2566,6 +2616,19 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2642,6 +2692,19 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id wined3d_cs_queue_submit(&cs->queue[queue_id], cs); } @@ -122,7 +122,7 @@ index 4314a4807a8..b8710137a3c 100644 static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs) { size_t queue_size = ARRAY_SIZE(queue->data); -@@ -2627,6 +2690,14 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size +@@ -2703,6 +2766,14 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size return packet->data; } @@ -137,7 +137,7 @@ index 4314a4807a8..b8710137a3c 100644 static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (cs->thread_id == GetCurrentThreadId()) -@@ -2646,6 +2717,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2722,6 +2793,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_mt_ops = { @@ -146,10 +146,10 @@ index 4314a4807a8..b8710137a3c 100644 wined3d_cs_mt_submit, wined3d_cs_mt_finish, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 489e8eb6bb3..1125bb33f70 100644 +index 975ab96b464..09b1fc459fc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4284,8 +4284,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4325,8 +4325,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str return; } @@ -159,10 +159,10 @@ index 489e8eb6bb3..1125bb33f70 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1574b9c9c9e..3f1184349b5 100644 +index 1f2c197e392..073328b71b6 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3399,6 +3399,7 @@ struct wined3d_cs_queue +@@ -3451,6 +3451,7 @@ struct wined3d_cs_queue struct wined3d_cs_ops { diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index f0338c7b..fc91d56e 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -9,7 +9,7 @@ Based on patches by: diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1318,6 +1318,9 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, +@@ -1219,6 +1219,9 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, const struct wined3d_box *box, const void *data) { UINT offset, size; @@ -19,7 +19,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c HRESULT hr; BYTE *ptr; -@@ -1332,7 +1335,14 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, +@@ -1233,7 +1236,14 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, size = buffer->resource.size; } @@ -47,7 +47,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_add_dirty_texture_region -@@ -2242,6 +2245,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2241,6 +2244,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r unsigned int slice_pitch) { struct wined3d_cs_update_sub_resource *op; @@ -101,7 +101,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP); op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; -@@ -2255,8 +2305,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2254,8 +2304,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r wined3d_resource_acquire(resource); cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP); @@ -112,8 +112,8 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP); } -@@ -2559,6 +2611,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_COPY_STRUCTURE_COUNT */ wined3d_cs_exec_copy_structure_count, +@@ -2557,6 +2609,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource, }; +#if defined(STAGING_CSMT) @@ -126,7 +126,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (size > (cs->data_size - cs->end)) -@@ -2612,6 +2671,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2610,6 +2669,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_st_ops = { @@ -136,7 +136,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_cs_st_require_space, wined3d_cs_st_submit, wined3d_cs_st_finish, -@@ -2644,6 +2706,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2642,6 +2704,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id wined3d_cs_queue_submit(&cs->queue[queue_id], cs); } @@ -158,7 +158,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs) { size_t queue_size = ARRAY_SIZE(queue->data); -@@ -2705,6 +2782,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size +@@ -2703,6 +2780,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size return packet->data; } @@ -175,7 +175,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) { if (cs->thread_id == GetCurrentThreadId()) -@@ -2724,6 +2811,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id +@@ -2722,6 +2809,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id static const struct wined3d_cs_ops wined3d_cs_mt_ops = { @@ -198,7 +198,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_device_delete_opengl_contexts(device); if (device->fb.depth_stencil) -@@ -4205,6 +4208,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4220,6 +4223,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; } @@ -206,7 +206,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (dst_texture->sub_resources[dst_sub_resource_idx].map_count) { WARN("Destination sub-resource %u is mapped.\n", dst_sub_resource_idx); -@@ -4215,6 +4219,19 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4230,6 +4234,19 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev { WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx); return WINED3DERR_INVALIDCALL; @@ -226,7 +226,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (!src_box) -@@ -4308,8 +4325,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4323,8 +4340,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str return; } @@ -237,7 +237,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); } -@@ -5274,3 +5293,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5273,3 +5292,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -580,7 +580,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c wined3d_cs_init_object(resource->device->cs, wined3d_shader_resource_view_cs_init, view); return WINED3D_OK; -@@ -964,6 +971,10 @@ static void wined3d_unordered_access_view_cs_init(void *object) +@@ -984,6 +991,10 @@ static void wined3d_unordered_access_view_cs_init(void *object) desc, texture, view->format); } } @@ -591,7 +591,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c } static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_access_view *view, -@@ -980,6 +991,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces +@@ -1000,6 +1011,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces wined3d_resource_incref(view->resource = resource); @@ -619,7 +619,7 @@ diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2823,6 +2823,16 @@ struct wined3d_state +@@ -2826,6 +2826,16 @@ struct wined3d_state struct wined3d_rasterizer_state *rasterizer_state; }; @@ -636,7 +636,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 -@@ -2934,6 +2944,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2937,6 +2947,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL 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; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; @@ -649,7 +649,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) { -@@ -3121,7 +3137,11 @@ struct wined3d_texture +@@ -3124,7 +3140,11 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -661,7 +661,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -3436,6 +3456,9 @@ struct wined3d_cs_queue +@@ -3439,6 +3459,9 @@ struct wined3d_cs_queue struct wined3d_cs_ops { diff --git a/patches/wined3d-Copy_Resource_Typeless/0003-wined3d-Implement-copying-sub-resources-between-comp.patch b/patches/wined3d-Copy_Resource_Typeless/0003-wined3d-Implement-copying-sub-resources-between-comp.patch index 8b1e5d4b..82e72d79 100644 --- a/patches/wined3d-Copy_Resource_Typeless/0003-wined3d-Implement-copying-sub-resources-between-comp.patch +++ b/patches/wined3d-Copy_Resource_Typeless/0003-wined3d-Implement-copying-sub-resources-between-comp.patch @@ -1,22 +1,22 @@ -From ee5dba7ce1957961af9bfcebf0f797debbc41d3a Mon Sep 17 00:00:00 2001 +From 9ee4e66d81e578d6b0366c5713f77d9ec7a0676e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 9 Jul 2017 01:04:33 +0200 Subject: wined3d: Implement copying sub resources between compatible formats. --- dlls/d3d11/tests/d3d11.c | 2 +- - dlls/wined3d/cs.c | 156 +++++++++++++++++++++++++++++++++++++++++ + dlls/wined3d/cs.c | 155 +++++++++++++++++++++++++++++++++++++++++ dlls/wined3d/device.c | 9 ++- dlls/wined3d/directx.c | 4 ++ dlls/wined3d/wined3d_gl.h | 1 + dlls/wined3d/wined3d_private.h | 3 + - 6 files changed, 171 insertions(+), 4 deletions(-) + 6 files changed, 170 insertions(+), 4 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c -index 155b8642d04..e2ef854b0aa 100644 +index 0ad5a701e00..50f8696619a 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c -@@ -10116,7 +10116,7 @@ static void test_copy_subresource_region(void) +@@ -10094,7 +10094,7 @@ static void test_copy_subresource_region(void) for (j = 0; j < min(level_src_height, level_dst_height); j++) { c_result = (DWORD*)((char*)map_desc.pData + j * map_desc.RowPitch); @@ -26,19 +26,19 @@ index 155b8642d04..e2ef854b0aa 100644 c_result[i], i, j, c_expected[j * level_src_width + i], k); } diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index c7df670682d..88dbedd8d89 100644 +index a76598ff4ca..55bab7b464b 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -70,6 +70,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_UPDATE_SUB_RESOURCE, +@@ -71,6 +71,7 @@ enum wined3d_cs_op WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION, WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW, + WINED3D_CS_OP_COPY_UAV_COUNTER, + WINED3D_CS_OP_COPY_SUB_RESOURCE, WINED3D_CS_OP_STOP, }; -@@ -418,6 +419,17 @@ struct wined3d_cs_clear_unordered_access_view - struct wined3d_uvec4 clear_value; +@@ -428,6 +429,17 @@ struct wined3d_cs_copy_uav_counter + struct wined3d_unordered_access_view *view; }; +struct wined3d_cs_copy_sub_resource @@ -55,7 +55,7 @@ index c7df670682d..88dbedd8d89 100644 struct wined3d_cs_stop { enum wined3d_cs_op opcode; -@@ -2227,6 +2239,149 @@ void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs *cs, +@@ -2270,6 +2282,148 @@ void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buff cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); } @@ -65,10 +65,9 @@ index c7df670682d..88dbedd8d89 100644 + + if (op->dst_resource->type == WINED3D_RTYPE_BUFFER) + { -+ if (FAILED(wined3d_buffer_copy(buffer_from_resource(op->dst_resource), op->dst_box.left, ++ wined3d_buffer_copy(buffer_from_resource(op->dst_resource), op->dst_box.left, + buffer_from_resource(op->src_resource), op->src_box.left, -+ op->src_box.right - op->src_box.left))) -+ ERR("Failed to copy buffer.\n"); ++ op->src_box.right - op->src_box.left); + } + else if (op->dst_resource->type == WINED3D_RTYPE_TEXTURE_1D || + op->dst_resource->type == WINED3D_RTYPE_TEXTURE_2D || @@ -205,19 +204,19 @@ index c7df670682d..88dbedd8d89 100644 static void wined3d_cs_emit_stop(struct wined3d_cs *cs) { struct wined3d_cs_stop *op; -@@ -2284,6 +2439,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, +@@ -2328,6 +2482,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region, /* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view, + /* WINED3D_CS_OP_COPY_UAV_COUNTER */ wined3d_cs_exec_copy_uav_counter, + /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource, }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 3d12e417a43..43b88913e55 100644 +index 0233a7e9865..abab8d2d819 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4062,7 +4062,10 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4098,7 +4098,10 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; } @@ -229,7 +228,7 @@ index 3d12e417a43..43b88913e55 100644 { WARN("Resource formats (%s / %s) don't match.\n", debug_d3dformat(dst_resource->format->id), -@@ -4164,8 +4167,8 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4200,8 +4203,8 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; } @@ -241,7 +240,7 @@ index 3d12e417a43..43b88913e55 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c -index b18d1aa3619..8a03dd5913f 100644 +index 3e3a0b42360..843b5efead0 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -116,6 +116,7 @@ static const struct wined3d_extension_map gl_extension_map[] = @@ -282,10 +281,10 @@ index 05558760850..a743ad20316 100644 ARB_DEPTH_BUFFER_FLOAT, ARB_DEPTH_CLAMP, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 1025c98f180..7d2bdf45e52 100644 +index b087ba33d3b..4d9c9274e9f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3478,6 +3478,9 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -3492,6 +3492,9 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou 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 slice_pitch) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-DrawIndirect/0001-wined3d-Implement-indirect-compute-dispatch.patch b/patches/wined3d-DrawIndirect/0001-wined3d-Implement-indirect-compute-dispatch.patch index ce2bb218..35e34d4d 100644 --- a/patches/wined3d-DrawIndirect/0001-wined3d-Implement-indirect-compute-dispatch.patch +++ b/patches/wined3d-DrawIndirect/0001-wined3d-Implement-indirect-compute-dispatch.patch @@ -1,4 +1,4 @@ -From ed7b6749de73056ab073634b6f561f2138e24f00 Mon Sep 17 00:00:00 2001 +From 654103d744671c2d55ad72aaae6a1107d665c9e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Sun, 23 Jul 2017 23:19:51 +0200 Subject: wined3d: Implement indirect compute dispatch. @@ -14,10 +14,10 @@ Subject: wined3d: Implement indirect compute dispatch. 7 files changed, 95 insertions(+), 13 deletions(-) diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c -index f25ff8b3700..9cffa8a9961 100644 +index 3c1cefb14aa..4cfa3b5a396 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c -@@ -1812,7 +1812,17 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_Dispatch(ID3D11DeviceConte +@@ -1808,7 +1808,17 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_Dispatch(ID3D11DeviceConte static void STDMETHODCALLTYPE d3d11_immediate_context_DispatchIndirect(ID3D11DeviceContext *iface, ID3D11Buffer *buffer, UINT offset) { @@ -37,7 +37,7 @@ index f25ff8b3700..9cffa8a9961 100644 static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceContext *iface, diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 4314a4807a8..171287dc99c 100644 +index 4bdab37068c..55aa49785bd 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -113,9 +113,7 @@ struct wined3d_cs_clear @@ -100,10 +100,10 @@ index 4314a4807a8..171287dc99c 100644 acquire_shader_resources(state, 1u << WINED3D_SHADER_TYPE_COMPUTE); acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_COMPUTE], diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 4839f09aee3..54a058ae1ed 100644 +index 3b6a335efc1..dfd2da6ceac 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -3701,6 +3701,14 @@ void CDECL wined3d_device_dispatch_compute(struct wined3d_device *device, +@@ -3703,6 +3703,14 @@ void CDECL wined3d_device_dispatch_compute(struct wined3d_device *device, wined3d_cs_emit_dispatch(device->cs, group_count_x, group_count_y, group_count_z); } @@ -119,7 +119,7 @@ index 4839f09aee3..54a058ae1ed 100644 enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count) { diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 353e9aac5f9..6de0d613d2d 100644 +index ad1e587cca7..2f7ed9205ad 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -683,7 +683,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s @@ -157,7 +157,7 @@ index 353e9aac5f9..6de0d613d2d 100644 GL_EXTCALL(glMemoryBarrier(GL_ALL_BARRIER_BITS)); checkGLcall("glMemoryBarrier"); diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec -index f0f6871a8a2..122e39ba8ee 100644 +index d17e2c9eb6d..09d1d644f4b 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -42,6 +42,7 @@ @@ -169,10 +169,10 @@ index f0f6871a8a2..122e39ba8ee 100644 @ cdecl wined3d_device_draw_indexed_primitive_instanced(ptr long long long long) @ cdecl wined3d_device_draw_primitive(ptr long long) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 3eeb3aef55e..e2461100a5a 100644 +index a487ee25bc9..9425f197c2b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1481,11 +1481,34 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf +@@ -1479,11 +1479,34 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf const struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info) DECLSPEC_HIDDEN; @@ -208,8 +208,8 @@ index 3eeb3aef55e..e2461100a5a 100644 DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN; #define eps 1e-8f -@@ -3432,6 +3455,8 @@ void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs *cs, - struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value) DECLSPEC_HIDDEN; +@@ -3434,6 +3457,8 @@ void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buff + unsigned int offset, struct wined3d_unordered_access_view *uav) DECLSPEC_HIDDEN; void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z) DECLSPEC_HIDDEN; +void wined3d_cs_emit_dispatch_indirect(struct wined3d_cs *cs, @@ -218,10 +218,10 @@ index 3eeb3aef55e..e2461100a5a 100644 int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h -index 4a85aac2cae..a99dbf64686 100644 +index 06772fd645e..a6091a65c86 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h -@@ -2240,6 +2240,8 @@ HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, +@@ -2230,6 +2230,8 @@ HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, ULONG __cdecl wined3d_device_decref(struct wined3d_device *device); void __cdecl wined3d_device_dispatch_compute(struct wined3d_device *device, unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z); diff --git a/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch b/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch index e497f3d2..b2c20d52 100644 --- a/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch +++ b/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch @@ -1,4 +1,4 @@ -From 331d0798182a0e5fab1fe59e6503d5e8597ff403 Mon Sep 17 00:00:00 2001 +From 213c4f62372760c1a3bdcd6f1c03bc9f1926c5be Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 8 Feb 2017 19:35:36 +0100 Subject: Revert "wined3d: Implement wined3d_buffer_upload_data() on top of @@ -12,10 +12,10 @@ This reverts commit e2dbbec1af8ae2ea8813148d56e14c8c211ee334. 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index c584147717b..18933d1f6df 100644 +index e953e9ad215..d81387291f1 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -525,7 +525,7 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) +@@ -532,7 +532,7 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) /* Context activation is done by the caller. */ static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct wined3d_context *context, @@ -24,7 +24,7 @@ index c584147717b..18933d1f6df 100644 { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_map_range *range; -@@ -536,7 +536,7 @@ static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct w +@@ -543,7 +543,7 @@ static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct w { range = &ranges[range_count]; GL_EXTCALL(glBufferSubData(buffer->buffer_type_hint, @@ -33,7 +33,7 @@ index c584147717b..18933d1f6df 100644 } checkGLcall("glBufferSubData"); } -@@ -592,7 +592,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined +@@ -599,7 +599,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined } } @@ -42,7 +42,7 @@ index c584147717b..18933d1f6df 100644 HeapFree(GetProcessHeap(), 0, data); } -@@ -676,7 +676,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, +@@ -683,7 +683,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, case WINED3D_LOCATION_BUFFER: if (!buffer->conversion_map) wined3d_buffer_upload_ranges(buffer, context, buffer->resource.heap_memory, @@ -51,8 +51,8 @@ index c584147717b..18933d1f6df 100644 else buffer_conversion_upload(buffer, context); break; -@@ -1261,23 +1261,31 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ - return WINED3D_OK; +@@ -1215,23 +1215,31 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off + wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size); } -void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context, @@ -91,10 +91,10 @@ index c584147717b..18933d1f6df 100644 static ULONG buffer_resource_incref(struct wined3d_resource *resource) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 9f3de815be5..39071faef32 100644 +index a76598ff4ca..f521475d3af 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -1669,18 +1669,11 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi +@@ -2107,18 +2107,11 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi if (op->resource->type == WINED3D_RTYPE_BUFFER) { struct wined3d_buffer *buffer = buffer_from_resource(op->resource); @@ -117,12 +117,12 @@ index 9f3de815be5..39071faef32 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 48f2f368d20..3883792f6fe 100644 +index f8aeb629c92..371b8b367ac 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3343,7 +3343,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, +@@ -3570,7 +3570,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; - HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, + void 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; -void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context, +HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, @@ -130,5 +130,5 @@ index 48f2f368d20..3883792f6fe 100644 struct wined3d_rendertarget_view -- -2.11.0 +2.13.1 diff --git a/patches/wined3d-UAV_Counters/0001-wined3d-Implement-support-for-setting-uav-counters.patch b/patches/wined3d-UAV_Counters/0001-wined3d-Implement-support-for-setting-uav-counters.patch deleted file mode 100644 index c29af50a..00000000 --- a/patches/wined3d-UAV_Counters/0001-wined3d-Implement-support-for-setting-uav-counters.patch +++ /dev/null @@ -1,270 +0,0 @@ -From ff6b6ee44f1e98b9f74ddddd1d7ada999283b135 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=B3zef=20Kucia?= -Date: Sun, 23 Jul 2017 22:00:30 +0200 -Subject: wined3d: Implement support for setting uav counters. - ---- - dlls/d3d11/device.c | 13 +++++++------ - dlls/d3d11/tests/d3d11.c | 2 +- - dlls/wined3d/cs.c | 7 ++++++- - dlls/wined3d/device.c | 15 ++++++++------- - dlls/wined3d/view.c | 18 ++++++++++++++++++ - dlls/wined3d/wined3d.spec | 4 ++-- - dlls/wined3d/wined3d_private.h | 4 +++- - include/wine/wined3d.h | 4 ++-- - 8 files changed, 47 insertions(+), 20 deletions(-) - -diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c -index 93938f98f0d..c7e19ed1313 100644 ---- a/dlls/d3d11/device.c -+++ b/dlls/d3d11/device.c -@@ -1601,7 +1601,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargetsAndUnord - wined3d_mutex_lock(); - for (i = 0; i < unordered_access_view_start_slot; ++i) - { -- wined3d_device_set_unordered_access_view(device->wined3d_device, i, NULL); -+ wined3d_device_set_unordered_access_view(device->wined3d_device, i, NULL, ~0u); - } - for (i = 0; i < unordered_access_view_count; ++i) - { -@@ -1616,12 +1616,13 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargetsAndUnord - - wined3d_device_set_unordered_access_view(device->wined3d_device, - unordered_access_view_start_slot + i, -- view ? view->wined3d_view : NULL); -+ view ? view->wined3d_view : NULL, -+ initial_counts ? initial_counts[i] : ~0u); - } - for (; unordered_access_view_start_slot + i < D3D11_PS_CS_UAV_REGISTER_COUNT; ++i) - { - wined3d_device_set_unordered_access_view(device->wined3d_device, -- unordered_access_view_start_slot + i, NULL); -+ unordered_access_view_start_slot + i, NULL, ~0u); - } - wined3d_mutex_unlock(); - } -@@ -2296,7 +2297,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSSetUnorderedAccessViews( - FIXME("Ignoring initial count %u for slot %u.\n", initial_counts[i], start_slot + i); - - wined3d_device_set_cs_uav(device->wined3d_device, start_slot + i, -- view ? view->wined3d_view : NULL); -+ view ? view->wined3d_view : NULL, initial_counts ? initial_counts[i] : ~0u); - } - wined3d_mutex_unlock(); - } -@@ -3438,8 +3439,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceCon - wined3d_device_set_depth_stencil_view(device->wined3d_device, NULL); - for (i = 0; i < D3D11_PS_CS_UAV_REGISTER_COUNT; ++i) - { -- wined3d_device_set_unordered_access_view(device->wined3d_device, i, NULL); -- wined3d_device_set_cs_uav(device->wined3d_device, i, NULL); -+ wined3d_device_set_unordered_access_view(device->wined3d_device, i, NULL, ~0u); -+ wined3d_device_set_cs_uav(device->wined3d_device, i, NULL, ~0u); - } - ID3D11DeviceContext_OMSetDepthStencilState(iface, NULL, 0); - ID3D11DeviceContext_OMSetBlendState(iface, NULL, blend_factor, D3D11_DEFAULT_SAMPLE_MASK); -diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c -index 2cfc9ce812d..7a851d924a0 100644 ---- a/dlls/d3d11/tests/d3d11.c -+++ b/dlls/d3d11/tests/d3d11.c -@@ -19067,7 +19067,7 @@ static void test_uav_counters(void) - for (i = 0; i < 8; ++i) - { - data = get_readback_color(&rb, i, 0); -- todo_wine ok(data == 0xdeadbeef, "Got data %u at %u.\n", data, i); -+ ok(data == 0xdeadbeef, "Got data %u at %u.\n", data, i); - } - release_resource_readback(&rb); - -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 92da18576e3..66876b6d172 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -244,6 +244,7 @@ struct wined3d_cs_set_unordered_access_view - enum wined3d_pipeline pipeline; - unsigned int view_idx; - struct wined3d_unordered_access_view *view; -+ unsigned int initial_count; - }; - - struct wined3d_cs_set_sampler -@@ -1298,10 +1299,13 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con - InterlockedDecrement(&prev->resource->bind_count); - - device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING(op->pipeline)); -+ -+ if (op->view && op->initial_count != ~0u) -+ wined3d_unordered_access_view_set_counter(op->view, op->initial_count); - } - - void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline, -- unsigned int view_idx, struct wined3d_unordered_access_view *view) -+ unsigned int view_idx, struct wined3d_unordered_access_view *view, unsigned int initial_count) - { - struct wined3d_cs_set_unordered_access_view *op; - -@@ -1310,6 +1314,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined - op->pipeline = pipeline; - op->view_idx = view_idx; - op->view = view; -+ op->initial_count = initial_count; - - cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); - } -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index a9c0a9ccc09..9841b5fd461 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -3002,7 +3002,8 @@ struct wined3d_sampler * CDECL wined3d_device_get_cs_sampler(const struct wined3 - } - - static void wined3d_device_set_pipeline_unordered_access_view(struct wined3d_device *device, -- enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav) -+ enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav, -+ unsigned int initial_count) - { - struct wined3d_unordered_access_view *prev; - -@@ -3013,14 +3014,14 @@ static void wined3d_device_set_pipeline_unordered_access_view(struct wined3d_dev - } - - prev = device->update_state->unordered_access_view[pipeline][idx]; -- if (uav == prev) -+ if (uav == prev && initial_count == ~0u) - return; - - if (uav) - wined3d_unordered_access_view_incref(uav); - device->update_state->unordered_access_view[pipeline][idx] = uav; - if (!device->recording) -- wined3d_cs_emit_set_unordered_access_view(device->cs, pipeline, idx, uav); -+ wined3d_cs_emit_set_unordered_access_view(device->cs, pipeline, idx, uav, initial_count); - if (prev) - wined3d_unordered_access_view_decref(prev); - } -@@ -3038,11 +3039,11 @@ static struct wined3d_unordered_access_view *wined3d_device_get_pipeline_unorder - } - - void CDECL wined3d_device_set_cs_uav(struct wined3d_device *device, unsigned int idx, -- struct wined3d_unordered_access_view *uav) -+ struct wined3d_unordered_access_view *uav, unsigned int initial_count) - { - TRACE("device %p, idx %u, uav %p.\n", device, idx, uav); - -- wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_COMPUTE, idx, uav); -+ wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_COMPUTE, idx, uav, initial_count); - } - - struct wined3d_unordered_access_view * CDECL wined3d_device_get_cs_uav(const struct wined3d_device *device, -@@ -3054,11 +3055,11 @@ struct wined3d_unordered_access_view * CDECL wined3d_device_get_cs_uav(const str - } - - void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *device, -- unsigned int idx, struct wined3d_unordered_access_view *uav) -+ unsigned int idx, struct wined3d_unordered_access_view *uav, unsigned int initial_count) - { - TRACE("device %p, idx %u, uav %p.\n", device, idx, uav); - -- wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav); -+ wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav, initial_count); - } - - struct wined3d_unordered_access_view * CDECL wined3d_device_get_unordered_access_view( -diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index 788946b81c2..260002eea12 100644 ---- a/dlls/wined3d/view.c -+++ b/dlls/wined3d/view.c -@@ -909,6 +909,24 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi - checkGLcall("clear unordered access view"); - } - -+void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_view *view, -+ unsigned int initial_count) -+{ -+ const struct wined3d_gl_info *gl_info; -+ struct wined3d_context *context; -+ GLuint value = initial_count; -+ -+ if (!view->counter_bo) -+ return; -+ -+ context = context_acquire(view->resource->device, NULL, 0); -+ gl_info = context->gl_info; -+ GL_EXTCALL(glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, view->counter_bo)); -+ GL_EXTCALL(glBufferSubData(GL_ATOMIC_COUNTER_BUFFER, 0, sizeof(value), &value)); -+ checkGLcall("set atomic counter"); -+ context_release(context); -+} -+ - static void wined3d_unordered_access_view_cs_init(void *object) - { - struct wined3d_unordered_access_view *view = object; -diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec -index 5de3ef730eb..631418bdaa9 100644 ---- a/dlls/wined3d/wined3d.spec -+++ b/dlls/wined3d/wined3d.spec -@@ -129,7 +129,7 @@ - @ cdecl wined3d_device_set_cs_cb(ptr long ptr) - @ cdecl wined3d_device_set_cs_resource_view(ptr long ptr) - @ cdecl wined3d_device_set_cs_sampler(ptr long ptr) --@ cdecl wined3d_device_set_cs_uav(ptr long ptr) -+@ cdecl wined3d_device_set_cs_uav(ptr long ptr long) - @ cdecl wined3d_device_set_cursor_position(ptr long long long) - @ cdecl wined3d_device_set_cursor_properties(ptr long long ptr long) - @ cdecl wined3d_device_set_depth_stencil_view(ptr ptr) -@@ -174,7 +174,7 @@ - @ cdecl wined3d_device_set_texture(ptr long ptr) - @ cdecl wined3d_device_set_texture_stage_state(ptr long long long) - @ cdecl wined3d_device_set_transform(ptr long ptr) --@ cdecl wined3d_device_set_unordered_access_view(ptr long ptr) -+@ cdecl wined3d_device_set_unordered_access_view(ptr long ptr long) - @ cdecl wined3d_device_set_vertex_declaration(ptr ptr) - @ cdecl wined3d_device_set_vertex_shader(ptr ptr) - @ cdecl wined3d_device_set_viewport(ptr ptr) -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index e95911ed0d5..ca477b3a270 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3506,7 +3506,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, - void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, - const struct wined3d_matrix *matrix) DECLSPEC_HIDDEN; - void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline, -- unsigned int view_idx, struct wined3d_unordered_access_view *view) DECLSPEC_HIDDEN; -+ unsigned int view_idx, struct wined3d_unordered_access_view *view, unsigned int initial_count) DECLSPEC_HIDDEN; - 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; -@@ -3680,6 +3680,8 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi - const struct wined3d_uvec4 *clear_value, struct wined3d_context *context) DECLSPEC_HIDDEN; - void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_access_view *view, - DWORD location) DECLSPEC_HIDDEN; -+void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_view *view, -+ unsigned int initial_count) DECLSPEC_HIDDEN; - - struct wined3d_swapchain_ops - { -diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h -index 6c5c5df83ff..22d49435caf 100644 ---- a/include/wine/wined3d.h -+++ b/include/wine/wined3d.h -@@ -2372,7 +2372,7 @@ void __cdecl wined3d_device_set_cs_resource_view(struct wined3d_device *device, - void __cdecl wined3d_device_set_cs_sampler(struct wined3d_device *device, - unsigned int idx, struct wined3d_sampler *sampler); - void __cdecl wined3d_device_set_cs_uav(struct wined3d_device *device, unsigned int idx, -- struct wined3d_unordered_access_view *uav); -+ struct wined3d_unordered_access_view *uav, unsigned int initial_count); - void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device, - int x_screen_space, int y_screen_space, DWORD flags); - HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device, -@@ -2443,7 +2443,7 @@ void __cdecl wined3d_device_set_texture_stage_state(struct wined3d_device *devic - void __cdecl wined3d_device_set_transform(struct wined3d_device *device, - enum wined3d_transform_state state, const struct wined3d_matrix *matrix); - void __cdecl wined3d_device_set_unordered_access_view(struct wined3d_device *device, -- unsigned int idx, struct wined3d_unordered_access_view *uav); -+ unsigned int idx, struct wined3d_unordered_access_view *uav, unsigned int initial_count); - void __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device, - struct wined3d_vertex_declaration *declaration); - void __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader); --- -2.13.1 - diff --git a/patches/wined3d-UAV_Counters/0001-wined3d-Remaining-UAV-counter-changes.patch b/patches/wined3d-UAV_Counters/0001-wined3d-Remaining-UAV-counter-changes.patch new file mode 100644 index 00000000..eed39056 --- /dev/null +++ b/patches/wined3d-UAV_Counters/0001-wined3d-Remaining-UAV-counter-changes.patch @@ -0,0 +1,102 @@ +From 421a9c0b534a902617188f3eb0e4f26ce8897613 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Wed, 9 Aug 2017 06:32:43 +0200 +Subject: wined3d: Remaining UAV counter changes. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Based on patches by Michael Müller and Józef Kucia. +--- + dlls/d3d11/device.c | 3 +++ + dlls/wined3d/cs.c | 4 +++- + dlls/wined3d/device.c | 6 ++++++ + dlls/wined3d/view.c | 5 +---- + 4 files changed, 13 insertions(+), 5 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index 0f268dfed27..5f8d0f3ec13 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -1026,6 +1026,9 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopyStructureCount(ID3D11D + TRACE("iface %p, dst_buffer %p, dst_offset %u, src_view %p.\n", + iface, dst_buffer, dst_offset, src_view); + ++ if (!dst_buffer || !src_view) ++ return; ++ + buffer_impl = unsafe_impl_from_ID3D11Buffer(dst_buffer); + uav = unsafe_impl_from_ID3D11UnorderedAccessView(src_view); + +diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +index a76598ff4ca..39a85fa513d 100644 +--- a/dlls/wined3d/cs.c ++++ b/dlls/wined3d/cs.c +@@ -1295,7 +1295,7 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con + + device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING(op->pipeline)); + +- if (op->initial_count != ~0u) ++ if (op->view && op->initial_count != ~0u) + wined3d_unordered_access_view_set_counter(op->view, op->initial_count); + } + +@@ -2252,6 +2252,7 @@ static void wined3d_cs_exec_copy_uav_counter(struct wined3d_cs *cs, const void * + context_release(context); + + wined3d_resource_release(&op->buffer->resource); ++ wined3d_resource_release(view->resource); + } + + void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer, +@@ -2266,6 +2267,7 @@ void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buff + op->view = uav; + + wined3d_resource_acquire(&dst_buffer->resource); ++ wined3d_resource_acquire(uav->resource); + + cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); + } +diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c +index 30e7fbed02a..3ecd9952893 100644 +--- a/dlls/wined3d/device.c ++++ b/dlls/wined3d/device.c +@@ -3966,6 +3966,12 @@ void CDECL wined3d_device_copy_uav_counter(struct wined3d_device *device, + TRACE("device %p, dst_buffer %p, offset %u, uav %p.\n", + device, dst_buffer, offset, uav); + ++ if (offset + sizeof(GLuint) > dst_buffer->resource.size) ++ { ++ WARN("Offset %u too large.\n", offset); ++ return; ++ } ++ + wined3d_cs_emit_copy_uav_counter(device->cs, dst_buffer, offset, uav); + } + +diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c +index f4f3b35f20c..896bc12bd32 100644 +--- a/dlls/wined3d/view.c ++++ b/dlls/wined3d/view.c +@@ -953,7 +953,7 @@ static void wined3d_unordered_access_view_cs_init(void *object) + context = context_acquire(resource->device, NULL, 0); + gl_info = context->gl_info; + create_buffer_view(&view->gl_view, context, desc, buffer, view->format); +- if (desc->flags & WINED3D_VIEW_BUFFER_COUNTER) ++ if (desc->flags & (WINED3D_VIEW_BUFFER_COUNTER|WINED3D_VIEW_BUFFER_APPEND)) + { + static const GLuint initial_value = 0; + GL_EXTCALL(glGenBuffers(1, &view->counter_bo)); +@@ -994,9 +994,6 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces + return E_INVALIDARG; + view->desc = *desc; + +- if (desc->flags & WINED3D_VIEW_BUFFER_APPEND) +- FIXME("Unhandled view flags %#x.\n", desc->flags); +- + wined3d_resource_incref(view->resource = resource); + + wined3d_cs_init_object(resource->device->cs, wined3d_unordered_access_view_cs_init, view); +-- +2.13.1 + diff --git a/patches/wined3d-UAV_Counters/0002-wined3d-Create-atomic-counter-when-uav-is-initialize.patch b/patches/wined3d-UAV_Counters/0002-wined3d-Create-atomic-counter-when-uav-is-initialize.patch deleted file mode 100644 index 0d8253d3..00000000 --- a/patches/wined3d-UAV_Counters/0002-wined3d-Create-atomic-counter-when-uav-is-initialize.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 10ed488c6db658380491805b03172eef139ba957 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=B3zef=20Kucia?= -Date: Sun, 23 Jul 2017 22:38:36 +0200 -Subject: wined3d: Create atomic counter when uav is initialized with - WINED3D_VIEW_BUFFER_APPEND. - ---- - dlls/wined3d/view.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index 5ef23eacbde..ed112edf4e3 100644 ---- a/dlls/wined3d/view.c -+++ b/dlls/wined3d/view.c -@@ -937,7 +937,7 @@ static void wined3d_unordered_access_view_cs_init(void *object) - context = context_acquire(resource->device, NULL, 0); - gl_info = context->gl_info; - create_buffer_view(&view->gl_view, context, desc, buffer, view->format); -- if (desc->flags & WINED3D_VIEW_BUFFER_COUNTER) -+ if (desc->flags & (WINED3D_VIEW_BUFFER_COUNTER|WINED3D_VIEW_BUFFER_APPEND)) - { - static const GLuint initial_value = 0; - GL_EXTCALL(glGenBuffers(1, &view->counter_bo)); -@@ -978,9 +978,6 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces - return E_INVALIDARG; - view->desc = *desc; - -- if (desc->flags & WINED3D_VIEW_BUFFER_APPEND) -- FIXME("Unhandled view flags %#x.\n", desc->flags); -- - wined3d_resource_incref(view->resource = resource); - - wined3d_cs_init_object(resource->device->cs, wined3d_unordered_access_view_cs_init, view); --- -2.13.1 - diff --git a/patches/wined3d-UAV_Counters/0003-wined3d-Implement-copying-structure-count-of-uav.patch b/patches/wined3d-UAV_Counters/0003-wined3d-Implement-copying-structure-count-of-uav.patch deleted file mode 100644 index 12aea526..00000000 --- a/patches/wined3d-UAV_Counters/0003-wined3d-Implement-copying-structure-count-of-uav.patch +++ /dev/null @@ -1,297 +0,0 @@ -From f7b7f46dd1865c7d71a2c5f7226f17b567d6c49e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 23 Jul 2017 22:41:09 +0200 -Subject: wined3d: Implement copying structure count of uav. - ---- - dlls/d3d11/device.c | 16 +++++++++++- - dlls/d3d11/tests/d3d11.c | 8 +++--- - dlls/wined3d/buffer.c | 55 ++++++++++++++++++++++++++++++++++++++++++ - dlls/wined3d/cs.c | 41 +++++++++++++++++++++++++++++++ - dlls/wined3d/device.c | 16 ++++++++++++ - dlls/wined3d/wined3d.spec | 1 + - dlls/wined3d/wined3d_private.h | 4 +++ - include/wine/wined3d.h | 2 ++ - 8 files changed, 138 insertions(+), 5 deletions(-) - -diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c -index 5662fc23a0c..b7be1194930 100644 ---- a/dlls/d3d11/device.c -+++ b/dlls/d3d11/device.c -@@ -1973,8 +1973,22 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_UpdateSubresource(ID3D11De - static void STDMETHODCALLTYPE d3d11_immediate_context_CopyStructureCount(ID3D11DeviceContext *iface, - ID3D11Buffer *dst_buffer, UINT dst_offset, ID3D11UnorderedAccessView *src_view) - { -- FIXME("iface %p, dst_buffer %p, dst_offset %u, src_view %p stub!\n", -+ struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); -+ struct d3d11_unordered_access_view *view; -+ struct d3d_buffer *buffer; -+ -+ TRACE("iface %p, dst_buffer %p, dst_offset %u, src_view %p.\n", - iface, dst_buffer, dst_offset, src_view); -+ -+ if (!dst_buffer || !src_view) -+ return; -+ -+ buffer = unsafe_impl_from_ID3D11Buffer(dst_buffer); -+ view = unsafe_impl_from_ID3D11UnorderedAccessView(src_view); -+ -+ wined3d_mutex_lock(); -+ wined3d_device_copy_structure_count(device->wined3d_device, buffer->wined3d_buffer, dst_offset, view->wined3d_view); -+ wined3d_mutex_unlock(); - } - - static void STDMETHODCALLTYPE d3d11_immediate_context_ClearRenderTargetView(ID3D11DeviceContext *iface, -diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c -index d2671643016..1e569fe4b9e 100644 ---- a/dlls/d3d11/tests/d3d11.c -+++ b/dlls/d3d11/tests/d3d11.c -@@ -18982,7 +18982,7 @@ static void test_uav_counters(void) - data = 8; - ID3D11DeviceContext_CSSetUnorderedAccessViews(context, 0, 1, &uav, &data); - data = read_uav_counter(context, staging_buffer, uav); -- todo_wine ok(data == 8, "Got unexpected value %u.\n", data); -+ ok(data == 8, "Got unexpected value %u.\n", data); - - ID3D11DeviceContext_CSSetShader(context, cs_producer, NULL, 0); - data = 0; -@@ -18994,7 +18994,7 @@ static void test_uav_counters(void) - /* produce */ - ID3D11DeviceContext_Dispatch(context, 16, 1, 1); - data = read_uav_counter(context, staging_buffer, uav); -- todo_wine ok(data == 64, "Got unexpected value %u.\n", data); -+ ok(data == 64, "Got unexpected value %u.\n", data); - get_buffer_readback(buffer, &rb); - memcpy(id, rb.map_desc.pData, 64 * sizeof(*id)); - release_resource_readback(&rb); -@@ -19030,12 +19030,12 @@ static void test_uav_counters(void) - data = 8; - ID3D11DeviceContext_CSSetUnorderedAccessViews(context, 0, 1, &uav, &data); - data = read_uav_counter(context, staging_buffer, uav); -- todo_wine ok(data == 8, "Got unexpected value %u.\n", data); -+ ok(data == 8, "Got unexpected value %u.\n", data); - - /* consume */ - ID3D11DeviceContext_Dispatch(context, 1, 1, 1); - data = read_uav_counter(context, staging_buffer, uav); -- todo_wine ok(data == 4, "Got unexpected value %u.\n", data); -+ ok(data == 4, "Got unexpected value %u.\n", data); - ID3D11DeviceContext_Dispatch(context, 1, 1, 1); - data = read_uav_counter(context, staging_buffer, uav); - ok(!data, "Got unexpected value %u.\n", data); -diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 040e56625d3..ad0b677f7fa 100644 ---- a/dlls/wined3d/buffer.c -+++ b/dlls/wined3d/buffer.c -@@ -1259,6 +1259,61 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ - return WINED3D_OK; - } - -+/* caller is responsible for tracking state of gl buffer binding */ -+HRESULT wined3d_buffer_copy_from_gl_buffer(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, -+ GLuint src_buffer, GLenum src_target, unsigned int src_offset, unsigned int size) -+{ -+ const struct wined3d_gl_info *gl_info; -+ struct wined3d_bo_address dst; -+ struct wined3d_context *context; -+ struct wined3d_device *device; -+ DWORD dst_location; -+ BYTE *dst_ptr; -+ -+ buffer_mark_used(dst_buffer); -+ -+ device = dst_buffer->resource.device; -+ -+ context = context_acquire(device, NULL, 0); -+ gl_info = context->gl_info; -+ -+ dst_location = wined3d_buffer_get_memory(dst_buffer, &dst, dst_buffer->locations); -+ dst.addr += dst_offset; -+ -+ if (dst.buffer_object) -+ { -+ if (gl_info->supported[ARB_COPY_BUFFER]) -+ { -+ GL_EXTCALL(glBindBuffer(GL_COPY_READ_BUFFER, src_buffer)); -+ GL_EXTCALL(glBindBuffer(GL_COPY_WRITE_BUFFER, dst.buffer_object)); -+ GL_EXTCALL(glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, -+ src_offset, dst_offset, size)); -+ checkGLcall("direct buffer copy"); -+ } -+ else -+ { -+ dst_ptr = context_map_bo_address(context, &dst, size, dst_buffer->buffer_type_hint, 0); -+ -+ GL_EXTCALL(glBindBuffer(src_target, src_buffer)); -+ GL_EXTCALL(glGetBufferSubData(src_target, src_offset, size, dst_ptr)); -+ checkGLcall("buffer download"); -+ -+ context_unmap_bo_address(context, &dst, dst_buffer->buffer_type_hint); -+ } -+ } -+ else -+ { -+ GL_EXTCALL(glBindBuffer(src_target, src_buffer)); -+ GL_EXTCALL(glGetBufferSubData(src_target, src_offset, size, dst.addr)); -+ checkGLcall("buffer download"); -+ } -+ -+ wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size); -+ -+ context_release(context); -+ return WINED3D_OK; -+} -+ - HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, - const struct wined3d_box *box, const void *data) - { -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 2d6544143e4..4314a4807a8 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -71,6 +71,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION, - WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW, - WINED3D_CS_OP_COPY_SUB_RESOURCE, -+ WINED3D_CS_OP_COPY_STRUCTURE_COUNT, - WINED3D_CS_OP_STOP, - }; - -@@ -431,6 +432,14 @@ struct wined3d_cs_copy_sub_resource - struct wined3d_box src_box; - }; - -+struct wined3d_cs_copy_structure_count -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_buffer *dst_buffer; -+ unsigned int offset; -+ struct wined3d_unordered_access_view *src_view; -+}; -+ - struct wined3d_cs_stop - { - enum wined3d_cs_op opcode; -@@ -2380,6 +2389,37 @@ void wined3d_cs_emit_copy_sub_resource(struct wined3d_cs *cs, struct wined3d_res - cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); - } - -+static void wined3d_cs_exec_copy_structure_count(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_copy_structure_count *op = data; -+ -+ if (op->src_view->counter_bo) -+ { -+ wined3d_buffer_copy_from_gl_buffer(op->dst_buffer, op->offset, -+ op->src_view->counter_bo, GL_ATOMIC_COUNTER_BUFFER, 0, sizeof(GLuint)); -+ } -+ -+ wined3d_resource_release(&op->dst_buffer->resource); -+ wined3d_resource_release(op->src_view->resource); -+} -+ -+void wined3d_cs_emit_copy_structure_count(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer, -+ unsigned int offset, struct wined3d_unordered_access_view *src_view) -+{ -+ struct wined3d_cs_copy_structure_count *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); -+ op->opcode = WINED3D_CS_OP_COPY_STRUCTURE_COUNT; -+ op->dst_buffer = dst_buffer; -+ op->offset = offset; -+ op->src_view = src_view; -+ -+ wined3d_resource_acquire(&dst_buffer->resource); -+ wined3d_resource_acquire(src_view->resource); -+ -+ cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); -+} -+ - static void wined3d_cs_emit_stop(struct wined3d_cs *cs) - { - struct wined3d_cs_stop *op; -@@ -2438,6 +2478,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region, - /* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view, - /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource, -+ /* WINED3D_CS_OP_COPY_STRUCTURE_COUNT */ wined3d_cs_exec_copy_structure_count, - }; - - static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id) -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 223885272f2..7cf3e0319d4 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -4289,6 +4289,22 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); - } - -+HRESULT CDECL wined3d_device_copy_structure_count(struct wined3d_device *device, struct wined3d_buffer *dst_buffer, -+ unsigned int offset, struct wined3d_unordered_access_view *src_view) -+{ -+ TRACE("device %p, dst_buffer %p, offset %u, src_view %p.\n", -+ device, dst_buffer, offset, src_view); -+ -+ if (offset + sizeof(GLuint) > dst_buffer->resource.size) -+ { -+ WARN("Offset %u too large.\n", offset); -+ return WINED3DERR_INVALIDCALL; -+ } -+ -+ wined3d_cs_emit_copy_structure_count(device->cs, dst_buffer, offset, src_view); -+ return WINED3D_OK; -+} -+ - HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, - struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, - const struct wined3d_color *color, float depth, DWORD stencil) -diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec -index 631418bdaa9..f0f6871a8a2 100644 ---- a/dlls/wined3d/wined3d.spec -+++ b/dlls/wined3d/wined3d.spec -@@ -37,6 +37,7 @@ - @ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long) - @ cdecl wined3d_device_clear_unordered_access_view_uint(ptr ptr ptr) - @ cdecl wined3d_device_copy_resource(ptr ptr ptr) -+@ cdecl wined3d_device_copy_structure_count(ptr ptr long ptr) - @ cdecl wined3d_device_copy_sub_resource_region(ptr ptr long long long long ptr long ptr) - @ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr) - @ cdecl wined3d_device_decref(ptr) -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 50321f37c3a..548a9679f3f 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3488,6 +3488,8 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou - 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 slice_pitch) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_copy_structure_count(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer, -+ unsigned int offset, struct wined3d_unordered_access_view *src_view) DECLSPEC_HIDDEN; - void wined3d_cs_emit_copy_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource, - unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_resource *src_resource, - unsigned int src_sub_resource_idx, const struct wined3d_box *src_box) DECLSPEC_HIDDEN; -@@ -3571,6 +3573,8 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, - BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; - 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_copy_from_gl_buffer(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, -+ GLuint src_buffer, GLenum src_target, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; - HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, - const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN; - -diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h -index bf182c68813..a0a5a1debcf 100644 ---- a/include/wine/wined3d.h -+++ b/include/wine/wined3d.h -@@ -2456,6 +2456,8 @@ void __cdecl wined3d_device_update_sub_resource(struct wined3d_device *device, s - HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device, - struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture); - HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes); -+HRESULT __cdecl wined3d_device_copy_structure_count(struct wined3d_device *device, struct wined3d_buffer *dst_buffer, -+ unsigned int offset, struct wined3d_unordered_access_view *src_view); - - HRESULT __cdecl wined3d_palette_create(struct wined3d_device *device, DWORD flags, - unsigned int entry_count, const PALETTEENTRY *entries, struct wined3d_palette **palette); --- -2.13.1 -