From 5b94baf1945e648c2cf0938236e27645ce5bbe79 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 21 Jul 2015 05:08:19 +0200 Subject: [PATCH] Rebase against 1a0c4efba9430382e3427cb3f355906bc2a66861. --- debian/changelog | 1 + patches/patchinstall.sh | 20 +- ...vcomp_for_dynamic_init-and-_vcomp_f.patch} | 30 +- ...-vcomp-Split-team-data-and-task-data.patch | 192 ------------ ...ling-of-_vcomp_fork-with-ifval-FALSE.patch | 122 -------- ...d-tests-for-_vcomp_for_dynamic_init.patch} | 34 +-- ...lement-omp_in_parallel-and-add-tests.patch | 244 --------------- ..._vcomp_for_static_simple_init-and-_v.patch | 135 -------- ...tests-for-_vcomp_for_static_simple_i.patch | 217 ------------- ...omp-Implement-_vcomp_for_static_init.patch | 128 -------- ...Add-tests-for-_vcomp_for_static_init.patch | 287 ------------------ .../wined3d-CSMT_Main/9999-IfDefined.patch | 66 ++-- 12 files changed, 69 insertions(+), 1407 deletions(-) rename patches/vcomp-Functions/{0008-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch => 0001-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch} (89%) delete mode 100644 patches/vcomp-Functions/0001-vcomp-Split-team-data-and-task-data.patch delete mode 100644 patches/vcomp-Functions/0002-vcomp-Fix-handling-of-_vcomp_fork-with-ifval-FALSE.patch rename patches/vcomp-Functions/{0009-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch => 0002-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch} (74%) delete mode 100644 patches/vcomp-Functions/0003-vcomp-Implement-omp_in_parallel-and-add-tests.patch delete mode 100644 patches/vcomp-Functions/0004-vcomp-Implement-_vcomp_for_static_simple_init-and-_v.patch delete mode 100644 patches/vcomp-Functions/0005-vcomp-tests-Add-tests-for-_vcomp_for_static_simple_i.patch delete mode 100644 patches/vcomp-Functions/0006-vcomp-Implement-_vcomp_for_static_init.patch delete mode 100644 patches/vcomp-Functions/0007-vcomp-tests-Add-tests-for-_vcomp_for_static_init.patch diff --git a/debian/changelog b/debian/changelog index 6610f4ae..aeb68ac8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,7 @@ wine-staging (1.7.48) UNRELEASED; urgency=low * Removed patch to revert security cookie changes in loader (fixed upstream). * Removed patch to add support 8bpp grayscale TIFF images with 8bpp alpha channel (accepted upstream). + * Partrially removed patches for vcomp implementation (accepted upstream). -- Sebastian Lackner Mon, 13 Jul 2015 02:29:48 +0200 wine-staging (1.7.47) unstable; urgency=low diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 3f941000..96811d89 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -55,7 +55,7 @@ version() echo "Copyright (C) 2014-2015 the Wine Staging project authors." echo "" echo "Patchset to be applied on upstream Wine:" - echo " commit a90592c8d29d3b145eada90c297405cbd8a9277f" + echo " commit 1a0c4efba9430382e3427cb3f355906bc2a66861" echo "" } @@ -4532,23 +4532,9 @@ fi # | dlls/vcomp90/vcomp90.spec # | if test "$enable_vcomp_Functions" -eq 1; then - patch_apply vcomp-Functions/0001-vcomp-Split-team-data-and-task-data.patch - patch_apply vcomp-Functions/0002-vcomp-Fix-handling-of-_vcomp_fork-with-ifval-FALSE.patch - patch_apply vcomp-Functions/0003-vcomp-Implement-omp_in_parallel-and-add-tests.patch - patch_apply vcomp-Functions/0004-vcomp-Implement-_vcomp_for_static_simple_init-and-_v.patch - patch_apply vcomp-Functions/0005-vcomp-tests-Add-tests-for-_vcomp_for_static_simple_i.patch - patch_apply vcomp-Functions/0006-vcomp-Implement-_vcomp_for_static_init.patch - patch_apply vcomp-Functions/0007-vcomp-tests-Add-tests-for-_vcomp_for_static_init.patch - patch_apply vcomp-Functions/0008-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch - patch_apply vcomp-Functions/0009-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch + patch_apply vcomp-Functions/0001-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch + patch_apply vcomp-Functions/0002-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch ( - echo '+ { "Sebastian Lackner", "vcomp: Split team data and task data.", 1 },'; - echo '+ { "Sebastian Lackner", "vcomp: Fix handling of _vcomp_fork with ifval == FALSE.", 1 },'; - echo '+ { "Sebastian Lackner", "vcomp: Implement omp_in_parallel and add tests.", 1 },'; - echo '+ { "Sebastian Lackner", "vcomp: Implement _vcomp_for_static_simple_init and _vcomp_for_static_end.", 1 },'; - echo '+ { "Sebastian Lackner", "vcomp/tests: Add tests for _vcomp_for_static_simple_init.", 1 },'; - echo '+ { "Sebastian Lackner", "vcomp: Implement _vcomp_for_static_init.", 1 },'; - echo '+ { "Sebastian Lackner", "vcomp/tests: Add tests for _vcomp_for_static_init.", 1 },'; echo '+ { "Sebastian Lackner", "vcomp: Implement _vcomp_for_dynamic_init and _vcomp_for_dynamic_next.", 1 },'; echo '+ { "Sebastian Lackner", "vcomp/tests: Add tests for _vcomp_for_dynamic_init.", 1 },'; ) >> "$patchlist" diff --git a/patches/vcomp-Functions/0008-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch b/patches/vcomp-Functions/0001-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch similarity index 89% rename from patches/vcomp-Functions/0008-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch rename to patches/vcomp-Functions/0001-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch index 6f38e4a6..0354a646 100644 --- a/patches/vcomp-Functions/0008-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch +++ b/patches/vcomp-Functions/0001-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch @@ -1,4 +1,4 @@ -From 669a548a8daa2c8477a81160cfc473844e0a2e1d Mon Sep 17 00:00:00 2001 +From 69ccde5d615c9d4fef7263ffc887bc1cab96bf5c Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 19 Jul 2015 01:01:28 +0200 Subject: vcomp: Implement _vcomp_for_dynamic_init and _vcomp_for_dynamic_next. @@ -11,7 +11,7 @@ Subject: vcomp: Implement _vcomp_for_dynamic_init and _vcomp_for_dynamic_next. 4 files changed, 83 insertions(+), 6 deletions(-) diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c -index 0148c8b..c565dc8 100644 +index ae5623b..d123327 100644 --- a/dlls/vcomp/main.c +++ b/dlls/vcomp/main.c @@ -63,6 +63,9 @@ struct vcomp_thread_data @@ -39,15 +39,15 @@ index 0148c8b..c565dc8 100644 }; #if defined(__i386__) -@@ -202,6 +213,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void) +@@ -199,6 +210,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void) + } - task_data = &((struct vcomp_thread_and_task_data *)thread_data)->task; - task_data->section = 0; -+ task_data->dynamic = 0; + data->task.section = 0; ++ data->task.dynamic = 0; + thread_data = &data->thread; thread_data->team = NULL; - thread_data->task = task_data; -@@ -209,6 +221,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void) +@@ -207,6 +219,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void) thread_data->parallel = FALSE; thread_data->fork_threads = 0; thread_data->section = 1; @@ -55,7 +55,7 @@ index 0148c8b..c565dc8 100644 vcomp_set_thread_data(thread_data); return thread_data; -@@ -483,6 +496,66 @@ void CDECL _vcomp_for_static_end(void) +@@ -481,6 +494,66 @@ void CDECL _vcomp_for_static_end(void) /* nothing to do here */ } @@ -93,7 +93,7 @@ index 0148c8b..c565dc8 100644 + LeaveCriticalSection(&vcomp_section); +} + -+BOOL CDECL _vcomp_for_dynamic_next(unsigned int *begin, unsigned int *end) ++int CDECL _vcomp_for_dynamic_next(unsigned int *begin, unsigned int *end) +{ + struct vcomp_thread_data *thread_data = vcomp_init_thread_data(); + struct vcomp_task_data *task_data = thread_data->task; @@ -119,10 +119,10 @@ index 0148c8b..c565dc8 100644 + return (iterations != 0); +} + - BOOL CDECL omp_in_parallel(void) + int CDECL omp_in_parallel(void) { TRACE("()\n"); -@@ -560,6 +633,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) +@@ -558,6 +631,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) team_data.barrier_count = 0; task_data.section = 0; @@ -130,7 +130,7 @@ index 0148c8b..c565dc8 100644 thread_data.team = &team_data; thread_data.task = &task_data; -@@ -567,6 +641,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) +@@ -565,6 +639,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) thread_data.parallel = ifval || prev_thread_data->parallel; thread_data.fork_threads = 0; thread_data.section = 1; @@ -138,7 +138,7 @@ index 0148c8b..c565dc8 100644 list_init(&thread_data.entry); InitializeConditionVariable(&thread_data.cond); -@@ -585,6 +660,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) +@@ -583,6 +658,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) data->parallel = thread_data.parallel; data->fork_threads = 0; data->section = 1; @@ -146,7 +146,7 @@ index 0148c8b..c565dc8 100644 list_remove(&data->entry); list_add_tail(&thread_data.entry, &data->entry); WakeAllConditionVariable(&data->cond); -@@ -606,6 +682,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) +@@ -604,6 +680,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) data->parallel = thread_data.parallel; data->fork_threads = 0; data->section = 1; diff --git a/patches/vcomp-Functions/0001-vcomp-Split-team-data-and-task-data.patch b/patches/vcomp-Functions/0001-vcomp-Split-team-data-and-task-data.patch deleted file mode 100644 index eb98a091..00000000 --- a/patches/vcomp-Functions/0001-vcomp-Split-team-data-and-task-data.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 52ef17d8550f05778f548cc01fce2a0eaa3b223b Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 18 Jul 2015 17:22:01 +0200 -Subject: vcomp: Split team data and task data. - ---- - dlls/vcomp/main.c | 47 ++++++++++++++++++++++++++++++++++------------- - dlls/vcomp/tests/vcomp.c | 20 ++++++++++++++++++++ - 2 files changed, 54 insertions(+), 13 deletions(-) - -diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c -index 0f8a272..8866b15 100644 ---- a/dlls/vcomp/main.c -+++ b/dlls/vcomp/main.c -@@ -52,6 +52,7 @@ static RTL_CRITICAL_SECTION vcomp_section = { &critsect_debug, -1, 0, 0, 0, 0 }; - struct vcomp_thread_data - { - struct vcomp_team_data *team; -+ struct vcomp_task_data *task; - int thread_num; - int fork_threads; - -@@ -77,7 +78,10 @@ struct vcomp_team_data - /* barrier */ - unsigned int barrier; - int barrier_count; -+}; - -+struct vcomp_task_data -+{ - /* section */ - unsigned int section; - int num_sections; -@@ -177,20 +181,32 @@ static inline void vcomp_set_thread_data(struct vcomp_thread_data *thread_data) - TlsSetValue(vcomp_context_tls, thread_data); - } - -+struct vcomp_thread_and_task_data -+{ -+ struct vcomp_thread_data thread; -+ struct vcomp_task_data task; -+}; -+ - static struct vcomp_thread_data *vcomp_init_thread_data(void) - { - struct vcomp_thread_data *thread_data = vcomp_get_thread_data(); -+ struct vcomp_task_data *task_data; - if (thread_data) return thread_data; - -- if (!(thread_data = HeapAlloc(GetProcessHeap(), 0, sizeof(*thread_data)))) -+ if (!(thread_data = HeapAlloc(GetProcessHeap(), 0, sizeof(struct vcomp_thread_and_task_data)))) - { - ERR("could not create thread data\n"); - ExitProcess(1); - } - -+ task_data = &((struct vcomp_thread_and_task_data *)thread_data)->task; -+ task_data->section = 0; -+ - thread_data->team = NULL; -+ thread_data->task = task_data; - thread_data->thread_num = 0; - thread_data->fork_threads = 0; -+ thread_data->section = 1; - - vcomp_set_thread_data(thread_data); - return thread_data; -@@ -311,35 +327,35 @@ void CDECL _vcomp_single_end(void) - - void CDECL _vcomp_sections_init(int n) - { -- struct vcomp_thread_data *thread_data = vcomp_get_thread_data(); -- struct vcomp_team_data *team_data = thread_data->team; -+ struct vcomp_thread_data *thread_data = vcomp_init_thread_data(); -+ struct vcomp_task_data *task_data = thread_data->task; - - TRACE("(%d)\n", n); - - EnterCriticalSection(&vcomp_section); - thread_data->section++; -- if ((int)(thread_data->section - team_data->section) > 0) -+ if ((int)(thread_data->section - task_data->section) > 0) - { -- team_data->section = thread_data->section; -- team_data->num_sections = n; -- team_data->section_index = 0; -+ task_data->section = thread_data->section; -+ task_data->num_sections = n; -+ task_data->section_index = 0; - } - LeaveCriticalSection(&vcomp_section); - } - - int CDECL _vcomp_sections_next(void) - { -- struct vcomp_thread_data *thread_data = vcomp_get_thread_data(); -- struct vcomp_team_data *team_data = thread_data->team; -+ struct vcomp_thread_data *thread_data = vcomp_init_thread_data(); -+ struct vcomp_task_data *task_data = thread_data->task; - int i = -1; - - TRACE("()\n"); - - EnterCriticalSection(&vcomp_section); -- if (thread_data->section == team_data->section && -- team_data->section_index != team_data->num_sections) -+ if (thread_data->section == task_data->section && -+ task_data->section_index != task_data->num_sections) - { -- i = team_data->section_index++; -+ i = task_data->section_index++; - } - LeaveCriticalSection(&vcomp_section); - return i; -@@ -391,6 +407,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - struct vcomp_thread_data *prev_thread_data = vcomp_init_thread_data(); - struct vcomp_thread_data thread_data; - struct vcomp_team_data team_data; -+ struct vcomp_task_data task_data; - int num_threads; - - TRACE("(%d, %d, %p, ...)\n", ifval, nargs, wrapper); -@@ -412,9 +429,11 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - __ms_va_start(team_data.valist, wrapper); - team_data.barrier = 0; - team_data.barrier_count = 0; -- team_data.section = 0; -+ -+ task_data.section = 0; - - thread_data.team = &team_data; -+ thread_data.task = &task_data; - thread_data.thread_num = 0; - thread_data.fork_threads = 0; - thread_data.section = 1; -@@ -431,6 +450,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - { - struct vcomp_thread_data *data = LIST_ENTRY(ptr, struct vcomp_thread_data, entry); - data->team = &team_data; -+ data->task = &task_data; - data->thread_num = team_data.num_threads++; - data->fork_threads = 0; - data->section = 1; -@@ -450,6 +470,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - if (!data) break; - - data->team = &team_data; -+ data->task = &task_data; - data->thread_num = team_data.num_threads; - data->fork_threads = 0; - data->section = 1; -diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c -index c433991..a933a4e 100644 ---- a/dlls/vcomp/tests/vcomp.c -+++ b/dlls/vcomp/tests/vcomp.c -@@ -378,6 +378,20 @@ static void test_vcomp_sections_init(void) - int max_threads = pomp_get_max_threads(); - int i; - -+if (0) -+{ -+ /* calling _vcomp_sections_next without prior _vcomp_sections_init -+ * returns uninitialized memory on Windows. */ -+ i = p_vcomp_sections_next(); -+ ok(i == -1, "expected -1, got %d\n", i); -+} -+ -+ a = b = c = 0; -+ section_cb(&a, &b, &c); -+ ok(a == 20, "expected a = 20, got %d\n", a); -+ ok(b == 30, "expected b = 30, got %d\n", b); -+ ok(c == 40, "expected c = 40, got %d\n", c); -+ - for (i = 1; i <= 4; i++) - { - pomp_set_num_threads(i); -@@ -387,6 +401,12 @@ static void test_vcomp_sections_init(void) - ok(a == 20, "expected a = 20, got %d\n", a); - ok(b == 30, "expected b = 30, got %d\n", b); - ok(c == 40, "expected c = 40, got %d\n", c); -+ -+ a = b = c = 0; -+ p_vcomp_fork(FALSE, 3, section_cb, &a, &b, &c); -+ ok(a == 20, "expected a = 20, got %d\n", a); -+ ok(b == 30, "expected b = 30, got %d\n", b); -+ ok(c == 40, "expected c = 40, got %d\n", c); - } - - pomp_set_num_threads(max_threads); --- -2.4.5 - diff --git a/patches/vcomp-Functions/0002-vcomp-Fix-handling-of-_vcomp_fork-with-ifval-FALSE.patch b/patches/vcomp-Functions/0002-vcomp-Fix-handling-of-_vcomp_fork-with-ifval-FALSE.patch deleted file mode 100644 index 6e661906..00000000 --- a/patches/vcomp-Functions/0002-vcomp-Fix-handling-of-_vcomp_fork-with-ifval-FALSE.patch +++ /dev/null @@ -1,122 +0,0 @@ -From fea70f187f3f04cfecd4c38014d51ea6a29d53c6 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 18 Jul 2015 18:00:45 +0200 -Subject: vcomp: Fix handling of _vcomp_fork with ifval == FALSE. - -Nested forks are still possible in this case, when it is not running inside -of a parallel block. ---- - dlls/vcomp/main.c | 10 ++++++++-- - dlls/vcomp/tests/vcomp.c | 23 ++++++++++++++++++++--- - 2 files changed, 28 insertions(+), 5 deletions(-) - -diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c -index 8866b15..8526d86 100644 ---- a/dlls/vcomp/main.c -+++ b/dlls/vcomp/main.c -@@ -54,6 +54,7 @@ struct vcomp_thread_data - struct vcomp_team_data *team; - struct vcomp_task_data *task; - int thread_num; -+ BOOL parallel; - int fork_threads; - - /* only used for concurrent tasks */ -@@ -205,6 +206,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void) - thread_data->team = NULL; - thread_data->task = task_data; - thread_data->thread_num = 0; -+ thread_data->parallel = FALSE; - thread_data->fork_threads = 0; - thread_data->section = 1; - -@@ -412,10 +414,11 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - - TRACE("(%d, %d, %p, ...)\n", ifval, nargs, wrapper); - -+ if (prev_thread_data->parallel && !vcomp_nested_fork) -+ ifval = FALSE; -+ - if (!ifval) - num_threads = 1; -- else if (prev_thread_data->team && !vcomp_nested_fork) -- num_threads = 1; - else if (prev_thread_data->fork_threads) - num_threads = prev_thread_data->fork_threads; - else -@@ -435,6 +438,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - thread_data.team = &team_data; - thread_data.task = &task_data; - thread_data.thread_num = 0; -+ thread_data.parallel = ifval || prev_thread_data->parallel; - thread_data.fork_threads = 0; - thread_data.section = 1; - list_init(&thread_data.entry); -@@ -452,6 +456,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - data->team = &team_data; - data->task = &task_data; - data->thread_num = team_data.num_threads++; -+ data->parallel = thread_data.parallel; - data->fork_threads = 0; - data->section = 1; - list_remove(&data->entry); -@@ -472,6 +477,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...) - data->team = &team_data; - data->task = &task_data; - data->thread_num = team_data.num_threads; -+ data->parallel = thread_data.parallel; - data->fork_threads = 0; - data->section = 1; - InitializeConditionVariable(&data->cond); -diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c -index a933a4e..4dae41f 100644 ---- a/dlls/vcomp/tests/vcomp.c -+++ b/dlls/vcomp/tests/vcomp.c -@@ -208,17 +208,21 @@ static void CDECL num_threads_cb(BOOL nested, int nested_threads, LONG *count) - thread_count = 0; - p_vcomp_fork(TRUE, 1, num_threads_cb2, &thread_count); - if (nested) -- ok(thread_count == nested_threads, "expected %d thread, got %d\n", nested_threads, thread_count); -+ ok(thread_count == nested_threads, "expected %d threads, got %d\n", nested_threads, thread_count); - else - ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); - -+ thread_count = 0; -+ p_vcomp_fork(FALSE, 1, num_threads_cb2, &thread_count); -+ ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); -+ - p_vcomp_set_num_threads(4); - thread_count = 0; - p_vcomp_fork(TRUE, 1, num_threads_cb2, &thread_count); - if (nested) -- ok(thread_count == 4 , "expected 4 thread, got %d\n", thread_count); -+ ok(thread_count == 4, "expected 4 threads, got %d\n", thread_count); - else -- ok(thread_count == 1 , "expected 1 thread, got %d\n", thread_count); -+ ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); - } - - static void test_omp_get_num_threads(BOOL nested) -@@ -241,6 +245,19 @@ static void test_omp_get_num_threads(BOOL nested) - p_vcomp_fork(TRUE, 3, num_threads_cb, nested, max_threads, &thread_count); - ok(thread_count == max_threads, "expected %d threads, got %d\n", max_threads, thread_count); - -+ num_threads = pomp_get_num_threads(); -+ ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); -+ thread_count = 0; -+ p_vcomp_fork(FALSE, 3, num_threads_cb, TRUE, max_threads, &thread_count); -+ ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); -+ -+ pomp_set_num_threads(1); -+ num_threads = pomp_get_num_threads(); -+ ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); -+ thread_count = 0; -+ p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 1, &thread_count); -+ ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); -+ - pomp_set_num_threads(2); - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); --- -2.4.5 - diff --git a/patches/vcomp-Functions/0009-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch b/patches/vcomp-Functions/0002-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch similarity index 74% rename from patches/vcomp-Functions/0009-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch rename to patches/vcomp-Functions/0002-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch index 303a0c6b..fce201bf 100644 --- a/patches/vcomp-Functions/0009-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch +++ b/patches/vcomp-Functions/0002-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch @@ -1,4 +1,4 @@ -From 23a2077048d54113d81a05a475d63c2df37c2d63 Mon Sep 17 00:00:00 2001 +From a175543f726f1205054a69bef12d901453326016 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 19 Jul 2015 01:05:02 +0200 Subject: vcomp/tests: Add tests for _vcomp_for_dynamic_init. @@ -8,7 +8,7 @@ Subject: vcomp/tests: Add tests for _vcomp_for_dynamic_init. 1 file changed, 68 insertions(+) diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c -index 205899d..c7a0e60 100644 +index bb1026b..769edf9 100644 --- a/dlls/vcomp/tests/vcomp.c +++ b/dlls/vcomp/tests/vcomp.c @@ -32,6 +32,9 @@ static BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR); @@ -17,7 +17,7 @@ index 205899d..c7a0e60 100644 static void (CDECL *p_vcomp_barrier)(void); +static void (CDECL *p_vcomp_for_dynamic_init)(unsigned int flags, unsigned int first, unsigned int last, + int step, unsigned int chunksize); -+static BOOL (CDECL *p_vcomp_for_dynamic_next)(unsigned int *begin, unsigned int *end); ++static int (CDECL *p_vcomp_for_dynamic_next)(unsigned int *begin, unsigned int *end); static void (CDECL *p_vcomp_for_static_end)(void); static void (CDECL *p_vcomp_for_static_init)(int first, int last, int step, int chunksize, unsigned int *loops, int *begin, int *end, int *next, int *lastchunk); @@ -30,7 +30,7 @@ index 205899d..c7a0e60 100644 VCOMP_GET_PROC(_vcomp_for_static_end); VCOMP_GET_PROC(_vcomp_for_static_init); VCOMP_GET_PROC(_vcomp_for_static_simple_init); -@@ -874,6 +879,68 @@ static void test_vcomp_for_static_init(void) +@@ -849,6 +854,68 @@ static void test_vcomp_for_static_init(void) pomp_set_num_threads(max_threads); } @@ -38,21 +38,21 @@ index 205899d..c7a0e60 100644 +{ + unsigned int begin, end; + -+ p_vcomp_for_dynamic_init(0x40, 1, 100000, 1, 30); ++ p_vcomp_for_dynamic_init(0x40, 1, 999983, 1, 30); + while (p_vcomp_for_dynamic_next(&begin, &end)) + { + InterlockedExchangeAdd(a, end - begin + 1); + Sleep(1); + } + -+ p_vcomp_for_dynamic_init(0, 1337, 1, 1, 50); ++ p_vcomp_for_dynamic_init(0, 99991, 1, 1, 50); + while (p_vcomp_for_dynamic_next(&begin, &end)) + { + InterlockedExchangeAdd(b, begin - end + 1); + Sleep(1); + } + -+ p_vcomp_for_dynamic_init(0x40, 1, 100000, 7, 30); ++ p_vcomp_for_dynamic_init(0x40, 1, 9973, 7, 30); + while (p_vcomp_for_dynamic_next(&begin, &end)) + { + while (begin <= end) @@ -72,9 +72,9 @@ index 205899d..c7a0e60 100644 + + a = b = c = 0; + for_dynamic_cb(&a, &b, &c); -+ ok(a == 100000, "expected a = 100000, got %d\n", a); -+ ok(b == 1337, "expected b = 1337, got %d\n", b); -+ ok(c == 14286, "expected c = 14286, got %d\n", c); ++ ok(a == 999983, "expected a == 999983, got %d\n", a); ++ ok(b == 99991, "expected b == 99991, got %d\n", b); ++ ok(c == 1425, "expected c == 1425, got %d\n", c); + + for (i = 1; i <= 4; i++) + { @@ -82,15 +82,15 @@ index 205899d..c7a0e60 100644 + + a = b = c = 0; + p_vcomp_fork(TRUE, 3, for_dynamic_cb, &a, &b, &c); -+ ok(a == 100000, "expected a = 100000, got %d\n", a); -+ ok(b == 1337, "expected b = 1337, got %d\n", b); -+ ok(c == 14286, "expected c = 14286, got %d\n", c); ++ ok(a == 999983, "expected a == 999983, got %d\n", a); ++ ok(b == 99991, "expected b == 99991, got %d\n", b); ++ ok(c == 1425, "expected c == 1425, got %d\n", c); + + a = b = c = 0; + p_vcomp_fork(FALSE, 3, for_dynamic_cb, &a, &b, &c); -+ ok(a == 100000, "expected a = 100000, got %d\n", a); -+ ok(b == 1337, "expected b = 1337, got %d\n", b); -+ ok(c == 14286, "expected c = 14286, got %d\n", c); ++ ok(a == 999983, "expected a == 999983, got %d\n", a); ++ ok(b == 99991, "expected b == 99991, got %d\n", b); ++ ok(c == 1425, "expected c == 1425, got %d\n", c); + } + + pomp_set_num_threads(max_threads); @@ -99,7 +99,7 @@ index 205899d..c7a0e60 100644 START_TEST(vcomp) { if (!init_vcomp()) -@@ -885,6 +952,7 @@ START_TEST(vcomp) +@@ -860,6 +927,7 @@ START_TEST(vcomp) test_vcomp_sections_init(); test_vcomp_for_static_simple_init(); test_vcomp_for_static_init(); diff --git a/patches/vcomp-Functions/0003-vcomp-Implement-omp_in_parallel-and-add-tests.patch b/patches/vcomp-Functions/0003-vcomp-Implement-omp_in_parallel-and-add-tests.patch deleted file mode 100644 index f3d3818d..00000000 --- a/patches/vcomp-Functions/0003-vcomp-Implement-omp_in_parallel-and-add-tests.patch +++ /dev/null @@ -1,244 +0,0 @@ -From 8f71eb6dce0bf634c75a5dc7a5137f45594a530a Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 18 Jul 2015 23:39:01 +0200 -Subject: vcomp: Implement omp_in_parallel and add tests. - ---- - dlls/vcomp/main.c | 6 +++++ - dlls/vcomp/tests/vcomp.c | 59 ++++++++++++++++++++++++++++++++++----------- - dlls/vcomp/vcomp.spec | 2 +- - dlls/vcomp100/vcomp100.spec | 2 +- - dlls/vcomp90/vcomp90.spec | 2 +- - 5 files changed, 54 insertions(+), 17 deletions(-) - -diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c -index 8526d86..a17407c 100644 ---- a/dlls/vcomp/main.c -+++ b/dlls/vcomp/main.c -@@ -363,6 +363,12 @@ int CDECL _vcomp_sections_next(void) - return i; - } - -+BOOL CDECL omp_in_parallel(void) -+{ -+ TRACE("()\n"); -+ return vcomp_init_thread_data()->parallel; -+} -+ - static DWORD WINAPI _vcomp_fork_worker(void *param) - { - struct vcomp_thread_data *thread_data = param; -diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c -index 4dae41f..6b22d48 100644 ---- a/dlls/vcomp/tests/vcomp.c -+++ b/dlls/vcomp/tests/vcomp.c -@@ -40,6 +40,7 @@ static int (CDECL *pomp_get_max_threads)(void); - static int (CDECL *pomp_get_nested)(void); - static int (CDECL *pomp_get_num_threads)(void); - static int (CDECL *pomp_get_thread_num)(void); -+static BOOL (CDECL *pomp_in_parallel)(void); - static void (CDECL *pomp_set_nested)(int nested); - static void (CDECL *pomp_set_num_threads)(int num_threads); - -@@ -178,6 +179,7 @@ static BOOL init_vcomp(void) - VCOMP_GET_PROC(omp_get_nested); - VCOMP_GET_PROC(omp_get_num_threads); - VCOMP_GET_PROC(omp_get_thread_num); -+ VCOMP_GET_PROC(omp_in_parallel); - VCOMP_GET_PROC(omp_set_nested); - VCOMP_GET_PROC(omp_set_num_threads); - -@@ -186,15 +188,19 @@ static BOOL init_vcomp(void) - - #undef VCOMP_GET_PROC - --static void CDECL num_threads_cb2(LONG *count) -+static void CDECL num_threads_cb2(BOOL parallel, LONG *count) - { -+ BOOL is_parallel = pomp_in_parallel(); -+ ok(is_parallel == parallel, "expected %u, got %u\n", parallel, is_parallel); -+ - InterlockedIncrement(count); - } - --static void CDECL num_threads_cb(BOOL nested, int nested_threads, LONG *count) -+static void CDECL num_threads_cb(BOOL nested, BOOL parallel, int nested_threads, LONG *count) - { - int num_threads, thread_num; - LONG thread_count; -+ BOOL is_parallel; - - InterlockedIncrement(count); - p_vcomp_barrier(); -@@ -205,30 +211,43 @@ static void CDECL num_threads_cb(BOOL nested, int nested_threads, LONG *count) - ok(thread_num >= 0 && thread_num < num_threads, - "expected thread_num in range [0, %d], got %d\n", num_threads - 1, thread_num); - -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == parallel, "expected %u, got %u\n", parallel, is_parallel); -+ - thread_count = 0; -- p_vcomp_fork(TRUE, 1, num_threads_cb2, &thread_count); -+ p_vcomp_fork(TRUE, 2, num_threads_cb2, TRUE, &thread_count); - if (nested) - ok(thread_count == nested_threads, "expected %d threads, got %d\n", nested_threads, thread_count); - else - ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); - -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == parallel, "expected %u, got %u\n", parallel, is_parallel); -+ - thread_count = 0; -- p_vcomp_fork(FALSE, 1, num_threads_cb2, &thread_count); -+ p_vcomp_fork(FALSE, 2, num_threads_cb2, parallel, &thread_count); - ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); - -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == parallel, "expected %u, got %u\n", parallel, is_parallel); -+ - p_vcomp_set_num_threads(4); - thread_count = 0; -- p_vcomp_fork(TRUE, 1, num_threads_cb2, &thread_count); -+ p_vcomp_fork(TRUE, 2, num_threads_cb2, TRUE, &thread_count); - if (nested) - ok(thread_count == 4, "expected 4 threads, got %d\n", thread_count); - else - ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); -+ -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == parallel, "expected %u, got %u\n", parallel, is_parallel); - } - - static void test_omp_get_num_threads(BOOL nested) - { - int is_nested, max_threads, num_threads, thread_num; - LONG thread_count; -+ BOOL is_parallel; - - pomp_set_nested(nested); - is_nested = pomp_get_nested(); -@@ -239,61 +258,73 @@ static void test_omp_get_num_threads(BOOL nested) - thread_num = pomp_get_thread_num(); - ok(thread_num == 0, "expected thread_num == 0, got %d\n", thread_num); - -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == FALSE, "expected FALSE, got %u\n", is_parallel); -+ - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, max_threads, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, max_threads, &thread_count); - ok(thread_count == max_threads, "expected %d threads, got %d\n", max_threads, thread_count); - -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == FALSE, "expected FALSE, got %u\n", is_parallel); -+ - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(FALSE, 3, num_threads_cb, TRUE, max_threads, &thread_count); -+ p_vcomp_fork(FALSE, 4, num_threads_cb, TRUE, FALSE, max_threads, &thread_count); - ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); - -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == FALSE, "expected FALSE, got %u\n", is_parallel); -+ - pomp_set_num_threads(1); - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 1, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, 1, &thread_count); - ok(thread_count == 1, "expected 1 thread, got %d\n", thread_count); - -+ is_parallel = pomp_in_parallel(); -+ ok(is_parallel == FALSE, "expected FALSE, got %u\n", is_parallel); -+ - pomp_set_num_threads(2); - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 2, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, 2, &thread_count); - ok(thread_count == 2, "expected 2 threads, got %d\n", thread_count); - - pomp_set_num_threads(4); - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 4, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, 4, &thread_count); - ok(thread_count == 4, "expected 4 threads, got %d\n", thread_count); - - p_vcomp_set_num_threads(8); - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 4, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, 4, &thread_count); - ok(thread_count == 8, "expected 8 threads, got %d\n", thread_count); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 4, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, 4, &thread_count); - ok(thread_count == 4, "expected 4 threads, got %d\n", thread_count); - - p_vcomp_set_num_threads(0); - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 4, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, 4, &thread_count); - ok(thread_count == 4, "expected 4 threads, got %d\n", thread_count); - - pomp_set_num_threads(0); - num_threads = pomp_get_num_threads(); - ok(num_threads == 1, "expected num_threads == 1, got %d\n", num_threads); - thread_count = 0; -- p_vcomp_fork(TRUE, 3, num_threads_cb, nested, 4, &thread_count); -+ p_vcomp_fork(TRUE, 4, num_threads_cb, nested, TRUE, 4, &thread_count); - ok(thread_count == 4, "expected 4 threads, got %d\n", thread_count); - - pomp_set_num_threads(max_threads); -diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec -index dfbd184..5a5b114 100644 ---- a/dlls/vcomp/vcomp.spec -+++ b/dlls/vcomp/vcomp.spec -@@ -98,7 +98,7 @@ - @ cdecl omp_get_thread_num() - @ stub omp_get_wtick - @ cdecl omp_get_wtime() --@ stub omp_in_parallel -+@ cdecl omp_in_parallel() - @ stub omp_init_lock - @ stub omp_init_nest_lock - @ cdecl omp_set_dynamic(long) -diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec -index 6eb6ae5..debc5ff 100644 ---- a/dlls/vcomp100/vcomp100.spec -+++ b/dlls/vcomp100/vcomp100.spec -@@ -98,7 +98,7 @@ - @ cdecl omp_get_thread_num() vcomp.omp_get_thread_num - @ stub omp_get_wtick - @ cdecl omp_get_wtime() vcomp.omp_get_wtime --@ stub omp_in_parallel -+@ cdecl omp_in_parallel() vcomp.omp_in_parallel - @ stub omp_init_lock - @ stub omp_init_nest_lock - @ cdecl omp_set_dynamic(long) vcomp.omp_set_dynamic -diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec -index 6eb6ae5..debc5ff 100644 ---- a/dlls/vcomp90/vcomp90.spec -+++ b/dlls/vcomp90/vcomp90.spec -@@ -98,7 +98,7 @@ - @ cdecl omp_get_thread_num() vcomp.omp_get_thread_num - @ stub omp_get_wtick - @ cdecl omp_get_wtime() vcomp.omp_get_wtime --@ stub omp_in_parallel -+@ cdecl omp_in_parallel() vcomp.omp_in_parallel - @ stub omp_init_lock - @ stub omp_init_nest_lock - @ cdecl omp_set_dynamic(long) vcomp.omp_set_dynamic --- -2.4.5 - diff --git a/patches/vcomp-Functions/0004-vcomp-Implement-_vcomp_for_static_simple_init-and-_v.patch b/patches/vcomp-Functions/0004-vcomp-Implement-_vcomp_for_static_simple_init-and-_v.patch deleted file mode 100644 index 1e5be109..00000000 --- a/patches/vcomp-Functions/0004-vcomp-Implement-_vcomp_for_static_simple_init-and-_v.patch +++ /dev/null @@ -1,135 +0,0 @@ -From a2e77ca2e3e956aaabaa5190a0e8cc822349f1a8 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 11 Jul 2015 18:59:41 +0200 -Subject: vcomp: Implement _vcomp_for_static_simple_init and - _vcomp_for_static_end. - ---- - dlls/vcomp/main.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ - dlls/vcomp/vcomp.spec | 4 ++-- - dlls/vcomp100/vcomp100.spec | 4 ++-- - dlls/vcomp90/vcomp90.spec | 4 ++-- - 4 files changed, 63 insertions(+), 6 deletions(-) - -diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c -index a17407c..b647bb1 100644 ---- a/dlls/vcomp/main.c -+++ b/dlls/vcomp/main.c -@@ -363,6 +363,63 @@ int CDECL _vcomp_sections_next(void) - return i; - } - -+void CDECL _vcomp_for_static_simple_init(unsigned int first, unsigned int last, int step, -+ BOOL increment, unsigned int *begin, unsigned int *end) -+{ -+ unsigned int iterations, per_thread, remaining; -+ struct vcomp_thread_data *thread_data = vcomp_init_thread_data(); -+ struct vcomp_team_data *team_data = thread_data->team; -+ int num_threads = team_data ? team_data->num_threads : 1; -+ int thread_num = thread_data->thread_num; -+ -+ TRACE("(%u, %u, %d, %u, %p, %p)\n", first, last, step, increment, begin, end); -+ -+ if (num_threads == 1) -+ { -+ *begin = first; -+ *end = last; -+ return; -+ } -+ -+ if (step <= 0) -+ { -+ *begin = 0; -+ *end = increment ? -1 : 1; -+ return; -+ } -+ -+ if (increment) -+ iterations = 1 + (last - first) / step; -+ else -+ { -+ iterations = 1 + (first - last) / step; -+ step *= -1; -+ } -+ -+ per_thread = iterations / num_threads; -+ remaining = iterations - per_thread * num_threads; -+ -+ if (thread_num < remaining) -+ per_thread++; -+ else if (per_thread) -+ first += remaining * step; -+ else -+ { -+ *begin = first; -+ *end = first - step; -+ return; -+ } -+ -+ *begin = first + per_thread * thread_num * step; -+ *end = *begin + (per_thread - 1) * step; -+} -+ -+void CDECL _vcomp_for_static_end(void) -+{ -+ TRACE("()\n"); -+ /* nothing to do here */ -+} -+ - BOOL CDECL omp_in_parallel(void) - { - TRACE("()\n"); -diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec -index 5a5b114..d6b8bf5 100644 ---- a/dlls/vcomp/vcomp.spec -+++ b/dlls/vcomp/vcomp.spec -@@ -59,10 +59,10 @@ - @ stub _vcomp_for_dynamic_init_i8 - @ stub _vcomp_for_dynamic_next - @ stub _vcomp_for_dynamic_next_i8 --@ stub _vcomp_for_static_end -+@ cdecl _vcomp_for_static_end() - @ stub _vcomp_for_static_init - @ stub _vcomp_for_static_init_i8 --@ stub _vcomp_for_static_simple_init -+@ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) - @ stub _vcomp_for_static_simple_init_i8 - @ varargs _vcomp_fork(long long ptr) - @ stub _vcomp_get_thread_num -diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec -index debc5ff..a6933c8 100644 ---- a/dlls/vcomp100/vcomp100.spec -+++ b/dlls/vcomp100/vcomp100.spec -@@ -59,10 +59,10 @@ - @ stub _vcomp_for_dynamic_init_i8 - @ stub _vcomp_for_dynamic_next - @ stub _vcomp_for_dynamic_next_i8 --@ stub _vcomp_for_static_end -+@ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end - @ stub _vcomp_for_static_init - @ stub _vcomp_for_static_init_i8 --@ stub _vcomp_for_static_simple_init -+@ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init - @ stub _vcomp_for_static_simple_init_i8 - @ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork - @ stub _vcomp_get_thread_num -diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec -index debc5ff..a6933c8 100644 ---- a/dlls/vcomp90/vcomp90.spec -+++ b/dlls/vcomp90/vcomp90.spec -@@ -59,10 +59,10 @@ - @ stub _vcomp_for_dynamic_init_i8 - @ stub _vcomp_for_dynamic_next - @ stub _vcomp_for_dynamic_next_i8 --@ stub _vcomp_for_static_end -+@ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end - @ stub _vcomp_for_static_init - @ stub _vcomp_for_static_init_i8 --@ stub _vcomp_for_static_simple_init -+@ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init - @ stub _vcomp_for_static_simple_init_i8 - @ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork - @ stub _vcomp_get_thread_num --- -2.4.5 - diff --git a/patches/vcomp-Functions/0005-vcomp-tests-Add-tests-for-_vcomp_for_static_simple_i.patch b/patches/vcomp-Functions/0005-vcomp-tests-Add-tests-for-_vcomp_for_static_simple_i.patch deleted file mode 100644 index d05d5060..00000000 --- a/patches/vcomp-Functions/0005-vcomp-tests-Add-tests-for-_vcomp_for_static_simple_i.patch +++ /dev/null @@ -1,217 +0,0 @@ -From fdcc5db8904f22d5fe4eb8ad393e371dd5026b31 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 18 Jul 2015 04:09:01 +0200 -Subject: vcomp/tests: Add tests for _vcomp_for_static_simple_init. - ---- - dlls/vcomp/tests/vcomp.c | 173 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 173 insertions(+) - -diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c -index 6b22d48..bab9f41 100644 ---- a/dlls/vcomp/tests/vcomp.c -+++ b/dlls/vcomp/tests/vcomp.c -@@ -32,6 +32,9 @@ static BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR); - static VOID (WINAPI *pReleaseActCtx)(HANDLE); - - static void (CDECL *p_vcomp_barrier)(void); -+static void (CDECL *p_vcomp_for_static_end)(void); -+static void (CDECL *p_vcomp_for_static_simple_init)(unsigned int first, unsigned int last, int step, -+ BOOL increment, unsigned int *begin, unsigned int *end); - static void (WINAPIV *p_vcomp_fork)(BOOL ifval, int nargs, void *wrapper, ...); - static void (CDECL *p_vcomp_sections_init)(int n); - static int (CDECL *p_vcomp_sections_next)(void); -@@ -171,6 +174,8 @@ static BOOL init_vcomp(void) - } - - VCOMP_GET_PROC(_vcomp_barrier); -+ VCOMP_GET_PROC(_vcomp_for_static_end); -+ VCOMP_GET_PROC(_vcomp_for_static_simple_init); - VCOMP_GET_PROC(_vcomp_fork); - VCOMP_GET_PROC(_vcomp_sections_init); - VCOMP_GET_PROC(_vcomp_sections_next); -@@ -460,6 +465,173 @@ if (0) - pomp_set_num_threads(max_threads); - } - -+static void my_for_static_simple_init(unsigned int first, unsigned int last, int step, -+ BOOL increment, unsigned int *begin, unsigned int *end) -+{ -+ unsigned int iterations, per_thread, remaining; -+ int num_threads = pomp_get_num_threads(); -+ int thread_num = pomp_get_thread_num(); -+ -+ if (num_threads == 1) -+ { -+ *begin = first; -+ *end = last; -+ return; -+ } -+ -+ if (step <= 0) -+ { -+ *begin = 0; -+ *end = increment ? -1 : 1; -+ return; -+ } -+ -+ if (increment) -+ iterations = 1 + (last - first) / step; -+ else -+ { -+ iterations = 1 + (first - last) / step; -+ step *= -1; -+ } -+ -+ per_thread = iterations / num_threads; -+ remaining = iterations - per_thread * num_threads; -+ -+ if (thread_num < remaining) -+ per_thread++; -+ else if (per_thread) -+ first += remaining * step; -+ else -+ { -+ *begin = first; -+ *end = first - step; -+ return; -+ } -+ -+ *begin = first + per_thread * thread_num * step; -+ *end = *begin + (per_thread - 1) * step; -+} -+ -+ -+static void CDECL for_static_simple_cb(void) -+{ -+ static const struct -+ { -+ unsigned int first; -+ unsigned int last; -+ int step; -+ } -+ tests[] = -+ { -+ { 0, 0, 1 }, /* 0 */ -+ { 0, 1, 1 }, -+ { 0, 2, 1 }, -+ { 0, 3, 1 }, -+ { 0, 100, 0 }, -+ { 0, 100, 1 }, -+ { 0, 100, 2 }, -+ { 0, 100, 3 }, -+ { 0, 100, -1 }, -+ { 0, 100, -2 }, -+ { 0, 100, -3 }, /* 10 */ -+ { 0, 100, 10 }, -+ { 0, 100, 50 }, -+ { 0, 100, 100 }, -+ { 0, 100, 150 }, -+ { 0, 0x80000000, 1 }, -+ { 0, 0xfffffffe, 1 }, -+ { 0, 0xffffffff, 1 }, -+ { 50, 50, 0 }, -+ { 50, 50, 1 }, -+ { 50, 50, 2 }, /* 20 */ -+ { 50, 50, 3 }, -+ { 50, 50, -1 }, -+ { 50, 50, -2 }, -+ { 50, 50, -3 }, -+ { 100, 200, 1 }, -+ { 100, 200, 5 }, -+ { 100, 200, 10 }, -+ { 100, 200, 50 }, -+ { 100, 200, 100 }, -+ { 100, 200, 150 }, /* 30 */ -+ }; -+ int num_threads = pomp_get_num_threads(); -+ int thread_num = pomp_get_thread_num(); -+ int i; -+ -+ for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) -+ { -+ unsigned int my_begin, my_end, begin, end; -+ -+ begin = end = 0xdeadbeef; -+ my_for_static_simple_init(tests[i].first, tests[i].last, tests[i].step, FALSE, &my_begin, &my_end); -+ p_vcomp_for_static_simple_init(tests[i].first, tests[i].last, tests[i].step, FALSE, &begin, &end); -+ -+ ok(begin == my_begin, "test %d, thread %d/%d: expected begin = %u, got %u\n", -+ i, thread_num, num_threads, my_begin, end); -+ ok(end == my_end, "test %d, thread %d/%d: expected end = %u, got %u\n", -+ i, thread_num, num_threads, my_end, end); -+ -+ p_vcomp_for_static_end(); -+ p_vcomp_barrier(); -+ -+ begin = end = 0xdeadbeef; -+ my_for_static_simple_init(tests[i].first, tests[i].last, tests[i].step, TRUE, &my_begin, &my_end); -+ p_vcomp_for_static_simple_init(tests[i].first, tests[i].last, tests[i].step, TRUE, &begin, &end); -+ -+ ok(begin == my_begin, "test %d, thread %d/%d: expected begin = %u, got %u\n", -+ i, thread_num, num_threads, my_begin, end); -+ ok(end == my_end, "test %d, thread %d/%d: expected end = %u, got %u\n", -+ i, thread_num, num_threads, my_end, end); -+ -+ p_vcomp_for_static_end(); -+ p_vcomp_barrier(); -+ -+ if (tests[i].first == tests[i].last) continue; -+ -+ begin = end = 0xdeadbeef; -+ my_for_static_simple_init(tests[i].last, tests[i].first, tests[i].step, FALSE, &my_begin, &my_end); -+ p_vcomp_for_static_simple_init(tests[i].last, tests[i].first, tests[i].step, FALSE, &begin, &end); -+ -+ ok(begin == my_begin, "test %d, thread %d/%d: expected begin = %u, got %u\n", -+ i, thread_num, num_threads, my_begin, end); -+ ok(end == my_end, "test %d, thread %d/%d: expected end = %u, got %u\n", -+ i, thread_num, num_threads, my_end, end); -+ -+ p_vcomp_for_static_end(); -+ p_vcomp_barrier(); -+ -+ begin = end = 0xdeadbeef; -+ my_for_static_simple_init(tests[i].last, tests[i].first, tests[i].step, TRUE, &my_begin, &my_end); -+ p_vcomp_for_static_simple_init(tests[i].last, tests[i].first, tests[i].step, TRUE, &begin, &end); -+ -+ ok(begin == my_begin, "test %d, thread %d/%d: expected begin = %u, got %u\n", -+ i, thread_num, num_threads, my_begin, end); -+ ok(end == my_end, "test %d, thread %d/%d: expected end = %u, got %u\n", -+ i, thread_num, num_threads, my_end, end); -+ -+ p_vcomp_for_static_end(); -+ p_vcomp_barrier(); -+ } -+} -+ -+static void test_vcomp_for_static_simple_init(void) -+{ -+ int max_threads = pomp_get_max_threads(); -+ int i; -+ -+ for_static_simple_cb(); -+ -+ for (i = 1; i <= 4; i++) -+ { -+ pomp_set_num_threads(i); -+ p_vcomp_fork(TRUE, 0, for_static_simple_cb); -+ p_vcomp_fork(FALSE, 0, for_static_simple_cb); -+ } -+ -+ pomp_set_num_threads(max_threads); -+} -+ - START_TEST(vcomp) - { - if (!init_vcomp()) -@@ -469,6 +641,7 @@ START_TEST(vcomp) - test_omp_get_num_threads(TRUE); - test_vcomp_fork(); - test_vcomp_sections_init(); -+ test_vcomp_for_static_simple_init(); - - release_vcomp(); - } --- -2.4.5 - diff --git a/patches/vcomp-Functions/0006-vcomp-Implement-_vcomp_for_static_init.patch b/patches/vcomp-Functions/0006-vcomp-Implement-_vcomp_for_static_init.patch deleted file mode 100644 index 4f5c21f9..00000000 --- a/patches/vcomp-Functions/0006-vcomp-Implement-_vcomp_for_static_init.patch +++ /dev/null @@ -1,128 +0,0 @@ -From bf7251bea46154f6ef2f61182b87d8e19964f4e8 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 18 Jul 2015 20:38:36 +0200 -Subject: vcomp: Implement _vcomp_for_static_init. - ---- - dlls/vcomp/main.c | 63 +++++++++++++++++++++++++++++++++++++++++++++ - dlls/vcomp/vcomp.spec | 2 +- - dlls/vcomp100/vcomp100.spec | 2 +- - dlls/vcomp90/vcomp90.spec | 2 +- - 4 files changed, 66 insertions(+), 3 deletions(-) - -diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c -index b647bb1..0148c8b 100644 ---- a/dlls/vcomp/main.c -+++ b/dlls/vcomp/main.c -@@ -414,6 +414,69 @@ void CDECL _vcomp_for_static_simple_init(unsigned int first, unsigned int last, - *end = *begin + (per_thread - 1) * step; - } - -+void CDECL _vcomp_for_static_init(int first, int last, int step, int chunksize, unsigned int *loops, -+ int *begin, int *end, int *next, int *lastchunk) -+{ -+ unsigned int iterations, num_chunks, per_thread, remaining; -+ struct vcomp_thread_data *thread_data = vcomp_init_thread_data(); -+ struct vcomp_team_data *team_data = thread_data->team; -+ int num_threads = team_data ? team_data->num_threads : 1; -+ int thread_num = thread_data->thread_num; -+ -+ TRACE("(%d, %d, %d, %d, %p, %p, %p, %p, %p)\n", -+ first, last, step, chunksize, loops, begin, end, next, lastchunk); -+ -+ if (num_threads == 1 && chunksize != 1) -+ { -+ *loops = 1; -+ *begin = first; -+ *end = last; -+ *next = 0; -+ *lastchunk = first; -+ return; -+ } -+ -+ if (first == last) -+ { -+ *loops = !thread_num; -+ if (!thread_num) -+ { -+ *begin = first; -+ *end = last; -+ *next = 0; -+ *lastchunk = first; -+ } -+ return; -+ } -+ -+ if (step <= 0) -+ { -+ *loops = 0; -+ return; -+ } -+ -+ if (first < last) -+ iterations = 1 + (last - first) / step; -+ else -+ { -+ iterations = 1 + (first - last) / step; -+ step *= -1; -+ } -+ -+ if (chunksize < 1) -+ chunksize = 1; -+ -+ num_chunks = ((DWORD64)iterations + chunksize - 1) / chunksize; -+ per_thread = num_chunks / num_threads; -+ remaining = num_chunks - per_thread * num_threads; -+ -+ *loops = per_thread + (thread_num < remaining); -+ *begin = first + thread_num * chunksize * step; -+ *end = *begin + (chunksize - 1) * step; -+ *next = chunksize * num_threads * step; -+ *lastchunk = first + (num_chunks - 1) * chunksize * step; -+} -+ - void CDECL _vcomp_for_static_end(void) - { - TRACE("()\n"); -diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec -index d6b8bf5..7083ce4 100644 ---- a/dlls/vcomp/vcomp.spec -+++ b/dlls/vcomp/vcomp.spec -@@ -60,7 +60,7 @@ - @ stub _vcomp_for_dynamic_next - @ stub _vcomp_for_dynamic_next_i8 - @ cdecl _vcomp_for_static_end() --@ stub _vcomp_for_static_init -+@ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr) - @ stub _vcomp_for_static_init_i8 - @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) - @ stub _vcomp_for_static_simple_init_i8 -diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec -index a6933c8..56c7ae3 100644 ---- a/dlls/vcomp100/vcomp100.spec -+++ b/dlls/vcomp100/vcomp100.spec -@@ -60,7 +60,7 @@ - @ stub _vcomp_for_dynamic_next - @ stub _vcomp_for_dynamic_next_i8 - @ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end --@ stub _vcomp_for_static_init -+@ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr) vcomp._vcomp_for_static_init - @ stub _vcomp_for_static_init_i8 - @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init - @ stub _vcomp_for_static_simple_init_i8 -diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec -index a6933c8..56c7ae3 100644 ---- a/dlls/vcomp90/vcomp90.spec -+++ b/dlls/vcomp90/vcomp90.spec -@@ -60,7 +60,7 @@ - @ stub _vcomp_for_dynamic_next - @ stub _vcomp_for_dynamic_next_i8 - @ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end --@ stub _vcomp_for_static_init -+@ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr) vcomp._vcomp_for_static_init - @ stub _vcomp_for_static_init_i8 - @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init - @ stub _vcomp_for_static_simple_init_i8 --- -2.4.5 - diff --git a/patches/vcomp-Functions/0007-vcomp-tests-Add-tests-for-_vcomp_for_static_init.patch b/patches/vcomp-Functions/0007-vcomp-tests-Add-tests-for-_vcomp_for_static_init.patch deleted file mode 100644 index bffc2344..00000000 --- a/patches/vcomp-Functions/0007-vcomp-tests-Add-tests-for-_vcomp_for_static_init.patch +++ /dev/null @@ -1,287 +0,0 @@ -From b330549979468af9a322b980f0c2cb73031a5b3b Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 18 Jul 2015 20:38:54 +0200 -Subject: vcomp/tests: Add tests for _vcomp_for_static_init. - ---- - dlls/vcomp/tests/vcomp.c | 243 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 243 insertions(+) - -diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c -index bab9f41..205899d 100644 ---- a/dlls/vcomp/tests/vcomp.c -+++ b/dlls/vcomp/tests/vcomp.c -@@ -33,6 +33,8 @@ static VOID (WINAPI *pReleaseActCtx)(HANDLE); - - static void (CDECL *p_vcomp_barrier)(void); - static void (CDECL *p_vcomp_for_static_end)(void); -+static void (CDECL *p_vcomp_for_static_init)(int first, int last, int step, int chunksize, unsigned int *loops, -+ int *begin, int *end, int *next, int *lastchunk); - static void (CDECL *p_vcomp_for_static_simple_init)(unsigned int first, unsigned int last, int step, - BOOL increment, unsigned int *begin, unsigned int *end); - static void (WINAPIV *p_vcomp_fork)(BOOL ifval, int nargs, void *wrapper, ...); -@@ -175,6 +177,7 @@ static BOOL init_vcomp(void) - - VCOMP_GET_PROC(_vcomp_barrier); - VCOMP_GET_PROC(_vcomp_for_static_end); -+ VCOMP_GET_PROC(_vcomp_for_static_init); - VCOMP_GET_PROC(_vcomp_for_static_simple_init); - VCOMP_GET_PROC(_vcomp_fork); - VCOMP_GET_PROC(_vcomp_sections_init); -@@ -632,6 +635,245 @@ static void test_vcomp_for_static_simple_init(void) - pomp_set_num_threads(max_threads); - } - -+#define VCOMP_FOR_STATIC_BROKEN_LOOP 1 -+#define VCOMP_FOR_STATIC_BROKEN_NEXT 2 -+ -+DWORD CDECL my_for_static_init(int first, int last, int step, int chunksize, unsigned int *loops, -+ int *begin, int *end, int *next, int *lastchunk) -+{ -+ unsigned int iterations, num_chunks, per_thread, remaining; -+ int num_threads = pomp_get_num_threads(); -+ int thread_num = pomp_get_thread_num(); -+ -+ if (num_threads == 1 && chunksize != 1) -+ { -+ *loops = 1; -+ *begin = first; -+ *end = last; -+ *next = 0; -+ *lastchunk = first; -+ return 0; -+ } -+ -+ if (first == last) -+ { -+ *loops = !thread_num; -+ if (!thread_num) -+ { -+ /* The value in *next on Windows is either uninitialized, or contains -+ * garbage. The value shouldn't matter for *loops <= 1, so no need to -+ * reproduce that. */ -+ *begin = first; -+ *end = last; -+ *next = 0; -+ *lastchunk = first; -+ } -+ return thread_num ? 0 : VCOMP_FOR_STATIC_BROKEN_NEXT; -+ } -+ -+ if (step <= 0) -+ { -+ /* The total number of iterations depends on the number of threads here, -+ * which doesn't make any sense. This is most likely a bug in the Windows -+ * implementation. */ -+ return VCOMP_FOR_STATIC_BROKEN_LOOP; -+ } -+ -+ if (first < last) -+ iterations = 1 + (last - first) / step; -+ else -+ { -+ iterations = 1 + (first - last) / step; -+ step *= -1; -+ } -+ -+ if (chunksize < 1) -+ chunksize = 1; -+ -+ num_chunks = ((DWORD64)iterations + chunksize - 1) / chunksize; -+ per_thread = num_chunks / num_threads; -+ remaining = num_chunks - per_thread * num_threads; -+ -+ *loops = per_thread + (thread_num < remaining); -+ *begin = first + thread_num * chunksize * step; -+ *end = *begin + (chunksize - 1) * step; -+ *next = chunksize * num_threads * step; -+ *lastchunk = first + (num_chunks - 1) * chunksize * step; -+ return 0; -+} -+ -+static void CDECL for_static_cb(void) -+{ -+ static const struct -+ { -+ int first; -+ int last; -+ int step; -+ int chunksize; -+ } -+ tests[] = -+ { -+ { 0, 0, 1, 1 }, -+ { 0, 0, 5, 1 }, -+ { 0, 1, 1, 1 }, -+ { 0, 2, 1, 1 }, -+ { 0, 3, 1, 1 }, -+ { 0, 100, 1, 1 }, -+ { 0, 100, 1, 5 }, -+ { 0, 100, 1, 10 }, -+ { 0, 100, 1, 50 }, -+ { 0, 100, 1, 100 }, -+ { 0, 100, 1, 150 }, -+ { 0, 100, 5, 1 }, -+ { 0, 100, 7, 0 }, -+ { 0, 100, 7, 1 }, -+ { 0, 100, 7, 5 }, -+ { 0, 100, 7, 10 }, -+ { 0, 100, 7, 50 }, -+ { 0, 100, 7, 100 }, -+ { 0, 100, 7, 150 }, -+ { 0, 100, -7, 0 }, -+ { 0, 100, -7, 1 }, -+ { 0, 100, -7, 5 }, -+ { 0, 100, -7, 10 }, -+ { 0, 100, -7, 50 }, -+ { 0, 100, -7, 100 }, -+ { 0, 100, -7, 150 }, -+ { 0, 100, 10, 1 }, -+ { 0, 100, 50, 1 }, -+ { 0, 100, 100, 1 }, -+ { 0, 100, 150, 1 }, -+ { 0, 100, -150, -5 }, -+ { 0, 0x10000000, 1, 1 }, -+ { 0, 0x10000000, 1, -500 }, -+ { 0, 0x20000000, 1, 1 }, -+ { 0, 0x20000000, 1, -500 }, -+ { 0, 0x20000000, -1, 1 }, -+ { 0, 0x20000000, -100, 1 }, -+ { 0, 0x20000000, -0x80000000, 1 }, -+ { 0, 0x40000000, 1, 1 }, -+ { 0, 0x40000000, 1, -500 }, -+ { 0, -0x80000000, 1, 1 }, -+ { 0, -0x80000000, 1, -500 }, -+ { 50, 50, 1, 1 }, -+ { 50, 50, 1, -1 }, -+ { 50, 50, 2, 1 }, -+ { 50, 50, 2, -1 }, -+ { 50, 50, 3, 1 }, -+ { 50, 50, 3, -1 }, -+ { 50, 50, -1, 1 }, -+ { 50, 50, -1, -1 }, -+ { 50, 50, -2, 1 }, -+ { 50, 50, -2, -1 }, -+ { 50, 50, -3, 1 }, -+ { 50, 50, -3, -1 }, -+ { 50, 50, -100, 1 }, -+ { 50, 50, -100, -1 }, -+ { 100, 200, 13, 1 }, -+ { 100, 200, 13, 5 }, -+ { 0x10000000, 0x20000000, -1, 1 }, -+ { 0x10000000, 0x20000000, -100, 1 }, -+ { 0x10000000, 0x20000000, -0x80000000, 1 }, -+ { 0x20000000, 0, 1, 1 }, -+ { 0x40000000, 0, 1, 1 }, -+ { 0x7FFFFFFE, -0x80000000, 1, 0x1000 }, -+ { 0x7FFFFFFF, -0x80000000, 1, 0x1000 }, -+ { -0x10000000, -0x20000000, -0x80000000, -1 }, -+ { -0x80000000, 0, 1, 1 }, -+ }; -+ int num_threads = pomp_get_num_threads(); -+ int thread_num = pomp_get_thread_num(); -+ int i; -+ -+ for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) -+ { -+ int my_begin, my_end, my_next, my_lastchunk; -+ int begin, end, next, lastchunk; -+ unsigned int my_loops, loops; -+ DWORD broken_flags; -+ -+ my_loops = my_begin = my_end = my_next = my_lastchunk = 0xdeadbeef; -+ loops = begin = end = next = lastchunk = 0xdeadbeef; -+ broken_flags = my_for_static_init(tests[i].first, tests[i].last, tests[i].step, tests[i].chunksize, -+ &my_loops, &my_begin, &my_end, &my_next, &my_lastchunk); -+ p_vcomp_for_static_init(tests[i].first, tests[i].last, tests[i].step, tests[i].chunksize, -+ &loops, &begin, &end, &next, &lastchunk); -+ -+ if (broken_flags & VCOMP_FOR_STATIC_BROKEN_LOOP) -+ { -+ ok(loops == 0 || loops == 1, "test %d, thread %d/%d: expected loops == 0 or 1, got %d\n", -+ i, thread_num, num_threads, loops); -+ } -+ else -+ { -+ ok(loops == my_loops, "test %d, thread %d/%d: expected loops == %d, got %d\n", -+ i, thread_num, num_threads, my_loops, loops); -+ ok(begin == my_begin, "test %d, thread %d/%d: expected begin == %d, got %d\n", -+ i, thread_num, num_threads, my_begin, begin); -+ ok(end == my_end, "test %d, thread %d/%d: expected end == %u, got %u\n", -+ i, thread_num, num_threads, my_end, end); -+ ok(next == my_next || broken(broken_flags & VCOMP_FOR_STATIC_BROKEN_NEXT), -+ "test %d, thread %d/%d: expected next == %d, got %d\n", i, thread_num, num_threads, my_next, next); -+ ok(lastchunk == my_lastchunk, "test %d, thread %d/%d: expected lastchunk == %d, got %d\n", -+ i, thread_num, num_threads, my_lastchunk, lastchunk); -+ } -+ -+ p_vcomp_for_static_end(); -+ p_vcomp_barrier(); -+ -+ if (tests[i].first == tests[i].last) continue; -+ -+ my_loops = my_begin = my_end = my_next = my_lastchunk = 0xdeadbeef; -+ loops = begin = end = next = lastchunk = 0xdeadbeef; -+ broken_flags = my_for_static_init(tests[i].last, tests[i].first, tests[i].step, tests[i].chunksize, -+ &my_loops, &my_begin, &my_end, &my_next, &my_lastchunk); -+ p_vcomp_for_static_init(tests[i].last, tests[i].first, tests[i].step, tests[i].chunksize, -+ &loops, &begin, &end, &next, &lastchunk); -+ -+ if (broken_flags & VCOMP_FOR_STATIC_BROKEN_LOOP) -+ { -+ ok(loops == 0 || loops == 1, "test %d, thread %d/%d: expected loops == 0 or 1, got %d\n", -+ i, thread_num, num_threads, loops); -+ } -+ else -+ { -+ ok(loops == my_loops, "test %d, thread %d/%d: expected loops == %d, got %d\n", -+ i, thread_num, num_threads, my_loops, loops); -+ ok(begin == my_begin, "test %d, thread %d/%d: expected begin == %d, got %d\n", -+ i, thread_num, num_threads, my_begin, begin); -+ ok(end == my_end, "test %d, thread %d/%d: expected end == %u, got %u\n", -+ i, thread_num, num_threads, my_end, end); -+ ok(next == my_next || broken(broken_flags & VCOMP_FOR_STATIC_BROKEN_NEXT), -+ "test %d, thread %d/%d: expected next == %d, got %d\n", i, thread_num, num_threads, my_next, next); -+ ok(lastchunk == my_lastchunk, "test %d, thread %d/%d: expected lastchunk == %d, got %d\n", -+ i, thread_num, num_threads, my_lastchunk, lastchunk); -+ } -+ -+ p_vcomp_for_static_end(); -+ p_vcomp_barrier(); -+ } -+} -+ -+#undef VCOMP_FOR_STATIC_BROKEN_LOOP -+#undef VCOMP_FOR_STATIC_BROKEN_NEXT -+ -+static void test_vcomp_for_static_init(void) -+{ -+ int max_threads = pomp_get_max_threads(); -+ int i; -+ -+ for_static_cb(); -+ -+ for (i = 1; i <= 4; i++) -+ { -+ pomp_set_num_threads(i); -+ p_vcomp_fork(TRUE, 0, for_static_cb); -+ p_vcomp_fork(FALSE, 0, for_static_cb); -+ } -+ -+ pomp_set_num_threads(max_threads); -+} -+ - START_TEST(vcomp) - { - if (!init_vcomp()) -@@ -642,6 +884,7 @@ START_TEST(vcomp) - test_vcomp_fork(); - test_vcomp_sections_init(); - test_vcomp_for_static_simple_init(); -+ test_vcomp_for_static_init(); - - release_vcomp(); - } --- -2.4.5 - diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 29c0cc6c..c4cdb22a 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -3982,7 +3982,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_copy_resource(struct wined3d_device *device, -@@ -3887,8 +4329,14 @@ +@@ -3961,8 +4403,14 @@ rect = &r; } @@ -3997,7 +3997,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -3902,6 +4350,7 @@ +@@ -3976,6 +4424,7 @@ return NULL; } @@ -4005,7 +4005,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -3917,6 +4366,22 @@ +@@ -3991,6 +4440,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -4028,7 +4028,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -3956,6 +4421,7 @@ +@@ -4030,6 +4495,7 @@ } @@ -4036,7 +4036,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c prev = fb->render_targets[view_idx]; if (view == prev) return WINED3D_OK; -@@ -3963,6 +4429,15 @@ +@@ -4037,6 +4503,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -4052,7 +4052,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -3974,6 +4449,7 @@ +@@ -4048,6 +4523,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -4060,7 +4060,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_fb_state *fb = &device->state.fb; struct wined3d_rendertarget_view *prev; -@@ -3998,6 +4474,79 @@ +@@ -4072,6 +4548,79 @@ { TRACE("device %p, x_hotspot %u, y_hotspot %u, cursor_image %p.\n", device, x_hotspot, y_hotspot, cursor_image); @@ -4140,7 +4140,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (cursor_image) { -@@ -4033,8 +4582,16 @@ +@@ -4107,8 +4656,16 @@ * release it after setting the cursor image. Windows doesn't * addref the set surface, so we can't do this either without * creating circular refcount dependencies. */ @@ -4157,7 +4157,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->cursorWidth = cursor_image->resource.width; device->cursorHeight = cursor_image->resource.height; -@@ -4134,6 +4691,12 @@ +@@ -4208,6 +4765,12 @@ else SetCursor(NULL); } @@ -4170,7 +4170,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return oldVisible; } -@@ -4144,8 +4707,10 @@ +@@ -4218,8 +4781,10 @@ TRACE("device %p.\n", device); @@ -4181,7 +4181,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Checking resource %p for eviction.\n", resource); -@@ -4153,6 +4718,7 @@ +@@ -4227,6 +4792,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -4189,7 +4189,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4173,6 +4739,37 @@ +@@ -4247,6 +4813,37 @@ gl_info = context->gl_info; wine_rb_clear(&device->samplers, device_free_sampler, NULL); @@ -4227,7 +4227,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4193,6 +4790,7 @@ +@@ -4267,6 +4864,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -4235,7 +4235,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4212,6 +4810,14 @@ +@@ -4286,6 +4884,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -4250,7 +4250,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4228,6 +4834,7 @@ +@@ -4302,6 +4908,7 @@ return hr; } @@ -4258,7 +4258,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); if (FAILED(hr)) { -@@ -4238,6 +4845,34 @@ +@@ -4312,6 +4919,34 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -4293,7 +4293,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4258,8 +4893,10 @@ +@@ -4332,8 +4967,10 @@ unsigned int i; TRACE("device %p, swapchain_desc %p, mode %p, callback %p.\n", device, swapchain_desc, mode, callback); @@ -4304,7 +4304,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { -@@ -4275,9 +4912,21 @@ +@@ -4349,9 +4986,21 @@ wined3d_texture_decref(device->logo_texture); device->logo_texture = NULL; } @@ -4326,7 +4326,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4286,6 +4935,7 @@ +@@ -4360,6 +5009,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -4334,7 +4334,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4295,6 +4945,12 @@ +@@ -4369,6 +5019,12 @@ { wined3d_surface_decref(device->cs->onscreen_depth_stencil); device->cs->onscreen_depth_stencil = NULL; @@ -4347,7 +4347,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4307,6 +4963,7 @@ +@@ -4381,6 +5037,7 @@ } } @@ -4355,7 +4355,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Free implicit resources and wait for the command stream before modifying * swapchain parameters. After modifying the swapchain parameters a new GL * context may be acquired by the worker thread. This causes problems in the -@@ -4328,6 +4985,7 @@ +@@ -4402,6 +5059,7 @@ } device->cs->ops->finish(device->cs); @@ -4363,7 +4363,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Is it necessary to recreate the gl context? Actually every setting can be changed * on an existing gl context, so there's no real need for recreation. * -@@ -4469,6 +5127,13 @@ +@@ -4543,6 +5201,13 @@ } } @@ -4377,7 +4377,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (swapchain->desc.enable_auto_depth_stencil) { struct wined3d_resource_desc surface_desc; -@@ -4506,6 +5171,13 @@ +@@ -4580,6 +5245,13 @@ wined3d_device_set_depth_stencil_view(device, device->auto_depth_stencil_view); } @@ -4391,7 +4391,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (swapchain->desc.backbuffer_count && FAILED(hr = wined3d_rendertarget_view_create_from_surface( surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)), NULL, &wined3d_null_parent_ops, &device->back_buffer_view))) -@@ -4588,12 +5260,20 @@ +@@ -4662,12 +5334,20 @@ } wined3d_cs_emit_reset_state(device->cs); state_cleanup(&device->state); @@ -4412,7 +4412,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); device->update_state = &device->state; -@@ -4602,6 +5282,7 @@ +@@ -4676,6 +5356,7 @@ } else if (device->back_buffer_view) { @@ -4420,7 +4420,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_state *state = &device->state; wined3d_device_set_rendertarget_view(device, 0, device->back_buffer_view, FALSE); -@@ -4617,6 +5298,24 @@ +@@ -4691,6 +5372,24 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; @@ -4445,7 +4445,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4695,6 +5394,10 @@ +@@ -4769,6 +5468,10 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -4456,7 +4456,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c switch (type) { case WINED3D_RTYPE_SURFACE: -@@ -4705,6 +5408,7 @@ +@@ -4779,6 +5482,7 @@ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -4464,7 +4464,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_rendertarget_view_get_surface(device->state.fb.render_targets[i]) == surface) { ERR("Surface %p is still in use as render target %u.\n", surface, i); -@@ -4716,6 +5420,19 @@ +@@ -4790,6 +5494,19 @@ { ERR("Surface %p is still in use as depth/stencil buffer.\n", surface); device->state.fb.depth_stencil = NULL; @@ -4484,7 +4484,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } } break; -@@ -4878,7 +5595,11 @@ +@@ -4952,7 +5669,11 @@ device->blitter = adapter->blitter; @@ -4496,7 +4496,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) { ERR("Failed to initialize device state, hr %#x.\n", hr); -@@ -4977,6 +5698,7 @@ +@@ -5051,6 +5772,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -4504,7 +4504,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Context activation is done by the caller */ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage, -@@ -5030,3 +5752,4 @@ +@@ -5104,3 +5826,4 @@ wined3d_device_destroy_bo(device, context, bo); }