diff --git a/README.md b/README.md index 5059e59f86..d37c313c25 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ builds into `Documents\Leonida`; `python -I make_game.py --help` lists every opt of work space (the asset export alone about 370 GB), Python 3.12+, the .NET 8 SDK, the Vulkan SDK, LLVM 21+ with the AMDGPU target for `llvm-mc` (`scripts\build_llvm_mc.ps1` builds one on Windows) and, for the runtime stage, Visual Studio 2022 with the Windows SDK 10.0.26100 or newer; `--stages check,shaders,runtime` needs about 30 GB. Clone with -`--recursive` for the `third_party/rpf9-explorer` submodule. [docs/design.md](docs/design.md) has the formats and the +`git clone --recursive https://github.com/ProjectLeonida/mandy` for the `third_party/rpf9-explorer` submodule. [docs/design.md](docs/design.md) has the formats and the translator's contract, [docs/linux.md](docs/linux.md) the Linux steps. | Piece | Where it stands | diff --git a/d3d12/README.md b/d3d12/README.md index 9b79d3444f..1c0a9fd867 100644 --- a/d3d12/README.md +++ b/d3d12/README.md @@ -17,7 +17,7 @@ On a Ryzen 5 7600X with a GeForce RTX 4060 Ti 16 GB, the Series X profile render frames a second is not reached yet. On RTX 40 and 50 cards, DLSS frame generation is on by default when NVIDIA's files are there (`Get-NVIDIA-DLSS.cmd`): it shows twice the frames, held to 28 a second by Reflex (`LEONIDA_FG_LIMIT_FPS`) with presents paced evenly (`LEONIDA_PRESENT_SMOOTH`); `-NoFrameGen` turns it off. The -measurements and what is still wrong in the picture are in the [top-level README](../README.md#project-status). +measurements and what is still wrong in the picture are in the [top-level README](../README.md#where-it-stands). ## Leonida's picture fixes diff --git a/docs/i18n/ar/quickstart.md b/docs/i18n/ar/quickstart.md index d28d5fc700..970da67c22 100644 --- a/docs/i18n/ar/quickstart.md +++ b/docs/i18n/ar/quickstart.md @@ -3,7 +3,7 @@ # دليل البدء السريع لمشروع Leonida الوثائق الإنجليزية هي المرجع المعتمد. يستند هذا الدليل إلى المراجعة `561b65a` ويغطي خطوات البدء الأساسية. -راجع [ملف README بالإنجليزية](../../../README.md#project-status) لمعرفة حالة المشروع الحالية، و[فهرس الوثائق](../../README.md) للمزيد من التفاصيل. +راجع [ملف README بالإنجليزية](../../../README.md#where-it-stands) لمعرفة حالة المشروع الحالية، و[فهرس الوثائق](../../README.md) للمزيد من التفاصيل. ## ما هو Leonida؟ @@ -72,7 +72,7 @@ python -I make_game.py --game "D:\path\to\package" --out "D:\Games\Leonida" --wo يعمل `make_game.py` على Linux، ويجد `llvm-mc` تلقائيًا إذا كان ضمن `PATH`. تأكد من أن نسخته تدعم AMDGPU. يعمل محمّل اللعبة، وهو برنامج Windows، عبر Wine أو Proton. إذا كان لديك بناء Windows جاهز للمحمّل، -فمرّر مجلده باستخدام `--runtime-build`. راجع [تعليمات البناء والتشغيل على Linux](../../../README.md#running-the-loader-on-linux). +فمرّر مجلده باستخدام `--runtime-build`. راجع [تعليمات البناء والتشغيل على Linux](../../linux.md). ## حل المشاكل الشائعة diff --git a/make_game.py b/make_game.py index 81af7c7568..f95193b933 100644 --- a/make_game.py +++ b/make_game.py @@ -1151,7 +1151,7 @@ def ensure_submodule() -> None: core = os.path.join(ROOT, "third_party", "rpf9-explorer", "Core") if submodule_ready(): return - clone = "git clone --recursive https://github.com/ubiquitarianism/leonida" + clone = "git clone --recursive https://github.com/ProjectLeonida/mandy" git = shutil.which("git") if not git: fail("third_party/rpf9-explorer is missing (a \"Download ZIP\" from GitHub leaves it out). Install Git " @@ -1323,7 +1323,7 @@ def read_translation_index(index: str) -> dict: with open(index, encoding="utf-8-sig") as f: shaders = json.load(f) if not isinstance(shaders, dict): - raise ValueError("expected a JSON object keyed by shader name") + raise ValueError("must contain a JSON object keyed by shader name") return shaders @@ -2976,8 +2976,6 @@ def require_translated_shaders(work: str) -> str: except (OSError, ValueError) as e: fail(f"The translated shader index {index} is unreadable ({getattr(e, 'strerror', None) or e}): " "run the shaders stage again.") - if not isinstance(translated, dict): - fail(f"The translated shader index {index} must contain a JSON object. Run the shaders stage again.") if not translated: # A build from before the shaders stage refused an empty merge can carry this marker. fail(f"The translated shader index {index} is empty, so there is nothing to check. Run the shaders stage again.") diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 7eda2c785e..51ed8bf39b 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -272,7 +272,8 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME) # /MAP writes gta6rt.map next to the exe (link.exe and lld-link): gta6rt_no_tls_callbacks names each TLS callback from # it, to tell the C++ runtime's __dyn_tls_init (tlsdyn.obj) and __dyn_tls_dtor (tlsdtor.obj) from Rust std's own # callback. It does not change the exe. - target_link_options(gta6rt PRIVATE /OPT:NOREF ${GTA6RT_HOST_BASE} /STACK:${GTA6RT_STACK} /MAP) + # /STACK goes last: tests/test_build_runtime_fallback.py reads the reserve at the end of this line. + target_link_options(gta6rt PRIVATE /OPT:NOREF ${GTA6RT_HOST_BASE} /MAP /STACK:${GTA6RT_STACK}) target_link_libraries(gta6rt PRIVATE gta6rt_bcpack gta6rt_d3d12_xs_rootsig gta6rt_xtaskqueue psapi) # Root-signature forwarding test: needs a real PC d3d12.lib to serialize the synthetic descriptors. diff --git a/runtime/test/pipeline_workers_test.cpp b/runtime/test/pipeline_workers_test.cpp index b830dc5fa7..e2dafd3fe4 100644 --- a/runtime/test/pipeline_workers_test.cpp +++ b/runtime/test/pipeline_workers_test.cpp @@ -345,14 +345,17 @@ void oom_during_start_and_enqueue() { } check(!threw, "hard oom on first batch threw instead of running inline"); for (auto& c : calls) check(c == 1, "hard oom inline fallback lost or repeated a job"); + // libstdc++'s deque owns its first node from construction, so the one push_back may succeed; the batch is + // then counted and the caller runs it. When the push does fail, the inline fallback counts nothing. const auto during = pool.stats(); - check(during.started == 0 && during.batches == 0 && during.jobs == 0 && during.running == 0, + const bool pushed = during.batches == 1; + check(during.started == 0 && during.running == 0 && (pushed ? during.jobs == 6 : during.batches == 0 && during.jobs == 0), "hard oom inline fallback kept stats clean"); std::vector> after(5); pool.run(after.size(), [&](std::size_t i) { after[i].fetch_add(1); }); for (auto& c : after) check(c == 1, "batch after hard oom lost or repeated a job"); - check(pool.stats().started == 4 && pool.stats().batches == 1 && pool.stats().running == 0, + check(pool.stats().started == 4 && pool.stats().batches == during.batches + 1 && pool.stats().running == 0, "pool works normally once memory is available again"); } } diff --git a/runtime/test/shaders/cs_imgatomic_ext.asm b/runtime/test/shaders/cs_imgatomic_ext.asm index e58ecbcb60..84fba49ce4 100644 --- a/runtime/test/shaders/cs_imgatomic_ext.asm +++ b/runtime/test/shaders/cs_imgatomic_ext.asm @@ -56,10 +56,10 @@ s_mov_b32 s8, 0x5000 s_mov_b32 s9, 0x1400000 s_mov_b32 s10, 0x55 s_mov_b32 s11, 0x55 -s_mov_b32 s12, 0x55 +s_mov_b32 s12, 0x80000055 s_mov_b32 s13, 0x55 s_mov_b32 s14, 0x55 -s_mov_b32 s15, 0x55 +s_mov_b32 s15, 0xd7801800 s_mov_b32 s16, 0x2000 s_mov_b32 s17, 0x1400000 s_mov_b32 s18, 0x22 diff --git a/runtime/test/vk_bindless_dimensions_test.cpp b/runtime/test/vk_bindless_dimensions_test.cpp index 3da8370d66..2b7863555b 100644 --- a/runtime/test/vk_bindless_dimensions_test.cpp +++ b/runtime/test/vk_bindless_dimensions_test.cpp @@ -404,6 +404,18 @@ int main() { return 77; } + // The limits above are only the sampled-image ones; the sizing also answers to the resource and set limits (an + // Apple Paravirtual device under MoltenVK stops at the 256 defaults). Below live_images there is nothing to test. + for (const ImageDimension dimension : + {ImageDimension::dim_1d, ImageDimension::dim_2d_array, ImageDimension::dim_3d}) { + const std::uint32_t sized = features.counts[bindless::sampled_binding(dimension)]; + if (sized <= live_images) { + std::printf("unsupported: the device's limits size the %s array at %u indices, too few for %u images\n", + name(dimension), sized, live_images); + return 77; + } + } + const std::vector code = load_spirv(LEONIDA_TEST_BINDLESS_DIMENSIONS_SPV); EXPECT(!code.empty()); const std::uint32_t max_layers = properties.properties.limits.maxImageArrayLayers; diff --git a/runtime/test/xs_proxy_mock_test.cpp b/runtime/test/xs_proxy_mock_test.cpp index 95edd30654..203f081b61 100644 --- a/runtime/test/xs_proxy_mock_test.cpp +++ b/runtime/test/xs_proxy_mock_test.cpp @@ -4295,10 +4295,12 @@ int check_list_values() { raw(lv, 14, 1, 1, 1); EXPECT(hr_of(raw(lv, 9)) == S_OK); g_queue_call_count = 0; - const ULONGLONG started = GetTickCount64(); + // steady_clock, not GetTickCount64: its 15.6 ms steps can report 15 ms for a 30 ms wait + const auto started = std::chrono::steady_clock::now(); EXPECT(submit(qb, lv) == 0); EXPECT(g_queue_call_count == 2 && queue_call_is(0, qb_mock, 15, word(b_gate), 2)); - EXPECT(xs::list_values_idle(3000) && fence_completed(b_gate) == 2 && GetTickCount64() - started >= 20); + EXPECT(xs::list_values_idle(3000) && fence_completed(b_gate) == 2 && + std::chrono::steady_clock::now() - started >= std::chrono::milliseconds(20)); stats = xs::list_value_stats(); EXPECT(stats.gates_timed_out == 1 && stats.waits_met_at_submit >= 1); xs::set_list_value_wait_timeout_ms(5000); diff --git a/scripts/bench_translate.py b/scripts/bench_translate.py index b639098b9b..f6000a82c9 100644 --- a/scripts/bench_translate.py +++ b/scripts/bench_translate.py @@ -306,4 +306,8 @@ def main(argv=None): if __name__ == "__main__": + try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode + sys.stdout.reconfigure(errors="replace") + except (AttributeError, ValueError, OSError): + pass sys.exit(main()) diff --git a/scripts/export_old_pr_manifest.py b/scripts/export_old_pr_manifest.py index 66d99f1acd..a83b128221 100644 --- a/scripts/export_old_pr_manifest.py +++ b/scripts/export_old_pr_manifest.py @@ -120,4 +120,8 @@ def main(argv=None) -> int: if __name__ == "__main__": + try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode + sys.stdout.reconfigure(errors="replace") + except (AttributeError, ValueError, OSError): + pass sys.exit(main()) diff --git a/scripts/run_game_wine.sh b/scripts/run_game_wine.sh index 9d8f19a37b..cc60d67670 100755 --- a/scripts/run_game_wine.sh +++ b/scripts/run_game_wine.sh @@ -228,13 +228,14 @@ DRM_SYSFS=${LEONIDA_DRM_SYSFS_DIR:-/sys/class/drm} if [ -n "$DEVICE" ]; then export MESA_VK_DEVICE_SELECT="$DEVICE!" # kwin and Xwayland's glamor on the card that renders, so the present path stays on one device. - dev_lc=${DEVICE,,} + lc() { printf '%s' "$1" | tr '[:upper:]' '[:lower:]'; } # not ${x,,}: macOS's bash 3.2 lacks it + dev_lc=$(lc "$DEVICE") for n in "$DRM_SYSFS"/renderD*; do [ -e "$n" ] || continue ven=$(cat "$n/device/vendor" 2>/dev/null || true) did=$(cat "$n/device/device" 2>/dev/null || true) ven=${ven//$'\r'/}; did=${did//$'\r'/} - [ "${ven,,}:${did,,}" = "0x${dev_lc%%:*}:0x${dev_lc#*:}" ] \ + [ "$(lc "$ven"):$(lc "$did")" = "0x${dev_lc%%:*}:0x${dev_lc#*:}" ] \ && export KWIN_DRM_DEVICES=/dev/dri/${n##*/} done else diff --git a/tests/semantic/test_valu_cvt_f16_int16_mods.py b/tests/semantic/test_valu_cvt_f16_int16_mods.py index 7141fbf195..995da602b5 100644 --- a/tests/semantic/test_valu_cvt_f16_int16_mods.py +++ b/tests/semantic/test_valu_cvt_f16_int16_mods.py @@ -70,10 +70,30 @@ def test_sdwa_clamp(self): self.assertEqual(words[0], 0x0000FFFE) # -2 clamped to +0.0 in WORD_1, WORD_0 preserved self.assertEqual(words[1], 0x00003C00) # 2 clamped to 1.0 in WORD_0, WORD_1 padded with 0 - def test_f16_to_int16_output_modifiers_still_rejected(self): + def test_f16_to_int16_output_modifiers_are_hardware_noops(self): + # Measured on RDNA2: clamp and mul:/div: change nothing on an integer destination (rdna2spirv.py, v_cvt_*_f16). + words = run_ps([ + "v_mov_b32 v0, 0xdead4500", + "v_cvt_u16_f16 v0, v0 clamp", + "v_mov_b32 v1, 0xbeefc000", + "v_cvt_i16_f16 v1, v1 mul:4", + "v_mov_b32 v2, 0xcafe4200", + "v_cvt_u16_f16 v2, v2 div:2", + "v_mov_b32 v3, 0x0000c000", + "v_cvt_i16_f16_sdwa v3, v3 clamp dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0", + "exp mrt0 v0, v1, v2, v3 done vm", + "s_endpgm", + ]) + self.assertEqual(words[0], 0xDEAD0005) # 5.0, not clamped to 1 + self.assertEqual(words[1], 0xBEEFFFFE) # -2.0, not scaled + self.assertEqual(words[2], 0xCAFE0003) # 3.0, not halved + self.assertEqual(words[3], 0x0000FFFE) # SDWA clamp ignored too + + def test_f16_to_int16_unknown_modifiers_still_rejected(self): for op in ("v_cvt_u16_f16", "v_cvt_i16_f16"): - with self.subTest(op=op), self.assertRaises(rdna2spirv.Unsupported): - translate_lines("ps_cvt_f16_reject", [f"{op} v0, v0 clamp", "exp mrt0 v0, v0, v0, v0 done vm", "s_endpgm"]) + for form, mod in ((op, "mul:8"), (op + "_e32", "clamp")): + with self.subTest(form=form, mod=mod), self.assertRaises(rdna2spirv.Unsupported): + translate_lines("ps_cvt_f16_reject", [f"{form} v0, v0 {mod}", "exp mrt0 v0, v0, v0, v0 done vm", "s_endpgm"]) if __name__ == "__main__": diff --git a/tests/test_bcpack_history_calib.py b/tests/test_bcpack_history_calib.py index 7c3c065295..8eb7e7460a 100644 --- a/tests/test_bcpack_history_calib.py +++ b/tests/test_bcpack_history_calib.py @@ -1194,7 +1194,9 @@ class PathDeduplicationAndGuardTest(unittest.TestCase): def _darwin(case_sensitive_result): fake_os = mock.Mock(wraps=os, pathconf=mock.Mock(return_value=case_sensitive_result)) fake_os.path.normcase = posixpath.normcase - return mock.patch.multiple(report_paths, sys=mock.Mock(platform="darwin"), os=fake_os) + # The scratch-folder probe asks the real volume, which on a Mac is case-insensitive whatever pathconf says here. + return mock.patch.multiple(report_paths, sys=mock.Mock(platform="darwin"), os=fake_os, + _same_resolved_name=mock.Mock(return_value=False)) def test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive(self): with mock.patch.object(calib._ttpf, "find_pools", side_effect=lambda p: [p]): diff --git a/tests/test_docs_cli_flags.py b/tests/test_docs_cli_flags.py index 2514ce9aa4..e5f4c5fc80 100644 --- a/tests/test_docs_cli_flags.py +++ b/tests/test_docs_cli_flags.py @@ -127,7 +127,17 @@ def extract_ps1_params(content): params = set() for part in parts: - decl = part.split("=", 1)[0] + # The default starts at the first "=" outside brackets: [Parameter(Mandatory = $true)][string]$Game has one inside. + nest, cut = 0, len(part) + for i, ch in enumerate(part): + if ch in "([{": + nest += 1 + elif ch in ")]}": + nest -= 1 + elif ch == "=" and nest == 0: + cut = i + break + decl = part[:cut] vars_found = re.findall(r"\$([a-zA-Z_][a-zA-Z0-9_]*)", decl) if vars_found: params.add(vars_found[-1].lower()) @@ -251,7 +261,7 @@ def test_checkers_report_only_the_missing_flag(self): self.assertEqual(tool_flag_mismatches(pages, sources), []) ps1_pages = {"docs/b.md": "```\n.\\scripts\\test.ps1 -ValidParam -BadParam\n```\n"} - ps1_sources = {"scripts/test.ps1": "param([string]$ValidParam)"} + ps1_sources = {"scripts/test.ps1": "param([Parameter(Mandatory = $true)][string]$ValidParam)"} self.assertEqual(ps1_flag_mismatches(ps1_pages, ps1_sources), [("docs/b.md:2", "scripts/test.ps1", "-BadParam")]) rust = '#[arg(long)]\n/// doc\npub one_submit: bool,\n#[arg(short, long)]\nno_merge: bool,\n' self.assertEqual(clap_long_flags(rust), ["--one-submit", "--no-merge"]) diff --git a/tests/test_make_game_preflight.py b/tests/test_make_game_preflight.py index 6c1a34be93..6f77cc9c2c 100644 --- a/tests/test_make_game_preflight.py +++ b/tests/test_make_game_preflight.py @@ -815,7 +815,7 @@ def test_ensure_submodule_missing_fails_cleanly(self): with mock.patch.object(make_game, "ROOT", tmp), \ mock.patch("shutil.which", return_value=None): self.assert_fails(make_game.ensure_submodule, - match="git clone --recursive https://github.com/ubiquitarianism/leonida") + match="git clone --recursive https://github.com/ProjectLeonida/mandy") def test_ensure_submodule_zip_with_git_does_not_say_install_git(self): with tempfile.TemporaryDirectory() as tmp: @@ -824,7 +824,7 @@ def test_ensure_submodule_zip_with_git_does_not_say_install_git(self): mock.patch("shutil.which", return_value="/usr/bin/git"), \ mock.patch("subprocess.run", return_value=not_a_repo): err = self.assert_fails(make_game.ensure_submodule, - match="git clone --recursive https://github.com/ubiquitarianism/leonida") + match="git clone --recursive https://github.com/ProjectLeonida/mandy") self.assertNotIn("Install Git", err) def test_ensure_submodule_names_the_clone_command_the_readme_gives(self): diff --git a/tests/test_run_game_wine_safety.py b/tests/test_run_game_wine_safety.py index 9c9de01698..ce2d6a1c51 100644 --- a/tests/test_run_game_wine_safety.py +++ b/tests/test_run_game_wine_safety.py @@ -147,6 +147,8 @@ def test_uppercase_device_inner_bash_lock_parent_and_summary_exit_propagation(se _write_lf(sbin / "flock", "#!/usr/bin/env bash\nexit 0\n", executable=True) _write_lf(sbin / "pkill", "#!/usr/bin/env bash\nexit 0\n", executable=True) _write_lf(sbin / "timeout", "#!/usr/bin/env bash\nshift 3\n\"$@\"\n", executable=True) + # --visible probes DISPLAY with xdpyinfo when the host has one; the fake :99 must not depend on that. + _write_lf(sbin / "xdpyinfo", "#!/usr/bin/env bash\nexit 0\n", executable=True) _write_lf( sbin / "python3", "#!/usr/bin/env bash\n" diff --git a/tests/test_sampler_source_census.py b/tests/test_sampler_source_census.py index 7e744ec2e6..84faf9941a 100644 --- a/tests/test_sampler_source_census.py +++ b/tests/test_sampler_source_census.py @@ -438,7 +438,7 @@ def test_statistics_bound_what_the_classes_cannot_decide(self): ("s_add_u32 s10, s10, 0x7fff0000", 8), ("s_mov_b32 s11, 0", 4), ("s_load_dwordx8 s[20:27], s[10:11], 0x800", 8), - ("s_lshl3_add_u32 s8, s8, 0x30", 4), + ("s_lshl3_add_u32 s8, 6, s8", 4), ("s_mov_b32 s9, 0", 4), ("s_load_dwordx4 s[28:31], s[8:9], 0x10", 8), SAMPLE, END, diff --git a/tests/test_spirv_metal_set0_cli_errors.py b/tests/test_spirv_metal_set0_cli_errors.py index 18a58e25a1..5a2744b652 100644 --- a/tests/test_spirv_metal_set0_cli_errors.py +++ b/tests/test_spirv_metal_set0_cli_errors.py @@ -74,7 +74,8 @@ def test_spirv_as_that_cannot_be_started(self): def test_spirv_as_that_fails(self): lines = self.assert_failed(self.run_tool(sys.executable, sys.executable)) # spirv-as writes to the terminal itself; the tool's own line comes last. - self.assertEqual(lines[-1], f"ERROR: {sys.executable} failed with exit status 2") + # The first line spirv-as printed to stderr follows the exit status. + self.assertTrue(lines[-1].startswith(f"ERROR: {sys.executable} failed with exit status 2: "), lines) self.assertEqual([line for line in lines if line.startswith("ERROR: ")], lines[-1:]) def test_usage_and_layout_still_work_through_cli(self): diff --git a/tests/test_spirv_metal_set0_extra.py b/tests/test_spirv_metal_set0_extra.py index eb31eb06b2..7dd104f510 100644 --- a/tests/test_spirv_metal_set0_extra.py +++ b/tests/test_spirv_metal_set0_extra.py @@ -343,7 +343,7 @@ def _make_fake_spirv_tools(dis_name="spirv-dis", asm_name="spirv-as"): """Return a subprocess.run replacement backed by the synthetic SPIR-V binary codec.""" calls: list[list[str]] = [] - def fake_run(cmd, check=False, capture_output=False, text=False, input=None, errors=None): + def fake_run(cmd, check=False, capture_output=False, text=False, input=None, errors=None, encoding=None): calls.append(list(cmd)) exe = cmd[0] if exe == dis_name: @@ -699,7 +699,7 @@ def test_out_of_bounds_set0_binding_raises_system_exit(self): self.assertIn("%bad", str(ctx.exception)) self.assertIn(f"binding {b}", str(ctx.exception)) - def test_missing_uint32_type_raises_when_runtime_array_rewritten(self): + def test_missing_uint32_type_is_declared_before_the_array_length(self): base = """\ OpDecorate %images DescriptorSet 0 OpDecorate %images Binding 0 @@ -716,9 +716,9 @@ def test_missing_uint32_type_raises_when_runtime_array_rewritten(self): ("unsigned_64", "%u64 = OpTypeInt 64 0"), ): with self.subTest(case=label): - with self.assertRaises(SystemExit) as ctx: - m.rewrite(base.format(int_decl=int_decl), [4096]) - self.assertIn("no 32-bit uint type", str(ctx.exception)) + out = m.rewrite(base.format(int_decl=int_decl), [4096]) + self.assertEqual(out.count("%msl_uint = OpTypeInt 32 0"), 1) + self.assertLess(out.index("%msl_uint = OpTypeInt 32 0"), out.index("%msl_cap_b0 = OpConstant %msl_uint 4096")) class TestMainAndCli(unittest.TestCase): @@ -904,7 +904,7 @@ def test_target_env_extraction_and_env_var_overrides(self): disasm = header_text + "OpCapability Shader\n" seen_cmds = [] - def run_stub(cmd, check=False, capture_output=False, text=False, input=None, errors=None): + def run_stub(cmd, check=False, capture_output=False, text=False, input=None, errors=None, encoding=None): seen_cmds.append((list(cmd), check, capture_output, text, input)) if len(seen_cmds) == 1: return subprocess.CompletedProcess(cmd, 0, disasm, "") diff --git a/tests/test_windows_boot_journal_seed.py b/tests/test_windows_boot_journal_seed.py index 21d20c4726..7be507d12c 100644 --- a/tests/test_windows_boot_journal_seed.py +++ b/tests/test_windows_boot_journal_seed.py @@ -23,7 +23,7 @@ @unittest.skipUnless(sys.platform == "win32" and POWERSHELL, "boot.ps1 is a Windows PowerShell script") class BootJournalSeedTest(unittest.TestCase): def setUp(self): - self.tmp = Path(tempfile.mkdtemp(prefix="leonida_boot_seed_")) + self.tmp = Path(os.path.realpath(tempfile.mkdtemp(prefix="leonida_boot_seed_"))) # not the RUNNER~1 short name self.addCleanup(shutil.rmtree, self.tmp, ignore_errors=True) self.runtime = self.tmp / "port" self.runtime.mkdir() diff --git a/tools/pc_prompt_glyphs.py b/tools/pc_prompt_glyphs.py index bb1e7e4bc8..355d2395a9 100644 --- a/tools/pc_prompt_glyphs.py +++ b/tools/pc_prompt_glyphs.py @@ -1375,4 +1375,8 @@ def main(argv): if __name__ == "__main__": + try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode + sys.stdout.reconfigure(errors="replace") + except (AttributeError, ValueError, OSError): + pass main(sys.argv[1:]) diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index eee7d329b9..2d02c0f6e5 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py @@ -53,7 +53,7 @@ SCHEMA = "leonida.progress/1" STATUSES = ("verified", "implemented", "partial", "failed", "missing", "blocked", "unknown") PYTEST_MARKERS = re.compile(r"^import pytest|^ *HAVE_NUMPY =", re.M) # the CI selection rule (ci.yml) -DEFAULT_REPO = "ubiquitarianism/leonida" +DEFAULT_REPO = "ProjectLeonida/mandy" # ----------------------------------------------------------------------------------------------- helpers diff --git a/tools/psin_dialogue.py b/tools/psin_dialogue.py index 9669ae73b8..dd0196bd03 100644 --- a/tools/psin_dialogue.py +++ b/tools/psin_dialogue.py @@ -1,8 +1,13 @@ """Read speaker slots and subtitle labels from typed PSIN conversation records.""" import collections +import os import re import struct +import sys + +# `python -I` implies `-P`, so the script's directory is not on sys.path; the sibling modules are next to it. +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from psin_data import Container diff --git a/tools/rdna2spirv.py b/tools/rdna2spirv.py index beb89b60db..9344e01947 100644 --- a/tools/rdna2spirv.py +++ b/tools/rdna2spirv.py @@ -11362,7 +11362,7 @@ def f64(sv): # 16-bit <-> f16 conversions of the low half (op_sel:[src,dst] picks the high half of the source / of the # destination); the other half of the destination is kept, as for the other 16-bit-result ops. f16 -> int # truncates toward zero, saturates to the 16-bit range (an f16 infinity too) and gives 0 for NaN, as the - # 32-bit conversions do (docs/design.md, "Float-to-int saturation"); output modifiers stay rejected on it. + # 32-bit conversions do (docs/design.md, "Float-to-int saturation"); clamp and omod are accepted as no-ops (below). # int -> f16 applies clamp_mods (mul:/div: then [0, 1] clamp) and rounds like every f16 result (f16_out). sel, dhi = self.opsel_bits(mods, 1) if op in ("v_cvt_f16_u16", "v_cvt_f16_i16"): diff --git a/tools/xbox_prompt_glyphs.py b/tools/xbox_prompt_glyphs.py index ae4893de58..43cfead5ce 100644 --- a/tools/xbox_prompt_glyphs.py +++ b/tools/xbox_prompt_glyphs.py @@ -653,4 +653,8 @@ def main(argv): if __name__ == "__main__": + try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode + sys.stdout.reconfigure(errors="replace") + except (AttributeError, ValueError, OSError): + pass main(sys.argv[1:])