diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 15:51:40 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 15:51:40 +0100 |
| commit | df91c6624b69ee4e6c6eeca20ed68d331ed0e728 (patch) | |
| tree | 323c88b9df89bf8abaa2b98d10808474ab675dc2 /scripts | |
| parent | b40d8039a98f57b26bd05860febbabbe59b97873 (diff) | |
| parent | 6a6704df1592e1dc4a3215ddf1423a78adb52045 (diff) | |
Merge main into test/valu-int-misc (#1492)
Conflicted files: runtime/test/shaders/check.py, scripts/run_gpu_tests.py
AI-assisted.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/build_runtime.ps1 | 6 | ||||
| -rw-r--r-- | scripts/run_gpu_tests.py | 40 | ||||
| -rw-r--r-- | scripts/run_wine_tests.py | 70 |
3 files changed, 96 insertions, 20 deletions
diff --git a/scripts/build_runtime.ps1 b/scripts/build_runtime.ps1 index e71bcfe27..b251a281c 100644 --- a/scripts/build_runtime.ps1 +++ b/scripts/build_runtime.ps1 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # Builds runtime\build\gta6rt.exe with MSVC at BelowNormal priority, on half the cores. | 1 | # Builds runtime\build\gta6rt.exe with MSVC at BelowNormal priority, on half the cores. |
| 2 | # Uses VS's CMake + Ninja when the "C++ CMake tools" component is installed, otherwise calls cl.exe directly. | 2 | # Uses VS's CMake + Ninja when the "C++ CMake tools" component is installed, otherwise calls cl.exe directly. |
| 3 | # The GameInput controller shim (SDL3, docs/gameinput.md) is built only on the CMake path: with an installed SDL3, or | 3 | # The GameInput controller shim (SDL3, docs/gameinput.md) is built only on the CMake path: with an installed SDL3, or |
| 4 | # with -FetchSdl3, which lets CMake download the pinned SDL3 release. The cl.exe fallback never builds it. | 4 | # with -FetchSdl3, which lets CMake download the pinned SDL3 release. The cl.exe fallback never builds it. |
| @@ -58,8 +58,10 @@ if defined VULKAN_SDK cl /nologo /std:c++20 /EHsc /O2 /DWIN32_LEAN_AND_MEAN /DNO | |||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | # A .cmd file avoids cmd.exe's quote stripping on paths with spaces. | 60 | # A .cmd file avoids cmd.exe's quote stripping on paths with spaces. |
| 61 | # Switch to UTF-8 (CP 65001) before invoking CMake/Ninja/cl.exe so non-English MSVC /showIncludes prefixes | ||
| 62 | # (e.g. Spanish "Nota: inclusión del archivo:") match Ninja's msvc_deps_prefix instead of being mojibaked in OEM CP. | ||
| 61 | $bat = Join-Path $out "_build.cmd" | 63 | $bat = Join-Path $out "_build.cmd" |
| 62 | "@echo off`r`nset `"PATH=$installer;%PATH%`"`r`ncall `"$vcvars`" >nul || exit /b 1`r`n$body" | Set-Content -Encoding ascii $bat | 64 | "@echo off`r`nchcp 65001 >nul`r`nset `"PATH=$installer;%PATH%`"`r`ncall `"$vcvars`" >nul || exit /b 1`r`n$body" | Set-Content -Encoding ascii $bat |
| 63 | 65 | ||
| 64 | $p = Start-Process cmd.exe -ArgumentList "/c", "`"$bat`"" -NoNewWindow -PassThru | 66 | $p = Start-Process cmd.exe -ArgumentList "/c", "`"$bat`"" -NoNewWindow -PassThru |
| 65 | $null = $p.Handle # keeps the exit code readable after WaitForExit | 67 | $null = $p.Handle # keeps the exit code readable after WaitForExit |
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index a1e98d40a..9361c1011 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -25,7 +25,7 @@ sys.path.insert(0, os.path.join(ROOT, "tools")) | |||
| 25 | import mc_command # noqa: E402 | 25 | import mc_command # noqa: E402 |
| 26 | sys.path.insert(0, SHADER_DIR) | 26 | sys.path.insert(0, SHADER_DIR) |
| 27 | from build import CLIP_CASES, clip_container, shader_source | 27 | from build import CLIP_CASES, clip_container, shader_source |
| 28 | from check import Skip, clip_test, fmt_1010102_test, fmt_xy_xyz_test | 28 | from check import Skip, clip_test, fmt_1010102_test, fmt_sint32_test, fmt_xy_xyz_test |
| 29 | from compute_fixture import compute_header | 29 | from compute_fixture import compute_header |
| 30 | from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test) | 30 | from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test) |
| 31 | from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, | 31 | from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, |
| @@ -40,6 +40,7 @@ from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, | |||
| 40 | vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py | 40 | vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py |
| 41 | from check import PIXEL_VERTEX, VINT_ENV, interp_f16_high_problem, ij_computed_problem # pixel producers and checks | 41 | from check import PIXEL_VERTEX, VINT_ENV, interp_f16_high_problem, ij_computed_problem # pixel producers and checks |
| 42 | from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries | 42 | from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries |
| 43 | from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide | ||
| 43 | 44 | ||
| 44 | 45 | ||
| 45 | def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: | 46 | def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: |
| @@ -553,7 +554,7 @@ OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_transl | |||
| 553 | # Shaders a selected test draws with, built even when the filter leaves them out (#192). | 554 | # Shaders a selected test draws with, built even when the filter leaves them out (#192). |
| 554 | DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", | 555 | DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", |
| 555 | "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", | 556 | "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", |
| 556 | **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", | 557 | **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", "ps_imgatomic": "vs_ids.asm", |
| 557 | **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", | 558 | **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", |
| 558 | "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", | 559 | "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", |
| 559 | "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm", | 560 | "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm", |
| @@ -761,6 +762,12 @@ def run_suite(a, work: str) -> int: | |||
| 761 | for fname in asm_files: | 762 | for fname in asm_files: |
| 762 | name = os.path.splitext(fname)[0] | 763 | name = os.path.splitext(fname)[0] |
| 763 | spv = os.path.join(spirv_dir, f"{name}.spv") | 764 | spv = os.path.join(spirv_dir, f"{name}.spv") |
| 765 | if name == "ps_ij_computed" and (bary_fallback() or f16_interp_fallback()): | ||
| 766 | # Before the .spv check: without PerVertexKHR inputs the translator refuses a computed I/J pair, so there | ||
| 767 | # is no .spv (the f16 fallback is on by default where PerVertexKHR doesn't compile: MoltenVK). | ||
| 768 | results.append((name, None, "SKIP (computed I/J pairs need PerVertexKHR inputs: " | ||
| 769 | "no --bary-fallback / --f16-interp-fallback)")) | ||
| 770 | continue | ||
| 764 | if not os.path.isfile(spv): | 771 | if not os.path.isfile(spv): |
| 765 | results.append((name, False, "missing .spv (translation failed)")) | 772 | results.append((name, False, "missing .spv (translation failed)")) |
| 766 | continue | 773 | continue |
| @@ -831,6 +838,9 @@ def run_suite(a, work: str) -> int: | |||
| 831 | elif name == "cs_fmt_1010102": | 838 | elif name == "cs_fmt_1010102": |
| 832 | problem = fmt_1010102_test(a.build, spirv_dir, cs_env) | 839 | problem = fmt_1010102_test(a.build, spirv_dir, cs_env) |
| 833 | results.append((name, not problem, problem or "64/64 dumped words exact")) | 840 | results.append((name, not problem, problem or "64/64 dumped words exact")) |
| 841 | elif name == "cs_fmt_sint32": | ||
| 842 | problem = fmt_sint32_test(a.build, spirv_dir, cs_env) | ||
| 843 | results.append((name, not problem, problem or "64/64 dumped words exact")) | ||
| 834 | elif name == "cs_fmt_xy_xyz": | 844 | elif name == "cs_fmt_xy_xyz": |
| 835 | # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) | 845 | # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) |
| 836 | problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) | 846 | problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) |
| @@ -866,7 +876,7 @@ def run_suite(a, work: str) -> int: | |||
| 866 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. | 876 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. |
| 867 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. | 877 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. |
| 868 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) | 878 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) |
| 869 | elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_wave64_ballot", "cs_wm_half_ops", "cs_wm_half_cmp", "cs_wm_bfm64", "cs_wm_scc_rfl", "cs_wqm_w64", "cs_wqm_w32", "cs_wqm_w64_half", | 879 | elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_wave64_ballot", "cs_wm_half_ops", "cs_wm_half_cmp", "cs_wm_bfm64", "cs_wm_scc_rfl", "cs_wqm_w64", "cs_wqm_w32", "cs_wqm_w64_half", |
| 870 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", | 880 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", |
| 871 | "cs_dpp_bound", "cs_dpp_w64", | 881 | "cs_dpp_bound", "cs_dpp_w64", |
| 872 | "cs_w64_mask_detect", | 882 | "cs_w64_mask_detect", |
| @@ -937,6 +947,7 @@ def run_suite(a, work: str) -> int: | |||
| 937 | "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820], | 947 | "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820], |
| 938 | "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave | 948 | "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave |
| 939 | "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 | 949 | "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 |
| 950 | "cs_w32_sincos": [1, 1, 1, 1, 1, 1], # SHADER-88 (cs_w32_sincos.asm): angles in turns | ||
| 940 | "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031], | 951 | "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031], |
| 941 | "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32], | 952 | "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32], |
| 942 | "cs_w64x_andn2_exec": [1, 16, 32, 4144, 2052, 3, 8, 1544], # s_andn2_saveexec/wrexec_b64 (.asm header) | 953 | "cs_w64x_andn2_exec": [1, 16, 32, 4144, 2052, 3, 8, 1544], # s_andn2_saveexec/wrexec_b64 (.asm header) |
| @@ -951,7 +962,7 @@ def run_suite(a, work: str) -> int: | |||
| 951 | } | 962 | } |
| 952 | want = cs_dump_wants[name] | 963 | want = cs_dump_wants[name] |
| 953 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / | 964 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / |
| 954 | # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32 | 965 | # cs_w32_lds_u8_d16 / cs_w32_sincos / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32 |
| 955 | # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, | 966 | # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, |
| 956 | # as check.py does, where the device has none | 967 | # as check.py does, where the device has none |
| 957 | # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were | 968 | # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were |
| @@ -963,7 +974,7 @@ def run_suite(a, work: str) -> int: | |||
| 963 | wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", | 974 | wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", |
| 964 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", | 975 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", |
| 965 | "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", | 976 | "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", |
| 966 | "cs_bpermute32", "cs_w32_partial_scmp", | 977 | "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", |
| 967 | "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", | 978 | "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", |
| 968 | "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial | 979 | "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial |
| 969 | if partial and not emulated: | 980 | if partial and not emulated: |
| @@ -1037,10 +1048,12 @@ def run_suite(a, work: str) -> int: | |||
| 1037 | else: | 1048 | else: |
| 1038 | results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else | 1049 | results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else |
| 1039 | f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}")) | 1050 | f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}")) |
| 1040 | elif name == "ps_tex": | 1051 | elif name in ("ps_tex", "ps_imgatomic"): |
| 1041 | # A texture through the descriptor hash table and the bindless set. vk_bindless_test compares the | 1052 | # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel |
| 1042 | # pixels itself, and exits 77 where the device lacks a feature the set or the shader needs. | 1053 | # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test |
| 1043 | rc, msg = run_cmd([vk_bindless, vs_tri, spv]) | 1054 | # compares the result itself, and exits 77 where the device lacks a feature the set or shader needs. |
| 1055 | vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_imgatomic" else vs_tri | ||
| 1056 | rc, msg = run_cmd([vk_bindless, vs, spv]) | ||
| 1044 | lines = msg.splitlines() | 1057 | lines = msg.splitlines() |
| 1045 | if rc == 77: | 1058 | if rc == 77: |
| 1046 | reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device") | 1059 | reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device") |
| @@ -1072,7 +1085,7 @@ def run_suite(a, work: str) -> int: | |||
| 1072 | raw = os.path.join(raw_dir, f"{name}.raw") | 1085 | raw = os.path.join(raw_dir, f"{name}.raw") |
| 1073 | vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids | 1086 | vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids |
| 1074 | if name in PIXEL_VERTEX: | 1087 | if name in PIXEL_VERTEX: |
| 1075 | if bary_fallback() and name in ("ps_interp_f16_high", "ps_ij_computed"): # no PerVertexKHR inputs | 1088 | if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback |
| 1076 | results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) | 1089 | results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) |
| 1077 | continue | 1090 | continue |
| 1078 | vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") | 1091 | vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") |
| @@ -1105,6 +1118,8 @@ def run_suite(a, work: str) -> int: | |||
| 1105 | "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header) | 1118 | "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header) |
| 1106 | "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), | 1119 | "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), |
| 1107 | "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), | 1120 | "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), |
| 1121 | "ps_scc_logic32": (0x0fff0fff, 0x000f000f, 0xf00ff00f, 0x36), | ||
| 1122 | "ps_scc_logic64": (0x0fff0fff, 0xff000000, 0xff0000ff, 0x16), | ||
| 1108 | "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), | 1123 | "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), |
| 1109 | "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64 | 1124 | "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64 |
| 1110 | # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers) | 1125 | # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers) |
| @@ -1117,6 +1132,7 @@ def run_suite(a, work: str) -> int: | |||
| 1117 | "ps_f16_const": (0xAAAA3D00, 0x38005555, 0xAAAA3800, 0x3F000000), | 1132 | "ps_f16_const": (0xAAAA3D00, 0x38005555, 0xAAAA3800, 0x3F000000), |
| 1118 | "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3), | 1133 | "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3), |
| 1119 | "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200), | 1134 | "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200), |
| 1135 | "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400), | ||
| 1120 | "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate | 1136 | "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate |
| 1121 | "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware | 1137 | "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware |
| 1122 | "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), | 1138 | "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), |
| @@ -1136,7 +1152,11 @@ def run_suite(a, work: str) -> int: | |||
| 1136 | "ps_vint_mul24": (0x13345678, 0xFFFFFFFD, 0x00007FFF, 0x0000FFFF), | 1152 | "ps_vint_mul24": (0x13345678, 0xFFFFFFFD, 0x00007FFF, 0x0000FFFF), |
| 1137 | "ps_vint_minmax": (0x7FFFFFFE, 0x80000001, 0x80000001, 0x7FFFFFFE), | 1153 | "ps_vint_minmax": (0x7FFFFFFE, 0x80000001, 0x80000001, 0x7FFFFFFE), |
| 1138 | "ps_vint_minmax3": (0xF0F0F0F0, 0xAB800000, 0xF0F0F0F0, 0xAB800000), | 1154 | "ps_vint_minmax3": (0xF0F0F0F0, 0xAB800000, 0xF0F0F0F0, 0xAB800000), |
| 1155 | "ps_w64x_readlane": (0x40000079, 0x40000010, 0x40000064, 0x400000BE), # same expectation as check.py | ||
| 1139 | } | 1156 | } |
| 1157 | if skip := wide_pixel_skip(name, msg): # a 64-wide pixel stage the device could not give: nothing to judge | ||
| 1158 | results.append((name, None, str(skip))) | ||
| 1159 | continue | ||
| 1140 | if name in const_wants: | 1160 | if name in const_wants: |
| 1141 | if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)): | 1161 | if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)): |
| 1142 | ok, detail = None, str(skip) | 1162 | ok, detail = None, str(skip) |
diff --git a/scripts/run_wine_tests.py b/scripts/run_wine_tests.py index b2736982f..b55ea9b91 100644 --- a/scripts/run_wine_tests.py +++ b/scripts/run_wine_tests.py | |||
| @@ -8,6 +8,10 @@ Usage: | |||
| 8 | made in (forward slashes, as `cygpath -m` prints it). Paths under it are mapped to --root, the Linux checkout (default: | 8 | made in (forward slashes, as `cygpath -m` prints it). Paths under it are mapped to --root, the Linux checkout (default: |
| 9 | this repository), which must hold the Windows build's runtime/build folder at the same place. | 9 | this repository), which must hold the Windows build's runtime/build folder at the same place. |
| 10 | 10 | ||
| 11 | Some tests open files through absolute paths compiled into them (the GLSL test shaders, LEONIDA_TEST_*_SPV under | ||
| 12 | runtime/build/generated). For those, the drive of --windows-root is pointed at --root in the Wine prefix for the run | ||
| 13 | ($WINEPREFIX, else ~/.wine), unless that drive is already in use there. | ||
| 14 | |||
| 11 | Every test is run and reported. The exit code is 1 if a test named by --require fails or is missing, else 0: the | 15 | Every test is run and reported. The exit code is 1 if a test named by --require fails or is missing, else 0: the |
| 12 | others show what does and doesn't work under Wine yet without failing the job. | 16 | others show what does and doesn't work under Wine yet without failing the job. |
| 13 | """ | 17 | """ |
| @@ -17,8 +21,10 @@ import math | |||
| 17 | import os | 21 | import os |
| 18 | import re | 22 | import re |
| 19 | import shlex | 23 | import shlex |
| 24 | import shutil | ||
| 20 | import subprocess | 25 | import subprocess |
| 21 | import sys | 26 | import sys |
| 27 | import tempfile | ||
| 22 | import time | 28 | import time |
| 23 | 29 | ||
| 24 | ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 30 | ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| @@ -46,6 +52,51 @@ def map_path(arg: str, windows_root: str, root: str) -> str | None: | |||
| 46 | return None | 52 | return None |
| 47 | 53 | ||
| 48 | 54 | ||
| 55 | class DriveMap: | ||
| 56 | """Points the drive of the Windows checkout at the Linux one inside the Wine prefix, for the run. | ||
| 57 | |||
| 58 | A test that opens D:/a/Leonida/Leonida/runtime/build/generated/x.spv (a path compiled into it) then reads | ||
| 59 | <root>/runtime/build/generated/x.spv. The drive is a dosdevices link to a scratch folder holding a/Leonida/Leonida | ||
| 60 | as a link to the root; both are removed afterwards. A drive the prefix already has (c:, z:, or one set up by | ||
| 61 | hand) is left alone, and so is a root without a drive letter. | ||
| 62 | """ | ||
| 63 | |||
| 64 | def __init__(self, windows_root: str, root: str, prefix: str): | ||
| 65 | self.windows_root, self.root, self.prefix = norm(windows_root), os.path.abspath(root), prefix | ||
| 66 | self.link = self.scratch = None | ||
| 67 | self.note = "" | ||
| 68 | |||
| 69 | def __enter__(self): | ||
| 70 | m = re.fullmatch(r"([A-Za-z]):/(.+)", self.windows_root) | ||
| 71 | if not m: | ||
| 72 | self.note = f"{self.windows_root} has no drive letter: no drive mapped" | ||
| 73 | return self | ||
| 74 | drive, rest = m.group(1).lower(), [p for p in m.group(2).split("/") if p] | ||
| 75 | dosdevices = os.path.join(self.prefix, "dosdevices") | ||
| 76 | link = os.path.join(dosdevices, drive + ":") | ||
| 77 | if not os.path.isdir(dosdevices): | ||
| 78 | self.note = f"no Wine prefix at {self.prefix}: drive {drive}: not mapped" | ||
| 79 | return self | ||
| 80 | if os.path.lexists(link): | ||
| 81 | self.note = f"drive {drive}: is already set in {dosdevices}: left as it is" | ||
| 82 | return self | ||
| 83 | self.scratch = tempfile.mkdtemp(prefix="wine-drive-") | ||
| 84 | parent = os.path.join(self.scratch, *rest[:-1]) | ||
| 85 | os.makedirs(parent, exist_ok=True) | ||
| 86 | os.symlink(self.root, os.path.join(parent, rest[-1])) | ||
| 87 | os.symlink(self.scratch, link) | ||
| 88 | self.link = link | ||
| 89 | self.note = f"drive {drive}: maps {self.windows_root} to {self.root} for this run" | ||
| 90 | return self | ||
| 91 | |||
| 92 | def __exit__(self, *exc): | ||
| 93 | if self.link and os.path.islink(self.link): | ||
| 94 | os.unlink(self.link) | ||
| 95 | if self.scratch: | ||
| 96 | shutil.rmtree(self.scratch, ignore_errors=True) # removes the links, never what they point to | ||
| 97 | return False | ||
| 98 | |||
| 99 | |||
| 49 | def wine_path(path: str) -> str: | 100 | def wine_path(path: str) -> str: |
| 50 | """Wine's Z: drive is the Unix root, so a Windows program reads /x/y as Z:\\x\\y.""" | 101 | """Wine's Z: drive is the Unix root, so a Windows program reads /x/y as Z:\\x\\y.""" |
| 51 | return "Z:" + os.path.abspath(path).replace("/", "\\") | 102 | return "Z:" + os.path.abspath(path).replace("/", "\\") |
| @@ -175,14 +226,17 @@ def main() -> int: | |||
| 175 | return 2 | 226 | return 2 |
| 176 | wine = args.wine | 227 | wine = args.wine |
| 177 | results = {} | 228 | results = {} |
| 178 | for test in tests: | 229 | prefix = os.environ.get("WINEPREFIX") or os.path.join(os.path.expanduser("~"), ".wine") |
| 179 | name = test.get("name", "?") | 230 | with DriveMap(args.windows_root, args.root, prefix) as drive: |
| 180 | status, detail = run_test(test, args, wine) | 231 | print(drive.note, flush=True) |
| 181 | results[name] = status | 232 | for test in tests: |
| 182 | print(f"[{status.upper()}] {name}", flush=True) | 233 | name = test.get("name", "?") |
| 183 | if status != "pass": | 234 | status, detail = run_test(test, args, wine) |
| 184 | for line in detail.rstrip().splitlines()[-40:]: | 235 | results[name] = status |
| 185 | print(f" {line}") | 236 | print(f"[{status.upper()}] {name}", flush=True) |
| 237 | if status != "pass": | ||
| 238 | for line in detail.rstrip().splitlines()[-40:]: | ||
| 239 | print(f" {line}") | ||
| 186 | 240 | ||
| 187 | missing = [n for n in args.require if n not in results] | 241 | missing = [n for n in args.require if n not in results] |
| 188 | failed_required = [n for n in args.require if results.get(n) != "pass"] | 242 | failed_required = [n for n in args.require if results.get(n) != "pass"] |