From 07e0bb1fed9207f62791600ceae31e3a992ce24b Mon Sep 17 00:00:00 2001 From: GloriousEggroll Date: Mon, 9 Mar 2020 01:32:31 -0600 Subject: [PATCH] fix warframe steamcontroller007 patch, update to latest git --- FAudio | 2 +- dxvk | 2 +- ...ntroller_SteamController007_warframe.patch | 12 - ..._or_steaminput001_without_controller.patch | 30 + .../proton-protonify_staging.patch | 584 ++--- .../proton_fs_hack_integer_scaling.patch | 23 + ...valve_proton_fullscreen_hack-staging.patch | 611 +++++ game-patches-testing/protonprep.sh | 19 +- ...kd3d-Fix_DXIL_check_in_test_coverage.patch | 28 + .../vkd3d-patches/wow-flicker.patch | 25 - .../HACK-winex11-limits-resources-nmode.patch | 35 + ..._one_compute_pipeline_per_swap_chain.patch | 152 -- ...evulkan-cleanup_barriers_for_fs_hack.patch | 288 --- .../wine-patches/winevulkan_fshack_opts.patch | 2187 +++++++++++++++++ vkd3d | 2 +- wine | 2 +- wine-staging | 2 +- 17 files changed, 3076 insertions(+), 928 deletions(-) delete mode 100644 game-patches-testing/proton-hotfixes/proton-lsteamclient_disable_winISteamController_SteamController007_warframe.patch create mode 100644 game-patches-testing/proton-hotfixes/steamclient-dont_load_steamcontroller007_or_steaminput001_without_controller.patch create mode 100644 game-patches-testing/vkd3d-patches/vkd3d-Fix_DXIL_check_in_test_coverage.patch delete mode 100644 game-patches-testing/vkd3d-patches/wow-flicker.patch create mode 100644 game-patches-testing/wine-patches/HACK-winex11-limits-resources-nmode.patch delete mode 100644 game-patches-testing/wine-patches/fshack-create_only_one_compute_pipeline_per_swap_chain.patch delete mode 100644 game-patches-testing/wine-patches/winevulkan-cleanup_barriers_for_fs_hack.patch create mode 100644 game-patches-testing/wine-patches/winevulkan_fshack_opts.patch diff --git a/FAudio b/FAudio index 0cfb4995b..b5f57cb87 160000 --- a/FAudio +++ b/FAudio @@ -1 +1 @@ -Subproject commit 0cfb4995bd0d8da949668cbe52e2c6129d4a6b23 +Subproject commit b5f57cb8787abac9cad612b9c6daacb24e2d98ff diff --git a/dxvk b/dxvk index 8c68cf155..304dad2d2 160000 --- a/dxvk +++ b/dxvk @@ -1 +1 @@ -Subproject commit 8c68cf1551c963e302bbde5dea15f2febf1fe795 +Subproject commit 304dad2d2e653fa2398801f1d2dd4c5876afed69 diff --git a/game-patches-testing/proton-hotfixes/proton-lsteamclient_disable_winISteamController_SteamController007_warframe.patch b/game-patches-testing/proton-hotfixes/proton-lsteamclient_disable_winISteamController_SteamController007_warframe.patch deleted file mode 100644 index d6e4e289c..000000000 --- a/game-patches-testing/proton-hotfixes/proton-lsteamclient_disable_winISteamController_SteamController007_warframe.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/win_constructors_table.dat b/win_constructors_table.dat -index f53da72..54b3abb 100644 ---- a/win_constructors_table.dat -+++ b/win_constructors_table.dat -@@ -15,7 +15,6 @@ - {"STEAMMUSICREMOTE_INTERFACE_VERSION001", &create_winISteamMusicRemote_STEAMMUSICREMOTE_INTERFACE_VERSION001}, - {"STEAMHTTP_INTERFACE_VERSION003", &create_winISteamHTTP_STEAMHTTP_INTERFACE_VERSION003}, - {"SteamInput001", &create_winISteamInput_SteamInput001}, -- {"SteamController007", &create_winISteamController_SteamController007}, - {"STEAMUGC_INTERFACE_VERSION014", &create_winISteamUGC_STEAMUGC_INTERFACE_VERSION014}, - {"STEAMAPPLIST_INTERFACE_VERSION001", &create_winISteamAppList_STEAMAPPLIST_INTERFACE_VERSION001}, - {"STEAMHTMLSURFACE_INTERFACE_VERSION_005", &create_winISteamHTMLSurface_STEAMHTMLSURFACE_INTERFACE_VERSION_005}, diff --git a/game-patches-testing/proton-hotfixes/steamclient-dont_load_steamcontroller007_or_steaminput001_without_controller.patch b/game-patches-testing/proton-hotfixes/steamclient-dont_load_steamcontroller007_or_steaminput001_without_controller.patch new file mode 100644 index 000000000..8c8f51a11 --- /dev/null +++ b/game-patches-testing/proton-hotfixes/steamclient-dont_load_steamcontroller007_or_steaminput001_without_controller.patch @@ -0,0 +1,30 @@ +diff --git a/lsteamclient/steamclient_main.c b/lsteamclient/steamclient_main.c +index e0eac01..345e7cd 100644 +--- a/lsteamclient/steamclient_main.c ++++ b/lsteamclient/steamclient_main.c +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + #include "windef.h" + #include "winbase.h" +@@ -408,6 +409,17 @@ void *create_win_interface(const char *name, void *linux_side) + if (!linux_side) + return NULL; + ++ int fd = open ("/dev/input/js0", O_RDONLY); ++ ++ if(fd < 0) ++ { ++ if(!strcmp(name,"SteamController007") || !strcmp(name,"SteamInput001")) ++ { ++ TRACE("No input devices detected, disabling: %s\n", name); ++ return NULL; ++ } ++ } ++ + EnterCriticalSection(&steamclient_cs); + + LIST_FOR_EACH_ENTRY(e, &steamclient_interfaces, struct steamclient_interface, entry) diff --git a/game-patches-testing/proton-valve-patches/proton-protonify_staging.patch b/game-patches-testing/proton-valve-patches/proton-protonify_staging.patch index 1dc974f61..ab92db289 100644 --- a/game-patches-testing/proton-valve-patches/proton-protonify_staging.patch +++ b/game-patches-testing/proton-valve-patches/proton-protonify_staging.patch @@ -3316,318 +3316,6 @@ index 639e032f629..dbd9577d6bc 100644 interlocked_xchg( &wait_work_item->CallbackInProgress, FALSE ); if (wait_work_item->Flags & WT_EXECUTEONLYONCE) -From 30440e42234e781932bb436fa53394a465358829 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Wed, 9 Oct 2019 09:47:09 +0200 -Subject: [PATCH] winegcc: Strip symbols before the make_wine_builtin call. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47718 -Signed-off-by: Rémi Bernon ---- - tools/winegcc/winegcc.c | 27 ++++++++++++++++++++++----- - 1 file changed, 22 insertions(+), 5 deletions(-) - -diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c -index 3d1817a36bb..899a3b3d5d9 100644 ---- a/tools/winegcc/winegcc.c -+++ b/tools/winegcc/winegcc.c -@@ -1162,9 +1166,21 @@ static void build(struct options* opts) - - if (libgcc) strarray_add(link_args, libgcc); - -+ if (opts->target_platform != PLATFORM_APPLE && !is_pe && opts->strip) -+ strarray_add(link_args, "-s"); -+ - spawn(opts->prefix, link_args, 0); - strarray_free (link_args); - -+ if (opts->target_platform != PLATFORM_APPLE && is_pe && opts->strip) -+ { -+ strarray *strip_args = strarray_fromstring(build_tool_name(opts, "strip", "strip"), " "); -+ strarray_add(strip_args, "--strip-all"); -+ strarray_add(strip_args, output_path); -+ spawn(opts->prefix, strip_args, 1); -+ strarray_free(strip_args); -+ } -+ - if (is_pe && opts->wine_builtin) make_wine_builtin( opts, output_path ); - - /* set the base address with prelink if linker support is not present */ -@@ -1555,12 +1571,8 @@ int main(int argc, char **argv) - opts.shared = 1; - raw_compiler_arg = raw_linker_arg = 0; - } -- else if (strcmp("-s", argv[i]) == 0 && opts.target_platform == PLATFORM_APPLE) -+ else if (strcmp("-s", argv[i]) == 0) - { -- /* On Mac, change -s into -Wl,-x. ld's -s switch -- * is deprecated, and it doesn't work on Tiger with -- * MH_BUNDLEs anyway -- */ - opts.strip = 1; - raw_linker_arg = 0; - } -@@ -1595,6 +1607,11 @@ int main(int argc, char **argv) - opts.wine_builtin = 1; - continue; - } -+ if (!strcmp(Wl->base[j], "--strip-all") || !strcmp(Wl->base[j], "-s")) -+ { -+ opts.strip = 1; -+ continue; -+ } - if (!strcmp(Wl->base[j], "--subsystem") && j < Wl->size - 1) - { - opts.subsystem = strdup( Wl->base[++j] ); -From 9b984a81aa58135001a18e8cef387beebfcd2bbb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Wed, 9 Oct 2019 09:47:10 +0200 -Subject: [PATCH] winegcc: Support -Wl, --strip-debug for stripping debug info - only. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rémi Bernon ---- - tools/winegcc/winegcc.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c -index 899a3b3d5d9..6e78b17e26c 100644 ---- a/tools/winegcc/winegcc.c -+++ b/tools/winegcc/winegcc.c -@@ -208,6 +208,7 @@ struct options - int wine_builtin; - int unwind_tables; - int strip; -+ int strip_debug; - int pic; - const char* wine_objdir; - const char* output_name; -@@ -1168,6 +1169,8 @@ static void build(struct options* opts) - - if (opts->target_platform != PLATFORM_APPLE && !is_pe && opts->strip) - strarray_add(link_args, "-s"); -+ else if (!is_pe && opts->strip_debug) -+ strarray_add(link_args, "-Wl,--strip-debug"); - - spawn(opts->prefix, link_args, 0); - strarray_free (link_args); -@@ -1180,6 +1183,14 @@ static void build(struct options* opts) - spawn(opts->prefix, strip_args, 1); - strarray_free(strip_args); - } -+ else if (is_pe && opts->strip_debug) -+ { -+ strarray *strip_args = strarray_fromstring(build_tool_name(opts, "strip", "strip"), " "); -+ strarray_add(strip_args, "--strip-debug"); -+ strarray_add(strip_args, output_path); -+ spawn(opts->prefix, strip_args, 1); -+ strarray_free(strip_args); -+ } - - if (is_pe && opts->wine_builtin) make_wine_builtin( output_path ); - -@@ -1612,6 +1623,11 @@ int main(int argc, char **argv) - opts.strip = 1; - continue; - } -+ if (!strcmp(Wl->base[j], "--strip-debug") || !strcmp(Wl->base[j], "-S")) -+ { -+ opts.strip_debug = 1; -+ continue; -+ } - if (!strcmp(Wl->base[j], "--subsystem") && j < Wl->size - 1) - { - opts.subsystem = strdup( Wl->base[++j] ); -From 9d912de1779a240f064c41b889d46a98982957e9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Wed, 9 Oct 2019 09:47:11 +0200 -Subject: [PATCH] winegcc: Add support for splitting PE debug sections to - external ELF. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Linux perf tool cannot parse PE files for debug information, but it also -looks for external debug info alongside to the binaries it detects. - -We can use this feature to provide DWARF information for PE files by -splitting the sections to a separate ELF that perf will understand. - -This could also be used to support different debug information formats, -or to support split-dwarf option on ELF binaries. - -Signed-off-by: Rémi Bernon ---- - tools/winegcc/utils.c | 47 ++++++++++++++++++++++++++++++++---- - tools/winegcc/utils.h | 3 +++ - tools/winegcc/winegcc.c | 33 +++++++++++++++++++++++++ - tools/winegcc/winegcc.man.in | 4 +++ - 4 files changed, 82 insertions(+), 5 deletions(-) - -diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c -index a124ef2d342..0fc165d8cc0 100644 ---- a/tools/winegcc/utils.c -+++ b/tools/winegcc/utils.c -@@ -179,15 +179,36 @@ char* strarray_tostring(const strarray* arr, const char* sep) - return str; - } - -+char* get_dirname(const char* file) -+{ -+ char *dir_name, *p; -+ -+ dir_name = xstrdup(file); -+ if ((p = strrchr(dir_name, '/'))) *p = 0; -+ else -+ { -+ free(dir_name); -+ dir_name = xstrdup("."); -+ } -+ -+ return dir_name; -+} -+ -+char* get_filename(const char* file) -+{ -+ const char *file_name; -+ -+ if ((file_name = strrchr(file, '/'))) file_name++; -+ else file_name = file; -+ -+ return xstrdup(file_name); -+} -+ - char* get_basename(const char* file) - { -- const char* name; - char *base_name, *p; - -- if ((name = strrchr(file, '/'))) name++; -- else name = file; -- -- base_name = strdup(name); -+ base_name = get_filename(file); - if ((p = strrchr(base_name, '.'))) *p = 0; - - return base_name; -@@ -208,6 +229,22 @@ void create_file(const char* name, int mode, const char* fmt, ...) - chmod(name, mode); - } - -+void create_dir( const char *dir ) -+{ -+ char *p, *path; -+ -+ p = path = xstrdup( dir ); -+ while ((p = strchr( p, '/' ))) -+ { -+ *p = 0; -+ if (mkdir( path, 0755 ) == -1 && errno != EEXIST) error( "mkdir %s", path ); -+ *p++ = '/'; -+ while (*p == '/') p++; -+ } -+ if (mkdir( path, 0755 ) == -1 && errno != EEXIST) error( "mkdir %s", path ); -+ free( path ); -+} -+ - file_type get_file_type(const char* filename) - { - /* see tools/winebuild/res32.c: check_header for details */ -diff --git a/tools/winegcc/utils.h b/tools/winegcc/utils.h -index 536fb2d2f97..c924a53627b 100644 ---- a/tools/winegcc/utils.h -+++ b/tools/winegcc/utils.h -@@ -78,8 +78,11 @@ typedef enum { - file_arh, file_dll, file_so, file_def, file_spec - } file_type; - -+char* get_dirname(const char* file); -+char* get_filename(const char* file); - char* get_basename(const char* file); - void create_file(const char* name, int mode, const char* fmt, ...); -+void create_dir( const char *dir ); - file_type get_file_type(const char* filename); - file_type get_lib_type(enum target_platform platform, strarray* path, const char *library, - const char *suffix, char** file); -diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c -index 6e78b17e26c..4fe1efa4e2b 100644 ---- a/tools/winegcc/winegcc.c -+++ b/tools/winegcc/winegcc.c -@@ -209,6 +209,7 @@ struct options - int unwind_tables; - int strip; - int strip_debug; -+ int split_dwarf; - int pic; - const char* wine_objdir; - const char* output_name; -@@ -1175,6 +1176,31 @@ static void build(struct options* opts) - spawn(opts->prefix, link_args, 0); - strarray_free (link_args); - -+ if (build_platform != PLATFORM_APPLE && is_pe && opts->split_dwarf) -+ { -+ char const *bfd_format = (opts->target_cpu == CPU_x86_64) ? "-Oelf64-x86-64" : "-Oelf32-i386"; -+ strarray *objcopy_args = strarray_fromstring(build_tool_name(opts, "objcopy", "objcopy"), " "); -+ char *debug_path, *file_name; -+ -+ file_name = get_filename(output_path); -+ debug_path = get_dirname(output_path); -+ debug_path = realloc(debug_path, strlen(debug_path) + strlen("/.debug/") + strlen(file_name) + 1); -+ -+ strcat(debug_path, "/.debug/"); -+ create_dir(debug_path); -+ -+ strcat(debug_path, file_name); -+ free(file_name); -+ -+ strarray_add(objcopy_args, bfd_format); -+ strarray_add(objcopy_args, "--only-keep-debug"); -+ strarray_add(objcopy_args, output_path); -+ strarray_add(objcopy_args, debug_path); -+ spawn(opts->prefix, objcopy_args, 1); -+ strarray_free(objcopy_args); -+ free(debug_path); -+ } -+ - if (opts->target_platform != PLATFORM_APPLE && is_pe && opts->strip) - { - strarray *strip_args = strarray_fromstring(build_tool_name(opts, "strip", "strip"), " "); -@@ -1510,6 +1536,13 @@ int main(int argc, char **argv) - else if (!strcmp("-fno-PIC", argv[i]) || !strcmp("-fno-pic", argv[i])) - opts.pic = 0; - break; -+ case 'g': -+ if (strcmp("-gsplit-dwarf", argv[i]) == 0) -+ { -+ opts.split_dwarf = 1; -+ raw_compiler_arg = 0; -+ } -+ break; - case 'i': - if (!strcmp( "-isysroot", argv[i] )) opts.isysroot = argv[i + 1]; - break; -diff --git a/tools/winegcc/winegcc.man.in b/tools/winegcc/winegcc.man.in -index 5bbb2fd58f7..c23a5c02d9c 100644 ---- a/tools/winegcc/winegcc.man.in -+++ b/tools/winegcc/winegcc.man.in -@@ -39,6 +39,10 @@ to avoid the special behaviour. - Override the underlying type for wchar_t to be the default for the - target, instead of using short unsigned int, which is the default - for Win32. -+.IP \fB-gsplit-dwarf\fR -+Split debug sections from PE files to a separate ELF binary. This can -+be used to help tools like \fBperf\fR, that only support ELF parsing, -+load the debug sections. - .IP \fB-mconsole\fR - This option passes '--subsystem console' to winebuild, to build - console applications. It is the default. From 5cd65deffffad9073538acf4fd8e794ac07824a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 9 Oct 2019 09:47:12 +0200 @@ -3656,133 +3344,6 @@ index 6079d1fe28b..18e7b8a913e 100644 output( "\n" ); if (spec_file && make->importlib) -From a60f003992a889e5af7f2905f9acd9efd6a2263e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Wed, 9 Oct 2019 09:47:13 +0200 -Subject: [PATCH] makedep: Split debug symbols on PE targets. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rémi Bernon ---- - tools/makedep.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tools/makedep.c b/tools/makedep.c -index 18e7b8a913e..725b1bf4567 100644 ---- a/tools/makedep.c -+++ b/tools/makedep.c -@@ -2328,6 +2328,7 @@ static void output_winegcc_command( struct makefile *make ) - output_filename( "-b" ); - output_filename( crosstarget ); - output_filename( "--lib-suffix=.cross.a" ); -+ output_filename( "-gsplit-dwarf" ); - } - else - { -From 6c1088acb51fdfa20fcffd0ef4cf242c7af62cef Mon Sep 17 00:00:00 2001 -From: Andrew Eikum -Date: Fri, 27 Sep 2019 14:08:07 -0500 -Subject: [PATCH] makedep: Add install-cross-debug target - -For installing ELF debug libraries. ---- - tools/makedep.c | 32 ++++++++++++++++++++++++++++---- - 1 file changed, 28 insertions(+), 4 deletions(-) - -diff --git a/tools/makedep.c b/tools/makedep.c -index 725b1bf4567..dbce0b92639 100644 ---- a/tools/makedep.c -+++ b/tools/makedep.c -@@ -126,7 +126,7 @@ static struct list files[HASH_SIZE]; - - static const struct strarray empty_strarray; - --enum install_rules { INSTALL_LIB, INSTALL_DEV, NB_INSTALL_RULES }; -+enum install_rules { INSTALL_LIB, INSTALL_DEV, INSTALL_DEBUG, NB_INSTALL_RULES }; - - /* variables common to all makefiles */ - static struct strarray linguas; -@@ -2233,8 +2233,16 @@ static void add_install_rule( struct makefile *make, const char *target, - strarray_exists( &top_install_lib, make->base_dir ) || - strarray_exists( &top_install_lib, base_dir_path( make, target ))) - { -- strarray_add( &make->install_rules[INSTALL_LIB], file ); -- strarray_add( &make->install_rules[INSTALL_LIB], dest ); -+ if (*dest == 'C') -+ { -+ strarray_add( &make->install_rules[INSTALL_DEBUG], file ); -+ strarray_add( &make->install_rules[INSTALL_DEBUG], dest ); -+ } -+ else -+ { -+ strarray_add( &make->install_rules[INSTALL_LIB], file ); -+ strarray_add( &make->install_rules[INSTALL_LIB], dest ); -+ } - } - else if (strarray_exists( &make->install_dev, target ) || - strarray_exists( &top_install_dev, make->base_dir ) || -@@ -2385,6 +2393,10 @@ static void output_install_commands( struct makefile *make, const struct makefil - output( "\tSTRIPPROG=%s-strip %s -m 644 $(INSTALL_PROGRAM_FLAGS) %s %s\n", - crosstarget, install_sh, obj_dir_path( make, file ), dest ); - break; -+ case 'C': /* debug symbols for cross-compiled program */ -+ output( "\t%s -m 644 $(filter-out -s,$(INSTALL_PROGRAM_FLAGS)) %s %s\n", -+ install_sh, obj_dir_path( make, file ), dest ); -+ break; - case 'd': /* data file */ - output( "\t%s -m 644 $(INSTALL_DATA_FLAGS) %s %s\n", - install_sh, obj_dir_path( make, file ), dest ); -@@ -2440,6 +2452,7 @@ static void output_install_rules( struct makefile *make, enum install_rules rule - switch (*files.str[i + 1]) - { - case 'c': /* cross-compiled program */ -+ case 'C': /* debug symbols for cross-compiled program */ - case 'd': /* data file */ - case 'p': /* program file */ - case 's': /* script */ -@@ -2451,7 +2464,10 @@ static void output_install_rules( struct makefile *make, enum install_rules rule - } - } - -- output( "install %s::", target ); -+ if (rules == INSTALL_DEBUG) -+ output( "%s::", target ); -+ else -+ output( "install %s::", target ); - output_filenames( targets ); - output( "\n" ); - output_install_commands( make, NULL, files ); -@@ -3198,6 +3214,8 @@ static void output_module( struct makefile *make ) - strarray_add( &make->all_targets, strmake( "%s", make->module )); - add_install_rule( make, make->module, strmake( "%s", make->module ), - strmake( "c$(dlldir)/%s", make->module )); -+ add_install_rule( make, make->module, strmake( ".debug/%s", make->module ), -+ strmake( "C$(dlldir)/.debug/%s", make->module )); - output( "%s:", module_path ); - } - else -@@ -3693,6 +3711,11 @@ static void output_subdirs( struct makefile *make ) - output( "install install-lib:: %s\n", submake->base_dir ); - output_install_commands( make, submake, submake->install_rules[INSTALL_LIB] ); - } -+ if (submake->install_rules[INSTALL_DEBUG].count) -+ { -+ output( "install-cross-debug:: %s\n", submake->base_dir ); -+ output_install_commands( make, submake, submake->install_rules[INSTALL_DEBUG] ); -+ } - if (submake->install_rules[INSTALL_DEV].count) - { - output( "install install-dev:: %s\n", submake->base_dir ); -@@ -3844,6 +3867,7 @@ static void output_sources( struct makefile *make ) - output( "\n" ); - } - output_install_rules( make, INSTALL_LIB, "install-lib" ); -+ output_install_rules( make, INSTALL_DEBUG, "install-cross-debug" ); - output_install_rules( make, INSTALL_DEV, "install-dev" ); - output_uninstall_rules( make ); - } From 213905a322620eb326b655ab89fbca07316e6357 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 19 Nov 2019 09:59:17 -0600 @@ -4726,3 +4287,148 @@ index 46d842bf4c1..8a485ca7fd5 100644 HANDLE engine_thread; pthread_cond_t engine_done, engine_ready; pthread_mutex_t engine_lock; +From ddb3e721daa73dc07079e7a15612e274f96f104b Mon Sep 17 00:00:00 2001 +From: Derek Lesho +Date: Fri, 6 Dec 2019 11:48:10 -0600 +Subject: [PATCH] bcrypt: Allow importing private ECDSA keys. + +Signed-off-by: Derek Lesho +--- + dlls/bcrypt/bcrypt_main.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c +index 2ac36d3db01..1daaa8ab599 100644 +--- a/dlls/bcrypt/bcrypt_main.c ++++ b/dlls/bcrypt/bcrypt_main.c +@@ -1175,6 +1175,10 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP + key_size = 32; + magic = BCRYPT_ECDH_PRIVATE_P256_MAGIC; + break; ++ case ALG_ID_ECDSA_P256: ++ key_size = 32; ++ magic = BCRYPT_ECDSA_PRIVATE_P256_MAGIC; ++ break; + + default: + FIXME( "algorithm %u does not yet support importing blob of type %s\n", alg->id, debugstr_w(type) ); +From 52c36274080a6edc1f1420b08df1ecf0defa9ca3 Mon Sep 17 00:00:00 2001 +From: Derek Lesho +Date: Thu, 5 Dec 2019 12:41:57 -0600 +Subject: [PATCH] bcrypt: Fallback to _gnutls_decode_ber_rs_raw if + gnutls_decode_rs_value is unavailable. + +This can be removed when the runtime ships gnutls >= 3.6 +--- + dlls/bcrypt/gnutls.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c +index 868f898bbbb..95f498123ea 100644 +--- a/dlls/bcrypt/gnutls.c ++++ b/dlls/bcrypt/gnutls.c +@@ -267,8 +267,11 @@ BOOL gnutls_initialize(void) + } + if (!(pgnutls_decode_rs_value = wine_dlsym( libgnutls_handle, "gnutls_decode_rs_value", NULL, 0 ))) + { +- WARN("gnutls_decode_rs_value not found\n"); +- pgnutls_decode_rs_value = compat_gnutls_decode_rs_value; ++ if (!(pgnutls_decode_rs_value = wine_dlsym( libgnutls_handle, "_gnutls_decode_ber_rs_raw", NULL, 0))) ++ { ++ WARN("gnutls_decode_rs_value and legacy alternative _gnutls_decode_ber_rs_raw not found\n"); ++ pgnutls_decode_rs_value = compat_gnutls_decode_rs_value; ++ } + } + + if (TRACE_ON( bcrypt )) +From 84d73a7fa55c13ed797b2b2f6cfb9071dceac800 Mon Sep 17 00:00:00 2001 +From: Andrew Eikum +Date: Mon, 21 Oct 2019 15:30:33 -0500 +Subject: [PATCH] wined3d: Use dxvk_config library to load DXVK options + +--- + dlls/wined3d/directx.c | 56 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c +index 12b53f75774..6f132ea047a 100644 +--- a/dlls/wined3d/directx.c ++++ b/dlls/wined3d/directx.c +@@ -1326,14 +1326,46 @@ HRESULT CDECL wined3d_set_adapter_display_mode(struct wined3d *wined3d, + return WINED3D_OK; + } + ++/* from dxvk_config.h, not available at wine build time in Proton */ ++struct DXVKOptions { ++ int32_t customVendorId; ++ int32_t customDeviceId; ++ int32_t nvapiHack; ++}; ++static HRESULT (WINAPI *pDXVKGetOptions)(struct DXVKOptions *out_opts); ++static HMODULE dxvk_config_mod; ++ ++static BOOL WINAPI load_dxvk_config(INIT_ONCE *once, void *param, void **context) ++{ ++ dxvk_config_mod = LoadLibraryA("dxvk_config.dll"); ++ if(!dxvk_config_mod) ++ { ++ ERR_(winediag)("Couldn't load dxvk_config.dll, won't apply default DXVK config options\n"); ++ return TRUE; ++ } ++ ++ pDXVKGetOptions = (void*)GetProcAddress(dxvk_config_mod, "DXVKGetOptions"); ++ if(!pDXVKGetOptions) ++ { ++ ERR_(winediag)("dxvk_config doesn't have DXVKGetOptions?!\n"); ++ return TRUE; ++ } ++ ++ return TRUE; ++} ++ + HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, + UINT adapter_idx, DWORD flags, struct wined3d_adapter_identifier *identifier) + { + const struct wined3d_adapter *adapter; ++ static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; ++ struct DXVKOptions dxvk_opts; + + TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n", + wined3d, adapter_idx, flags, identifier); + ++ InitOnceExecuteOnce(&init_once, load_dxvk_config, NULL, NULL); ++ + wined3d_mutex_lock(); + + if (adapter_idx >= wined3d->adapter_count) +@@ -1359,6 +1391,30 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, + identifier->driver_version.u.LowPart = adapter->driver_info.version_low; + identifier->vendor_id = adapter->driver_info.vendor; + identifier->device_id = adapter->driver_info.device; ++ ++ if(pDXVKGetOptions && pDXVKGetOptions(&dxvk_opts) == S_OK) ++ { ++ TRACE("got dxvk options:\n"); ++ TRACE("\tnvapiHack: %u\n", dxvk_opts.nvapiHack); ++ TRACE("\tcustomVendorId: 0x%04x\n", dxvk_opts.customVendorId); ++ TRACE("\tcustomDeviceId: 0x%04x\n", dxvk_opts.customDeviceId); ++ ++ /* logic from dxvk/src/dxgi/dxgi_adapter.cpp:DxgiAdapter::GetDesc2 */ ++ if (dxvk_opts.customVendorId >= 0) ++ identifier->vendor_id = dxvk_opts.customVendorId; ++ ++ if (dxvk_opts.customDeviceId >= 0) ++ identifier->device_id = dxvk_opts.customDeviceId; ++ ++ if (dxvk_opts.customVendorId < 0 && dxvk_opts.customDeviceId < 0 && ++ dxvk_opts.nvapiHack && adapter->driver_info.vendor == HW_VENDOR_NVIDIA) { ++ TRACE("NvAPI workaround enabled, reporting AMD GPU\n"); ++ identifier->vendor_id = HW_VENDOR_AMD; ++ identifier->device_id = CARD_AMD_RADEON_RX_480; ++ } ++ }else ++ WARN("failed to get DXVK options!\n"); ++ + identifier->subsystem_id = 0; + identifier->revision = 0; + identifier->device_identifier = IID_D3DDEVICE_D3DUID; diff --git a/game-patches-testing/proton-valve-patches/proton_fs_hack_integer_scaling.patch b/game-patches-testing/proton-valve-patches/proton_fs_hack_integer_scaling.patch index 2fe3466a9..517ab17c2 100644 --- a/game-patches-testing/proton-valve-patches/proton_fs_hack_integer_scaling.patch +++ b/game-patches-testing/proton-valve-patches/proton_fs_hack_integer_scaling.patch @@ -198,3 +198,26 @@ index 40ff8c35dbd..0f2bae9b9ef 100644 }; extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(HDC hdc, UINT version); +From 0f22d04d80db76054302251d7eccc39414dbcab4 Mon Sep 17 00:00:00 2001 +From: Georg Lehmann +Date: Wed, 4 Mar 2020 13:42:04 +0100 +Subject: [PATCH] winevulkan: fix missing VkFilter for fshack integer scaling + in vulkan_driver.h + +--- + dlls/winevulkan/make_vulkan | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan +index a49cd2409c9..10728785223 100755 +--- a/dlls/winevulkan/make_vulkan ++++ b/dlls/winevulkan/make_vulkan +@@ -2512,7 +2512,7 @@ class VkGenerator(object): + f.write(" * resolution; user_sz will contain the app's requested mode; and dst_blit\n") + f.write(" * will contain the area to blit the user image to in real coordinates.\n") + f.write(" * All parameters are optional. */\n") +- f.write(" VkBool32 (*query_fs_hack)(VkExtent2D *real_sz, VkExtent2D *user_sz, VkRect2D *dst_blit);\n") ++ f.write(" VkBool32 (*query_fs_hack)(VkExtent2D *real_sz, VkExtent2D *user_sz, VkRect2D *dst_blit, VkFilter *filter);\n") + + f.write("};\n\n") + diff --git a/game-patches-testing/proton-valve-patches/valve_proton_fullscreen_hack-staging.patch b/game-patches-testing/proton-valve-patches/valve_proton_fullscreen_hack-staging.patch index 062c1a9cb..224f4bd48 100644 --- a/game-patches-testing/proton-valve-patches/valve_proton_fullscreen_hack-staging.patch +++ b/game-patches-testing/proton-valve-patches/valve_proton_fullscreen_hack-staging.patch @@ -5379,3 +5379,614 @@ index 1f1a2d59e2e..b2700164a3d 100644 mwm_hints.input_mode = 0; mwm_hints.status = 0; data->unmapnotify_serial = NextRequest( data->display ); +From 013a9b234732a9fbbd77ca370a3d66cf587a9113 Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Mon, 24 Feb 2020 17:36:49 +0000 +Subject: [PATCH 1/4] winevulkan: Cleanup barriers for fs hack + +Removes needless GENERAL transitions for graphics presentation. +(we can be TRANSFER_SRC for vkCmdBlitImage, no need to disable DCC with GENERAL) +Access masks were also incorrect for this, this fixes those. (VK_ACCESS_TRANSFER_READ_BIT was missing) + +Fixes some spec violations when presenting from compute queues: +Previously, we were transitioning to PRESENT_SRC too early and copies were happening to PRESENT_SRC which is illegal. +This patch will fix that by them being GENERAL (they are storage images anyway) at this point, then transitioning. +Also fixes misc. access flag issues. +--- + dlls/winevulkan/vulkan.c | 123 ++++++++++++++++++++------------------- + 1 file changed, 63 insertions(+), 60 deletions(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index 63665fb7a6f..15644e4901d 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -2216,9 +2216,10 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + + device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); + +- /* transition user image from GENERAL to SHADER_READ */ ++ /* for the cs we run... */ ++ /* transition user image from TRANSFER_SRC to SHADER_READ */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; +- barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; ++ barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + barriers[0].newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +@@ -2228,9 +2229,10 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; +- barriers[0].srcAccessMask = 0; ++ barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + barriers[0].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; + ++ /* storage image... */ + /* transition blit image from whatever to GENERAL */ + barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; +@@ -2278,10 +2280,10 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + device->funcs.p_vkCmdDispatch(hack->cmd, ceil(swapchain->real_extent.width / 8.), + ceil(swapchain->real_extent.height / 8.), 1); + +- /* transition user image from SHADER_READ to GENERAL */ ++ /* transition user image from SHADER_READ back to TRANSFER_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; +- barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; ++ barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->user_image; +@@ -2291,7 +2293,7 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; +- barriers[0].dstAccessMask = 0; ++ barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + + device->funcs.p_vkCmdPipelineBarrier( + hack->cmd, +@@ -2304,11 +2306,11 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + ); + + if(hack->blit_image){ +- /* transition blit image layout from GENERAL to TRANSFER_SRC +- * and access from SHADER_WRITE_BIT to TRANSFER_READ_BIT */ ++ /* for the copy... */ ++ /* no transition, just a barrier for our access masks (w -> r) */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; +- barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->blit_image; +@@ -2320,10 +2322,12 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + +- /* transition swapchain image from whatever to PRESENT_SRC */ ++ /* for the copy... */ ++ /* transition swapchain image from whatever to TRANSFER_DST ++ * we don't care about the contents... */ + barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; +- barriers[1].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; ++ barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].image = hack->swapchain_image; +@@ -2361,9 +2365,34 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + region.extent.depth = 1; + + device->funcs.p_vkCmdCopyImage(hack->cmd, +- hack->blit_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, +- hack->swapchain_image, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, ++ hack->blit_image, VK_IMAGE_LAYOUT_GENERAL, ++ hack->swapchain_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + 1, ®ion); ++ ++ /* transition swapchain image from TRANSFER_DST_OPTIMAL to PRESENT_SRC */ ++ barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; ++ barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; ++ barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; ++ barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; ++ barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; ++ barriers[0].image = hack->swapchain_image; ++ barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; ++ barriers[0].subresourceRange.baseMipLevel = 0; ++ barriers[0].subresourceRange.levelCount = 1; ++ barriers[0].subresourceRange.baseArrayLayer = 0; ++ barriers[0].subresourceRange.layerCount = 1; ++ barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; ++ barriers[0].dstAccessMask = 0; ++ ++ device->funcs.p_vkCmdPipelineBarrier( ++ hack->cmd, ++ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, ++ VK_PIPELINE_STAGE_TRANSFER_BIT, ++ 0, ++ 0, NULL, ++ 0, NULL, ++ 1, barriers ++ ); + }else{ + /* transition swapchain image from GENERAL to PRESENT_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; +@@ -2421,35 +2450,20 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + + device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); + +- /* transition user image from GENERAL to TRANSFER_SRC_OPTIMAL */ ++ /* transition real image from whatever to TRANSFER_DST_OPTIMAL */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; +- barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; +- barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ barriers[0].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; ++ barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +- barriers[0].image = hack->user_image; ++ barriers[0].image = hack->swapchain_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = 0; +- barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; +- +- /* transition real image from whatever to TRANSFER_DST_OPTIMAL */ +- barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; +- barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; +- barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; +- barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +- barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +- barriers[1].image = hack->swapchain_image; +- barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; +- barriers[1].subresourceRange.baseMipLevel = 0; +- barriers[1].subresourceRange.levelCount = 1; +- barriers[1].subresourceRange.baseArrayLayer = 0; +- barriers[1].subresourceRange.layerCount = 1; +- barriers[1].srcAccessMask = 0; +- barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; ++ barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + + device->funcs.p_vkCmdPipelineBarrier( + hack->cmd, +@@ -2458,7 +2472,7 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + 0, + 0, NULL, + 0, NULL, +- 2, barriers ++ 1, barriers + ); + + /* clear the image */ +@@ -2496,36 +2510,21 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + hack->swapchain_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + 1, &blitregion, swapchain->fs_hack_filter); + +- /* transition user image from TRANSFER_SRC_OPTIMAL to GENERAL */ ++ /* transition real image from TRANSFER_DST to PRESENT_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; +- barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; +- barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; ++ barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; ++ barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +- barriers[0].image = hack->user_image; ++ barriers[0].image = hack->swapchain_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; +- barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; ++ barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + barriers[0].dstAccessMask = 0; + +- /* transition real image from TRANSFER_DST to PRESENT_SRC */ +- barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; +- barriers[1].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; +- barriers[1].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; +- barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +- barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +- barriers[1].image = hack->swapchain_image; +- barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; +- barriers[1].subresourceRange.baseMipLevel = 0; +- barriers[1].subresourceRange.levelCount = 1; +- barriers[1].subresourceRange.baseArrayLayer = 0; +- barriers[1].subresourceRange.layerCount = 1; +- barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; +- barriers[1].dstAccessMask = 0; +- + device->funcs.p_vkCmdPipelineBarrier( + hack->cmd, + VK_PIPELINE_STAGE_TRANSFER_BIT, +@@ -2533,7 +2532,7 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + 0, + 0, NULL, + 0, NULL, +- 2, barriers ++ 1, barriers + ); + + result = device->funcs.p_vkEndCommandBuffer(hack->cmd); +@@ -2687,7 +2686,7 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, + #endif + + /* if the client is trying to transition a user image to PRESENT_SRC, +- * transition it to GENERAL instead. */ ++ * transition it to TRANSFER_SRC_OPTIMAL instead. */ + EnterCriticalSection(&commandBuffer->device->swapchain_lock); + for(i = 0; i < imageMemoryBarrierCount; ++i){ + old = pImageMemoryBarriers[i].oldLayout == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; +@@ -2703,10 +2702,14 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, + if(!pImageMemoryBarriers_host) + pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); + #endif +- if(old) +- pImageMemoryBarriers_host[i].oldLayout = VK_IMAGE_LAYOUT_GENERAL; +- if(new) +- pImageMemoryBarriers_host[i].newLayout = VK_IMAGE_LAYOUT_GENERAL; ++ if(old) { ++ pImageMemoryBarriers_host[i].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ pImageMemoryBarriers_host[i].srcAccessMask |= VK_ACCESS_TRANSFER_READ_BIT; ++ } ++ if(new) { ++ pImageMemoryBarriers_host[i].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ pImageMemoryBarriers_host[i].dstAccessMask |= VK_ACCESS_TRANSFER_READ_BIT; ++ } + goto next; + } + } + +From 459239da871d87c611644b4fefcdf91f6be1dae9 Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Tue, 25 Feb 2020 19:03:31 +0000 +Subject: [PATCH 2/4] winevulkan: Fix warning due to implicit different ptr + size cast + +--- + dlls/winevulkan/vulkan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index 15644e4901d..298fa72e014 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -1774,7 +1774,7 @@ VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCrea + result = init_blit_images(device, object); + if(result != VK_SUCCESS){ + ERR("creating blit images failed: %d\n", result); +- wine_vkDestroySwapchainKHR(device, (VkSwapchainKHR)object, NULL); ++ wine_vkDestroySwapchainKHR(device, (VkSwapchainKHR)(UINT_PTR)object, NULL); + return result; + } + } + +From e8d0dc7f9afd58d5927401067c3d8734360f64de Mon Sep 17 00:00:00 2001 +From: Georg Lehmann +Date: Mon, 2 Mar 2020 14:53:35 +0100 +Subject: [PATCH 3/4] winevulkan: fshack: don't change the transitions to + PRESENT + +We can't be sure that the application transitions with barriers and not with render passes. +So we let it transition to PRESENT and change our layout changes accordingly. + +Also fixes that the user image is created without VK_IMAGE_USAGE_TRANSFER_SRC_BIT. +--- + dlls/winevulkan/vulkan.c | 85 ++++++++++++++++++---------------------- + 1 file changed, 39 insertions(+), 46 deletions(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index 298fa72e014..0950c591d3f 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -1590,7 +1590,7 @@ static VkResult init_fs_hack_images(VkDevice device, struct VkSwapchainKHR_T *sw + imageInfo.format = createinfo->imageFormat; + imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; +- imageInfo.usage = createinfo->imageUsage | VK_IMAGE_USAGE_SAMPLED_BIT; ++ imageInfo.usage = createinfo->imageUsage | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + imageInfo.sharingMode = createinfo->imageSharingMode; + imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; + imageInfo.queueFamilyIndexCount = createinfo->queueFamilyIndexCount; +@@ -2217,9 +2217,9 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); + + /* for the cs we run... */ +- /* transition user image from TRANSFER_SRC to SHADER_READ */ ++ /* transition user image from PRESENT_SRC to SHADER_READ */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; +- barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ barriers[0].oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; +@@ -2229,7 +2229,7 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; +- barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; ++ barriers[0].srcAccessMask = 0; + barriers[0].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; + + /* storage image... */ +@@ -2280,10 +2280,10 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + device->funcs.p_vkCmdDispatch(hack->cmd, ceil(swapchain->real_extent.width / 8.), + ceil(swapchain->real_extent.height / 8.), 1); + +- /* transition user image from SHADER_READ back to TRANSFER_SRC */ ++ /* transition user image from SHADER_READ back to PRESENT_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; +- barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->user_image; +@@ -2293,7 +2293,7 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; +- barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; ++ barriers[0].dstAccessMask = 0; + + device->funcs.p_vkCmdPipelineBarrier( + hack->cmd, +@@ -2465,6 +2465,21 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + barriers[0].srcAccessMask = 0; + barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + ++ /* transition user image from PRESENT_SRC to TRANSFER_SRC_OPTIMAL */ ++ barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; ++ barriers[1].oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; ++ barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; ++ barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; ++ barriers[1].image = hack->user_image; ++ barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; ++ barriers[1].subresourceRange.baseMipLevel = 0; ++ barriers[1].subresourceRange.levelCount = 1; ++ barriers[1].subresourceRange.baseArrayLayer = 0; ++ barriers[1].subresourceRange.layerCount = 1; ++ barriers[1].srcAccessMask = 0; ++ barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; ++ + device->funcs.p_vkCmdPipelineBarrier( + hack->cmd, + VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, +@@ -2472,7 +2487,7 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + 0, + 0, NULL, + 0, NULL, +- 1, barriers ++ 2, barriers + ); + + /* clear the image */ +@@ -2525,6 +2540,21 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + barriers[0].dstAccessMask = 0; + ++ /* transition user image from TRANSFER_SRC_OPTIMAL to back to PRESENT_SRC */ ++ barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; ++ barriers[1].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; ++ barriers[1].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; ++ barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; ++ barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; ++ barriers[1].image = hack->user_image; ++ barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; ++ barriers[1].subresourceRange.baseMipLevel = 0; ++ barriers[1].subresourceRange.levelCount = 1; ++ barriers[1].subresourceRange.baseArrayLayer = 0; ++ barriers[1].subresourceRange.layerCount = 1; ++ barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; ++ barriers[1].dstAccessMask = 0; ++ + device->funcs.p_vkCmdPipelineBarrier( + hack->cmd, + VK_PIPELINE_STAGE_TRANSFER_BIT, +@@ -2532,7 +2562,7 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw + 0, + 0, NULL, + 0, NULL, +- 1, barriers ++ 2, barriers + ); + + result = device->funcs.p_vkEndCommandBuffer(hack->cmd); +@@ -2675,8 +2705,6 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, + VkBufferMemoryBarrier_host *pBufferMemoryBarriers_host; + #endif + VkImageMemoryBarrier_host *pImageMemoryBarriers_host = NULL; +- uint32_t i, j, k; +- int old, new; + + TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + +@@ -2685,41 +2713,6 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, + pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); + #endif + +- /* if the client is trying to transition a user image to PRESENT_SRC, +- * transition it to TRANSFER_SRC_OPTIMAL instead. */ +- EnterCriticalSection(&commandBuffer->device->swapchain_lock); +- for(i = 0; i < imageMemoryBarrierCount; ++i){ +- old = pImageMemoryBarriers[i].oldLayout == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; +- new = pImageMemoryBarriers[i].newLayout == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; +- if(old || new){ +- for(j = 0; j < commandBuffer->device->num_swapchains; ++j){ +- struct VkSwapchainKHR_T *swapchain = commandBuffer->device->swapchains[j]; +- if(swapchain->fs_hack_enabled){ +- for(k = 0; k < swapchain->n_images; ++k){ +- struct fs_hack_image *hack = &swapchain->fs_hack_images[k]; +- if(pImageMemoryBarriers[i].image == hack->user_image){ +-#if !defined(USE_STRUCT_CONVERSION) +- if(!pImageMemoryBarriers_host) +- pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); +-#endif +- if(old) { +- pImageMemoryBarriers_host[i].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; +- pImageMemoryBarriers_host[i].srcAccessMask |= VK_ACCESS_TRANSFER_READ_BIT; +- } +- if(new) { +- pImageMemoryBarriers_host[i].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; +- pImageMemoryBarriers_host[i].dstAccessMask |= VK_ACCESS_TRANSFER_READ_BIT; +- } +- goto next; +- } +- } +- } +- } +- } +-next: ; +- } +- LeaveCriticalSection(&commandBuffer->device->swapchain_lock); +- + commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, + srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, + pMemoryBarriers, bufferMemoryBarrierCount, + +From f76050cdaa3c5f803c1e2a99bb475c3850dd2568 Mon Sep 17 00:00:00 2001 +From: Georg Lehmann +Date: Mon, 2 Mar 2020 18:07:15 +0100 +Subject: [PATCH 4/4] winevulkan: fshack: don't free invidual descriptor set + +They get destroyed when the pool gets destroyed anyway. +--- + dlls/winevulkan/vulkan.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index 0950c591d3f..6408695f1f8 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -1510,7 +1510,6 @@ static VkResult create_descriptor_set(VkDevice device, struct VkSwapchainKHR_T * + static void destroy_fs_hack_image(VkDevice device, struct VkSwapchainKHR_T *swapchain, struct fs_hack_image *hack) + { + device->funcs.p_vkDestroyPipeline(device->device, hack->pipeline, NULL); +- device->funcs.p_vkFreeDescriptorSets(device->device, swapchain->descriptor_pool, 1, &hack->descriptor_set); + device->funcs.p_vkDestroyImageView(device->device, hack->user_view, NULL); + device->funcs.p_vkDestroyImageView(device->device, hack->blit_view, NULL); + device->funcs.p_vkDestroyImage(device->device, hack->user_image, NULL); +From a4f4dd8c6578bb153a06487d071cbd790a83aa3a Mon Sep 17 00:00:00 2001 +From: Georg Lehmann +Date: Wed, 4 Mar 2020 13:50:12 +0100 +Subject: [PATCH] winevulkan: generate wine_vkCmdPipelineBarrier again + +since we removed everything special from that function, we can generate it again +--- + dlls/winevulkan/make_vulkan | 1 - + dlls/winevulkan/vulkan.c | 38 --------------------------------- + dlls/winevulkan/vulkan_thunks.c | 19 +++++++++++++++++ + dlls/winevulkan/vulkan_thunks.h | 1 - + 4 files changed, 19 insertions(+), 40 deletions(-) + +diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan +index 10728785223..b58ca9301cc 100755 +--- a/dlls/winevulkan/make_vulkan ++++ b/dlls/winevulkan/make_vulkan +@@ -171,7 +171,6 @@ FUNCTION_OVERRIDES = { + "vkCmdExecuteCommands" : {"dispatch" : True, "driver" : False, "thunk" : False}, + "vkCreateCommandPool" : {"dispatch": True, "driver" : False, "thunk" : False}, + "vkDestroyCommandPool" : {"dispatch": True, "driver" : False, "thunk" : False}, +- "vkCmdPipelineBarrier" : {"dispatch" : True, "driver" : False, "thunk" : False}, + "vkDestroyDevice" : {"dispatch" : True, "driver" : False, "thunk" : False}, + "vkFreeCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False}, + "vkGetDeviceProcAddr" : {"dispatch" : False, "driver" : True, "thunk" : False}, +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index bad31300df8..e2991c2dc47 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -2693,44 +2693,6 @@ VkResult WINAPI wine_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pP + + } + +-void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, +- VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, +- VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, +- const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, +- const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, +- const VkImageMemoryBarrier *pImageMemoryBarriers) +-{ +-#if defined(USE_STRUCT_CONVERSION) +- VkBufferMemoryBarrier_host *pBufferMemoryBarriers_host; +-#endif +- VkImageMemoryBarrier_host *pImageMemoryBarriers_host = NULL; +- +- TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); +- +-#if defined(USE_STRUCT_CONVERSION) +- pBufferMemoryBarriers_host = convert_VkBufferMemoryBarrier_array_win_to_host(pBufferMemoryBarriers, bufferMemoryBarrierCount); +- pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); +-#endif +- +- commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, +- srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, +- pMemoryBarriers, bufferMemoryBarrierCount, +-#if defined(USE_STRUCT_CONVERSION) +- pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host +-#else +- pBufferMemoryBarriers, imageMemoryBarrierCount, +- pImageMemoryBarriers_host ? (VkImageMemoryBarrier*)pImageMemoryBarriers_host : pImageMemoryBarriers +-#endif +- ); +- +-#if defined(USE_STRUCT_CONVERSION) +- free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount); +-#else +- if(pImageMemoryBarriers_host) +-#endif +- free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount); +-} +- + VkDevice WINAPI __wine_get_native_VkDevice(VkDevice device) + { + return device->device; +diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c +index f073539bd53..ea9e8262d83 100644 +--- a/dlls/winevulkan/vulkan_thunks.c ++++ b/dlls/winevulkan/vulkan_thunks.c +@@ -2895,6 +2895,25 @@ static void WINAPI wine_vkCmdNextSubpass2KHR(VkCommandBuffer commandBuffer, cons + commandBuffer->device->funcs.p_vkCmdNextSubpass2KHR(commandBuffer->command_buffer, pSubpassBeginInfo, pSubpassEndInfo); + } + ++void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) ++{ ++#if defined(USE_STRUCT_CONVERSION) ++ VkBufferMemoryBarrier_host *pBufferMemoryBarriers_host; ++ VkImageMemoryBarrier_host *pImageMemoryBarriers_host; ++ TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); ++ ++ pBufferMemoryBarriers_host = convert_VkBufferMemoryBarrier_array_win_to_host(pBufferMemoryBarriers, bufferMemoryBarrierCount); ++ pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); ++ commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host); ++ ++ free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount); ++ free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount); ++#else ++ TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); ++ commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); ++#endif ++} ++ + void WINAPI wine_vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void *pValues) + { + TRACE("%p, 0x%s, %#x, %u, %u, %p\n", commandBuffer, wine_dbgstr_longlong(layout), stageFlags, offset, size, pValues); +diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h +index 08ede0bd2af..82d0c3a0a5e 100644 +--- a/dlls/winevulkan/vulkan_thunks.h ++++ b/dlls/winevulkan/vulkan_thunks.h +@@ -44,7 +44,6 @@ + VkResult WINAPI wine_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex); + VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers); + void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers); +-void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers); + VkResult WINAPI wine_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool); + VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice); + VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain); diff --git a/game-patches-testing/protonprep.sh b/game-patches-testing/protonprep.sh index 21dd9fa56..606746794 100755 --- a/game-patches-testing/protonprep.sh +++ b/game-patches-testing/protonprep.sh @@ -13,17 +13,19 @@ # warframe controller fix git checkout lsteamclient cd lsteamclient - patch -Np1 < ../game-patches-testing/proton-hotfixes/proton-lsteamclient_disable_winISteamController_SteamController007_warframe.patch patch -Np1 < ../game-patches-testing/proton-hotfixes/proton-lsteamclient_sync_important_environment_variables_before_loading_steamclient.patch patch -Np1 < ../game-patches-testing/proton-hotfixes/proton-lsteamclient_reallocate_new_interface_only_when_linux_side_changes.patch + patch -Np1 < ../game-patches-testing/proton-hotfixes/steamclient-dont_load_steamcontroller007_or_steaminput001_without_controller.patch cd .. # VKD3D patches cd vkd3d git reset --hard HEAD git clean -xdf + git revert --no-commit d45bc9baab4b9203ea974decfc45707ee64dbbb3 + patch -Np1 < ../game-patches-testing/vkd3d-patches/vkd3d-Fix_DXIL_check_in_test_coverage.patch #WoW anti-flicker patch - patch -Np1 < ../game-patches-testing/vkd3d-patches/Support_RS_1.0_Volatile.patch + #patch -Np1 < ../game-patches-testing/vkd3d-patches/Support_RS_1.0_Volatile.patch cd .. # Valve DXVK patches @@ -115,8 +117,8 @@ patch -Np1 < ../game-patches-testing/proton-valve-patches/proton-protonify_staging.patch patch -Np1 < ../game-patches-testing/proton-valve-patches/proton-LAA_staging.patch - #echo "mk11 patch" - #patch -Np1 < ../game-patches-testing/game-patches/mk11.patch + echo "mk11 patch" + patch -Np1 < ../game-patches-testing/game-patches/mk11.patch echo "clock monotonic, amd ags, hide prefix update" patch -Np1 < ../game-patches-testing/proton-valve-patches/proton-use_clock_monotonic.patch @@ -158,6 +160,7 @@ echo "FS Hack integer scaling" patch -Np1 < ../game-patches-testing/proton-valve-patches/proton_fs_hack_integer_scaling.patch + echo "SDL Joystick" patch -Np1 < ../game-patches-testing/proton-valve-patches/proton-sdl_joy.patch patch -Np1 < ../game-patches-testing/proton-valve-patches/proton-sdl_joy_2.patch @@ -177,17 +180,19 @@ patch -Np1 < ../game-patches-testing/proton-hotfixes/proton-mf_hacks.patch echo "fs hack improvement PRs" - patch -Np1 < ../game-patches-testing/wine-patches/winevulkan-cleanup_barriers_for_fs_hack.patch - patch -Np1 < ../game-patches-testing/wine-patches/winevulkan_implement_Contrast_Adaptive_Sharpening_scaling_in_fshack.patch - patch -Np1 < ../game-patches-testing/wine-patches/fshack-create_only_one_compute_pipeline_per_swap_chain.patch + patch -Np1 < ../game-patches-testing/wine-patches/winevulkan_fshack_opts.patch + #patch -Np1 < ../game-patches-testing/wine-patches/winevulkan_implement_Contrast_Adaptive_Sharpening_scaling_in_fshack.patch #WINE VULKAN - must be applied after fshack echo "applying winevulkan patches" patch -Np1 < ../game-patches-testing/wine-patches/winevulkan-childwindow.patch + echo "applying WoW vkd3d wine patches" patch -Np1 < ../game-patches-testing/wine-patches/D3D12SerializeVersionedRootSignature.patch patch -Np1 < ../game-patches-testing/wine-patches/D3D12CreateVersionedRootSignatureDeserializer.patch + echo "winex11 proton hotfix" + patch -Np1 < ../game-patches-testing/wine-patches/HACK-winex11-limits-resources-nmode.patch #WINE CUSTOM PATCHES #add your own custom patch lines below diff --git a/game-patches-testing/vkd3d-patches/vkd3d-Fix_DXIL_check_in_test_coverage.patch b/game-patches-testing/vkd3d-patches/vkd3d-Fix_DXIL_check_in_test_coverage.patch new file mode 100644 index 000000000..ea8cac12e --- /dev/null +++ b/game-patches-testing/vkd3d-patches/vkd3d-Fix_DXIL_check_in_test_coverage.patch @@ -0,0 +1,28 @@ +From ae2a2bdbe8b35cd7b23c1049a4c1615a4ce69a9f Mon Sep 17 00:00:00 2001 +From: Hans-Kristian Arntzen +Date: Thu, 5 Mar 2020 15:36:05 +0100 +Subject: [PATCH] vkd3d: Fix DXIL check in test_coverage. + +Signed-off-by: Hans-Kristian Arntzen +--- + tests/d3d12.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/tests/d3d12.c b/tests/d3d12.c +index f1e0122c..92f33ca7 100644 +--- a/tests/d3d12.c ++++ b/tests/d3d12.c +@@ -33736,6 +33736,13 @@ static void test_coverage(bool use_dxil) + desc.no_root_signature = true; + if (!init_test_context(&context, &desc)) + return; ++ ++ if (use_dxil && !context_supports_dxil(&context)) ++ { ++ destroy_test_context(&context); ++ return; ++ } ++ + command_list = context.list; + queue = context.queue; + diff --git a/game-patches-testing/vkd3d-patches/wow-flicker.patch b/game-patches-testing/vkd3d-patches/wow-flicker.patch deleted file mode 100644 index 4db404738..000000000 --- a/game-patches-testing/vkd3d-patches/wow-flicker.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c -index c401349..62b4751 100644 ---- a/libs/vkd3d/command.c -+++ b/libs/vkd3d/command.c -@@ -1862,14 +1862,17 @@ static void d3d12_command_list_invalidate_current_render_pass(struct d3d12_comma - static void d3d12_command_list_invalidate_bindings(struct d3d12_command_list *list, - struct d3d12_pipeline_state *state) - { -+ struct vkd3d_pipeline_bindings *bindings; -+ - if (!state) - return; - -+ bindings = &list->pipeline_bindings[state->vk_bind_point]; -+ -+ bindings->descriptor_table_dirty_mask |= bindings->descriptor_table_active_mask; -+ - if (state->uav_counter_mask) -- { -- struct vkd3d_pipeline_bindings *bindings = &list->pipeline_bindings[state->vk_bind_point]; - bindings->uav_counter_dirty_mask = ~(uint8_t)0; -- } - } - - static void d3d12_command_list_invalidate_root_parameters(struct d3d12_command_list *list, diff --git a/game-patches-testing/wine-patches/HACK-winex11-limits-resources-nmode.patch b/game-patches-testing/wine-patches/HACK-winex11-limits-resources-nmode.patch new file mode 100644 index 000000000..500217591 --- /dev/null +++ b/game-patches-testing/wine-patches/HACK-winex11-limits-resources-nmode.patch @@ -0,0 +1,35 @@ +From 1d6a9c4db01123b6dfd7de0848fe4b3d1870cf8c Mon Sep 17 00:00:00 2001 +From: yuiiio +Date: Sun, 1 Mar 2020 17:26:58 +0900 +Subject: [PATCH] HACK:winex11: limits resources->nmode + +fix https://github.com/ValveSoftware/Proton/issues/2929 +--- + dlls/winex11.drv/xrandr.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c +index fff1322d292..cb73950e894 100644 +--- a/dlls/winex11.drv/xrandr.c ++++ b/dlls/winex11.drv/xrandr.c +@@ -564,10 +564,19 @@ static int xrandr12_init_modes(void) + primary_height = tmp; + } + ++ int limit = 53; // required by nier_automata (55), sekiro (53), dark_souls3 (53) ++ int capped_resources_nmode = 1; ++ ++ if (resources->nmode > limit) { ++ capped_resources_nmode = limit; ++ } else { ++ capped_resources_nmode = resources->nmode; ++ } ++ + xrandr_mode_count = 0; + for (i = 0; i < output_info->nmode; ++i) + { +- for (j = 0; j < resources->nmode; ++j) ++ for (j = 0; j < capped_resources_nmode; ++j) + { + XRRModeInfo *mode = &resources->modes[j]; + diff --git a/game-patches-testing/wine-patches/fshack-create_only_one_compute_pipeline_per_swap_chain.patch b/game-patches-testing/wine-patches/fshack-create_only_one_compute_pipeline_per_swap_chain.patch deleted file mode 100644 index ee95b40ed..000000000 --- a/game-patches-testing/wine-patches/fshack-create_only_one_compute_pipeline_per_swap_chain.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 77b9303eabcd92ee86b3a2ae964a3339a9639fa6 Mon Sep 17 00:00:00 2001 -From: Georg Lehmann -Date: Tue, 25 Feb 2020 13:15:42 +0100 -Subject: [PATCH] fshack: Create only one compute pipeline per swap chain - -There is no need to create one pipeline per swapchain image ---- - dlls/winevulkan/vulkan.c | 46 ++++++++++++++++---------------- - dlls/winevulkan/vulkan_private.h | 2 +- - 2 files changed, 24 insertions(+), 24 deletions(-) - -diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c -index 63665fb7a6f..36e2cc54d99 100644 ---- a/dlls/winevulkan/vulkan.c -+++ b/dlls/winevulkan/vulkan.c -@@ -1428,7 +1428,7 @@ const uint32_t blit_comp_spv[] = { - 0x000100fd,0x00010038 - }; - --static VkResult create_pipeline(VkDevice device, struct VkSwapchainKHR_T *swapchain, struct fs_hack_image *hack, VkShaderModule shaderModule) -+static VkResult create_pipeline(VkDevice device, struct VkSwapchainKHR_T *swapchain, VkShaderModule shaderModule) - { - VkResult res; - #if defined(USE_STRUCT_CONVERSION) -@@ -1446,7 +1446,7 @@ static VkResult create_pipeline(VkDevice device, struct VkSwapchainKHR_T *swapch - pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; - pipelineInfo.basePipelineIndex = -1; - -- res = device->funcs.p_vkCreateComputePipelines(device->device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, &hack->pipeline); -+ res = device->funcs.p_vkCreateComputePipelines(device->device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, &swapchain->pipeline); - if(res != VK_SUCCESS){ - ERR("vkCreateComputePipelines: %d\n", res); - return res; -@@ -1509,7 +1509,6 @@ static VkResult create_descriptor_set(VkDevice device, struct VkSwapchainKHR_T * - - static void destroy_fs_hack_image(VkDevice device, struct VkSwapchainKHR_T *swapchain, struct fs_hack_image *hack) - { -- device->funcs.p_vkDestroyPipeline(device->device, hack->pipeline, NULL); - device->funcs.p_vkFreeDescriptorSets(device->device, swapchain->descriptor_pool, 1, &hack->descriptor_set); - device->funcs.p_vkDestroyImageView(device->device, hack->user_view, NULL); - device->funcs.p_vkDestroyImageView(device->device, hack->blit_view, NULL); -@@ -1837,6 +1836,7 @@ void WINAPI wine_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain - if(object->cmd_pools[i]) - device->funcs.p_vkDestroyCommandPool(device->device, object->cmd_pools[i], NULL); - -+ device->funcs.p_vkDestroyPipeline(device->device, object->pipeline, NULL); - device->funcs.p_vkDestroyPipelineLayout(device->device, object->pipeline_layout, NULL); - device->funcs.p_vkDestroyDescriptorSetLayout(device->device, object->descriptor_set_layout, NULL); - device->funcs.p_vkDestroyDescriptorPool(device->device, object->descriptor_pool, NULL); -@@ -2022,6 +2022,22 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc - ERR("vkCreatePipelineLayout: %d\n", res); - goto fail; - } -+ -+ shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; -+ shaderInfo.codeSize = sizeof(blit_comp_spv); -+ shaderInfo.pCode = blit_comp_spv; -+ -+ res = device->funcs.p_vkCreateShaderModule(device->device, &shaderInfo, NULL, &shaderModule); -+ if(res != VK_SUCCESS){ -+ ERR("vkCreateShaderModule: %d\n", res); -+ goto fail; -+ } -+ -+ res = create_pipeline(device, swapchain, shaderModule); -+ if(res != VK_SUCCESS) -+ goto fail; -+ -+ device->funcs.p_vkDestroyShaderModule(device->device, shaderModule, NULL); - - if(!(swapchain->surface_usage & VK_IMAGE_USAGE_STORAGE_BIT)){ - TRACE("using intermediate blit images\n"); -@@ -2107,16 +2123,6 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc - }else - TRACE("blitting directly to swapchain images\n"); - -- shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; -- shaderInfo.codeSize = swapchain->fs_hack_cas ? sizeof(cas_comp_spv) : sizeof(blit_comp_spv); -- shaderInfo.pCode = swapchain->fs_hack_cas ? cas_comp_spv : blit_comp_spv; -- -- res = device->funcs.p_vkCreateShaderModule(device->device, &shaderInfo, NULL, &shaderModule); -- if(res != VK_SUCCESS){ -- ERR("vkCreateShaderModule: %d\n", res); -- goto fail; -- } -- - /* create imageviews */ - for(i = 0; i < swapchain->n_images; ++i){ - struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; -@@ -2140,23 +2146,14 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc - res = create_descriptor_set(device, swapchain, hack); - if(res != VK_SUCCESS) - goto fail; -- -- res = create_pipeline(device, swapchain, hack, shaderModule); -- if(res != VK_SUCCESS) -- goto fail; - } - -- device->funcs.p_vkDestroyShaderModule(device->device, shaderModule, NULL); -- - return VK_SUCCESS; - - fail: - for(i = 0; i < swapchain->n_images; ++i){ - struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; - -- device->funcs.p_vkDestroyPipeline(device->device, hack->pipeline, NULL); -- hack->pipeline = VK_NULL_HANDLE; -- - device->funcs.p_vkFreeDescriptorSets(device->device, swapchain->descriptor_pool, 1, &hack->descriptor_set); - hack->descriptor_set = VK_NULL_HANDLE; - -@@ -2168,6 +2165,9 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc - } - - device->funcs.p_vkDestroyShaderModule(device->device, shaderModule, NULL); -+ -+ device->funcs.p_vkDestroyPipeline(device->device, swapchain->pipeline, NULL); -+ swapchain->pipeline = VK_NULL_HANDLE; - - device->funcs.p_vkDestroyPipelineLayout(device->device, swapchain->pipeline_layout, NULL); - swapchain->pipeline_layout = VK_NULL_HANDLE; -@@ -2258,7 +2258,7 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - - /* perform blit shader */ - device->funcs.p_vkCmdBindPipeline(hack->cmd, -- VK_PIPELINE_BIND_POINT_COMPUTE, hack->pipeline); -+ VK_PIPELINE_BIND_POINT_COMPUTE, swapchain->pipeline); - - device->funcs.p_vkCmdBindDescriptorSets(hack->cmd, - VK_PIPELINE_BIND_POINT_COMPUTE, swapchain->pipeline_layout, -diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h -index 00626eff1e3..001ce85a1fd 100644 ---- a/dlls/winevulkan/vulkan_private.h -+++ b/dlls/winevulkan/vulkan_private.h -@@ -147,7 +147,6 @@ struct fs_hack_image - VkSemaphore blit_finished; - VkImageView user_view, blit_view; - VkDescriptorSet descriptor_set; -- VkPipeline pipeline; - }; - - struct VkSwapchainKHR_T -@@ -170,6 +169,7 @@ struct VkSwapchainKHR_T - VkDescriptorPool descriptor_pool; - VkDescriptorSetLayout descriptor_set_layout; - VkPipelineLayout pipeline_layout; -+ VkPipeline pipeline; - }; - - void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN; diff --git a/game-patches-testing/wine-patches/winevulkan-cleanup_barriers_for_fs_hack.patch b/game-patches-testing/wine-patches/winevulkan-cleanup_barriers_for_fs_hack.patch deleted file mode 100644 index 260f8f20e..000000000 --- a/game-patches-testing/wine-patches/winevulkan-cleanup_barriers_for_fs_hack.patch +++ /dev/null @@ -1,288 +0,0 @@ -From 013a9b234732a9fbbd77ca370a3d66cf587a9113 Mon Sep 17 00:00:00 2001 -From: Joshua Ashton -Date: Mon, 24 Feb 2020 17:36:49 +0000 -Subject: [PATCH 1/2] winevulkan: Cleanup barriers for fs hack - -Removes needless GENERAL transitions for graphics presentation. -(we can be TRANSFER_SRC for vkCmdBlitImage, no need to disable DCC with GENERAL) -Access masks were also incorrect for this, this fixes those. (VK_ACCESS_TRANSFER_READ_BIT was missing) - -Fixes some spec violations when presenting from compute queues: -Previously, we were transitioning to PRESENT_SRC too early and copies were happening to PRESENT_SRC which is illegal. -This patch will fix that by them being GENERAL (they are storage images anyway) at this point, then transitioning. -Also fixes misc. access flag issues. ---- - dlls/winevulkan/vulkan.c | 123 ++++++++++++++++++++------------------- - 1 file changed, 63 insertions(+), 60 deletions(-) - -diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c -index 63665fb7a6f..15644e4901d 100644 ---- a/dlls/winevulkan/vulkan.c -+++ b/dlls/winevulkan/vulkan.c -@@ -2216,9 +2216,10 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - - device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); - -- /* transition user image from GENERAL to SHADER_READ */ -+ /* for the cs we run... */ -+ /* transition user image from TRANSFER_SRC to SHADER_READ */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; -- barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; -+ barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; - barriers[0].newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -@@ -2228,9 +2229,10 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; -- barriers[0].srcAccessMask = 0; -+ barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - barriers[0].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; - -+ /* storage image... */ - /* transition blit image from whatever to GENERAL */ - barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; -@@ -2278,10 +2280,10 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - device->funcs.p_vkCmdDispatch(hack->cmd, ceil(swapchain->real_extent.width / 8.), - ceil(swapchain->real_extent.height / 8.), 1); - -- /* transition user image from SHADER_READ to GENERAL */ -+ /* transition user image from SHADER_READ back to TRANSFER_SRC */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; -- barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; -+ barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].image = hack->user_image; -@@ -2291,7 +2293,7 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; - barriers[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; -- barriers[0].dstAccessMask = 0; -+ barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - - device->funcs.p_vkCmdPipelineBarrier( - hack->cmd, -@@ -2304,11 +2306,11 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - ); - - if(hack->blit_image){ -- /* transition blit image layout from GENERAL to TRANSFER_SRC -- * and access from SHADER_WRITE_BIT to TRANSFER_READ_BIT */ -+ /* for the copy... */ -+ /* no transition, just a barrier for our access masks (w -> r) */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; -- barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; -+ barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].image = hack->blit_image; -@@ -2320,10 +2322,12 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; - barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - -- /* transition swapchain image from whatever to PRESENT_SRC */ -+ /* for the copy... */ -+ /* transition swapchain image from whatever to TRANSFER_DST -+ * we don't care about the contents... */ - barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; -- barriers[1].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; -+ barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].image = hack->swapchain_image; -@@ -2361,9 +2365,34 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa - region.extent.depth = 1; - - device->funcs.p_vkCmdCopyImage(hack->cmd, -- hack->blit_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, -- hack->swapchain_image, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, -+ hack->blit_image, VK_IMAGE_LAYOUT_GENERAL, -+ hack->swapchain_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - 1, ®ion); -+ -+ /* transition swapchain image from TRANSFER_DST_OPTIMAL to PRESENT_SRC */ -+ barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; -+ barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; -+ barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; -+ barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -+ barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -+ barriers[0].image = hack->swapchain_image; -+ barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; -+ barriers[0].subresourceRange.baseMipLevel = 0; -+ barriers[0].subresourceRange.levelCount = 1; -+ barriers[0].subresourceRange.baseArrayLayer = 0; -+ barriers[0].subresourceRange.layerCount = 1; -+ barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; -+ barriers[0].dstAccessMask = 0; -+ -+ device->funcs.p_vkCmdPipelineBarrier( -+ hack->cmd, -+ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, -+ VK_PIPELINE_STAGE_TRANSFER_BIT, -+ 0, -+ 0, NULL, -+ 0, NULL, -+ 1, barriers -+ ); - }else{ - /* transition swapchain image from GENERAL to PRESENT_SRC */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; -@@ -2421,35 +2450,20 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw - - device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); - -- /* transition user image from GENERAL to TRANSFER_SRC_OPTIMAL */ -+ /* transition real image from whatever to TRANSFER_DST_OPTIMAL */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; -- barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; -- barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; -+ barriers[0].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; -+ barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -- barriers[0].image = hack->user_image; -+ barriers[0].image = hack->swapchain_image; - barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[0].subresourceRange.baseMipLevel = 0; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; - barriers[0].srcAccessMask = 0; -- barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; -- -- /* transition real image from whatever to TRANSFER_DST_OPTIMAL */ -- barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; -- barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; -- barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; -- barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -- barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -- barriers[1].image = hack->swapchain_image; -- barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; -- barriers[1].subresourceRange.baseMipLevel = 0; -- barriers[1].subresourceRange.levelCount = 1; -- barriers[1].subresourceRange.baseArrayLayer = 0; -- barriers[1].subresourceRange.layerCount = 1; -- barriers[1].srcAccessMask = 0; -- barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; -+ barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - - device->funcs.p_vkCmdPipelineBarrier( - hack->cmd, -@@ -2458,7 +2472,7 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw - 0, - 0, NULL, - 0, NULL, -- 2, barriers -+ 1, barriers - ); - - /* clear the image */ -@@ -2496,36 +2510,21 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw - hack->swapchain_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - 1, &blitregion, swapchain->fs_hack_filter); - -- /* transition user image from TRANSFER_SRC_OPTIMAL to GENERAL */ -+ /* transition real image from TRANSFER_DST to PRESENT_SRC */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; -- barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; -- barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; -+ barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; -+ barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -- barriers[0].image = hack->user_image; -+ barriers[0].image = hack->swapchain_image; - barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[0].subresourceRange.baseMipLevel = 0; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; -- barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; -+ barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barriers[0].dstAccessMask = 0; - -- /* transition real image from TRANSFER_DST to PRESENT_SRC */ -- barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; -- barriers[1].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; -- barriers[1].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; -- barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -- barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; -- barriers[1].image = hack->swapchain_image; -- barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; -- barriers[1].subresourceRange.baseMipLevel = 0; -- barriers[1].subresourceRange.levelCount = 1; -- barriers[1].subresourceRange.baseArrayLayer = 0; -- barriers[1].subresourceRange.layerCount = 1; -- barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; -- barriers[1].dstAccessMask = 0; -- - device->funcs.p_vkCmdPipelineBarrier( - hack->cmd, - VK_PIPELINE_STAGE_TRANSFER_BIT, -@@ -2533,7 +2532,7 @@ static VkResult record_graphics_cmd(VkDevice device, struct VkSwapchainKHR_T *sw - 0, - 0, NULL, - 0, NULL, -- 2, barriers -+ 1, barriers - ); - - result = device->funcs.p_vkEndCommandBuffer(hack->cmd); -@@ -2687,7 +2686,7 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, - #endif - - /* if the client is trying to transition a user image to PRESENT_SRC, -- * transition it to GENERAL instead. */ -+ * transition it to TRANSFER_SRC_OPTIMAL instead. */ - EnterCriticalSection(&commandBuffer->device->swapchain_lock); - for(i = 0; i < imageMemoryBarrierCount; ++i){ - old = pImageMemoryBarriers[i].oldLayout == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; -@@ -2703,10 +2702,14 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, - if(!pImageMemoryBarriers_host) - pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); - #endif -- if(old) -- pImageMemoryBarriers_host[i].oldLayout = VK_IMAGE_LAYOUT_GENERAL; -- if(new) -- pImageMemoryBarriers_host[i].newLayout = VK_IMAGE_LAYOUT_GENERAL; -+ if(old) { -+ pImageMemoryBarriers_host[i].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; -+ pImageMemoryBarriers_host[i].srcAccessMask |= VK_ACCESS_TRANSFER_READ_BIT; -+ } -+ if(new) { -+ pImageMemoryBarriers_host[i].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; -+ pImageMemoryBarriers_host[i].dstAccessMask |= VK_ACCESS_TRANSFER_READ_BIT; -+ } - goto next; - } - } - -From 459239da871d87c611644b4fefcdf91f6be1dae9 Mon Sep 17 00:00:00 2001 -From: Joshua Ashton -Date: Tue, 25 Feb 2020 19:03:31 +0000 -Subject: [PATCH 2/2] winevulkan: Fix warning due to implicit different ptr - size cast - ---- - dlls/winevulkan/vulkan.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c -index 15644e4901d..298fa72e014 100644 ---- a/dlls/winevulkan/vulkan.c -+++ b/dlls/winevulkan/vulkan.c -@@ -1774,7 +1774,7 @@ VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCrea - result = init_blit_images(device, object); - if(result != VK_SUCCESS){ - ERR("creating blit images failed: %d\n", result); -- wine_vkDestroySwapchainKHR(device, (VkSwapchainKHR)object, NULL); -+ wine_vkDestroySwapchainKHR(device, (VkSwapchainKHR)(UINT_PTR)object, NULL); - return result; - } - } diff --git a/game-patches-testing/wine-patches/winevulkan_fshack_opts.patch b/game-patches-testing/wine-patches/winevulkan_fshack_opts.patch new file mode 100644 index 000000000..7330e23af --- /dev/null +++ b/game-patches-testing/wine-patches/winevulkan_fshack_opts.patch @@ -0,0 +1,2187 @@ +From 61174aaf0d58210b62f799d447b48c89e92c456d Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Thu, 5 Mar 2020 06:19:51 +0000 +Subject: [PATCH] winevulkan: Eliminate shared conversion structs + +We don't need these any more since we stopped intercepting vkCmdPipelineBarrier for fshack. +--- + dlls/winevulkan/make_vulkan | 58 ++++++++++--------------------------- + 1 file changed, 15 insertions(+), 43 deletions(-) + +diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan +index b58ca9301cc..25bc7369074 100755 +--- a/dlls/winevulkan/make_vulkan ++++ b/dlls/winevulkan/make_vulkan +@@ -219,8 +219,6 @@ STRUCT_CHAIN_CONVERSIONS = [ + "VkInstanceCreateInfo", + ] + +-shared_conversion_structs = ["VkBufferMemoryBarrier", "VkImageMemoryBarrier"] +- + class Direction(Enum): + """ Parameter direction: input, output, input_output. """ + INPUT = 1 +@@ -1080,14 +1078,14 @@ class VkMember(object): + struct = self.type_info["data"] + direction = Direction.OUTPUT if struct.returnedonly else Direction.INPUT + if self.is_dynamic_array(): +- conversions.append(ConversionFunction(False, True, struct.name in shared_conversion_structs, direction, struct)) ++ conversions.append(ConversionFunction(False, True, direction, struct)) + elif self.is_static_array(): +- conversions.append(ConversionFunction(True, False, struct.name in shared_conversion_structs, direction, struct)) ++ conversions.append(ConversionFunction(True, False, direction, struct)) + else: +- conversions.append(ConversionFunction(False, False, struct.name in shared_conversion_structs, direction, struct)) ++ conversions.append(ConversionFunction(False, False, direction, struct)) + + if self.needs_free(): +- conversions.append(FreeFunction(self.is_dynamic_array(), struct.name in shared_conversion_structs, struct)) ++ conversions.append(FreeFunction(self.is_dynamic_array(), struct)) + + return conversions + +@@ -1244,16 +1242,16 @@ class VkParam(object): + + # Input functions require win to host conversion. + if self._direction in [Direction.INPUT, Direction.INPUT_OUTPUT]: +- self.input_conv = ConversionFunction(False, self.is_dynamic_array(), self.struct.name in shared_conversion_structs, Direction.INPUT, self.struct) ++ self.input_conv = ConversionFunction(False, self.is_dynamic_array(), Direction.INPUT, self.struct) + + # Output functions require host to win conversion. + if self._direction in [Direction.INPUT_OUTPUT, Direction.OUTPUT]: +- self.output_conv = ConversionFunction(False, self.is_dynamic_array(), self.struct.name in shared_conversion_structs, Direction.OUTPUT, self.struct) ++ self.output_conv = ConversionFunction(False, self.is_dynamic_array(), Direction.OUTPUT, self.struct) + + # Dynamic arrays, but also some normal structs (e.g. VkCommandBufferBeginInfo) need memory + # allocation and thus some cleanup. + if self.is_dynamic_array() or self.struct.needs_free(): +- self.free_func = FreeFunction(self.is_dynamic_array(), self.struct.name in shared_conversion_structs, self.struct) ++ self.free_func = FreeFunction(self.is_dynamic_array(), self.struct) + + def _set_direction(self): + """ Internal helper function to set parameter direction (input/output/input_output). """ +@@ -1729,10 +1727,9 @@ class VkStruct(Sequence): + + + class ConversionFunction(object): +- def __init__(self, array, dyn_array, shared, direction, struct): ++ def __init__(self, array, dyn_array, direction, struct): + self.array = array + self.direction = direction +- self.shared = shared + self.dyn_array = dyn_array + self.struct = struct + self.type = struct.name +@@ -1753,10 +1750,7 @@ class ConversionFunction(object): + return_type = "{0}_host".format(self.type) + + # Generate function prototype. +- if self.shared: +- body = "" +- else: +- body = "static inline " ++ body = "static inline " + body += "{0} *{1}(".format(return_type, self.name) + body += ", ".join(p for p in params) + body += ")\n{\n" +@@ -1788,10 +1782,7 @@ class ConversionFunction(object): + else: + params = ["const {0} *in".format(self.type), "{0}_host *out".format(self.type)] + +- if self.shared: +- body = "" +- else: +- body = "static inline " ++ body = "static inline " + body += "void {0}(".format(self.name) + + # Generate parameter list +@@ -1825,10 +1816,7 @@ class ConversionFunction(object): + params = ["const {0} *in".format(self.type), "{0} *out_host".format(self.type), "uint32_t count"] + + # Generate function prototype. +- if self.shared: +- body = "" +- else: +- body = "static inline " ++ body = "static inline " + body += "void {0}(".format(self.name) + body += ", ".join(p for p in params) + body += ")\n{\n" +@@ -1908,9 +1896,8 @@ class ConversionFunction(object): + + + class FreeFunction(object): +- def __init__(self, dyn_array, shared, struct): ++ def __init__(self, dyn_array, struct): + self.dyn_array = dyn_array +- self.shared = shared + self.struct = struct + self.type = struct.name + +@@ -1926,10 +1913,7 @@ class FreeFunction(object): + """ Helper function for cleaning up temporary buffers required for array conversions. """ + + # Generate function prototype. +- if self.shared: +- body = "" +- else: +- body = "static inline " ++ body = "static inline " + body += "void {0}({1}_host *in, uint32_t count)\n{{\n".format(self.name, self.type) + + # E.g. VkGraphicsPipelineCreateInfo_host needs freeing for pStages. +@@ -1963,10 +1947,7 @@ class FreeFunction(object): + return "" + + # Generate function prototype. +- if self.shared: +- body = "" +- else: +- body = "static inline " ++ body = "static inline " + body += "void {0}({1}_host *in)\n{{\n".format(self.name, self.type) + + for m in self.struct: +@@ -2137,14 +2118,9 @@ class VkGenerator(object): + # Generate any conversion helper functions. + f.write("#if defined(USE_STRUCT_CONVERSION)\n") + for conv in self.conversions: +- if not conv.shared: +- f.write(conv.definition()) ++ f.write(conv.definition()) + f.write("#endif /* USE_STRUCT_CONVERSION */\n\n") + +- for conv in self.conversions: +- if conv.shared: +- f.write(conv.definition()) +- + for conv in self.struct_chain_conversions: + f.write(conv.definition()) + +@@ -2308,10 +2284,6 @@ class VkGenerator(object): + f.write(func.prototype(postfix="DECLSPEC_HIDDEN") + ";\n") + f.write("\n") + +- for conv in self.conversions: +- if conv.shared: +- f.write(conv.prototype()) +- + f.write("/* For use by vkDevice and children */\n") + f.write("struct vulkan_device_funcs\n{\n") + for vk_func in self.registry.device_funcs: +From 2e70e641784151d5a15db904ff6d1b25365de9b2 Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Thu, 5 Mar 2020 06:26:22 +0000 +Subject: [PATCH] winevulkan: Use alloca for struct conversions + +This allocates these structs on the stack instead of the heap (which is expensive and takes time!) + +These structures and arrays of structures are fairly small, and this is all super hot path code. +--- + dlls/winevulkan/make_vulkan | 155 ++----------------------------- + dlls/winevulkan/vulkan_private.h | 12 +++ + 2 files changed, 22 insertions(+), 145 deletions(-) + +diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan +index 25bc7369074..7f7967fde35 100755 +--- a/dlls/winevulkan/make_vulkan ++++ b/dlls/winevulkan/make_vulkan +@@ -666,13 +666,6 @@ class VkFunction(object): + + body += p.copy(Direction.OUTPUT) + +- # Perform any required cleanups. Most of these are for array functions. +- for p in self.params: +- if not p.needs_free(): +- continue +- +- body += p.free() +- + # Finally return the result. + if self.type != "void": + body += " return result;\n" +@@ -1084,9 +1077,6 @@ class VkMember(object): + else: + conversions.append(ConversionFunction(False, False, direction, struct)) + +- if self.needs_free(): +- conversions.append(FreeFunction(self.is_dynamic_array(), struct)) +- + return conversions + + def is_const(self): +@@ -1152,17 +1142,6 @@ class VkMember(object): + struct = self.type_info["data"] + return struct.needs_conversion() + +- def needs_free(self): +- if not self.needs_conversion(): +- return False +- +- if self.is_dynamic_array(): +- return True +- +- # TODO: some non-pointer structs and optional pointer structs may need freeing, +- # though none of this type have been encountered yet. +- return False +- + def needs_struct_extensions_conversion(self): + if not self.is_struct(): + return False +@@ -1248,11 +1227,6 @@ class VkParam(object): + if self._direction in [Direction.INPUT_OUTPUT, Direction.OUTPUT]: + self.output_conv = ConversionFunction(False, self.is_dynamic_array(), Direction.OUTPUT, self.struct) + +- # Dynamic arrays, but also some normal structs (e.g. VkCommandBufferBeginInfo) need memory +- # allocation and thus some cleanup. +- if self.is_dynamic_array() or self.struct.needs_free(): +- self.free_func = FreeFunction(self.is_dynamic_array(), self.struct) +- + def _set_direction(self): + """ Internal helper function to set parameter direction (input/output/input_output). """ + +@@ -1380,20 +1354,6 @@ class VkParam(object): + def format_string(self): + return self.format_str + +- def free(self): +- if self.is_dynamic_array(): +- if self.struct.returnedonly: +- # For returnedonly, counts is stored in a pointer. +- return " free_{0}_array({1}_host, *{2});\n".format(self.type, self.name, self.dyn_array_len) +- else: +- return " free_{0}_array({1}_host, {2});\n".format(self.type, self.name, self.dyn_array_len) +- else: +- # We are operating on a single structure. Some structs (very rare) contain dynamic members, +- # which would need freeing. +- if self.struct.needs_free(): +- return " free_{0}(&{1}_host);\n".format(self.type, self.name) +- return "" +- + def get_conversions(self): + """ Get a list of conversions required for this parameter if any. + Parameters which are structures may require conversion between win32 +@@ -1430,8 +1390,6 @@ class VkParam(object): + conversions.append(self.input_conv) + if self.output_conv is not None: + conversions.append(self.output_conv) +- if self.free_func is not None: +- conversions.append(self.free_func) + + return conversions + +@@ -1479,9 +1437,6 @@ class VkParam(object): + + return False + +- def needs_free(self): +- return self.free_func is not None +- + def needs_input_conversion(self): + return self.input_conv is not None + +@@ -1694,17 +1649,6 @@ class VkStruct(Sequence): + return True + return False + +- def needs_free(self): +- """ Check if any struct member needs some memory freeing.""" +- +- for m in self.members: +- if m.needs_free(): +- return True +- +- continue +- +- return False +- + def needs_struct_extensions_conversion(self): + """ Checks if structure extensions in pNext chain need conversion. """ + ret = False +@@ -1749,8 +1693,10 @@ class ConversionFunction(object): + params = ["const {0} *in".format(self.type), "uint32_t count"] + return_type = "{0}_host".format(self.type) + +- # Generate function prototype. +- body = "static inline " ++ # We *must* forceinline otherwise our alloca will be ++ # garbage when this function returns. ++ # Regular inline won't cut it, alloca invalidates regular inlining. ++ body = "static WINEVULKAN_FORCEINLINE " + body += "{0} *{1}(".format(return_type, self.name) + body += ", ".join(p for p in params) + body += ")\n{\n" +@@ -1759,7 +1705,7 @@ class ConversionFunction(object): + body += " unsigned int i;\n\n" + body += " if (!in) return NULL;\n\n" + +- body += " out = heap_alloc(count * sizeof(*out));\n" ++ body += " out = WINEVULKAN_ALLOCA(count * sizeof(*out));\n" + + body += " for (i = 0; i < count; i++)\n" + body += " {\n" +@@ -1782,7 +1728,7 @@ class ConversionFunction(object): + else: + params = ["const {0} *in".format(self.type), "{0}_host *out".format(self.type)] + +- body = "static inline " ++ body = "static WINEVULKAN_FORCEINLINE " + body += "void {0}(".format(self.name) + + # Generate parameter list +@@ -1816,7 +1762,7 @@ class ConversionFunction(object): + params = ["const {0} *in".format(self.type), "{0} *out_host".format(self.type), "uint32_t count"] + + # Generate function prototype. +- body = "static inline " ++ body = "static WINEVULKAN_FORCEINLINE " + body += "void {0}(".format(self.name) + body += ", ".join(p for p in params) + body += ")\n{\n" +@@ -1868,7 +1814,7 @@ class ConversionFunction(object): + params = ["const {0} *in".format(self.type), "{0} *out_host".format(self.type), "uint32_t count"] + return_type = "{0}_host".format(self.type) + +- body = "void {0}(".format(self.name) ++ body = "static WINEVULKAN_FORCEINLINE void {0}(".format(self.name) + body += ", ".join(p for p in params) + body += ");\n" + elif self.dyn_array: +@@ -1879,7 +1825,7 @@ class ConversionFunction(object): + params = ["const {0} *in".format(self.type), "uint32_t count"] + return_type = "{0}_host".format(self.type) + +- body = "{0} *{1}(".format(return_type, self.name) ++ body = "static WINEVULKAN_FORCEINLINE {0} *{1}(".format(return_type, self.name) + body += ", ".join(p for p in params) + body += ");\n" + else: +@@ -1888,94 +1834,13 @@ class ConversionFunction(object): + else: + params = ["const {0} *in".format(self.type), "{0}_host *out".format(self.type)] + +- body = "void {0}(".format(self.name) ++ body = "static WINEVULKAN_FORCEINLINE void {0}(".format(self.name) + body += ", ".join(p for p in params) + body += ");\n" + + return body + + +-class FreeFunction(object): +- def __init__(self, dyn_array, struct): +- self.dyn_array = dyn_array +- self.struct = struct +- self.type = struct.name +- +- if dyn_array: +- self.name = "free_{0}_array".format(self.type) +- else: +- self.name = "free_{0}".format(self.type) +- +- def __eq__(self, other): +- return self.name == other.name +- +- def _generate_array_free_func(self): +- """ Helper function for cleaning up temporary buffers required for array conversions. """ +- +- # Generate function prototype. +- body = "static inline " +- body += "void {0}({1}_host *in, uint32_t count)\n{{\n".format(self.name, self.type) +- +- # E.g. VkGraphicsPipelineCreateInfo_host needs freeing for pStages. +- if self.struct.needs_free(): +- body += " unsigned int i;\n\n" +- body += " if (!in) return;\n\n" +- body += " for (i = 0; i < count; i++)\n" +- body += " {\n" +- +- for m in self.struct: +- if m.needs_conversion() and m.is_dynamic_array(): +- if m.is_const(): +- # Add a cast to ignore const on conversion structs we allocated ourselves. +- body += " free_{0}_array(({0}_host *)in[i].{1}, in[i].{2});\n".format(m.type, m.name, m.dyn_array_len) +- else: +- body += " free_{0}_array(in[i].{1}, in[i].{2});\n".format(m.type, m.name, m.dyn_array_len) +- elif m.needs_conversion(): +- LOGGER.error("Unhandled conversion for {0}".format(m.name)) +- body += " }\n" +- else: +- body += " if (!in) return;\n\n" +- +- body += " heap_free(in);\n" +- +- body += "}\n\n" +- return body +- +- def _generate_free_func(self): +- # E.g. VkCommandBufferBeginInfo.pInheritanceInfo needs freeing. +- if not self.struct.needs_free(): +- return "" +- +- # Generate function prototype. +- body = "static inline " +- body += "void {0}({1}_host *in)\n{{\n".format(self.name, self.type) +- +- for m in self.struct: +- if m.needs_conversion() and m.is_dynamic_array(): +- count = m.dyn_array_len if isinstance(m.dyn_array_len, int) else "in->{0}".format(m.dyn_array_len) +- if m.is_const(): +- # Add a cast to ignore const on conversion structs we allocated ourselves. +- body += " free_{0}_array(({0}_host *)in->{1}, {2});\n".format(m.type, m.name, count) +- else: +- body += " free_{0}_array(in->{1}, {2});\n".format(m.type, m.name, count) +- +- body += "}\n\n" +- return body +- +- def definition(self): +- if self.dyn_array: +- return self._generate_array_free_func() +- else: +- # Some structures need freeing too if they contain dynamic arrays. +- # E.g. VkCommandBufferBeginInfo +- return self._generate_free_func() +- +- def prototype(self): +- if self.dyn_array: +- return "void {0}({1}_host *in, uint32_t count);\n".format(self.name, self.type) +- return "void {0}({1}_host *in);\n".format(self.name, self.type) +- +- + class StructChainConversionFunction(object): + def __init__(self, direction, struct): + self.direction = direction +diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h +index 00626eff1e3..ea2501ebc68 100644 +--- a/dlls/winevulkan/vulkan_private.h ++++ b/dlls/winevulkan/vulkan_private.h +@@ -34,6 +34,18 @@ + + #include "vulkan_thunks.h" + ++#if defined(__GNUC__) || defined(__clang__) ++#include ++#define WINEVULKAN_FORCEINLINE __attribute__((always_inline)) inline ++#define WINEVULKAN_ALLOCA(x) alloca(x) ++#elif defined(_MSC_VER) ++#include ++#define WINEVULKAN_FORCEINLINE __forceinline ++#define WINEVULKAN_ALLOCA(x) _alloca(x) ++#else ++#error Unsupported platform for forceinline/alloca ++#endif ++ + /* Magic value defined by Vulkan ICD / Loader spec */ + #define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE + +From 8e1498a5e028a3a5375c52c42e65652d21fa4d97 Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Thu, 5 Mar 2020 06:26:48 +0000 +Subject: [PATCH] winevulkan: Regenerate thunks + +--- + dlls/winevulkan/vulkan_thunks.c | 512 +++++++++----------------------- + dlls/winevulkan/vulkan_thunks.h | 4 - + 2 files changed, 133 insertions(+), 383 deletions(-) + +diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c +index ea9e8262d83..ae68cdeccc8 100644 +--- a/dlls/winevulkan/vulkan_thunks.c ++++ b/dlls/winevulkan/vulkan_thunks.c +@@ -43,7 +43,7 @@ + WINE_DEFAULT_DEBUG_CHANNEL(vulkan); + + #if defined(USE_STRUCT_CONVERSION) +-static inline void convert_VkAcquireNextImageInfoKHR_win_to_host(const VkAcquireNextImageInfoKHR *in, VkAcquireNextImageInfoKHR_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkAcquireNextImageInfoKHR_win_to_host(const VkAcquireNextImageInfoKHR *in, VkAcquireNextImageInfoKHR_host *out) + { + if (!in) return; + +@@ -56,7 +56,7 @@ static inline void convert_VkAcquireNextImageInfoKHR_win_to_host(const VkAcquire + out->deviceMask = in->deviceMask; + } + +-static inline void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescriptorSetAllocateInfo *in, VkDescriptorSetAllocateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescriptorSetAllocateInfo *in, VkDescriptorSetAllocateInfo_host *out) + { + if (!in) return; + +@@ -67,7 +67,7 @@ static inline void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescr + out->pSetLayouts = in->pSetLayouts; + } + +-static inline void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAllocateInfo *in, VkMemoryAllocateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAllocateInfo *in, VkMemoryAllocateInfo_host *out) + { + if (!in) return; + +@@ -77,14 +77,14 @@ static inline void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAlloca + out->memoryTypeIndex = in->memoryTypeIndex; + } + +-static inline VkCommandBufferInheritanceInfo_host *convert_VkCommandBufferInheritanceInfo_array_win_to_host(const VkCommandBufferInheritanceInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkCommandBufferInheritanceInfo_host *convert_VkCommandBufferInheritanceInfo_array_win_to_host(const VkCommandBufferInheritanceInfo *in, uint32_t count) + { + VkCommandBufferInheritanceInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -100,14 +100,7 @@ static inline VkCommandBufferInheritanceInfo_host *convert_VkCommandBufferInheri + return out; + } + +-static inline void free_VkCommandBufferInheritanceInfo_array(VkCommandBufferInheritanceInfo_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline void convert_VkCommandBufferBeginInfo_win_to_host(const VkCommandBufferBeginInfo *in, VkCommandBufferBeginInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkCommandBufferBeginInfo_win_to_host(const VkCommandBufferBeginInfo *in, VkCommandBufferBeginInfo_host *out) + { + if (!in) return; + +@@ -117,19 +110,14 @@ static inline void convert_VkCommandBufferBeginInfo_win_to_host(const VkCommandB + out->pInheritanceInfo = convert_VkCommandBufferInheritanceInfo_array_win_to_host(in->pInheritanceInfo, 1); + } + +-static inline void free_VkCommandBufferBeginInfo(VkCommandBufferBeginInfo_host *in) +-{ +- free_VkCommandBufferInheritanceInfo_array((VkCommandBufferInheritanceInfo_host *)in->pInheritanceInfo, 1); +-} +- +-static inline VkBindAccelerationStructureMemoryInfoNV_host *convert_VkBindAccelerationStructureMemoryInfoNV_array_win_to_host(const VkBindAccelerationStructureMemoryInfoNV *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkBindAccelerationStructureMemoryInfoNV_host *convert_VkBindAccelerationStructureMemoryInfoNV_array_win_to_host(const VkBindAccelerationStructureMemoryInfoNV *in, uint32_t count) + { + VkBindAccelerationStructureMemoryInfoNV_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -144,21 +132,14 @@ static inline VkBindAccelerationStructureMemoryInfoNV_host *convert_VkBindAccele + return out; + } + +-static inline void free_VkBindAccelerationStructureMemoryInfoNV_array(VkBindAccelerationStructureMemoryInfoNV_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline VkBindBufferMemoryInfo_host *convert_VkBindBufferMemoryInfo_array_win_to_host(const VkBindBufferMemoryInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkBindBufferMemoryInfo_host *convert_VkBindBufferMemoryInfo_array_win_to_host(const VkBindBufferMemoryInfo *in, uint32_t count) + { + VkBindBufferMemoryInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -171,21 +152,14 @@ static inline VkBindBufferMemoryInfo_host *convert_VkBindBufferMemoryInfo_array_ + return out; + } + +-static inline void free_VkBindBufferMemoryInfo_array(VkBindBufferMemoryInfo_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline VkBindImageMemoryInfo_host *convert_VkBindImageMemoryInfo_array_win_to_host(const VkBindImageMemoryInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkBindImageMemoryInfo_host *convert_VkBindImageMemoryInfo_array_win_to_host(const VkBindImageMemoryInfo *in, uint32_t count) + { + VkBindImageMemoryInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -198,14 +172,7 @@ static inline VkBindImageMemoryInfo_host *convert_VkBindImageMemoryInfo_array_wi + return out; + } + +-static inline void free_VkBindImageMemoryInfo_array(VkBindImageMemoryInfo_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline void convert_VkConditionalRenderingBeginInfoEXT_win_to_host(const VkConditionalRenderingBeginInfoEXT *in, VkConditionalRenderingBeginInfoEXT_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkConditionalRenderingBeginInfoEXT_win_to_host(const VkConditionalRenderingBeginInfoEXT *in, VkConditionalRenderingBeginInfoEXT_host *out) + { + if (!in) return; + +@@ -216,7 +183,7 @@ static inline void convert_VkConditionalRenderingBeginInfoEXT_win_to_host(const + out->flags = in->flags; + } + +-static inline void convert_VkRenderPassBeginInfo_win_to_host(const VkRenderPassBeginInfo *in, VkRenderPassBeginInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkRenderPassBeginInfo_win_to_host(const VkRenderPassBeginInfo *in, VkRenderPassBeginInfo_host *out) + { + if (!in) return; + +@@ -229,7 +196,7 @@ static inline void convert_VkRenderPassBeginInfo_win_to_host(const VkRenderPassB + out->pClearValues = in->pClearValues; + } + +-static inline void convert_VkGeometryTrianglesNV_win_to_host(const VkGeometryTrianglesNV *in, VkGeometryTrianglesNV_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkGeometryTrianglesNV_win_to_host(const VkGeometryTrianglesNV *in, VkGeometryTrianglesNV_host *out) + { + if (!in) return; + +@@ -248,7 +215,7 @@ static inline void convert_VkGeometryTrianglesNV_win_to_host(const VkGeometryTri + out->transformOffset = in->transformOffset; + } + +-static inline void convert_VkGeometryAABBNV_win_to_host(const VkGeometryAABBNV *in, VkGeometryAABBNV_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkGeometryAABBNV_win_to_host(const VkGeometryAABBNV *in, VkGeometryAABBNV_host *out) + { + if (!in) return; + +@@ -260,7 +227,7 @@ static inline void convert_VkGeometryAABBNV_win_to_host(const VkGeometryAABBNV * + out->offset = in->offset; + } + +-static inline void convert_VkGeometryDataNV_win_to_host(const VkGeometryDataNV *in, VkGeometryDataNV_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkGeometryDataNV_win_to_host(const VkGeometryDataNV *in, VkGeometryDataNV_host *out) + { + if (!in) return; + +@@ -268,14 +235,14 @@ static inline void convert_VkGeometryDataNV_win_to_host(const VkGeometryDataNV * + convert_VkGeometryAABBNV_win_to_host(&in->aabbs, &out->aabbs); + } + +-static inline VkGeometryNV_host *convert_VkGeometryNV_array_win_to_host(const VkGeometryNV *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkGeometryNV_host *convert_VkGeometryNV_array_win_to_host(const VkGeometryNV *in, uint32_t count) + { + VkGeometryNV_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -288,14 +255,7 @@ static inline VkGeometryNV_host *convert_VkGeometryNV_array_win_to_host(const Vk + return out; + } + +-static inline void free_VkGeometryNV_array(VkGeometryNV_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline void convert_VkAccelerationStructureInfoNV_win_to_host(const VkAccelerationStructureInfoNV *in, VkAccelerationStructureInfoNV_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkAccelerationStructureInfoNV_win_to_host(const VkAccelerationStructureInfoNV *in, VkAccelerationStructureInfoNV_host *out) + { + if (!in) return; + +@@ -308,19 +268,14 @@ static inline void convert_VkAccelerationStructureInfoNV_win_to_host(const VkAcc + out->pGeometries = convert_VkGeometryNV_array_win_to_host(in->pGeometries, in->geometryCount); + } + +-static inline void free_VkAccelerationStructureInfoNV(VkAccelerationStructureInfoNV_host *in) +-{ +- free_VkGeometryNV_array((VkGeometryNV_host *)in->pGeometries, in->geometryCount); +-} +- +-static inline VkBufferCopy_host *convert_VkBufferCopy_array_win_to_host(const VkBufferCopy *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkBufferCopy_host *convert_VkBufferCopy_array_win_to_host(const VkBufferCopy *in, uint32_t count) + { + VkBufferCopy_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].srcOffset = in[i].srcOffset; +@@ -331,21 +286,14 @@ static inline VkBufferCopy_host *convert_VkBufferCopy_array_win_to_host(const Vk + return out; + } + +-static inline void free_VkBufferCopy_array(VkBufferCopy_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline VkBufferImageCopy_host *convert_VkBufferImageCopy_array_win_to_host(const VkBufferImageCopy *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkBufferImageCopy_host *convert_VkBufferImageCopy_array_win_to_host(const VkBufferImageCopy *in, uint32_t count) + { + VkBufferImageCopy_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].bufferOffset = in[i].bufferOffset; +@@ -359,46 +307,81 @@ static inline VkBufferImageCopy_host *convert_VkBufferImageCopy_array_win_to_hos + return out; + } + +-static inline void free_VkBufferImageCopy_array(VkBufferImageCopy_host *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkBufferMemoryBarrier_host *convert_VkBufferMemoryBarrier_array_win_to_host(const VkBufferMemoryBarrier *in, uint32_t count) + { +- if (!in) return; ++ VkBufferMemoryBarrier_host *out; ++ unsigned int i; ++ ++ if (!in) return NULL; ++ ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); ++ for (i = 0; i < count; i++) ++ { ++ out[i].sType = in[i].sType; ++ out[i].pNext = in[i].pNext; ++ out[i].srcAccessMask = in[i].srcAccessMask; ++ out[i].dstAccessMask = in[i].dstAccessMask; ++ out[i].srcQueueFamilyIndex = in[i].srcQueueFamilyIndex; ++ out[i].dstQueueFamilyIndex = in[i].dstQueueFamilyIndex; ++ out[i].buffer = in[i].buffer; ++ out[i].offset = in[i].offset; ++ out[i].size = in[i].size; ++ } + +- heap_free(in); ++ return out; + } + +-static inline VkDescriptorImageInfo_host *convert_VkDescriptorImageInfo_array_win_to_host(const VkDescriptorImageInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkImageMemoryBarrier_host *convert_VkImageMemoryBarrier_array_win_to_host(const VkImageMemoryBarrier *in, uint32_t count) + { +- VkDescriptorImageInfo_host *out; ++ VkImageMemoryBarrier_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { +- out[i].sampler = in[i].sampler; +- out[i].imageView = in[i].imageView; +- out[i].imageLayout = in[i].imageLayout; ++ out[i].sType = in[i].sType; ++ out[i].pNext = in[i].pNext; ++ out[i].srcAccessMask = in[i].srcAccessMask; ++ out[i].dstAccessMask = in[i].dstAccessMask; ++ out[i].oldLayout = in[i].oldLayout; ++ out[i].newLayout = in[i].newLayout; ++ out[i].srcQueueFamilyIndex = in[i].srcQueueFamilyIndex; ++ out[i].dstQueueFamilyIndex = in[i].dstQueueFamilyIndex; ++ out[i].image = in[i].image; ++ out[i].subresourceRange = in[i].subresourceRange; + } + + return out; + } + +-static inline void free_VkDescriptorImageInfo_array(VkDescriptorImageInfo_host *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkDescriptorImageInfo_host *convert_VkDescriptorImageInfo_array_win_to_host(const VkDescriptorImageInfo *in, uint32_t count) + { +- if (!in) return; ++ VkDescriptorImageInfo_host *out; ++ unsigned int i; + +- heap_free(in); ++ if (!in) return NULL; ++ ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); ++ for (i = 0; i < count; i++) ++ { ++ out[i].sampler = in[i].sampler; ++ out[i].imageView = in[i].imageView; ++ out[i].imageLayout = in[i].imageLayout; ++ } ++ ++ return out; + } + +-static inline VkDescriptorBufferInfo_host *convert_VkDescriptorBufferInfo_array_win_to_host(const VkDescriptorBufferInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkDescriptorBufferInfo_host *convert_VkDescriptorBufferInfo_array_win_to_host(const VkDescriptorBufferInfo *in, uint32_t count) + { + VkDescriptorBufferInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].buffer = in[i].buffer; +@@ -409,21 +392,14 @@ static inline VkDescriptorBufferInfo_host *convert_VkDescriptorBufferInfo_array_ + return out; + } + +-static inline void free_VkDescriptorBufferInfo_array(VkDescriptorBufferInfo_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline VkWriteDescriptorSet_host *convert_VkWriteDescriptorSet_array_win_to_host(const VkWriteDescriptorSet *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkWriteDescriptorSet_host *convert_VkWriteDescriptorSet_array_win_to_host(const VkWriteDescriptorSet *in, uint32_t count) + { + VkWriteDescriptorSet_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -441,21 +417,7 @@ static inline VkWriteDescriptorSet_host *convert_VkWriteDescriptorSet_array_win_ + return out; + } + +-static inline void free_VkWriteDescriptorSet_array(VkWriteDescriptorSet_host *in, uint32_t count) +-{ +- unsigned int i; +- +- if (!in) return; +- +- for (i = 0; i < count; i++) +- { +- free_VkDescriptorImageInfo_array((VkDescriptorImageInfo_host *)in[i].pImageInfo, in[i].descriptorCount); +- free_VkDescriptorBufferInfo_array((VkDescriptorBufferInfo_host *)in[i].pBufferInfo, in[i].descriptorCount); +- } +- heap_free(in); +-} +- +-static inline void convert_VkPerformanceMarkerInfoINTEL_win_to_host(const VkPerformanceMarkerInfoINTEL *in, VkPerformanceMarkerInfoINTEL_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPerformanceMarkerInfoINTEL_win_to_host(const VkPerformanceMarkerInfoINTEL *in, VkPerformanceMarkerInfoINTEL_host *out) + { + if (!in) return; + +@@ -464,7 +426,7 @@ static inline void convert_VkPerformanceMarkerInfoINTEL_win_to_host(const VkPerf + out->marker = in->marker; + } + +-static inline void convert_VkPerformanceOverrideInfoINTEL_win_to_host(const VkPerformanceOverrideInfoINTEL *in, VkPerformanceOverrideInfoINTEL_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPerformanceOverrideInfoINTEL_win_to_host(const VkPerformanceOverrideInfoINTEL *in, VkPerformanceOverrideInfoINTEL_host *out) + { + if (!in) return; + +@@ -475,7 +437,7 @@ static inline void convert_VkPerformanceOverrideInfoINTEL_win_to_host(const VkPe + out->parameter = in->parameter; + } + +-static inline void convert_VkAccelerationStructureCreateInfoNV_win_to_host(const VkAccelerationStructureCreateInfoNV *in, VkAccelerationStructureCreateInfoNV_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkAccelerationStructureCreateInfoNV_win_to_host(const VkAccelerationStructureCreateInfoNV *in, VkAccelerationStructureCreateInfoNV_host *out) + { + if (!in) return; + +@@ -485,7 +447,7 @@ static inline void convert_VkAccelerationStructureCreateInfoNV_win_to_host(const + convert_VkAccelerationStructureInfoNV_win_to_host(&in->info, &out->info); + } + +-static inline void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateInfo *in, VkBufferCreateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateInfo *in, VkBufferCreateInfo_host *out) + { + if (!in) return; + +@@ -499,7 +461,7 @@ static inline void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateIn + out->pQueueFamilyIndices = in->pQueueFamilyIndices; + } + +-static inline void convert_VkBufferViewCreateInfo_win_to_host(const VkBufferViewCreateInfo *in, VkBufferViewCreateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkBufferViewCreateInfo_win_to_host(const VkBufferViewCreateInfo *in, VkBufferViewCreateInfo_host *out) + { + if (!in) return; + +@@ -512,7 +474,7 @@ static inline void convert_VkBufferViewCreateInfo_win_to_host(const VkBufferView + out->range = in->range; + } + +-static inline void convert_VkPipelineShaderStageCreateInfo_win_to_host(const VkPipelineShaderStageCreateInfo *in, VkPipelineShaderStageCreateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPipelineShaderStageCreateInfo_win_to_host(const VkPipelineShaderStageCreateInfo *in, VkPipelineShaderStageCreateInfo_host *out) + { + if (!in) return; + +@@ -525,14 +487,14 @@ static inline void convert_VkPipelineShaderStageCreateInfo_win_to_host(const VkP + out->pSpecializationInfo = in->pSpecializationInfo; + } + +-static inline VkComputePipelineCreateInfo_host *convert_VkComputePipelineCreateInfo_array_win_to_host(const VkComputePipelineCreateInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkComputePipelineCreateInfo_host *convert_VkComputePipelineCreateInfo_array_win_to_host(const VkComputePipelineCreateInfo *in, uint32_t count) + { + VkComputePipelineCreateInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -547,14 +509,7 @@ static inline VkComputePipelineCreateInfo_host *convert_VkComputePipelineCreateI + return out; + } + +-static inline void free_VkComputePipelineCreateInfo_array(VkComputePipelineCreateInfo_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline void convert_VkDescriptorUpdateTemplateCreateInfo_win_to_host(const VkDescriptorUpdateTemplateCreateInfo *in, VkDescriptorUpdateTemplateCreateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkDescriptorUpdateTemplateCreateInfo_win_to_host(const VkDescriptorUpdateTemplateCreateInfo *in, VkDescriptorUpdateTemplateCreateInfo_host *out) + { + if (!in) return; + +@@ -570,7 +525,7 @@ static inline void convert_VkDescriptorUpdateTemplateCreateInfo_win_to_host(cons + out->set = in->set; + } + +-static inline void convert_VkFramebufferCreateInfo_win_to_host(const VkFramebufferCreateInfo *in, VkFramebufferCreateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkFramebufferCreateInfo_win_to_host(const VkFramebufferCreateInfo *in, VkFramebufferCreateInfo_host *out) + { + if (!in) return; + +@@ -585,14 +540,14 @@ static inline void convert_VkFramebufferCreateInfo_win_to_host(const VkFramebuff + out->layers = in->layers; + } + +-static inline VkPipelineShaderStageCreateInfo_host *convert_VkPipelineShaderStageCreateInfo_array_win_to_host(const VkPipelineShaderStageCreateInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkPipelineShaderStageCreateInfo_host *convert_VkPipelineShaderStageCreateInfo_array_win_to_host(const VkPipelineShaderStageCreateInfo *in, uint32_t count) + { + VkPipelineShaderStageCreateInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -607,21 +562,14 @@ static inline VkPipelineShaderStageCreateInfo_host *convert_VkPipelineShaderStag + return out; + } + +-static inline void free_VkPipelineShaderStageCreateInfo_array(VkPipelineShaderStageCreateInfo_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline VkGraphicsPipelineCreateInfo_host *convert_VkGraphicsPipelineCreateInfo_array_win_to_host(const VkGraphicsPipelineCreateInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkGraphicsPipelineCreateInfo_host *convert_VkGraphicsPipelineCreateInfo_array_win_to_host(const VkGraphicsPipelineCreateInfo *in, uint32_t count) + { + VkGraphicsPipelineCreateInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -648,20 +596,7 @@ static inline VkGraphicsPipelineCreateInfo_host *convert_VkGraphicsPipelineCreat + return out; + } + +-static inline void free_VkGraphicsPipelineCreateInfo_array(VkGraphicsPipelineCreateInfo_host *in, uint32_t count) +-{ +- unsigned int i; +- +- if (!in) return; +- +- for (i = 0; i < count; i++) +- { +- free_VkPipelineShaderStageCreateInfo_array((VkPipelineShaderStageCreateInfo_host *)in[i].pStages, in[i].stageCount); +- } +- heap_free(in); +-} +- +-static inline void convert_VkImageViewCreateInfo_win_to_host(const VkImageViewCreateInfo *in, VkImageViewCreateInfo_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkImageViewCreateInfo_win_to_host(const VkImageViewCreateInfo *in, VkImageViewCreateInfo_host *out) + { + if (!in) return; + +@@ -675,14 +610,14 @@ static inline void convert_VkImageViewCreateInfo_win_to_host(const VkImageViewCr + out->subresourceRange = in->subresourceRange; + } + +-static inline VkRayTracingPipelineCreateInfoNV_host *convert_VkRayTracingPipelineCreateInfoNV_array_win_to_host(const VkRayTracingPipelineCreateInfoNV *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkRayTracingPipelineCreateInfoNV_host *convert_VkRayTracingPipelineCreateInfoNV_array_win_to_host(const VkRayTracingPipelineCreateInfoNV *in, uint32_t count) + { + VkRayTracingPipelineCreateInfoNV_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -701,27 +636,14 @@ static inline VkRayTracingPipelineCreateInfoNV_host *convert_VkRayTracingPipelin + return out; + } + +-static inline void free_VkRayTracingPipelineCreateInfoNV_array(VkRayTracingPipelineCreateInfoNV_host *in, uint32_t count) +-{ +- unsigned int i; +- +- if (!in) return; +- +- for (i = 0; i < count; i++) +- { +- free_VkPipelineShaderStageCreateInfo_array((VkPipelineShaderStageCreateInfo_host *)in[i].pStages, in[i].stageCount); +- } +- heap_free(in); +-} +- +-static inline VkMappedMemoryRange_host *convert_VkMappedMemoryRange_array_win_to_host(const VkMappedMemoryRange *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkMappedMemoryRange_host *convert_VkMappedMemoryRange_array_win_to_host(const VkMappedMemoryRange *in, uint32_t count) + { + VkMappedMemoryRange_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -734,14 +656,7 @@ static inline VkMappedMemoryRange_host *convert_VkMappedMemoryRange_array_win_to + return out; + } + +-static inline void free_VkMappedMemoryRange_array(VkMappedMemoryRange_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline void convert_VkAccelerationStructureMemoryRequirementsInfoNV_win_to_host(const VkAccelerationStructureMemoryRequirementsInfoNV *in, VkAccelerationStructureMemoryRequirementsInfoNV_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkAccelerationStructureMemoryRequirementsInfoNV_win_to_host(const VkAccelerationStructureMemoryRequirementsInfoNV *in, VkAccelerationStructureMemoryRequirementsInfoNV_host *out) + { + if (!in) return; + +@@ -751,7 +666,7 @@ static inline void convert_VkAccelerationStructureMemoryRequirementsInfoNV_win_t + out->accelerationStructure = in->accelerationStructure; + } + +-static inline void convert_VkMemoryRequirements_host_to_win(const VkMemoryRequirements_host *in, VkMemoryRequirements *out) ++static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements_host_to_win(const VkMemoryRequirements_host *in, VkMemoryRequirements *out) + { + if (!in) return; + +@@ -760,7 +675,7 @@ static inline void convert_VkMemoryRequirements_host_to_win(const VkMemoryRequir + out->memoryTypeBits = in->memoryTypeBits; + } + +-static inline void convert_VkMemoryRequirements2KHR_win_to_host(const VkMemoryRequirements2KHR *in, VkMemoryRequirements2KHR_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2KHR_win_to_host(const VkMemoryRequirements2KHR *in, VkMemoryRequirements2KHR_host *out) + { + if (!in) return; + +@@ -768,7 +683,7 @@ static inline void convert_VkMemoryRequirements2KHR_win_to_host(const VkMemoryRe + out->sType = in->sType; + } + +-static inline void convert_VkMemoryRequirements2KHR_host_to_win(const VkMemoryRequirements2KHR_host *in, VkMemoryRequirements2KHR *out) ++static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2KHR_host_to_win(const VkMemoryRequirements2KHR_host *in, VkMemoryRequirements2KHR *out) + { + if (!in) return; + +@@ -777,7 +692,7 @@ static inline void convert_VkMemoryRequirements2KHR_host_to_win(const VkMemoryRe + convert_VkMemoryRequirements_host_to_win(&in->memoryRequirements, &out->memoryRequirements); + } + +-static inline void convert_VkBufferDeviceAddressInfoKHR_win_to_host(const VkBufferDeviceAddressInfoKHR *in, VkBufferDeviceAddressInfoKHR_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkBufferDeviceAddressInfoKHR_win_to_host(const VkBufferDeviceAddressInfoKHR *in, VkBufferDeviceAddressInfoKHR_host *out) + { + if (!in) return; + +@@ -786,7 +701,7 @@ static inline void convert_VkBufferDeviceAddressInfoKHR_win_to_host(const VkBuff + out->buffer = in->buffer; + } + +-static inline void convert_VkBufferMemoryRequirementsInfo2_win_to_host(const VkBufferMemoryRequirementsInfo2 *in, VkBufferMemoryRequirementsInfo2_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkBufferMemoryRequirementsInfo2_win_to_host(const VkBufferMemoryRequirementsInfo2 *in, VkBufferMemoryRequirementsInfo2_host *out) + { + if (!in) return; + +@@ -795,7 +710,7 @@ static inline void convert_VkBufferMemoryRequirementsInfo2_win_to_host(const VkB + out->buffer = in->buffer; + } + +-static inline void convert_VkMemoryRequirements2_win_to_host(const VkMemoryRequirements2 *in, VkMemoryRequirements2_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2_win_to_host(const VkMemoryRequirements2 *in, VkMemoryRequirements2_host *out) + { + if (!in) return; + +@@ -803,7 +718,7 @@ static inline void convert_VkMemoryRequirements2_win_to_host(const VkMemoryRequi + out->sType = in->sType; + } + +-static inline void convert_VkMemoryRequirements2_host_to_win(const VkMemoryRequirements2_host *in, VkMemoryRequirements2 *out) ++static WINEVULKAN_FORCEINLINE void convert_VkMemoryRequirements2_host_to_win(const VkMemoryRequirements2_host *in, VkMemoryRequirements2 *out) + { + if (!in) return; + +@@ -812,7 +727,7 @@ static inline void convert_VkMemoryRequirements2_host_to_win(const VkMemoryRequi + convert_VkMemoryRequirements_host_to_win(&in->memoryRequirements, &out->memoryRequirements); + } + +-static inline void convert_VkImageMemoryRequirementsInfo2_win_to_host(const VkImageMemoryRequirementsInfo2 *in, VkImageMemoryRequirementsInfo2_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkImageMemoryRequirementsInfo2_win_to_host(const VkImageMemoryRequirementsInfo2 *in, VkImageMemoryRequirementsInfo2_host *out) + { + if (!in) return; + +@@ -821,7 +736,7 @@ static inline void convert_VkImageMemoryRequirementsInfo2_win_to_host(const VkIm + out->image = in->image; + } + +-static inline void convert_VkImageSparseMemoryRequirementsInfo2_win_to_host(const VkImageSparseMemoryRequirementsInfo2 *in, VkImageSparseMemoryRequirementsInfo2_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkImageSparseMemoryRequirementsInfo2_win_to_host(const VkImageSparseMemoryRequirementsInfo2 *in, VkImageSparseMemoryRequirementsInfo2_host *out) + { + if (!in) return; + +@@ -830,7 +745,7 @@ static inline void convert_VkImageSparseMemoryRequirementsInfo2_win_to_host(cons + out->image = in->image; + } + +-static inline void convert_VkSubresourceLayout_host_to_win(const VkSubresourceLayout_host *in, VkSubresourceLayout *out) ++static WINEVULKAN_FORCEINLINE void convert_VkSubresourceLayout_host_to_win(const VkSubresourceLayout_host *in, VkSubresourceLayout *out) + { + if (!in) return; + +@@ -841,7 +756,7 @@ static inline void convert_VkSubresourceLayout_host_to_win(const VkSubresourceLa + out->depthPitch = in->depthPitch; + } + +-static inline void convert_VkImageFormatProperties_host_to_win(const VkImageFormatProperties_host *in, VkImageFormatProperties *out) ++static WINEVULKAN_FORCEINLINE void convert_VkImageFormatProperties_host_to_win(const VkImageFormatProperties_host *in, VkImageFormatProperties *out) + { + if (!in) return; + +@@ -852,7 +767,7 @@ static inline void convert_VkImageFormatProperties_host_to_win(const VkImageForm + out->maxResourceSize = in->maxResourceSize; + } + +-static inline void convert_VkImageFormatProperties2_win_to_host(const VkImageFormatProperties2 *in, VkImageFormatProperties2_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkImageFormatProperties2_win_to_host(const VkImageFormatProperties2 *in, VkImageFormatProperties2_host *out) + { + if (!in) return; + +@@ -860,7 +775,7 @@ static inline void convert_VkImageFormatProperties2_win_to_host(const VkImageFor + out->sType = in->sType; + } + +-static inline void convert_VkImageFormatProperties2_host_to_win(const VkImageFormatProperties2_host *in, VkImageFormatProperties2 *out) ++static WINEVULKAN_FORCEINLINE void convert_VkImageFormatProperties2_host_to_win(const VkImageFormatProperties2_host *in, VkImageFormatProperties2 *out) + { + if (!in) return; + +@@ -869,7 +784,7 @@ static inline void convert_VkImageFormatProperties2_host_to_win(const VkImageFor + convert_VkImageFormatProperties_host_to_win(&in->imageFormatProperties, &out->imageFormatProperties); + } + +-static inline void convert_VkMemoryHeap_static_array_host_to_win(const VkMemoryHeap_host *in, VkMemoryHeap *out, uint32_t count) ++static WINEVULKAN_FORCEINLINE void convert_VkMemoryHeap_static_array_host_to_win(const VkMemoryHeap_host *in, VkMemoryHeap *out, uint32_t count) + { + unsigned int i; + +@@ -882,7 +797,7 @@ static inline void convert_VkMemoryHeap_static_array_host_to_win(const VkMemoryH + } + } + +-static inline void convert_VkPhysicalDeviceMemoryProperties_host_to_win(const VkPhysicalDeviceMemoryProperties_host *in, VkPhysicalDeviceMemoryProperties *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceMemoryProperties_host_to_win(const VkPhysicalDeviceMemoryProperties_host *in, VkPhysicalDeviceMemoryProperties *out) + { + if (!in) return; + +@@ -892,7 +807,7 @@ static inline void convert_VkPhysicalDeviceMemoryProperties_host_to_win(const Vk + convert_VkMemoryHeap_static_array_host_to_win(in->memoryHeaps, out->memoryHeaps, VK_MAX_MEMORY_HEAPS); + } + +-static inline void convert_VkPhysicalDeviceMemoryProperties2_win_to_host(const VkPhysicalDeviceMemoryProperties2 *in, VkPhysicalDeviceMemoryProperties2_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceMemoryProperties2_win_to_host(const VkPhysicalDeviceMemoryProperties2 *in, VkPhysicalDeviceMemoryProperties2_host *out) + { + if (!in) return; + +@@ -900,7 +815,7 @@ static inline void convert_VkPhysicalDeviceMemoryProperties2_win_to_host(const V + out->sType = in->sType; + } + +-static inline void convert_VkPhysicalDeviceMemoryProperties2_host_to_win(const VkPhysicalDeviceMemoryProperties2_host *in, VkPhysicalDeviceMemoryProperties2 *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceMemoryProperties2_host_to_win(const VkPhysicalDeviceMemoryProperties2_host *in, VkPhysicalDeviceMemoryProperties2 *out) + { + if (!in) return; + +@@ -909,7 +824,7 @@ static inline void convert_VkPhysicalDeviceMemoryProperties2_host_to_win(const V + convert_VkPhysicalDeviceMemoryProperties_host_to_win(&in->memoryProperties, &out->memoryProperties); + } + +-static inline void convert_VkPhysicalDeviceLimits_host_to_win(const VkPhysicalDeviceLimits_host *in, VkPhysicalDeviceLimits *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceLimits_host_to_win(const VkPhysicalDeviceLimits_host *in, VkPhysicalDeviceLimits *out) + { + if (!in) return; + +@@ -1021,7 +936,7 @@ static inline void convert_VkPhysicalDeviceLimits_host_to_win(const VkPhysicalDe + out->nonCoherentAtomSize = in->nonCoherentAtomSize; + } + +-static inline void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysicalDeviceProperties_host *in, VkPhysicalDeviceProperties *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysicalDeviceProperties_host *in, VkPhysicalDeviceProperties *out) + { + if (!in) return; + +@@ -1036,7 +951,7 @@ static inline void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysic + out->sparseProperties = in->sparseProperties; + } + +-static inline void convert_VkPhysicalDeviceProperties2_win_to_host(const VkPhysicalDeviceProperties2 *in, VkPhysicalDeviceProperties2_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceProperties2_win_to_host(const VkPhysicalDeviceProperties2 *in, VkPhysicalDeviceProperties2_host *out) + { + if (!in) return; + +@@ -1044,7 +959,7 @@ static inline void convert_VkPhysicalDeviceProperties2_win_to_host(const VkPhysi + out->sType = in->sType; + } + +-static inline void convert_VkPhysicalDeviceProperties2_host_to_win(const VkPhysicalDeviceProperties2_host *in, VkPhysicalDeviceProperties2 *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPhysicalDeviceProperties2_host_to_win(const VkPhysicalDeviceProperties2_host *in, VkPhysicalDeviceProperties2 *out) + { + if (!in) return; + +@@ -1053,7 +968,7 @@ static inline void convert_VkPhysicalDeviceProperties2_host_to_win(const VkPhysi + convert_VkPhysicalDeviceProperties_host_to_win(&in->properties, &out->properties); + } + +-static inline void convert_VkPipelineExecutableInfoKHR_win_to_host(const VkPipelineExecutableInfoKHR *in, VkPipelineExecutableInfoKHR_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPipelineExecutableInfoKHR_win_to_host(const VkPipelineExecutableInfoKHR *in, VkPipelineExecutableInfoKHR_host *out) + { + if (!in) return; + +@@ -1063,7 +978,7 @@ static inline void convert_VkPipelineExecutableInfoKHR_win_to_host(const VkPipel + out->executableIndex = in->executableIndex; + } + +-static inline void convert_VkPipelineInfoKHR_win_to_host(const VkPipelineInfoKHR *in, VkPipelineInfoKHR_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkPipelineInfoKHR_win_to_host(const VkPipelineInfoKHR *in, VkPipelineInfoKHR_host *out) + { + if (!in) return; + +@@ -1072,14 +987,14 @@ static inline void convert_VkPipelineInfoKHR_win_to_host(const VkPipelineInfoKHR + out->pipeline = in->pipeline; + } + +-static inline VkSparseMemoryBind_host *convert_VkSparseMemoryBind_array_win_to_host(const VkSparseMemoryBind *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkSparseMemoryBind_host *convert_VkSparseMemoryBind_array_win_to_host(const VkSparseMemoryBind *in, uint32_t count) + { + VkSparseMemoryBind_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].resourceOffset = in[i].resourceOffset; +@@ -1092,21 +1007,14 @@ static inline VkSparseMemoryBind_host *convert_VkSparseMemoryBind_array_win_to_h + return out; + } + +-static inline void free_VkSparseMemoryBind_array(VkSparseMemoryBind_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline VkSparseBufferMemoryBindInfo_host *convert_VkSparseBufferMemoryBindInfo_array_win_to_host(const VkSparseBufferMemoryBindInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkSparseBufferMemoryBindInfo_host *convert_VkSparseBufferMemoryBindInfo_array_win_to_host(const VkSparseBufferMemoryBindInfo *in, uint32_t count) + { + VkSparseBufferMemoryBindInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].buffer = in[i].buffer; +@@ -1117,27 +1025,14 @@ static inline VkSparseBufferMemoryBindInfo_host *convert_VkSparseBufferMemoryBin + return out; + } + +-static inline void free_VkSparseBufferMemoryBindInfo_array(VkSparseBufferMemoryBindInfo_host *in, uint32_t count) +-{ +- unsigned int i; +- +- if (!in) return; +- +- for (i = 0; i < count; i++) +- { +- free_VkSparseMemoryBind_array((VkSparseMemoryBind_host *)in[i].pBinds, in[i].bindCount); +- } +- heap_free(in); +-} +- +-static inline VkSparseImageOpaqueMemoryBindInfo_host *convert_VkSparseImageOpaqueMemoryBindInfo_array_win_to_host(const VkSparseImageOpaqueMemoryBindInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkSparseImageOpaqueMemoryBindInfo_host *convert_VkSparseImageOpaqueMemoryBindInfo_array_win_to_host(const VkSparseImageOpaqueMemoryBindInfo *in, uint32_t count) + { + VkSparseImageOpaqueMemoryBindInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].image = in[i].image; +@@ -1148,27 +1043,14 @@ static inline VkSparseImageOpaqueMemoryBindInfo_host *convert_VkSparseImageOpaqu + return out; + } + +-static inline void free_VkSparseImageOpaqueMemoryBindInfo_array(VkSparseImageOpaqueMemoryBindInfo_host *in, uint32_t count) +-{ +- unsigned int i; +- +- if (!in) return; +- +- for (i = 0; i < count; i++) +- { +- free_VkSparseMemoryBind_array((VkSparseMemoryBind_host *)in[i].pBinds, in[i].bindCount); +- } +- heap_free(in); +-} +- +-static inline VkSparseImageMemoryBind_host *convert_VkSparseImageMemoryBind_array_win_to_host(const VkSparseImageMemoryBind *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkSparseImageMemoryBind_host *convert_VkSparseImageMemoryBind_array_win_to_host(const VkSparseImageMemoryBind *in, uint32_t count) + { + VkSparseImageMemoryBind_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].subresource = in[i].subresource; +@@ -1182,21 +1064,14 @@ static inline VkSparseImageMemoryBind_host *convert_VkSparseImageMemoryBind_arra + return out; + } + +-static inline void free_VkSparseImageMemoryBind_array(VkSparseImageMemoryBind_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-static inline VkSparseImageMemoryBindInfo_host *convert_VkSparseImageMemoryBindInfo_array_win_to_host(const VkSparseImageMemoryBindInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkSparseImageMemoryBindInfo_host *convert_VkSparseImageMemoryBindInfo_array_win_to_host(const VkSparseImageMemoryBindInfo *in, uint32_t count) + { + VkSparseImageMemoryBindInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].image = in[i].image; +@@ -1207,27 +1082,14 @@ static inline VkSparseImageMemoryBindInfo_host *convert_VkSparseImageMemoryBindI + return out; + } + +-static inline void free_VkSparseImageMemoryBindInfo_array(VkSparseImageMemoryBindInfo_host *in, uint32_t count) +-{ +- unsigned int i; +- +- if (!in) return; +- +- for (i = 0; i < count; i++) +- { +- free_VkSparseImageMemoryBind_array((VkSparseImageMemoryBind_host *)in[i].pBinds, in[i].bindCount); +- } +- heap_free(in); +-} +- +-static inline VkBindSparseInfo_host *convert_VkBindSparseInfo_array_win_to_host(const VkBindSparseInfo *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkBindSparseInfo_host *convert_VkBindSparseInfo_array_win_to_host(const VkBindSparseInfo *in, uint32_t count) + { + VkBindSparseInfo_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -1247,22 +1109,7 @@ static inline VkBindSparseInfo_host *convert_VkBindSparseInfo_array_win_to_host( + return out; + } + +-static inline void free_VkBindSparseInfo_array(VkBindSparseInfo_host *in, uint32_t count) +-{ +- unsigned int i; +- +- if (!in) return; +- +- for (i = 0; i < count; i++) +- { +- free_VkSparseBufferMemoryBindInfo_array((VkSparseBufferMemoryBindInfo_host *)in[i].pBufferBinds, in[i].bufferBindCount); +- free_VkSparseImageOpaqueMemoryBindInfo_array((VkSparseImageOpaqueMemoryBindInfo_host *)in[i].pImageOpaqueBinds, in[i].imageOpaqueBindCount); +- free_VkSparseImageMemoryBindInfo_array((VkSparseImageMemoryBindInfo_host *)in[i].pImageBinds, in[i].imageBindCount); +- } +- heap_free(in); +-} +- +-static inline void convert_VkSemaphoreSignalInfoKHR_win_to_host(const VkSemaphoreSignalInfoKHR *in, VkSemaphoreSignalInfoKHR_host *out) ++static WINEVULKAN_FORCEINLINE void convert_VkSemaphoreSignalInfoKHR_win_to_host(const VkSemaphoreSignalInfoKHR *in, VkSemaphoreSignalInfoKHR_host *out) + { + if (!in) return; + +@@ -1272,14 +1119,14 @@ static inline void convert_VkSemaphoreSignalInfoKHR_win_to_host(const VkSemaphor + out->value = in->value; + } + +-static inline VkCopyDescriptorSet_host *convert_VkCopyDescriptorSet_array_win_to_host(const VkCopyDescriptorSet *in, uint32_t count) ++static WINEVULKAN_FORCEINLINE VkCopyDescriptorSet_host *convert_VkCopyDescriptorSet_array_win_to_host(const VkCopyDescriptorSet *in, uint32_t count) + { + VkCopyDescriptorSet_host *out; + unsigned int i; + + if (!in) return NULL; + +- out = heap_alloc(count * sizeof(*out)); ++ out = WINEVULKAN_ALLOCA(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; +@@ -1296,13 +1143,6 @@ static inline VkCopyDescriptorSet_host *convert_VkCopyDescriptorSet_array_win_to + return out; + } + +-static inline void free_VkCopyDescriptorSet_array(VkCopyDescriptorSet_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- + #endif /* USE_STRUCT_CONVERSION */ + + VkResult convert_VkDeviceCreateInfo_struct_chain(const void *pNext, VkDeviceCreateInfo *out_struct) +@@ -2300,69 +2140,6 @@ void free_VkInstanceCreateInfo_struct_chain(VkInstanceCreateInfo *s) + s->pNext = NULL; + } + +-VkBufferMemoryBarrier_host *convert_VkBufferMemoryBarrier_array_win_to_host(const VkBufferMemoryBarrier *in, uint32_t count) +-{ +- VkBufferMemoryBarrier_host *out; +- unsigned int i; +- +- if (!in) return NULL; +- +- out = heap_alloc(count * sizeof(*out)); +- for (i = 0; i < count; i++) +- { +- out[i].sType = in[i].sType; +- out[i].pNext = in[i].pNext; +- out[i].srcAccessMask = in[i].srcAccessMask; +- out[i].dstAccessMask = in[i].dstAccessMask; +- out[i].srcQueueFamilyIndex = in[i].srcQueueFamilyIndex; +- out[i].dstQueueFamilyIndex = in[i].dstQueueFamilyIndex; +- out[i].buffer = in[i].buffer; +- out[i].offset = in[i].offset; +- out[i].size = in[i].size; +- } +- +- return out; +-} +- +-void free_VkBufferMemoryBarrier_array(VkBufferMemoryBarrier_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- +-VkImageMemoryBarrier_host *convert_VkImageMemoryBarrier_array_win_to_host(const VkImageMemoryBarrier *in, uint32_t count) +-{ +- VkImageMemoryBarrier_host *out; +- unsigned int i; +- +- if (!in) return NULL; +- +- out = heap_alloc(count * sizeof(*out)); +- for (i = 0; i < count; i++) +- { +- out[i].sType = in[i].sType; +- out[i].pNext = in[i].pNext; +- out[i].srcAccessMask = in[i].srcAccessMask; +- out[i].dstAccessMask = in[i].dstAccessMask; +- out[i].oldLayout = in[i].oldLayout; +- out[i].newLayout = in[i].newLayout; +- out[i].srcQueueFamilyIndex = in[i].srcQueueFamilyIndex; +- out[i].dstQueueFamilyIndex = in[i].dstQueueFamilyIndex; +- out[i].image = in[i].image; +- out[i].subresourceRange = in[i].subresourceRange; +- } +- +- return out; +-} +- +-void free_VkImageMemoryBarrier_array(VkImageMemoryBarrier_host *in, uint32_t count) +-{ +- if (!in) return; +- +- heap_free(in); +-} +- + VkResult WINAPI wine_vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, uint32_t *pImageIndex) + { + #if defined(USE_STRUCT_CONVERSION) +@@ -2430,7 +2207,6 @@ VkResult WINAPI wine_vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const V + convert_VkCommandBufferBeginInfo_win_to_host(pBeginInfo, &pBeginInfo_host); + result = commandBuffer->device->funcs.p_vkBeginCommandBuffer(commandBuffer->command_buffer, &pBeginInfo_host); + +- free_VkCommandBufferBeginInfo(&pBeginInfo_host); + return result; + #else + TRACE("%p, %p\n", commandBuffer, pBeginInfo); +@@ -2448,7 +2224,6 @@ static VkResult WINAPI wine_vkBindAccelerationStructureMemoryNV(VkDevice device, + pBindInfos_host = convert_VkBindAccelerationStructureMemoryInfoNV_array_win_to_host(pBindInfos, bindInfoCount); + result = device->funcs.p_vkBindAccelerationStructureMemoryNV(device->device, bindInfoCount, pBindInfos_host); + +- free_VkBindAccelerationStructureMemoryInfoNV_array(pBindInfos_host, bindInfoCount); + return result; + #else + TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos); +@@ -2472,7 +2247,6 @@ VkResult WINAPI wine_vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount + pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount); + result = device->funcs.p_vkBindBufferMemory2(device->device, bindInfoCount, pBindInfos_host); + +- free_VkBindBufferMemoryInfo_array(pBindInfos_host, bindInfoCount); + return result; + #else + TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos); +@@ -2490,7 +2264,6 @@ static VkResult WINAPI wine_vkBindBufferMemory2KHR(VkDevice device, uint32_t bin + pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount); + result = device->funcs.p_vkBindBufferMemory2KHR(device->device, bindInfoCount, pBindInfos_host); + +- free_VkBindBufferMemoryInfo_array(pBindInfos_host, bindInfoCount); + return result; + #else + TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos); +@@ -2514,7 +2287,6 @@ VkResult WINAPI wine_vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, + pBindInfos_host = convert_VkBindImageMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount); + result = device->funcs.p_vkBindImageMemory2(device->device, bindInfoCount, pBindInfos_host); + +- free_VkBindImageMemoryInfo_array(pBindInfos_host, bindInfoCount); + return result; + #else + TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos); +@@ -2532,7 +2304,6 @@ static VkResult WINAPI wine_vkBindImageMemory2KHR(VkDevice device, uint32_t bind + pBindInfos_host = convert_VkBindImageMemoryInfo_array_win_to_host(pBindInfos, bindInfoCount); + result = device->funcs.p_vkBindImageMemory2KHR(device->device, bindInfoCount, pBindInfos_host); + +- free_VkBindImageMemoryInfo_array(pBindInfos_host, bindInfoCount); + return result; + #else + TRACE("%p, %u, %p\n", device, bindInfoCount, pBindInfos); +@@ -2654,7 +2425,6 @@ static void WINAPI wine_vkCmdBuildAccelerationStructureNV(VkCommandBuffer comman + convert_VkAccelerationStructureInfoNV_win_to_host(pInfo, &pInfo_host); + commandBuffer->device->funcs.p_vkCmdBuildAccelerationStructureNV(commandBuffer->command_buffer, &pInfo_host, instanceData, instanceOffset, update, dst, src, scratch, scratchOffset); + +- free_VkAccelerationStructureInfoNV(&pInfo_host); + #else + TRACE("%p, %p, 0x%s, 0x%s, %u, 0x%s, 0x%s, 0x%s, 0x%s\n", commandBuffer, pInfo, wine_dbgstr_longlong(instanceData), wine_dbgstr_longlong(instanceOffset), update, wine_dbgstr_longlong(dst), wine_dbgstr_longlong(src), wine_dbgstr_longlong(scratch), wine_dbgstr_longlong(scratchOffset)); + commandBuffer->device->funcs.p_vkCmdBuildAccelerationStructureNV(commandBuffer->command_buffer, pInfo, instanceData, instanceOffset, update, dst, src, scratch, scratchOffset); +@@ -2694,7 +2464,6 @@ void WINAPI wine_vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuff + pRegions_host = convert_VkBufferCopy_array_win_to_host(pRegions, regionCount); + commandBuffer->device->funcs.p_vkCmdCopyBuffer(commandBuffer->command_buffer, srcBuffer, dstBuffer, regionCount, pRegions_host); + +- free_VkBufferCopy_array(pRegions_host, regionCount); + #else + TRACE("%p, 0x%s, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdCopyBuffer(commandBuffer->command_buffer, srcBuffer, dstBuffer, regionCount, pRegions); +@@ -2710,7 +2479,6 @@ void WINAPI wine_vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer + pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount); + commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions_host); + +- free_VkBufferImageCopy_array(pRegions_host, regionCount); + #else + TRACE("%p, 0x%s, 0x%s, %#x, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); +@@ -2732,7 +2500,6 @@ void WINAPI wine_vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage s + pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount); + commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions_host); + +- free_VkBufferImageCopy_array(pRegions_host, regionCount); + #else + TRACE("%p, 0x%s, %#x, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); +@@ -2906,8 +2673,6 @@ void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineS + pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); + commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host); + +- free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount); +- free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount); + #else + TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); +@@ -2929,7 +2694,6 @@ static void WINAPI wine_vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, + pDescriptorWrites_host = convert_VkWriteDescriptorSet_array_win_to_host(pDescriptorWrites, descriptorWriteCount); + commandBuffer->device->funcs.p_vkCmdPushDescriptorSetKHR(commandBuffer->command_buffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites_host); + +- free_VkWriteDescriptorSet_array(pDescriptorWrites_host, descriptorWriteCount); + #else + TRACE("%p, %#x, 0x%s, %u, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), set, descriptorWriteCount, pDescriptorWrites); + commandBuffer->device->funcs.p_vkCmdPushDescriptorSetKHR(commandBuffer->command_buffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites); +@@ -3143,8 +2907,6 @@ void WINAPI wine_vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCo + pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); + commandBuffer->device->funcs.p_vkCmdWaitEvents(commandBuffer->command_buffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host); + +- free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount); +- free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount); + #else + TRACE("%p, %u, %p, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + commandBuffer->device->funcs.p_vkCmdWaitEvents(commandBuffer->command_buffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); +@@ -3236,7 +2998,6 @@ VkResult WINAPI wine_vkCreateComputePipelines(VkDevice device, VkPipelineCache p + pCreateInfos_host = convert_VkComputePipelineCreateInfo_array_win_to_host(pCreateInfos, createInfoCount); + result = device->funcs.p_vkCreateComputePipelines(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines); + +- free_VkComputePipelineCreateInfo_array(pCreateInfos_host, createInfoCount); + return result; + #else + TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); +@@ -3329,7 +3090,6 @@ VkResult WINAPI wine_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache + pCreateInfos_host = convert_VkGraphicsPipelineCreateInfo_array_win_to_host(pCreateInfos, createInfoCount); + result = device->funcs.p_vkCreateGraphicsPipelines(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines); + +- free_VkGraphicsPipelineCreateInfo_array(pCreateInfos_host, createInfoCount); + return result; + #else + TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); +@@ -3394,7 +3154,6 @@ static VkResult WINAPI wine_vkCreateRayTracingPipelinesNV(VkDevice device, VkPip + pCreateInfos_host = convert_VkRayTracingPipelineCreateInfoNV_array_win_to_host(pCreateInfos, createInfoCount); + result = device->funcs.p_vkCreateRayTracingPipelinesNV(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines); + +- free_VkRayTracingPipelineCreateInfoNV_array(pCreateInfos_host, createInfoCount); + return result; + #else + TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); +@@ -3628,7 +3387,6 @@ VkResult WINAPI wine_vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryR + pMemoryRanges_host = convert_VkMappedMemoryRange_array_win_to_host(pMemoryRanges, memoryRangeCount); + result = device->funcs.p_vkFlushMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges_host); + +- free_VkMappedMemoryRange_array(pMemoryRanges_host, memoryRangeCount); + return result; + #else + TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); +@@ -4289,7 +4047,6 @@ VkResult WINAPI wine_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t me + pMemoryRanges_host = convert_VkMappedMemoryRange_array_win_to_host(pMemoryRanges, memoryRangeCount); + result = device->funcs.p_vkInvalidateMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges_host); + +- free_VkMappedMemoryRange_array(pMemoryRanges_host, memoryRangeCount); + return result; + #else + TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); +@@ -4325,7 +4082,6 @@ VkResult WINAPI wine_vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, co + pBindInfo_host = convert_VkBindSparseInfo_array_win_to_host(pBindInfo, bindInfoCount); + result = queue->device->funcs.p_vkQueueBindSparse(queue->queue, bindInfoCount, pBindInfo_host, fence); + +- free_VkBindSparseInfo_array(pBindInfo_host, bindInfoCount); + return result; + #else + TRACE("%p, %u, %p, 0x%s\n", queue, bindInfoCount, pBindInfo, wine_dbgstr_longlong(fence)); +@@ -4457,8 +4213,6 @@ void WINAPI wine_vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWrit + pDescriptorCopies_host = convert_VkCopyDescriptorSet_array_win_to_host(pDescriptorCopies, descriptorCopyCount); + device->funcs.p_vkUpdateDescriptorSets(device->device, descriptorWriteCount, pDescriptorWrites_host, descriptorCopyCount, pDescriptorCopies_host); + +- free_VkWriteDescriptorSet_array(pDescriptorWrites_host, descriptorWriteCount); +- free_VkCopyDescriptorSet_array(pDescriptorCopies_host, descriptorCopyCount); + #else + TRACE("%p, %u, %p, %u, %p\n", device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); + device->funcs.p_vkUpdateDescriptorSets(device->device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); +diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h +index 82d0c3a0a5e..57d64cd1215 100644 +--- a/dlls/winevulkan/vulkan_thunks.h ++++ b/dlls/winevulkan/vulkan_thunks.h +@@ -816,10 +816,6 @@ void free_VkDeviceCreateInfo_struct_chain(VkDeviceCreateInfo *s) DECLSPEC_HIDDEN + VkResult convert_VkInstanceCreateInfo_struct_chain(const void *pNext, VkInstanceCreateInfo *out_struct) DECLSPEC_HIDDEN; + void free_VkInstanceCreateInfo_struct_chain(VkInstanceCreateInfo *s) DECLSPEC_HIDDEN; + +-VkBufferMemoryBarrier_host *convert_VkBufferMemoryBarrier_array_win_to_host(const VkBufferMemoryBarrier *in, uint32_t count); +-void free_VkBufferMemoryBarrier_array(VkBufferMemoryBarrier_host *in, uint32_t count); +-VkImageMemoryBarrier_host *convert_VkImageMemoryBarrier_array_win_to_host(const VkImageMemoryBarrier *in, uint32_t count); +-void free_VkImageMemoryBarrier_array(VkImageMemoryBarrier_host *in, uint32_t count); + /* For use by vkDevice and children */ + struct vulkan_device_funcs + { + +From d8388b630c69d58ffd8a8b7ac7f43cd343e77f8b Mon Sep 17 00:00:00 2001 +From: Georg Lehmann +Date: Wed, 4 Mar 2020 21:49:16 +0100 +Subject: [PATCH] winevulkan: use swapchain format for fshack image + view + +--- + dlls/winevulkan/vulkan.c | 93 ++++++++++++++------------------ + dlls/winevulkan/vulkan_private.h | 1 + + 2 files changed, 42 insertions(+), 52 deletions(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index b6ad2dc4b3d..920f203d830 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -1362,7 +1362,7 @@ static inline void convert_VkSwapchainCreateInfoKHR_win_to_host(const VkSwapchai + #version 450 + + layout(binding = 0) uniform sampler2D texSampler; +-layout(binding = 1, rgba8) uniform writeonly image2D outImage; ++layout(binding = 1) uniform writeonly image2D outImage; + layout(push_constant) uniform pushConstants { + //both in real image coords + vec2 offset; +@@ -1375,57 +1375,45 @@ void main() + { + vec2 texcoord = (vec2(gl_GlobalInvocationID.xy) - constants.offset) / constants.extents; + vec4 c = texture(texSampler, texcoord); +- imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), c.bgra); ++ imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), c); + } + */ + const uint32_t blit_comp_spv[] = { +- 0x07230203,0x00010000,0x00080006,0x00000037,0x00000000,0x00020011,0x00000001,0x0006000b, +- 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, +- 0x0006000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x0000000d,0x00060010,0x00000004, +- 0x00000011,0x00000008,0x00000008,0x00000001,0x00030003,0x00000002,0x000001c2,0x00040005, +- 0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000009,0x63786574,0x64726f6f,0x00000000, +- 0x00080005,0x0000000d,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x00000044, +- 0x00060005,0x00000012,0x68737570,0x736e6f43,0x746e6174,0x00000073,0x00050006,0x00000012, +- 0x00000000,0x7366666f,0x00007465,0x00050006,0x00000012,0x00000001,0x65747865,0x0073746e, +- 0x00050005,0x00000014,0x736e6f63,0x746e6174,0x00000073,0x00030005,0x00000021,0x00000063, +- 0x00050005,0x00000025,0x53786574,0x6c706d61,0x00007265,0x00050005,0x0000002c,0x4974756f, +- 0x6567616d,0x00000000,0x00040047,0x0000000d,0x0000000b,0x0000001c,0x00050048,0x00000012, +- 0x00000000,0x00000023,0x00000000,0x00050048,0x00000012,0x00000001,0x00000023,0x00000008, +- 0x00030047,0x00000012,0x00000002,0x00040047,0x00000025,0x00000022,0x00000000,0x00040047, +- 0x00000025,0x00000021,0x00000000,0x00040047,0x0000002c,0x00000022,0x00000000,0x00040047, +- 0x0000002c,0x00000021,0x00000001,0x00030047,0x0000002c,0x00000019,0x00040047,0x00000036, +- 0x0000000b,0x00000019,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016, +- 0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008, +- 0x00000007,0x00000007,0x00040015,0x0000000a,0x00000020,0x00000000,0x00040017,0x0000000b, +- 0x0000000a,0x00000003,0x00040020,0x0000000c,0x00000001,0x0000000b,0x0004003b,0x0000000c, +- 0x0000000d,0x00000001,0x00040017,0x0000000e,0x0000000a,0x00000002,0x0004001e,0x00000012, +- 0x00000007,0x00000007,0x00040020,0x00000013,0x00000009,0x00000012,0x0004003b,0x00000013, +- 0x00000014,0x00000009,0x00040015,0x00000015,0x00000020,0x00000001,0x0004002b,0x00000015, +- 0x00000016,0x00000000,0x00040020,0x00000017,0x00000009,0x00000007,0x0004002b,0x00000015, +- 0x0000001b,0x00000001,0x00040017,0x0000001f,0x00000006,0x00000004,0x00040020,0x00000020, +- 0x00000007,0x0000001f,0x00090019,0x00000022,0x00000006,0x00000001,0x00000000,0x00000000, +- 0x00000000,0x00000001,0x00000000,0x0003001b,0x00000023,0x00000022,0x00040020,0x00000024, +- 0x00000000,0x00000023,0x0004003b,0x00000024,0x00000025,0x00000000,0x0004002b,0x00000006, +- 0x00000028,0x00000000,0x00090019,0x0000002a,0x00000006,0x00000001,0x00000000,0x00000000, +- 0x00000000,0x00000002,0x00000004,0x00040020,0x0000002b,0x00000000,0x0000002a,0x0004003b, +- 0x0000002b,0x0000002c,0x00000000,0x00040017,0x00000030,0x00000015,0x00000002,0x0004002b, +- 0x0000000a,0x00000034,0x00000008,0x0004002b,0x0000000a,0x00000035,0x00000001,0x0006002c, +- 0x0000000b,0x00000036,0x00000034,0x00000034,0x00000035,0x00050036,0x00000002,0x00000004, +- 0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007, +- 0x0004003b,0x00000020,0x00000021,0x00000007,0x0004003d,0x0000000b,0x0000000f,0x0000000d, +- 0x0007004f,0x0000000e,0x00000010,0x0000000f,0x0000000f,0x00000000,0x00000001,0x00040070, +- 0x00000007,0x00000011,0x00000010,0x00050041,0x00000017,0x00000018,0x00000014,0x00000016, +- 0x0004003d,0x00000007,0x00000019,0x00000018,0x00050083,0x00000007,0x0000001a,0x00000011, +- 0x00000019,0x00050041,0x00000017,0x0000001c,0x00000014,0x0000001b,0x0004003d,0x00000007, +- 0x0000001d,0x0000001c,0x00050088,0x00000007,0x0000001e,0x0000001a,0x0000001d,0x0003003e, +- 0x00000009,0x0000001e,0x0004003d,0x00000023,0x00000026,0x00000025,0x0004003d,0x00000007, +- 0x00000027,0x00000009,0x00070058,0x0000001f,0x00000029,0x00000026,0x00000027,0x00000002, +- 0x00000028,0x0003003e,0x00000021,0x00000029,0x0004003d,0x0000002a,0x0000002d,0x0000002c, +- 0x0004003d,0x0000000b,0x0000002e,0x0000000d,0x0007004f,0x0000000e,0x0000002f,0x0000002e, +- 0x0000002e,0x00000000,0x00000001,0x0004007c,0x00000030,0x00000031,0x0000002f,0x0004003d, +- 0x0000001f,0x00000032,0x00000021,0x0009004f,0x0000001f,0x00000033,0x00000032,0x00000032, +- 0x00000002,0x00000001,0x00000000,0x00000003,0x00040063,0x0000002d,0x00000031,0x00000033, +- 0x000100fd,0x00010038 ++ 0x07230203, 0x00010000, 0x00080008, 0x00000036, 0x00000000, 0x00020011, 0x00000001, 0x00020011, 0x00000038, ++ 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, 0x00000000, 0x0003000E, 0x00000000, 0x00000001, ++ 0x0006000F, 0x00000005, 0x00000004, 0x6E69616D, 0x00000000, 0x0000000D, 0x00060010, 0x00000004, 0x00000011, ++ 0x00000008, 0x00000008, 0x00000001, 0x00030003, 0x00000002, 0x000001C2, 0x00040005, 0x00000004, 0x6E69616D, ++ 0x00000000, 0x00080005, 0x0000000D, 0x475F6C67, 0x61626F6C, 0x766E496C, 0x7461636F, 0x496E6F69, 0x00000044, ++ 0x00060005, 0x00000012, 0x68737570, 0x736E6F43, 0x746E6174, 0x00000073, 0x00050006, 0x00000012, 0x00000000, ++ 0x7366666F, 0x00007465, 0x00050006, 0x00000012, 0x00000001, 0x65747865, 0x0073746E, 0x00050005, 0x00000014, ++ 0x736E6F63, 0x746E6174, 0x00000073, 0x00050005, 0x00000025, 0x53786574, 0x6C706D61, 0x00007265, 0x00050005, ++ 0x0000002C, 0x4974756F, 0x6567616D, 0x00000000, 0x00040047, 0x0000000D, 0x0000000B, 0x0000001C, 0x00050048, ++ 0x00000012, 0x00000000, 0x00000023, 0x00000000, 0x00050048, 0x00000012, 0x00000001, 0x00000023, 0x00000008, ++ 0x00030047, 0x00000012, 0x00000002, 0x00040047, 0x00000025, 0x00000022, 0x00000000, 0x00040047, 0x00000025, ++ 0x00000021, 0x00000000, 0x00040047, 0x0000002C, 0x00000022, 0x00000000, 0x00040047, 0x0000002C, 0x00000021, ++ 0x00000001, 0x00030047, 0x0000002C, 0x00000019, 0x00040047, 0x00000035, 0x0000000B, 0x00000019, 0x00020013, ++ 0x00000002, 0x00030021, 0x00000003, 0x00000002, 0x00030016, 0x00000006, 0x00000020, 0x00040017, 0x00000007, ++ 0x00000006, 0x00000002, 0x00040015, 0x0000000A, 0x00000020, 0x00000000, 0x00040017, 0x0000000B, 0x0000000A, ++ 0x00000003, 0x00040020, 0x0000000C, 0x00000001, 0x0000000B, 0x0004003B, 0x0000000C, 0x0000000D, 0x00000001, ++ 0x00040017, 0x0000000E, 0x0000000A, 0x00000002, 0x0004001E, 0x00000012, 0x00000007, 0x00000007, 0x00040020, ++ 0x00000013, 0x00000009, 0x00000012, 0x0004003B, 0x00000013, 0x00000014, 0x00000009, 0x00040015, 0x00000015, ++ 0x00000020, 0x00000001, 0x0004002B, 0x00000015, 0x00000016, 0x00000000, 0x00040020, 0x00000017, 0x00000009, ++ 0x00000007, 0x0004002B, 0x00000015, 0x0000001B, 0x00000001, 0x00040017, 0x0000001F, 0x00000006, 0x00000004, ++ 0x00090019, 0x00000022, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, ++ 0x0003001B, 0x00000023, 0x00000022, 0x00040020, 0x00000024, 0x00000000, 0x00000023, 0x0004003B, 0x00000024, ++ 0x00000025, 0x00000000, 0x0004002B, 0x00000006, 0x00000028, 0x00000000, 0x00090019, 0x0000002A, 0x00000006, ++ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00040020, 0x0000002B, 0x00000000, ++ 0x0000002A, 0x0004003B, 0x0000002B, 0x0000002C, 0x00000000, 0x00040017, 0x00000030, 0x00000015, 0x00000002, ++ 0x0004002B, 0x0000000A, 0x00000033, 0x00000008, 0x0004002B, 0x0000000A, 0x00000034, 0x00000001, 0x0006002C, ++ 0x0000000B, 0x00000035, 0x00000033, 0x00000033, 0x00000034, 0x00050036, 0x00000002, 0x00000004, 0x00000000, ++ 0x00000003, 0x000200F8, 0x00000005, 0x0004003D, 0x0000000B, 0x0000000F, 0x0000000D, 0x0007004F, 0x0000000E, ++ 0x00000010, 0x0000000F, 0x0000000F, 0x00000000, 0x00000001, 0x00040070, 0x00000007, 0x00000011, 0x00000010, ++ 0x00050041, 0x00000017, 0x00000018, 0x00000014, 0x00000016, 0x0004003D, 0x00000007, 0x00000019, 0x00000018, ++ 0x00050083, 0x00000007, 0x0000001A, 0x00000011, 0x00000019, 0x00050041, 0x00000017, 0x0000001C, 0x00000014, ++ 0x0000001B, 0x0004003D, 0x00000007, 0x0000001D, 0x0000001C, 0x00050088, 0x00000007, 0x0000001E, 0x0000001A, ++ 0x0000001D, 0x0004003D, 0x00000023, 0x00000026, 0x00000025, 0x00070058, 0x0000001F, 0x00000029, 0x00000026, ++ 0x0000001E, 0x00000002, 0x00000028, 0x0004003D, 0x0000002A, 0x0000002D, 0x0000002C, 0x0004007C, 0x00000030, ++ 0x00000031, 0x00000010, 0x00040063, 0x0000002D, 0x00000031, 0x00000029, 0x000100FD, 0x00010038 + }; + + static VkResult create_pipeline(VkDevice device, struct VkSwapchainKHR_T *swapchain, struct fs_hack_image *hack, VkShaderModule shaderModule) +@@ -1739,12 +1727,13 @@ VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCrea + TRACE("surface usage flags: 0x%x\n", object->surface_usage); + + our_createinfo.imageExtent = object->real_extent; +- our_createinfo.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; /* XXX: check if supported by surface */ ++ our_createinfo.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT | (object->surface_usage & VK_IMAGE_USAGE_STORAGE_BIT); /* XXX: check if supported by surface */ + + if(our_createinfo.imageFormat != VK_FORMAT_B8G8R8A8_UNORM && + our_createinfo.imageFormat != VK_FORMAT_B8G8R8A8_SRGB){ + FIXME("swapchain image format is not BGRA8 UNORM/SRGB. Things may go badly. %d\n", our_createinfo.imageFormat); + } ++ object->imageFormat = our_createinfo.imageFormat; + + object->fs_hack_enabled = TRUE; + } +@@ -2035,7 +2024,7 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc + imageInfo.extent.depth = 1; + imageInfo.mipLevels = 1; + imageInfo.arrayLayers = 1; +- imageInfo.format = VK_FORMAT_R8G8B8A8_UNORM; ++ imageInfo.format = swapchain->imageFormat; + imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + imageInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; +@@ -2123,7 +2112,7 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc + viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + viewInfo.image = hack->blit_image ? hack->blit_image : hack->swapchain_image; + viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; +- viewInfo.format = VK_FORMAT_R8G8B8A8_UNORM; ++ viewInfo.format = swapchain->imageFormat; + viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + viewInfo.subresourceRange.baseMipLevel = 0; + viewInfo.subresourceRange.levelCount = 1; +diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h +index ea2501ebc68..d5a0369608e 100644 +--- a/dlls/winevulkan/vulkan_private.h ++++ b/dlls/winevulkan/vulkan_private.h +@@ -178,6 +178,7 @@ struct VkSwapchainKHR_T + uint32_t n_images; + struct fs_hack_image *fs_hack_images; /* struct fs_hack_image[n_images] */ + VkFilter fs_hack_filter; ++ VkFormat imageFormat; + VkSampler sampler; + VkDescriptorPool descriptor_pool; + VkDescriptorSetLayout descriptor_set_layout; +From 2478cd397f466ad3348f096a08c4c46b565497fe Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Thu, 5 Mar 2020 15:53:05 +0000 +Subject: [PATCH] winevulkan: Use alloca for vkCmdExecuteCommands + +--- + dlls/winevulkan/vulkan.c | 13 +------------ + 1 file changed, 1 insertion(+), 12 deletions(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index 920f203d830..f989388d7ce 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -511,23 +511,12 @@ void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer buffer, uint32_t count, + if (!buffers || !count) + return; + +- /* Unfortunately we need a temporary buffer as our command buffers are wrapped. +- * This call is called often and if a performance concern, we may want to use +- * alloca as we shouldn't need much memory and it needs to be cleaned up after +- * the call anyway. +- */ +- if (!(tmp_buffers = heap_alloc(count * sizeof(*tmp_buffers)))) +- { +- ERR("Failed to allocate memory for temporary command buffers\n"); +- return; +- } ++ tmp_buffers = WINEVULKAN_ALLOCA(count * sizeof(*tmp_buffers)); + + for (i = 0; i < count; i++) + tmp_buffers[i] = buffers[i]->command_buffer; + + buffer->device->funcs.p_vkCmdExecuteCommands(buffer->command_buffer, count, tmp_buffers); +- +- heap_free(tmp_buffers); + } + + VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, +From 1f350c3deec385bdec51f712748f144dd3219401 Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Thu, 5 Mar 2020 15:54:25 +0000 +Subject: [PATCH] winevulkan: Remove unnecessary check for buffers and count in + vkCmdExecuteCommands + +The Vulkan spec states commandBufferCount must be greater than zero and pCommandBuffers must be a valid pointer. +--- + dlls/winevulkan/vulkan.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index f989388d7ce..508869e66b5 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -508,9 +508,6 @@ void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer buffer, uint32_t count, + + TRACE("%p %u %p\n", buffer, count, buffers); + +- if (!buffers || !count) +- return; +- + tmp_buffers = WINEVULKAN_ALLOCA(count * sizeof(*tmp_buffers)); + + for (i = 0; i < count; i++) +From 17203ba38d89d9c32d84eb40b50dd672939f6712 Mon Sep 17 00:00:00 2001 +From: Joshua Ashton +Date: Thu, 5 Mar 2020 16:01:19 +0000 +Subject: [PATCH] winevulkan: Use alloca for swapchain buffers + +--- + dlls/winevulkan/vulkan.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index 508869e66b5..22a819ed2b9 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -2649,11 +2649,7 @@ VkResult WINAPI wine_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pP + our_presentInfo.pWaitSemaphores = &blit_sema; + } + +- arr = heap_alloc(our_presentInfo.swapchainCount * sizeof(VkSwapchainKHR)); +- if(!arr){ +- ERR("Failed to allocate memory for swapchain array\n"); +- return VK_ERROR_OUT_OF_HOST_MEMORY; +- } ++ arr = WINEVULKAN_ALLOCA(our_presentInfo.swapchainCount * sizeof(VkSwapchainKHR)); + + for(i = 0; i < our_presentInfo.swapchainCount; ++i) + arr[i] = ((struct VkSwapchainKHR_T *)(UINT_PTR)our_presentInfo.pSwapchains[i])->swapchain; +@@ -2662,8 +2658,6 @@ VkResult WINAPI wine_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pP + + res = queue->device->funcs.p_vkQueuePresentKHR(queue->queue, &our_presentInfo); + +- heap_free(arr); +- + return res; + + } +From 77b9303eabcd92ee86b3a2ae964a3339a9639fa6 Mon Sep 17 00:00:00 2001 +From: Georg Lehmann +Date: Tue, 25 Feb 2020 13:15:42 +0100 +Subject: [PATCH] fshack: Create only one compute pipeline per swap chain + +There is no need to create one pipeline per swapchain image +--- + dlls/winevulkan/vulkan.c | 46 ++++++++++++++++---------------- + dlls/winevulkan/vulkan_private.h | 2 +- + 2 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c +index 63665fb7a6f..36e2cc54d99 100644 +--- a/dlls/winevulkan/vulkan.c ++++ b/dlls/winevulkan/vulkan.c +@@ -1428,7 +1428,7 @@ const uint32_t blit_comp_spv[] = { + 0x000100fd,0x00010038 + }; + +-static VkResult create_pipeline(VkDevice device, struct VkSwapchainKHR_T *swapchain, struct fs_hack_image *hack, VkShaderModule shaderModule) ++static VkResult create_pipeline(VkDevice device, struct VkSwapchainKHR_T *swapchain, VkShaderModule shaderModule) + { + VkResult res; + #if defined(USE_STRUCT_CONVERSION) +@@ -1446,7 +1446,7 @@ static VkResult create_pipeline(VkDevice device, struct VkSwapchainKHR_T *swapch + pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; + pipelineInfo.basePipelineIndex = -1; + +- res = device->funcs.p_vkCreateComputePipelines(device->device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, &hack->pipeline); ++ res = device->funcs.p_vkCreateComputePipelines(device->device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, &swapchain->pipeline); + if(res != VK_SUCCESS){ + ERR("vkCreateComputePipelines: %d\n", res); + return res; +@@ -1509,7 +1509,6 @@ static VkResult create_descriptor_set(VkDevice device, struct VkSwapchainKHR_T * + + static void destroy_fs_hack_image(VkDevice device, struct VkSwapchainKHR_T *swapchain, struct fs_hack_image *hack) + { +- device->funcs.p_vkDestroyPipeline(device->device, hack->pipeline, NULL); + device->funcs.p_vkDestroyImageView(device->device, hack->user_view, NULL); + device->funcs.p_vkDestroyImageView(device->device, hack->blit_view, NULL); + device->funcs.p_vkDestroyImage(device->device, hack->user_image, NULL); +@@ -1837,6 +1836,7 @@ void WINAPI wine_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain + if(object->cmd_pools[i]) + device->funcs.p_vkDestroyCommandPool(device->device, object->cmd_pools[i], NULL); + ++ device->funcs.p_vkDestroyPipeline(device->device, object->pipeline, NULL); + device->funcs.p_vkDestroyPipelineLayout(device->device, object->pipeline_layout, NULL); + device->funcs.p_vkDestroyDescriptorSetLayout(device->device, object->descriptor_set_layout, NULL); + device->funcs.p_vkDestroyDescriptorPool(device->device, object->descriptor_pool, NULL); +@@ -2022,6 +2022,22 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc + ERR("vkCreatePipelineLayout: %d\n", res); + goto fail; + } ++ ++ shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; ++ shaderInfo.codeSize = sizeof(blit_comp_spv); ++ shaderInfo.pCode = blit_comp_spv; ++ ++ res = device->funcs.p_vkCreateShaderModule(device->device, &shaderInfo, NULL, &shaderModule); ++ if(res != VK_SUCCESS){ ++ ERR("vkCreateShaderModule: %d\n", res); ++ goto fail; ++ } ++ ++ res = create_pipeline(device, swapchain, shaderModule); ++ if(res != VK_SUCCESS) ++ goto fail; ++ ++ device->funcs.p_vkDestroyShaderModule(device->device, shaderModule, NULL); + + if(!(swapchain->surface_usage & VK_IMAGE_USAGE_STORAGE_BIT)){ + TRACE("using intermediate blit images\n"); +@@ -2107,16 +2123,6 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc + }else + TRACE("blitting directly to swapchain images\n"); + +- shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; +- shaderInfo.codeSize = sizeof(blit_comp_spv); +- shaderInfo.pCode = blit_comp_spv; +- +- res = device->funcs.p_vkCreateShaderModule(device->device, &shaderInfo, NULL, &shaderModule); +- if(res != VK_SUCCESS){ +- ERR("vkCreateShaderModule: %d\n", res); +- goto fail; +- } +- + /* create imageviews */ + for(i = 0; i < swapchain->n_images; ++i){ + struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; +@@ -2140,23 +2146,14 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc + res = create_descriptor_set(device, swapchain, hack); + if(res != VK_SUCCESS) + goto fail; +- +- res = create_pipeline(device, swapchain, hack, shaderModule); +- if(res != VK_SUCCESS) +- goto fail; + } + +- device->funcs.p_vkDestroyShaderModule(device->device, shaderModule, NULL); +- + return VK_SUCCESS; + + fail: + for(i = 0; i < swapchain->n_images; ++i){ + struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; + +- device->funcs.p_vkDestroyPipeline(device->device, hack->pipeline, NULL); +- hack->pipeline = VK_NULL_HANDLE; +- + device->funcs.p_vkFreeDescriptorSets(device->device, swapchain->descriptor_pool, 1, &hack->descriptor_set); + hack->descriptor_set = VK_NULL_HANDLE; + +@@ -2168,6 +2165,9 @@ static VkResult init_blit_images(VkDevice device, struct VkSwapchainKHR_T *swapc + } + + device->funcs.p_vkDestroyShaderModule(device->device, shaderModule, NULL); ++ ++ device->funcs.p_vkDestroyPipeline(device->device, swapchain->pipeline, NULL); ++ swapchain->pipeline = VK_NULL_HANDLE; + + device->funcs.p_vkDestroyPipelineLayout(device->device, swapchain->pipeline_layout, NULL); + swapchain->pipeline_layout = VK_NULL_HANDLE; +@@ -2258,7 +2258,7 @@ static VkResult record_compute_cmd(VkDevice device, struct VkSwapchainKHR_T *swa + + /* perform blit shader */ + device->funcs.p_vkCmdBindPipeline(hack->cmd, +- VK_PIPELINE_BIND_POINT_COMPUTE, hack->pipeline); ++ VK_PIPELINE_BIND_POINT_COMPUTE, swapchain->pipeline); + + device->funcs.p_vkCmdBindDescriptorSets(hack->cmd, + VK_PIPELINE_BIND_POINT_COMPUTE, swapchain->pipeline_layout, +diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h +index 00626eff1e3..001ce85a1fd 100644 +--- a/dlls/winevulkan/vulkan_private.h ++++ b/dlls/winevulkan/vulkan_private.h +@@ -147,7 +147,6 @@ struct fs_hack_image + VkSemaphore blit_finished; + VkImageView user_view, blit_view; + VkDescriptorSet descriptor_set; +- VkPipeline pipeline; + }; + + struct VkSwapchainKHR_T +@@ -170,6 +169,7 @@ struct VkSwapchainKHR_T + VkDescriptorPool descriptor_pool; + VkDescriptorSetLayout descriptor_set_layout; + VkPipelineLayout pipeline_layout; ++ VkPipeline pipeline; + }; + + void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN; diff --git a/vkd3d b/vkd3d index 52e6e5b79..456a522ad 160000 --- a/vkd3d +++ b/vkd3d @@ -1 +1 @@ -Subproject commit 52e6e5b79497fb678a5b40ed4dec87e012e6b5ae +Subproject commit 456a522adbe9b17027cfc5643497b9e467537a21 diff --git a/wine b/wine index 1e478b804..eb63713f6 160000 --- a/wine +++ b/wine @@ -1 +1 @@ -Subproject commit 1e478b804f72a9b5122fc6adafac5479b816885e +Subproject commit eb63713f606d81dee75d7fdbc5685cc3862bc63f diff --git a/wine-staging b/wine-staging index b4e027748..8450903b5 160000 --- a/wine-staging +++ b/wine-staging @@ -1 +1 @@ -Subproject commit b4e027748836d7debe90c779acf43f492f349b74 +Subproject commit 8450903b5c4a2b806b52855e5df4a5b76732273d