Repository navigation
Refactor/layers - #16
Merged
Merged
Conversation
First part of the groundwork refactor (build layout before any source moves). No runtime source changes. - runtime/CMakePresets.json: presets dev (Debug, diagnostics on, build-dev), release (RelWithDebInfo, diagnostics off, build) and diag (release plus diagnostics, build-diag), each with a build and a test preset. All use Ninja. The existing `cmake -S runtime -B ...` commands of CI and the scripts are unchanged. - LEONIDA_DIAGNOSTICS (default OFF): compiles every target with LEONIDA_DIAGNOSTICS=1. Nothing reads the macro yet; the logging and capture code moves behind it in later steps. - runtime/cmake/fixtures.cmake: leonida_add_d3d12_xs_stub() replaces the two copies of the d3d12_xs_stub target (tiny_frame and tiny_guest_draw) with one definition. - runtime/README.md: the presets in the Build section. AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, GeForce GTX 1070 Ti, driver 582.66: - RelWithDebInfo reconfigure and build of d3d12_xs_stub, tiny_frame, gta6rt, d3d12_com_test and the tiny_argv fixtures: one stub link rule; ctest root_sig, file_system, run_argv_modes, root_signature, host_cpu, run_tiny_frame and run_tiny_frame_queue_test_settings pass. - `cmake --preset diag` into a scratch folder: 402 of 402 compile rules carry -DLEONIDA_DIAGNOSTICS=1; host_cpu and root_signature build and pass there. - python -I on the tests that read the CMake text or the docs (27 files, among them test_ctest_registration, test_runtime_paths, test_build_runtime_fallback, test_docs_*): all pass. Not tested: the dev preset, and the second call site of the stub function (LEONIDA_TEST_GUEST_DRAW / LEONIDA_GUEST_SCENE are off here). The whole ctest suite was not run.
Second part of the groundwork refactor. The 3,389-line build file keeps its options and the order of the build (166 lines); the bodies of its five large blocks move, unchanged apart from two columns of indentation, to files it includes at the same place: - cmake/windows_runtime.cmake: gta6rt.exe, the libraries its shims link, the shim test programs - cmake/runtime_tests.cmake: the tests that need no Vulkan headers and the stand-in titles - cmake/vulkan_tools.cmake: the standalone Vulkan tools and their tests - cmake/d3d12_vulkan.cmake: the D3D12 COM objects over Vulkan and their tests - cmake/vulkan_cpu_tests.cmake: the Vulkan-layer tests that need no GPU include() is used, not add_subdirectory(), so variables, relative source paths and binary folders stay as they were. No target, option or test changes. What reads the build as text follows the split: - tests/runtime_cmake.py: read() returns CMakeLists.txt with each included cmake/*.cmake file inserted after its include() line. Used by test_ctest_registration, test_cmake_translator_deps, test_build_runtime_fallback, test_acphal_abi and test_check_sparse_queue_family, which would otherwise see no targets. - scripts/first_look.ps1: runtime\cmake counts as a source of gta6rt.exe for the stale check, as CMakeLists.txt did. - Comments and docs that named a place in runtime/CMakeLists.txt name the file it is in now; runtime/README.md lists the five files. AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66: - build.ninja before and after the split: 12,904 lines each, the same except for the two rules that list CMake's input files (the five new files are added). `ctest --show-only=json-v1`: 268 tests before and after, same names, commands, properties and order. - Build of gta6rt, gta6rt_tls_host, d3d12_xs_stub, tiny_frame, vk_xdxr_build_test, vk_pipeline_check, d3d12_vulkan_device_test, d3d12_com_test, root_sig_test, file_system_test, acphal_test, crt_timed_wait_test, host_cpu_test and root_signature_test; ctest root_sig, acphal, file_system, gta6rt_stack, root_signature, host_cpu, vk_pipeline_check_stack, run_tiny_frame, run_tiny_frame_queue_test_settings and crt_timed_wait pass. - python -I on the 69 standard-library test files that name the build file, the docs or the build scripts: all pass. The 18 that read the README or build_runtime.ps1 were run again after the last edit. test_runtime_paths lists files with git ls-files, so it sees the new files only once they are added. Not tested: a configure on Linux or macOS, with clang-cl, or without Vulkan headers; the branches that need glslangValidator, llvm-mc, SDL3, LEONIDA_TEST_GUEST_DRAW or LEONIDA_D3D12_SHIM_TESTS (not available or off here, so their lines were not run by CMake). The whole ctest suite and the pytest-based tests were not run.
First part of step 2 of the groundwork refactor: one place that knows
every setting of the runtime, instead of about 50 environment reads
spread over 19 files.
- runtime/core/config.h, config.cpp (new library gta6rt_core, built on
every OS): kSettings has a row per setting with its name in the file
("section.name"), its environment variable and its default; 49 rows,
one for each variable runtime/src and runtime/shims read today apart
from the two internal ones. rt::config::get("vulkan.validation")
returns the value and where it comes from: the environment variable
if set and not empty, else the file, else the default. The name is
checked at compile time (a consteval constructor), so a misspelt key
does not build. The environment is read at each call and not cached,
because 19 test programs set variables in their own process.
- The file is the part of TOML it needs ([section], name = value, #
comments; text in single or double quotes, numbers, true/false),
read by a small reader of its own rather than a new dependency. An
unknown section or name, a name set twice or a malformed line is an
error with file and line, and no value of that file is taken.
- gta6rt reads the file LEONIDA_CONFIG names, else leonida.toml next to
gta6rt.exe, before it does anything else; an error ends the run with
exit code 2. `gta6rt config` prints the file in use and every setting
with its source, variable and value.
- runtime/leonida.example.toml lists every setting with its default and
variable. core_config_test compares it with the table, so the two
cannot drift apart.
- scripts/build_runtime.ps1: core\config.cpp in the cl.exe fallback's
file list. tests/test_docs_env_vars.py also scans runtime/core, so a
variable stays checked once its name is only in the table.
- runtime/README.md: a section on the file, the order and the command.
No reader has moved to the table yet: every setting still takes its
value from its environment variable alone, as before, so a value in
leonida.toml has no effect so far although `gta6rt config` lists it.
The README says so. The readers move file by file in the next commits.
The defaults in the table repeat what the readers do today and are not
yet checked against them by a test; that comes with each move.
Two added lines are over 120 columns; both were already (the usage
line in main.cpp, 169 before and after; the $files line in
build_runtime.ps1, 615 to 634).
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66:
- Build of gta6rt, core_config_test, host_cpu_test and tiny_game; ctest
core_config, host_cpu, run_tiny_game, run_tiny_game_dir, gta6rt_stack
and the three gta6rt_rejects_* pass.
- By hand: `gta6rt config` with nothing set (50 lines, all default),
with LEONIDA_CONFIG and a variable (file, environment and default
shown as such), with a misspelt setting (exit 2, file and line) and
with LEONIDA_CONFIG naming no file (exit 2).
- core\config.cpp compiles with the flags of the cl.exe fallback
(UNICODE, /W4); the fallback build itself was not run.
- python -I on test_docs_env_vars, the eight other test_docs_* files,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_cmake_translator_deps,
test_text_write_line_endings, test_check_no_game_data and
test_run_wine_tests: all pass.
Not tested: Linux, macOS, clang-cl and Wine (the non-Windows branches
of config.cpp and of the test were not compiled); the whole ctest
suite; the pytest-based tests. core_config took 11.8 s on each first
run after a build and 0.02 s on a rerun; the cause was not looked into.
…table Second part of step 2 of the groundwork refactor: the first three readers move from their own environment reads to rt::config::get(). - src/host_cpu.cpp: loader.skip_cpu_check (LEONIDA_SKIP_CPU_CHECK), on for exactly "1" as before. The two #if branches (GetEnvironmentVariableA on Windows, getenv elsewhere) are gone, and with them windows.h, <cstring> and <cstdlib> in that file. - src/pe_loader.cpp: loader.tls_ga_patch (LEONIDA_TLS_GA_PATCH), off for exactly "0" as before, and paths.compat_dir (LEONIDA_COMPAT_DIR). - runtime/CMakeLists.txt: LEONIDA_SETTING_READERS lists the sources that read from the table, and a loop over the directory's targets links gta6rt_core into every target that compiles one of them. 18 targets compile src/pe_loader.cpp themselves, so naming the library at each of them would be 18 edits per moved file; the list goes when the layers are libraries that carry the dependency themselves. What changes for a user: these three settings now also take a value from leonida.toml (true and false are read as 1 and 0), the variable still wins. A variable that is set but empty now counts as not set and falls through to the file; without a file the result is what it was (the check is not skipped, the patch stays on, no compat folder). AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66: - build.ninja after a reconfigure: 19 targets compile host_cpu.cpp or pe_loader.cpp and all 19 link gta6rt_core.lib; the only other target that links it is core_config_test. ctest still lists 269 tests. - Build of those 19 targets, core_config_test and the 24 tiny_* fixtures: no error. - ctest over the 38 tests that run one of those targets or gta6rt: 30 pass, 7 print SKIP for want of game files (bink_decode, bink_abi, bink_play_headless, bink_audio, fsr_dispatch, bvh_builder, d3d12_boot_movie), and run_module_names hits its 90 s limit three times. Run by hand without the limit it reports 22 children and 0 failures in 138 s, of which 137 s are its native children (12 to 23 s for each freshly copied program, gta6rt not involved) and under 1 s the 15 children under gta6rt. Whether it also times out on the commit before this one was not measured. - By hand: `gta6rt config` with skip_cpu_check = true in a file named by LEONIDA_CONFIG, then with LEONIDA_SKIP_CPU_CHECK=0 over it. - python -I on test_docs_env_vars, test_docs_cli_flags, test_build_runtime_fallback, test_runtime_paths, test_ci_registration, test_ctest_registration, test_cmake_vulkan_missing, test_cmake_translator_deps, test_text_write_line_endings and test_check_no_game_data: all pass. Not tested: Linux, macOS, clang-cl and Wine (host_cpu.cpp without <cstdlib> was not compiled there); the cl.exe fallback build; the whole ctest suite; the pytest-based tests. No test sets tls_ga_patch or compat_dir through a file yet; the table's order of sources is covered by core_config_test.
…able Third part of step 2 of the groundwork refactor. - shims/registry.cpp: unimplemented_policy() takes loader.unimplemented from rt::config::get() instead of GetEnvironmentVariableA. It is still read once per process and kept in g_policy. Unset or empty is log without a warning, a value that is not log, fail or stop is log with the warning, as before; a value of 32 characters or more used to be replaced by "?" to reach that warning and now reaches it as itself. - runtime/CMakeLists.txt: shims/registry.cpp joins LEONIDA_SETTING_READERS, so the 37 targets that compile it link gta6rt_core. - scripts/build_runtime.ps1: the two cl.exe lines of the fallback that build root_sig_test and device_proxy_test compile registry.cpp themselves and now name core\config.cpp too; without it they would not link. What changes for a user: loader.unimplemented in leonida.toml now takes effect; the variable still wins. The two changed lines in build_runtime.ps1 are over 120 columns; both were already (304 to 327 and 321 to 344). AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66: - build.ninja after a reconfigure: 38 targets compile a moved reader (37 of them registry.cpp) and all 38 link gta6rt_core.lib; the only other target that links it is core_config_test. - Build of those 38 targets and core_config_test: no error. - ctest over the 64 tests that run one of those targets or gta6rt, without run_module_names: all pass, 7 of them print SKIP for want of game files (bink_decode, bink_abi, bink_play_headless, bink_audio, fsr_dispatch, bvh_builder, d3d12_boot_movie). unimplemented_policy, which sets the variable for child processes, is among those passed. - run_module_names by hand: 22 children, 0 failures in 1 s. On the commit before it took 138 s right after its fixtures were built, so the 90 s limit it hit there came from the first runs of new programs on this PC. It was not run again under ctest. - The fallback's cl.exe line for root_sig_test, typed out by hand with core\config.cpp: builds, and root_sig_test reports 0 failures. The line for device_proxy_test and the fallback script as a whole were not run. - By hand: `gta6rt config` shows loader.unimplemented from a file named by LEONIDA_CONFIG. That the file's value reaches the policy was not shown: tiny_game calls no import without a shim, so the two runs with 'bogus' and 'stop' in the file never read it. The variable's way into the policy is covered by unimplemented_policy_test, the order of sources by core_config_test. - python -I on test_docs_env_vars, test_docs_cli_flags, test_build_runtime_fallback, test_build_runtime_batch, test_runtime_paths, test_ci_registration, test_ctest_registration, test_cmake_vulkan_missing, test_text_write_line_endings and test_check_no_game_data: all pass. Not tested: Linux, macOS, clang-cl and Wine; the whole ctest suite; the pytest-based tests.
Fourth part of step 2 of the groundwork refactor. - shims/bcrypt_rng.cpp: init_bcrypt_once() takes loader.rng_seed from rt::config::get() instead of GetEnvironmentVariableA. It is still read once per process, inside InitOnceExecuteOnce. Unset or empty means no seed, a value strtoull does not take whole means no seed, and a value of 64 characters or more is still not taken as a seed, all as before. - runtime/CMakeLists.txt: shims/bcrypt_rng.cpp joins LEONIDA_SETTING_READERS. The two targets that compile it, gta6rt and bcrypt_rng_test, already linked gta6rt_core through registry.cpp, so no link line changes; the entry keeps the list complete. What changes for a user: loader.rng_seed in leonida.toml now takes effect (a number, decimal or with 0x); the variable still wins. AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66: - build.ninja after a reconfigure: 38 targets compile a moved reader and all 38 link gta6rt_core.lib; the only other target that links it is core_config_test. - Build of gta6rt, bcrypt_rng_test, core_config_test and tiny_game: no error. - ctest bcrypt_rng, bcrypt_rng_seeded (which sets the variable through its ENVIRONMENT property), unimplemented_policy, core_config, host_cpu, run_tiny_game, run_tiny_game_dir, gta6rt_stack and the three gta6rt_rejects_*: all 11 pass. - python -I on test_docs_env_vars, test_docs_cli_flags, test_build_runtime_fallback, test_build_runtime_batch, test_runtime_paths, test_ci_registration, test_ctest_registration, test_cmake_vulkan_missing, test_text_write_line_endings and test_check_no_game_data: all pass. Not shown: that a seed in the file reaches the generator. Four runs of tiny_game under gta6rt (nothing set, the variable, a seed in the file, text in the file) printed no bcrypt line at all, because tiny_game never calls bcrypt, so the seed was not read in any of them. The variable's way to the generator is covered by bcrypt_rng_seeded, the order of sources by core_config_test. Not tested: Linux, macOS, clang-cl and Wine; the cl.exe fallback build; the whole ctest suite; the pytest-based tests.
Fifth part of step 2 of the groundwork refactor.
- shims/xgameruntime.cpp: seven reads of six variables move from
GetEnvironmentVariableA/W to rt::config:
system.device_type (LEONIDA_DEVICE_TYPE)
system.analytics_form (LEONIDA_ANALYTICS_FORM)
system.package_id (LEONIDA_PACKAGE_ID, read in two places; now
one helper, configured_package_identifier)
system.content_packages (LEONIDA_CONTENT_PACKAGES)
system.packaged (LEONIDA_PACKAGED)
paths.game_dir (LEONIDA_GAME_DIR, in package_config)
Each is still read at every call, as before, so a test that sets a
variable in its own process sees it at the next call.
- The length limits of the old buffers are kept as explicit checks: a
device type or packaged value of 16 characters or more, a form of 64
or more, a package id of 33 or more and a game folder of MAX_PATH or
more are ignored and the default is used, as before.
- runtime/CMakeLists.txt: shims/xgameruntime.cpp joins
LEONIDA_SETTING_READERS. The six targets that compile it already
linked gta6rt_core through registry.cpp, so no link line changes.
What changes for a user: these six settings in leonida.toml now take
effect; the variable still wins. A package id or an analytics form with
characters outside ASCII now reaches the title as UTF-8, where the old
read gave the bytes of the ANSI code page, and its length limit counts
UTF-8 bytes. LEONIDA_GAME_DIR and LEONIDA_CONTENT_PACKAGES were read
wide before and are unchanged.
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66:
- build.ninja after a reconfigure: 38 targets compile a moved reader
(6 of them xgameruntime.cpp) and all 38 link gta6rt_core.lib; the
only other target that links it is core_config_test.
- Build of those 38 targets, core_config_test and tiny_game: no error.
- ctest over the 32 tests that run a target compiling xgameruntime.cpp,
core_config_test or gta6rt: all pass, among them xgameruntime (which
sets LEONIDA_GAME_DIR narrow and wide, LEONIDA_CONTENT_PACKAGES
narrow and wide, LEONIDA_PACKAGE_ID and LEONIDA_PACKAGED in its own
process), xgameruntime_user, xgameruntime_gamesave,
xgameruntime_store, xgameruntime_offline and their three variants.
- By hand: `gta6rt config` shows device_type, packaged and package_id
from a file named by LEONIDA_CONFIG. That shows the table only; no
test sets one of the six through a file and then asks the shim.
- python -I on test_docs_env_vars, test_docs_cli_flags,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_text_write_line_endings and
test_check_no_game_data: all pass.
Not tested: LEONIDA_DEVICE_TYPE and LEONIDA_ANALYTICS_FORM have no test
that sets them, before or after this change; the over-long values that
the explicit length checks refuse; Linux, macOS, clang-cl and Wine; the
cl.exe fallback build; the whole ctest suite; the pytest-based tests.
Sixth part of step 2 of the groundwork refactor. - shims/xgameruntime_user.cpp: system.gamertag (LEONIDA_GAMERTAG), still read once per process inside call_once. A tag longer than 15 characters or with a character outside printable ASCII is refused with the same warning as before and "Player" is used. - shims/xgameruntime_offline.cpp: system.log_game_events (LEONIDA_LOG_GAME_EVENTS) and system.hdr (LEONIDA_HDR), each on for exactly "1" and read once per process, as before. - shims/xgameruntime_gamesave.cpp: paths.save_dir (LEONIDA_SAVE_DIR), read at each call as before. A folder of MAX_PATH * 2 characters or more is still ignored. The fallback to %LOCALAPPDATA%\Leonida\saves keeps its own read of LOCALAPPDATA, which is not a setting. - runtime/CMakeLists.txt: the three files join LEONIDA_SETTING_READERS. The six targets that compile them already linked gta6rt_core through registry.cpp, so no link line changes. What changes for a user: these four settings in leonida.toml now take effect (true and false are read as 1 and 0); the variable still wins. Two details differ from before: - The two gamertag warnings name LEONIDA_GAMERTAG also when the refused value came from the file. - The gamertag's length is counted in UTF-8 bytes, where the old read counted bytes of the ANSI code page. A tag with characters outside ASCII was refused before and is refused now; only which of the two warnings it gets can differ. AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66: - build.ninja after a reconfigure: 38 targets compile a moved reader (6 of them one of these three files) and all 38 link gta6rt_core.lib; the only other target that links it is core_config_test. - Build of those 6 targets, core_config_test and tiny_game: no error. - ctest over the 32 tests that run one of those targets, core_config_test or gta6rt: all pass. Among them are xgameruntime_offline_hdr (LEONIDA_HDR=1), xgameruntime_user_gamertag (LEONIDA_GAMERTAG=Tester42) and xgameruntime_user_gamertag_long (a tag of 70 characters, refused), which set the variable through their ENVIRONMENT property, and xgameruntime_gamesave, which sets LEONIDA_SAVE_DIR wide in its own process. - python -I on test_docs_env_vars, test_docs_cli_flags, test_build_runtime_fallback, test_build_runtime_batch, test_runtime_paths, test_ci_registration, test_ctest_registration, test_cmake_vulkan_missing, test_text_write_line_endings and test_check_no_game_data: all pass. Not tested: LEONIDA_LOG_GAME_EVENTS has no test that sets it, before or after this change; no test sets one of the four through a file and then asks the shim (the order of sources is covered by core_config_test); a gamertag with characters outside ASCII; a save folder of MAX_PATH * 2 characters or more; Linux, macOS, clang-cl and Wine; the cl.exe fallback build; the whole ctest suite; the pytest-based tests.
…table
Seventh part of step 2 of the groundwork refactor.
- shims/d3d12_xs.cpp: d3d12.backend (LEONIDA_D3D12), read at each
D3D12XboxCreateDevice as before; the Vulkan-backed device is taken for
exactly "vulkan".
- shims/d3d12_xs_device.cpp:
d3d12.xs_trace (XS_TRACE), read once per process: on for a value
that does not start with 0; a value of 8 characters or more is
still ignored.
d3d12.frame_interval_slot, d3d12.schedule_event_slot,
d3d12.wait_event_slot, d3d12.queue_x_slot, d3d12.list_x_slot (the
five LEONIDA_XS_*_SLOT variables), read once per process.
env_device_slot() now takes the setting instead of the variable's
name. A slot outside 3..127, text that is not a number and a value
of 32 characters or more keep the default with the same two
messages as before. The defaults of the table (78, 79, 80, 48, 73)
are those of XboxDeviceSlotRoutes; when nothing sets a slot the
struct's value is used and the table's default is not parsed.
- runtime/CMakeLists.txt: the two files join LEONIDA_SETTING_READERS.
d3d12_xs_device.cpp is also compiled by the static library
gta6rt_d3d12_com, so gta6rt_core now travels with that library to the
73 programs that link it. 117 targets link gta6rt_core.lib after this
change (39 before): 43 compile a moved reader, 73 get it through
gta6rt_d3d12_com, and core_config_test.
- scripts/build_runtime.ps1 needs no change: its three cl.exe lines
that compile one of the two files already name core\config.cpp.
What changes for a user: these seven settings in leonida.toml now take
effect; the variable still wins. The two slot messages name the
variable also when the refused value came from the file.
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66:
- build.ninja after a reconfigure: 43 targets compile a moved reader
(13 of them one of these two files) and all 43 link gta6rt_core.lib;
no target links gta6rt_d3d12_com.lib without gta6rt_core.lib.
- Build of all 117 targets that link gta6rt_core.lib: no error, no
output missing, nothing left out of date.
- ctest over the 41 tests that run a target compiling one of the two
files, core_config_test or gta6rt: all pass, 3 of them print SKIP for
want of game files (fsr_dispatch, bvh_builder, d3d12_first_light).
Among those passed are xs_proxy_mock_env_slots and
xs_proxy_mock_env_slots_invalid, which set the five slot variables,
and device_proxy, device_proxy_trace and root_sig.
- ctest d3d12_com, queue_proxy, allocator_proxy, dxgi_device and
xbox_present (five of the 73 programs that now get gta6rt_core
through gta6rt_d3d12_com), and run_tiny_frame and
run_tiny_frame_queue_test_settings, which run gta6rt with
LEONIDA_D3D12=vulkan: all 7 pass.
- python -I on test_docs_env_vars, test_docs_cli_flags,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_text_write_line_endings and
test_check_no_game_data: all pass.
Not tested: XS_TRACE has no test that sets it, before or after this
change (device_proxy_trace uses --trace-d3d12); no test sets one of the
seven through a file and then asks the shim (the order of sources is
covered by core_config_test); the tests of the other 68 programs that
link gta6rt_d3d12_com were built but not run; Linux, macOS, clang-cl
and Wine; the cl.exe fallback build; the whole ctest suite; the
pytest-based tests.
Eighth part of step 2 of the groundwork refactor.
- shims/xbox_present.cpp, both read once per XboxPresentation, in its
constructor, as before:
present.sdr_eotf (LEONIDA_SDR_EOTF): gamma22 or 2.2 in any case
gives the pure power of 2.2, srgb or nothing set keeps piecewise
sRGB, anything else is refused with the same message as before. A
value of 32 characters or more still gets the "too long" message;
that was the ERANGE of the old 32-character buffer and is now an
explicit length check.
present.uncap (LEONIDA_PRESENT_UNCAP): on for a non-empty value
other than "0", with the same message as before.
- runtime/CMakeLists.txt: shims/xbox_present.cpp joins
LEONIDA_SETTING_READERS. Its only target is the static library
gta6rt_d3d12_com, which already linked gta6rt_core through
d3d12_xs_device.cpp, so no link line changes.
- scripts/build_runtime.ps1 needs no change: no cl.exe line of the
fallback compiles xbox_present.cpp.
What changes for a user: these two settings in leonida.toml now take
effect (uncap = true is read as 1); the variable still wins. The
messages name the variable also when the value came from the file.
<cerrno> is no longer needed by this file and is left in; the include
list is tidied when the file moves to its layer folder.
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66:
- build.ninja after a reconfigure: 43 targets compile a moved reader
and all 43 link gta6rt_core.lib; 117 targets link gta6rt_core.lib, as
before this change; none of the 81 targets that link
gta6rt_d3d12_com.lib does so without gta6rt_core.lib.
- Build of gta6rt_d3d12_com, gta6rt, core_config_test, tiny_game,
xbox_present_test, d3d12_present_test, dxgi_swapchain_test,
d3d12_com_test, queue_proxy_test and frame_pacer_test: no error. The
four warnings it prints are in src/vulkan_present.h (three C4996 for
getenv, one C4189), which this change does not touch.
- ctest over the 30 tests that run one of those programs or gta6rt: all
pass, among them xbox_present, d3d12_present, dxgi_swapchain,
frame_pacer, d3d12_com, queue_proxy, run_tiny_frame and
run_tiny_frame_queue_test_settings.
- python -I on test_docs_env_vars, test_docs_cli_flags,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_text_write_line_endings and
test_check_no_game_data: all pass.
Not tested: neither LEONIDA_SDR_EOTF nor LEONIDA_PRESENT_UNCAP has a
test that sets it, before or after this change, so the tests above only
show the path with nothing set; frame_pacer covers set_uncapped itself.
No test sets one of the two through a file and then asks the shim (the
order of sources is covered by core_config_test). The other programs
that link gta6rt_d3d12_com were not rebuilt or run for this change.
Linux, macOS, clang-cl and Wine; the cl.exe fallback build; the whole
ctest suite; the pytest-based tests.
Ninth part of step 2 of the groundwork refactor.
- shims/gameinput.cpp: env() takes a setting of the table instead of the
variable's name, and read_config() names the ten settings:
input.ds_triggers (LEONIDA_DS_TRIGGERS)
input.ds_trigger_gain (LEONIDA_DS_TRIGGER_GAIN)
input.ds_trigger_freq (LEONIDA_DS_TRIGGER_FREQ)
input.ds_lightbar (LEONIDA_DS_LIGHTBAR)
input.mouse_sensitivity (LEONIDA_MOUSE_SENSITIVITY)
input.rumble (LEONIDA_RUMBLE)
input.thread (LEONIDA_GAMEINPUT_THREAD)
input.keyboard_pad (LEONIDA_KEYBOARD_PAD)
input.prompts (LEONIDA_PROMPTS)
input.prompts_switch_ms (LEONIDA_PROMPTS_SWITCH_MS)
read_config() is still called where it was, so a variable a test sets
in its own process is seen at the next read. The value is lower-cased
as before, and a value of 64 characters or more is still ignored (the
size of the old buffer, now an explicit check). The value lists, the
clamps and the messages of read_config() are unchanged. When nothing
sets a setting, env() returns nothing and the default of
rt::gameinput::Config is used; the table's defaults repeat those and
are not parsed.
- runtime/CMakeLists.txt: shims/gameinput.cpp joins
LEONIDA_SETTING_READERS. The three targets that compile it (gta6rt,
gameinput_test, gameinput_probe) already linked gta6rt_core through
registry.cpp, so no link line changes.
- scripts/build_runtime.ps1 needs no change: the cl.exe fallback builds
without the GameInput shim and compiles gameinput.cpp nowhere.
What changes for a user: these ten settings in leonida.toml now take
effect (rumble = false and thread = false are read as 0, keyboard_pad =
true as 1); the variable still wins. The messages name the variable
also when the refused value came from the file.
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66, with the
pinned SDL3 3.4.20 that -DLEONIDA_SDL3_FETCH=ON downloads and checks by
hash (without SDL3 this file is not compiled at all):
- build.ninja after a reconfigure: 45 targets compile a moved reader
(3 of them gameinput.cpp) and all 45 link gta6rt_core.lib.
- Build of gta6rt, gameinput_test, gameinput_probe, core_config_test
and tiny_game: no error and no warning in a file of this repository.
- ctest over the 26 tests that run one of those programs or gta6rt: all
pass, among them gameinput (364 checks, 0 failures) and
gameinput_host. gameinput_test sets LEONIDA_MOUSE_SENSITIVITY,
LEONIDA_KEYBOARD_PAD, LEONIDA_PROMPTS, LEONIDA_PROMPTS_SWITCH_MS,
LEONIDA_RUMBLE, LEONIDA_DS_TRIGGERS, LEONIDA_DS_LIGHTBAR and
LEONIDA_GAMEINPUT_THREAD in its own process, an unknown
LEONIDA_PROMPTS and a value in mixed case among them.
- python -I on test_docs_env_vars, test_docs_cli_flags,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_text_write_line_endings and
test_check_no_game_data: all pass.
Not tested: LEONIDA_DS_TRIGGER_GAIN and LEONIDA_DS_TRIGGER_FREQ have no
test that sets them, before or after this change; no test sets one of
the ten through a file and then asks the shim (the order of sources is
covered by core_config_test); a value of 64 characters or more; a real
controller (the tests use SDL's virtual devices); gameinput_probe was
built but not run; a build without SDL3 after this change (there the
file is left out, as before); Linux, macOS, clang-cl and Wine; the
cl.exe fallback build; the whole ctest suite; the pytest-based tests.
…ings table
Tenth part of step 2 of the groundwork refactor.
- shims/d3d12_vulkan_device.cpp, each read where and as often as before:
vulkan.graphics_family_only (LEONIDA_VK_GRAPHICS_FAMILY_ONLY)
vulkan.max_queues_per_family (LEONIDA_VK_MAX_QUEUES_PER_FAMILY)
queue_test_setting() takes a setting of the table and hands the
text back as a std::string. Set on the game's device, it still
says that the device ignores the test setting.
vulkan.upload_sysmem (LEONIDA_UPLOAD_SYSMEM)
vulkan.bindless_idle_wait (LEONIDA_BINDLESS_IDLE_WAIT)
vulkan.arena_log (LEONIDA_ARENA_LOG)
vulkan.validation (LEONIDA_VK_VALIDATION)
on for a value that does not start with 0.
vulkan.arena_mb (LEONIDA_ARENA_MB): the text goes to
decide_arena_size as written; with nothing set it still gets
nullptr, not the table's default.
vulkan.rt_as (LEONIDA_RT_AS): exactly khr, as before.
present.no_tear (LEONIDA_PRESENT_NO_TEAR): tearing is allowed when
the value is empty or 0, as before.
paths.shaders (LEONIDA_SHADERS): configured_shader_directory()
takes it before shader_path.txt, as before.
The length limits of the old buffers (4, 8 or 16 characters) are kept
as explicit size checks: a longer value is ignored as it was. The
messages are unchanged and name the variable also when the value came
from the file.
- runtime/CMakeLists.txt: shims/d3d12_vulkan_device.cpp joins
LEONIDA_SETTING_READERS. Its only target is the static library
gta6rt_d3d12_com, which already linked gta6rt_core, so no link line
changes.
- scripts/build_runtime.ps1 needs no change: no cl.exe line of the
fallback compiles d3d12_vulkan_device.cpp.
What changes for a user: these ten settings in leonida.toml now take
effect (true is read as 1, false as 0); the variable still wins.
LEONIDA_SHADERS now passes through UTF-8 on its way to a path, like
every other value of the table.
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66:
- build.ninja after a reconfigure: 45 targets compile a moved reader
and all 45 link gta6rt_core.lib; 119 targets link gta6rt_core.lib, as
before this change; none of the 81 targets that link
gta6rt_d3d12_com.lib does so without gta6rt_core.lib.
- Build of the 84 targets that link gta6rt_d3d12_com.lib, plus gta6rt,
core_config_test and tiny_game: no error.
- ctest over the 116 tests that run one of those programs or gta6rt:
8 fail, the other 108 pass or are skipped. The 8 are
d3d12_vulkan_device, d3d12_dxr_validation_khr, d3d12_r9g9b9e5_uav,
d3d12_existing_heap, d3d12_close_parity, d3d12_subresource_copy,
d3d12_heap_properties and d3d12_set_descriptor_heaps. With this
change set aside and their programs rebuilt from the parent commit,
the same 8 fail with the same failure lines, so this change is not
their cause. d3d12_heap_properties was known to fail on this PC (4
mismatches against the NVIDIA host driver); whether the other 7
already fail on main was not looked at.
- Tests that set a moved variable: d3d12_queue_share_one_queue and
d3d12_queue_wait_one_queue (LEONIDA_VK_MAX_QUEUES_PER_FAMILY=1 and
LEONIDA_VK_GRAPHICS_FAMILY_ONLY=1), d3d12_indirect_rt_upload_sysmem
(LEONIDA_UPLOAD_SYSMEM=1), d3d12_shader_path (LEONIDA_SHADERS) and
xbox_present (LEONIDA_PRESENT_NO_TEAR=1) pass.
d3d12_dxr_validation_khr (LEONIDA_RT_AS=khr) is one of the 8 above:
"failed to allocate synthetic buffers", before and after alike.
- python -I on test_docs_env_vars, test_docs_cli_flags,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_text_write_line_endings and
test_check_no_game_data: all pass.
Not tested: no test that ran here sets LEONIDA_ARENA_MB,
LEONIDA_ARENA_LOG, LEONIDA_BINDLESS_IDLE_WAIT or LEONIDA_VK_VALIDATION
for this file (d3d12_bindless_churn_test.cpp and
d3d12_stores_atomics_test.cpp set the last two, but no test of this
build runs a program of that name); the KHR path of LEONIDA_RT_AS=khr
past the point where its test fails on this GPU; a value too long for
one of the old buffers; no test sets one of the ten through a file and
then asks the device (the order of sources is covered by
core_config_test). Linux, macOS, clang-cl and Wine; the cl.exe fallback
build; the whole ctest suite; the pytest-based tests.
Eleventh part of step 2 of the groundwork refactor.
- src/main.cpp: the place that makes LEONIDA_SHADERS absolute before
the title can change the current directory now takes the value from
rt::config::path("paths.shaders"), so from the variable or, when that
is not set, from leonida.toml. It still writes the absolute path into
the variable LEONIDA_SHADERS, at the same point of startup as before;
the device's reader (configured_shader_directory in
shims/d3d12_vulkan_device.cpp) then finds it there, since the
variable wins over the file. With nothing set the variable stays
unset, as before.
- runtime/CMakeLists.txt: src/main.cpp joins LEONIDA_SETTING_READERS.
Its only target is gta6rt, which already linked gta6rt_core, so no
link line changes.
- scripts/build_runtime.ps1 needs no change: the cl.exe fallback
already compiles core\config.cpp together with src\main.cpp.
What changes for a user: paths.shaders in leonida.toml now takes effect
in gta6rt. A relative path there is taken from the folder gta6rt was
started in, like a relative LEONIDA_SHADERS, and not from the folder of
the settings file. The value now passes through UTF-8 on its way to a
path, like every other value of the table.
main.cpp has no reader of the environment left. Still reading the
environment themselves are the three header-only readers
(src/vulkan_present.h, src/vulkan_device_filter.h,
shims/startup_trace.h) and the two internal variables.
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66:
- build.ninja after a reconfigure: 45 targets compile a moved reader
and all 45 link gta6rt_core.lib; 119 targets link gta6rt_core.lib, as
before this change.
- Build of gta6rt, core_config_test, tiny_game and
d3d12_shader_path_test: no error and no warning in main.cpp.
- ctest over the 25 tests that run one of those programs or gta6rt: all
pass, among them core_config, d3d12_shader_path, the three
gta6rt_rejects_* tests, run_argv_modes, run_module_names,
run_tiny_frame and run_tiny_frame_queue_test_settings.
- python -I on test_docs_env_vars, test_docs_cli_flags,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_text_write_line_endings and
test_check_no_game_data: all pass.
Not tested: no test starts gta6rt with LEONIDA_SHADERS set, relative or
absolute, before or after this change, and none sets paths.shaders in a
settings file, so the tests above only show the path with nothing set.
d3d12_shader_path covers the device's reader in its own process, not
this rewrite. Linux, macOS, clang-cl and Wine; the cl.exe fallback
build; the whole ctest suite; the pytest-based tests.
Twelfth part of step 2 of the groundwork refactor, and the first of the
three header-only readers.
- src/vulkan_present.h reads no setting itself any more. VulkanPresenter
takes a new last constructor argument, PresentCapture {dir, every,
limit}, with the old defaults (no folder, 30, 24). The folder is kept
as a std::filesystem::path instead of a std::string, and the frame
files and index.txt are named with operator/ instead of by joining
text. The messages are unchanged; they print the folder as UTF-8.
- shims/d3d12_vulkan_device.cpp: create_window_presenter(), the only
place of the runtime that makes a presenter, fills PresentCapture from
present.capture_dir (LEONIDA_CAPTURE)
present.capture_every (LEONIDA_CAPTURE_EVERY)
present.capture_limit (LEONIDA_CAPTURE_LIMIT)
The two numbers are still read with atoi and raised to 1 by the
presenter.
- runtime/CMakeLists.txt needs no change: the header needs nothing from
gta6rt_core, and d3d12_vulkan_device.cpp is already in
LEONIDA_SETTING_READERS. A header that takes its values as arguments
keeps the test programs and the cl.exe fallback lines that include it
free of a new library.
What changes for a user: these three settings in leonida.toml now take
effect in gta6rt; the variable still wins. The folder now passes
through UTF-8 on its way to a path, like every other value of the
table, instead of through the ANSI code page. A program that makes a
VulkanPresenter itself no longer follows LEONIDA_CAPTURE; in this
repository that is vk_presenter_sync_test only, which does not set it.
AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18),
Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66:
- Build of gta6rt_d3d12_com, gta6rt, core_config_test, tiny_game,
tiny_frame, d3d12_present_test, xbox_present_test,
vk_presenter_sync_test, dxgi_swapchain_test,
dxgi_waitable_latency_test, frame_pacer_test, d3d12_shader_path_test
and d3d12_queue_share_test: no error. The one warning left in
vulkan_present.h is the C4189 that was there before; the three C4996
for getenv are gone with the reads.
- ctest over the 37 tests that run one of those programs or gta6rt: all
pass, among them vk_presenter_sync, d3d12_present, xbox_present,
dxgi_swapchain, dxgi_waitable_latency, run_tiny_frame,
run_tiny_frame_queue_test_settings and frame_pacer.
- d3d12_present_test sets LEONIDA_CAPTURE, LEONIDA_CAPTURE_EVERY=1 and
LEONIDA_CAPTURE_LIMIT=4 in its own process; run by hand it prints
"capture on: every 1 presented frame(s), at most 4", writes four
frames and reports "4 correct images, 4 index rows, 4 matching frame
colours".
- python -I on test_docs_env_vars, test_docs_cli_flags,
test_build_runtime_fallback, test_build_runtime_batch,
test_runtime_paths, test_ci_registration, test_ctest_registration,
test_cmake_vulkan_missing, test_text_write_line_endings and
test_check_no_game_data: all pass.
Not tested: a capture folder with characters outside ASCII; a capture
with the two numbers left at their defaults; a surface that refuses the
capture; no test sets one of the three through a file and then asks the
presenter (the order of sources is covered by core_config_test). The
other programs that link gta6rt_d3d12_com were not rebuilt or run for
this change. Linux, macOS, clang-cl and Wine; the cl.exe fallback
build; the whole ctest suite; the pytest-based tests.
…ttings table Thirteenth part of step 2 of the groundwork refactor, and the second of the three header-only readers. - shims/startup_trace.h reads no setting itself any more. The handler's skip_int3() asks a switch, off until rt::startup_trace::set_skip_int3() turns it on, instead of reading LEONIDA_SKIP_INT3 once per process. - src/main.cpp sets the switch from loader.skip_int3 (LEONIDA_SKIP_INT3) before it opens the trace, so before the exception handler exists. The variable turns it on with any value, also 0, as before. A value from leonida.toml turns it on unless it is 0, so skip_int3 = false in the file means off. - test/int3_skip_test.cpp calls set_skip_int3(true) instead of setting the variable; its five checks are unchanged. - cmake/windows_runtime.cmake: the comment above int3_skip_test. - runtime/CMakeLists.txt needs no change: the header needs nothing from gta6rt_core, and src/main.cpp is already in LEONIDA_SETTING_READERS. A header that is told its value keeps the seven sources and four tests that include it free of a new library. - scripts/build_runtime.ps1 needs no change: the cl.exe fallback already compiles core\config.cpp together with src\main.cpp, and no line of it builds int3_skip_test. What changes for a user: loader.skip_int3 in leonida.toml now takes effect in gta6rt; the variable still wins. A program other than gta6rt that includes startup_trace.h no longer follows LEONIDA_SKIP_INT3; in this repository those are test programs, and only int3_skip_test used it. AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66: - Build of gta6rt, int3_skip_test, startup_trace_test, xmem_test, file_system_test, core_config_test and tiny_game: no error and no warning in the changed files. A first attempt did not build (the new function had landed inside namespace detail); this is the corrected one. - ctest over the 28 tests that run one of those programs or gta6rt: all pass, among them int3_skip, startup_trace, xmem, file_system and core_config. - int3_skip_test by hand: "all checks passed" (execution continues past every int3, two int3_skipped events for two addresses, no exception event for a skipped int3). - python -I on test_docs_env_vars, test_docs_cli_flags, test_build_runtime_fallback, test_build_runtime_batch, test_runtime_paths, test_ci_registration, test_ctest_registration, test_cmake_vulkan_missing, test_text_write_line_endings and test_check_no_game_data: all pass. Not tested: no test starts gta6rt with LEONIDA_SKIP_INT3 set or with skip_int3 in a settings file, before or after this change, so the lines added to main.cpp are only shown to build and to leave the switch off when nothing is set; int3_skip_test covers the switch itself. The other programs that include startup_trace.h were not rebuilt or run for this change. Linux, macOS, clang-cl and Wine; the cl.exe fallback build; the whole ctest suite; the pytest-based tests.
…table Fourteenth part of step 2 of the groundwork refactor, and the last of the three header-only readers. - src/vulkan_device_filter.h: vulkan_device_wanted() gets a second form that takes the filter as an argument, and vulkan_device_filter_of() lower-cases a text into a filter. The one-argument forms stay and still read the variable LEONIDA_VK_DEVICE alone: they are what the test harnesses and tools use (vk_test_device.h, vk_device_pick.h, vk_sampler_test, vk_image_fuzz, ...), which load no settings file and some of which the cl.exe fallback compiles with only /I src. - shims/d3d12_vulkan_device.cpp: create_vulkan_device_standalone() takes the filter from vulkan.device (LEONIDA_VK_DEVICE, else leonida.toml), once before the loop over the devices instead of once per device, and uses the same value for the message when no device is left. The messages are unchanged and name the variable also when the value came from the file. - runtime/CMakeLists.txt needs no change: the header needs nothing from gta6rt_core, and d3d12_vulkan_device.cpp is already in LEONIDA_SETTING_READERS. - scripts/build_runtime.ps1 needs no change, for the reason above. What changes for a user: vulkan.device in leonida.toml now takes effect for the runtime's device; the variable still wins. The runtime now reads the variable from the process environment as UTF-8, like every other value of the table, instead of from the C runtime's copy. The test programs and tools follow the variable only, as before. With this, no source of the runtime reads a setting of the table from the environment by itself, except the one-argument forms above, which are kept on purpose. The two internal variables (LEONIDA_BASE_RESERVED, LEONIDA_RT_ENV_INIT) and LOCALAPPDATA are not settings and stay direct reads. AI-assisted. Tested on Windows 10 22H2, MSVC 14.51 (Visual Studio 18), Ninja, RelWithDebInfo, GeForce GTX 1070 Ti, driver 582.66: - Build of gta6rt_d3d12_com, gta6rt, core_config_test, tiny_game, tiny_frame, vulkan_device_filter_test, d3d12_indirect_rt_test, dxgi_swapchain_test, dxgi_waitable_latency_test, vk_image_fuzz, vk_sampler_test, vk_bindless_test, vk_descriptor_bench, vk_sandbox, d3d12_queue_share_test, d3d12_queue_wait_test, d3d12_shader_path_test, d3d12_present_test and xbox_present_test: no error and no warning in the two files. - ctest over the 43 tests that run one of those programs: all pass, among them vulkan_device_filter, vk_device_filter_tools, d3d12_queue_share, d3d12_queue_wait, d3d12_indirect_rt, d3d12_present, xbox_present, dxgi_swapchain, run_tiny_frame and vk_descriptor_bench_selftest. - d3d12_queue_share_test by hand, which makes the runtime's device: with LEONIDA_VK_DEVICE=zzz-no-such-gpu it prints "no GPU named by LEONIDA_VK_DEVICE has Vulkan 1.3 ..." and exits 77; with LEONIDA_VK_DEVICE="1070 TI" (other case than the device's name) it takes the GeForce GTX 1070 Ti and passes. - python -I on test_docs_env_vars, test_docs_cli_flags, test_build_runtime_fallback, test_build_runtime_batch, test_runtime_paths, test_ci_registration, test_ctest_registration, test_cmake_vulkan_missing, test_text_write_line_endings and test_check_no_game_data: all pass. Not tested: no test sets vulkan.device through a file and then asks the device (the order of sources is covered by core_config_test); a PC with more than one usable GPU, where the filter decides which one is taken; a filter with characters outside ASCII. The other programs that link gta6rt_d3d12_com were not rebuilt or run for this change. Linux, macOS, clang-cl and Wine; the cl.exe fallback build; the whole ctest suite; the pytest-based tests.
…shed Last part of step 2 of the groundwork refactor. - runtime/README.md, section "Settings: leonida.toml and gta6rt config": the paragraph "State of the move" said that readers were still being moved to the table and that a reader not yet moved ignored the settings file. The last reader moved in the commit before this one, so the paragraph goes, as it announced. In its place two lines say what is still true and easy to trip over: only gta6rt loads a settings file; the test programs and tools load none, so for them a setting comes from its environment variable or is the default. (core_config_test reads settings files to test the reader itself; it is not a program a setting is meant for.) No source file changes. AI-assisted. Tested on Windows 10 22H2: - git grep over runtime, docs, scripts, tests, README.md, CONTRIBUTING.md and AGENTS.md finds no other text that calls the move unfinished. - python -I on test_docs_env_vars, test_docs_cli_flags, test_build_runtime_fallback, test_build_runtime_batch, test_runtime_paths, test_ci_registration, test_ctest_registration, test_cmake_vulkan_missing (3 of its 5 tests skipped in this run), test_text_write_line_endings and test_check_no_game_data: all pass. Not tested: nothing was built or run with ctest for this change, since it only changes a document; the pytest-based tests.
Read-only study of a local ztrx source snapshot (no git history) compared with refactor/layers at abdaf16. Text only: no ztrx code is quoted, nothing was built or run in either tree, nothing was written into the ztrx folder and no game file was opened. - Licence: ztrx is GPL-3.0-or-later, compatible with Leonida. Two loader files that say they are ported from XCL (GPL-2.0-only) are off limits. - Finding: ztrx has no Vulkan path. It renders on host D3D12 with a DXIL emitter of its own and has no handling for the GeForce 10 series. - Gap table per area (loader, settings, console API, GPU and frame, shaders) with risk, effort and a main-frame mark; parts that were not compared are marked as such. - ztrx solves none of the eight failing d3d12_* tests. - The backend for the main frame (Vulkan or host D3D12) is left open for the maintainer. AI-assisted. Tested (Windows 10, Python 3.14.7; no build, no GPU involved): the ten text tests and fourteen more docs and text tests, 24 files, all OK (test_cmake_vulkan_missing skips 3 as before); git diff --check; no line over 120 columns; scripts/check_no_game_data.py on the new file. Not tested: nothing in the document was verified by running ztrx or gta6rt. The page is not yet listed in docs/README.md.
…has no memory type Tests: d3d12_subresource_copy, d3d12_r9g9b9e5_uav, d3d12_vulkan_device (lines 173 and 7033/7034), d3d12_heap_properties (2 of its 4 mismatches). Category b: a bug in the Vulkan layer, fixed in product code. Cause, measured on a GTX 1070 Ti with NVIDIA 582.66: the driver reports VK_EXT_host_image_copy and accepts VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT in the image format query and in vkCreateImage, but vkGetImageMemoryRequirements then answers memoryTypeBits 0 for the image (0x82 for the same image without the usage). No memory type could be chosen, so create_texture returned E_OUTOFMEMORY for every texture in a CPU-visible custom heap. Fix: when a host-transfer image names no memory type, destroy it, make it again without the usage and log once. WriteToSubresource and ReadFromSubresource on such a texture take the staging copy, the path the layer already has for a device without the extension. docs/d3d12_vulkan.md names the case. Tested on Windows 10 22H2, GTX 1070 Ti, NVIDIA 582.66, MSVC 14.51, Ninja RelWithDebInfo, each test alone with ctest -R: - d3d12_subresource_copy: failed (line 391), now passes. - d3d12_r9g9b9e5_uav: failed (line 669), now passes. - d3d12_heap_properties: 4 mismatches, now 2. The two left are heaps of more than one resource category, another cause, handled in the next commit. - d3d12_vulkan_device: lines 173 and 7033/7034 no longer fail and the CPU copies match on both paths. It still fails at line 7307, the same other cause. - 20 text and docs tests, git diff --check, check_no_game_data. Not tested: the whole ctest suite (run once at the end of this branch), other GPUs and drivers, Wine, Linux. The Vulkan validation layer is not installed on this PC. Nothing was run with game files. AI-assisted.
… tier 1 host Tests: d3d12_vulkan_device (heap_mismatches <= 0 and placed_mismatches <= 0), d3d12_heap_properties (its last 2 mismatches). Category c: a test expectation that does not hold on this hardware. Cause, measured on a GTX 1070 Ti with NVIDIA 582.66 and a scratch probe outside the repository: the host D3D12 device reports D3D12_RESOURCE_HEAP_TIER_1 and CreateHeap answers E_INVALIDARG for every heap that does not set two of the three DENY flags (default, upload and readback heaps with D3D12_HEAP_FLAG_NONE); the ALLOW_ONLY_* heaps are accepted. WARP on the same PC reports tier 2 and accepts them all. The tests treated such heaps as valid on every host: - compare_heap_neighbours: 7 "valid neighbour" heaps use D3D12_HEAP_FLAG_NONE. - compare_placed_reserved: PlacedArgs' default heap uses D3D12_HEAP_FLAG_NONE, so placed() answered E_UNEXPECTED on the host before CreatePlacedResource was reached. - d3d12_heap_properties: the two "placed ..., DEFAULT heap, ALLOW_ALL" cases. Why the expectation is corrected and not the layer: D3D12 only promises a heap of more than one resource category at tier 2; at tier 1 the refusal is the adapter's tier, not a rule about the arguments under test. The layer accepts such heaps on every GPU, and the accepted_heaps checks of d3d12_vulkan_device require that. Change: the tests read the host's ResourceHeapTier. On a tier 1 host only this pair is excused, with a printed line: the layer's S_OK against the host's E_INVALIDARG for a heap marked mixed, and, for placed cases, a host that refused the case's own mixed heap (E_UNEXPECTED from placed()). Any other difference is still a mismatch, and a tier 2 host compares everything as before. Tested on Windows 10 22H2, GTX 1070 Ti, NVIDIA 582.66, MSVC 14.51, Ninja RelWithDebInfo, each test alone with ctest -R: - d3d12_heap_properties: 2 mismatches, now passes. - d3d12_vulkan_device: failed, now passes, also when run directly. - 20 text and docs tests, git diff --check, check_no_game_data. Not tested: a tier 2 host other than by reading the code (WARP is not the comparison adapter here), other GPUs and drivers, Wine, Linux, the whole ctest suite (run once at the end of this branch). Less coverage on this PC: 46 of the 84 placed and reserved cases and the 7 heap cases are no longer compared with the host here; the test prints the count. Finding, not changed here: the layer reports D3D12_RESOURCE_HEAP_TIER_1 itself and still accepts heaps of more than one resource category. AI-assisted.
… KHR builds exist
Test: d3d12_dxr_validation_khr.
Category a: the hardware cannot do it; the test asks and skips (77)
through the suite's existing skip return code.
Cause on a GTX 1070 Ti with NVIDIA 582.66: the test runs with
LEONIDA_RT_AS=khr, which turns the XDXR records off and asks for KHR
builds. The layer enables those only with
VK_KHR_acceleration_structure, VK_KHR_deferred_host_operations and
VK_KHR_ray_query. The vulkaninfo profile of this GPU lists the first two
and no VK_KHR_ray_query, so the layer has no acceleration structures at
all: it answers a zero prebuild and refuses a buffer in the
RAYTRACING_ACCELERATION_STRUCTURE state. The log line was
"CreateCommittedResource refused (acceleration-structure state on a
device without acceleration structures)", then "Leonida Vulkan: failed
to allocate synthetic buffers" and exit 1.
The test already had the skip for this case ("neither XDXR nor KHR
acceleration structures supported, skipping"), but only after it had
made its buffers in that state, so the skip was never reached.
Change: for the layer's device (no raytracing tier reported), ask
GetRaytracingAccelerationStructurePrebuildInfo for one triangle before
the buffers are made, and skip with the same message when the answer is
zero. Nothing else in the suite changes: a device that answers a
non-zero prebuild runs every check as before.
Tested on Windows 10 22H2, GTX 1070 Ti, NVIDIA 582.66, MSVC 14.51,
Ninja RelWithDebInfo, each test alone with ctest -R:
- d3d12_dxr_validation_khr: failed, now Skipped with the message above.
- d3d12_dxr_validation (same executable, XDXR records): still passes
with "valid prebuild, GPU BLAS+TLAS build, and all strict validation
checks OK", so the new question does not skip a device that has
acceleration structures.
- The ten text tests, git diff --check, check_no_game_data.
Not tested: a GPU with VK_KHR_ray_query, where the KHR path must still
run in full (read from the code only), other drivers, Wine, Linux, the
whole ctest suite (run once at the end of this branch).
AI-assisted.
…he host serializer refuses them Test: d3d12_set_descriptor_heaps. Category c: a test expectation that does not hold on this host. Cause, measured on Windows 10 22H2 with a scratch probe outside the repository: the test serializes a root signature with CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED through the host's D3D12SerializeVersionedRootSignature. The d3d12.dll of this Windows (file version 6.2.19041.3636) answers E_INVALIDARG, "Unsupported bit-flag set (root signature flags c00)", for 0x400, 0x800 and both, in versions 1.0 and 1.1, the same answer it gives an undefined bit (0x1000). The flags up to 0x200 are accepted. The helper returned an empty blob and the test stopped at "CHECK failed: !blob.empty()" (line 341) before it reached the layer. Why the expectation is corrected and not the layer: what the test checks is that the layer keeps the two flags of a root signature it is given. The layer reads the blob itself (rt::rootsig::parse_rts0) and the game's root signatures do not come from the PC's serializer, so that the host serializer knows the flags is not something the check needs. D3D12 only has these flags from the Windows 11 era runtime on. Change: when the host serializer returns nothing for the flagged signature, the test serializes the same signature without the flags, sets the flags word in the RTS0 chunk (payload offset 20, where parse_rts0 reads it) and prints a line saying so. The checks after that are unchanged. A host whose serializer knows the flags takes the old path. If the plain signature cannot be serialized either, the test still fails. Tested on Windows 10 22H2, GTX 1070 Ti, NVIDIA 582.66, MSVC 14.51, Ninja RelWithDebInfo, the test alone with ctest -R: - d3d12_set_descriptor_heaps: failed (line 341), now passes; the output has the new line and "23 single-list cases, 7 bundle parity cases, ClearState/Reset, lifetime pinning, direct-index flags (matched host NVIDIA GeForce GTX 1070 Ti) passed". - The ten text tests, git diff --check, check_no_game_data. Not tested: a host whose serializer accepts the flags (the old path, read from the code only), other GPUs and drivers, Wine, Linux, the whole ctest suite (run once at the end of this branch). The patched blob keeps the container hash of the unflagged signature; the layer does not check that hash, and the test would fail at CreateRootSignature if it started to. AI-assisted.
…ent rule Test: d3d12_close_parity. Category c: a test expectation that does not hold on this host. Cause, measured on Windows 10 22H2 with a scratch probe outside the repository: three cases copy from a placed footprint with an unaligned offset (16, 4) or row pitch (260). The table marks them "layer stricter": WARP closes the list, the layer fails it. That column was measured on Windows 11 26200 (d3d10warp.dll 10.0.26100.9818), whose runtime reports UnrestrictedBufferTextureCopyPitchSupported. The runtime of this PC (d3d12.dll and d3d10warp.dll 10.0.19041.3636) does not know D3D12_FEATURE_D3D12_OPTIONS13 (CheckFeatureSupport answers E_INVALIDARG), and both WARP and the GTX 1070 Ti close such a list with E_INVALIDARG. The layer answers the same, so the difference the table records does not exist here and the test failed with "now matches WARP; mark it Known::match in the table" for the three cases. Why the expectation is corrected and not the layer: D3D12 wants a placed footprint's offset a multiple of 512 and its row pitch a multiple of 256 unless the device reports the capability. The layer reports it as FALSE and refuses the list, which is the rule for such a device. Marking the cases Known::match in the table, as the message suggests, would be wrong on a Windows 11 host, where the difference is still there. Change: the three cases get a flag (unaligned_footprint). The test asks the live WARP for the capability; when WARP does not report it and refuses the list itself, the case counts as a match the layer has to agree with, and the test prints that and the count. On a WARP that reports the capability, or with no live WARP (the measured column), the cases are compared as before. docs/d3d12_vulkan.md names the older runtime's answer. Tested on Windows 10 22H2, GTX 1070 Ti, NVIDIA 582.66, MSVC 14.51, Ninja RelWithDebInfo, the test alone with ctest -R: - d3d12_close_parity: 3 failures, now passes: "113 cases, 85 match WARP, 13 known layer-stricter, 15 known layer-looser, 0 not run, 3 where WARP differs from the measured column, 0 failures". - 20 text and docs tests, git diff --check, check_no_game_data. Not tested: a WARP that reports the capability (Windows 11; the old path, read from the code only), Wine, Linux, other GPUs and drivers, the whole ctest suite (run once at the end of this branch). AI-assisted.
… 64 bytes into a page Test: d3d12_existing_heap. Category a: this driver cannot do it; the test asks the driver and checks the layer's fallback for that one case instead of the import. The rest of the test runs as before, so there is no skip return code. Cause, measured on a GTX 1070 Ti with NVIDIA 582.66 with a temporary diagnostic line (not committed): the case "64 bytes into a page" places a 4032-byte buffer 64 bytes into an imported page (Xbox device slot 133, create_buffer_at_host_address). For that buffer vkGetBufferMemoryRequirements names an alignment of 256 bytes and a size of 4096. Vulkan binds a buffer only at a multiple of that alignment, and 64 + 4096 does not fit the 4096 imported bytes either, so create_host_buffer answers E_NOTIMPL at its "offset off the buffer's own alignment" check and the layer hands out its ordinary-buffer fallback, with the log line "a title-placed buffer (device slot 133) could not import its pages". The test expected the import on every driver and failed at line 196 (the GPU VA is not the address). The three imports at a page's start (VirtualAlloc range, section view, existing heap) work on this GPU. 256 is also this GPU's minUniformBufferOffsetAlignment in its vulkaninfo profile; that the buffer's uniform-buffer usage is what sets the alignment is not measured. Why the layer is not changed here: binding at offset 64 is not valid on this driver, and the fallback is what the layer documents for pages it cannot import. See the finding below. Change: the case moves to check_title_placed_inside_page. It imports a buffer of the same description at the page's start, asks the driver for that buffer's memory requirements (rt::d3d12::vulkan_buffer), and runs the old import checks when 64 is a multiple of the alignment and the driver's size fits behind it. Otherwise it checks the fallback: S_OK, a buffer of the asked width, a GPU VA that is not the title's address, and prints the alignment and size the driver named. docs/retail_boot_chain.md names the case. Tested on Windows 10 22H2, GTX 1070 Ti, NVIDIA 582.66, MSVC 14.51, Ninja RelWithDebInfo, the test alone with ctest -R: - d3d12_existing_heap: failed (line 196), now passes; the output has "64 bytes into a page, 4032 bytes: this driver binds the buffer only at a multiple of 256 bytes (its size for it: 4096), so it is not imported; ordinary-buffer fallback verified" and the 8 OpenExistingHeapFromAddress cases still match the GTX 1070 Ti and WARP. - 20 text and docs tests, git diff --check, check_no_game_data. Not tested: a driver that binds the buffer 64 bytes in (the old import path, read from the code only; the case was found on an RTX 5090), other GPUs and drivers, Wine, Linux, the whole ctest suite (run once at the end of this branch). The Vulkan validation layer is not installed on this PC. Finding, not changed here: on this GPU a buffer the title places inside a page at an offset that is not a multiple of 256 is not imported, so the title's writes at that address do not reach it. Importing it would need the buffer bound at the page's start and addressed at an inner offset. AI-assisted.
…A_LOG)
The runtime's "[rt] ..." lines get levels: off, error, warn, info, debug, trace. This commit adds the layer
and its test only; the existing fprintf(stderr, "[rt] ...") lines move to it in the commits that follow, so
nothing is filtered yet and the output of every program is unchanged.
- runtime/core/log.h: the levels, parse_level(), the level in use (one inline atomic per program) and the
macros RT_LOG_ERROR/WARN/INFO/DEBUG/TRACE. A macro puts "[rt] " in front of a string literal and calls
std::fprintf once, so the compiler still checks the format and a line that is held back evaluates none
of its arguments. The header needs neither gta6rt_core nor windows.h, so header-only parts and tests
that link no library can log without a new link dependency.
- runtime/core/log.cpp (gta6rt_core): level_from_settings() and apply_settings(), which read log.level.
- runtime/core/config.h: the row {"log.level", "LEONIDA_LOG", "debug"} in kSettings, so `gta6rt config`
shows it with its source and an empty variable falls through to the file.
- runtime/src/main.cpp: apply_settings() after the settings file is loaded. A gta6rt that was started again
to reserve the image range does not repeat the warning.
- runtime/leonida.example.toml, runtime/README.md: the [log] section and "Log levels: LEONIDA_LOG".
- runtime/test/core_log_test.cpp, ctest core_log: the level filter, the prefix, that a held-back line
evaluates no argument, a value that is not a level, the order environment > file > default, an empty
variable.
- scripts/build_runtime.ps1: core\log.cpp in the cl.exe fallback list of gta6rt.
Decisions:
- The default is debug: it prints every line the runtime printed before it had levels. No line has the
level trace yet.
- One level for all modules. The per-module form (warn,gameinput=debug) is left out: lines without a
module and the header-only parts would each need a module id and a lookup per line.
- A value that is not a level prints one warning that lists the levels and uses the default, in the style
of LEONIDA_PROMPTS: "[rt] log: LEONIDA_LOG=loud unknown (off, error, warn, info, debug or trace), using
debug".
- Only gta6rt reads the setting, as only gta6rt loads a settings file. Test programs log at the default.
AI-assisted.
Tested on Windows 10 Pro 22H2, MSVC 14.51, Ninja RelWithDebInfo (GTX 1070 Ti, NVIDIA 582.66; nothing here
uses the GPU), no game files:
- build of core_log_test, core_config_test, gta6rt and tiny_game: no errors; 2 warnings C4189 in
src/vulkan_present.h, a file this commit does not touch.
- ctest core_log and core_config pass; the 25 tests named run_*, gta6rt_* and core_* pass.
- by hand with gta6rt and the synthetic tiny_game only: `gta6rt config` shows log.level as default
(debug), as environment (warn) and as default again for an empty LEONIDA_LOG; LEONIDA_LOG=loud prints the
warning once with config and with --dry-run.
- the 20 text and docs tests under tests/, git diff --check, scripts/check_no_game_data.py.
- one added line is over 120 columns: the $files line of scripts/build_runtime.ps1, which was over 600
columns before and only gains "core\log.cpp"; tests/test_build_runtime_fallback.py reads its shape.
Not tested: Linux, macOS, Wine, the cl.exe fallback build itself, the relaunch path of base_reservation.h
(arm64 Wine only), anything with the game. With LEONIDA_LOG=off the "[rt]" lines are still printed until
they are moved to the layer.
… the log layer The first group of the settings readers: 29 fprintf(stderr, "[rt] ...") lines in six files become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: for each file the removed and the added lines are the same text once the call and the prefix are normalised. Levels (info 8, warn 17, error 3, debug 1): - shims/bcrypt_rng.cpp (1): the seeded mode is on: info. - shims/xgameruntime_gamesave.cpp (1): the offline save provider and its folder: info. - shims/xgameruntime_user.cpp (5): LEONIDA_GAMERTAG not usable, "Player" used: warn; XUserImpl slots that are private, have no signature or are not available offline: warn. - shims/xgameruntime.cpp (10): the initialize lines: info; slots and classes not provided, XLaunchNewGame ignored, no restart registered: warn; XErrorReport (the title reports an error) and no <TitleId> in MicrosoftGame.Config (the call returns E_FAIL): error. - shims/xgameruntime_offline.cpp (8): slots not available offline: warn; "game events are dropped", the game dialog and the HDR answer: info; the game's error dialog: error; the per-event line behind LEONIDA_LOG_GAME_EVENTS keeps its switch and is debug. - shims/xbox_present.cpp (4): log_once (PresentX inputs that are refused, ignored or presented anyway) and a LEONIDA_SDR_EOTF that is not understood: warn; LEONIDA_PRESENT_UNCAP in effect: info. Behaviour: at the default level (debug) every one of these lines is printed as before. With LEONIDA_LOG below a line's level, gta6rt holds the line back. A "logged once" flag is still set when its line is held back, as the flags are set before the print. AI-assisted. Tested on Windows 10 Pro 22H2, MSVC 14.51, Ninja RelWithDebInfo (GTX 1070 Ti, NVIDIA 582.66), no game files: - build of gta6rt, bcrypt_rng_test, the five xgameruntime*_test programs, xbox_present_test, core_log_test and tiny_game: no errors; one warning C4189 in src/vulkan_present.h, a file this commit does not touch. - ctest: the 35 tests named bcrypt_rng, xgameruntime*, xbox_present, core_log, core_config, run_* and gta6rt_* pass. - no fprintf(stderr is left in the six files; 29 RT_LOG_ lines. - the ten text tests under tests/, git diff --check, no added line over 120 columns, scripts/check_no_game_data.py. Not tested: Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Which of these lines the game makes the runtime print in a real run is not measured.
The second group of the settings readers: the 20 fprintf(stderr, "[rt] gameinput: ...") lines of shims/gameinput.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added lines are the same text once the call and the prefix are normalised (2169 characters on both sides). Levels (error 3, warn 8, info 9): - error: a gamepad that cannot be opened, the keyboard pad that cannot be attached, the SDL gamepad subsystem that does not start (no controllers). - warn: a value that is not understood and the fallback in use (LEONIDA_DS_TRIGGERS, LEONIDA_DS_LIGHTBAR, LEONIDA_KEYBOARD_PAD, LEONIDA_PROMPTS); no raw HID for a device (two lines); no raw mouse input, the cursor position is used (two lines). - info: the input family set or cleared by LEONIDA_PROMPTS, a controller connected or disconnected, raw mouse input on, the keyboard pad attached or removed, the SDL version, the input in use. One line that was a single statement after `else if (...)` is now on its own line, as it was over 120 columns; the statement is the same. Behaviour: at the default level (debug) every one of these lines is printed as before. With LEONIDA_LOG below a line's level, gta6rt holds the line back. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo): the three targets that compile shims/gameinput.cpp (gta6rt, gameinput_test, gameinput_probe) build and link with no error and no warning. No program was executed. Also checked: no fprintf(stderr is left in the file (20 RT_LOG_ lines), git diff --check, no added line over 120 columns. Not tested (nothing was run): ctest gameinput and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The third group of the settings readers: the 16 fprintf(stderr, "[rt] ...") lines of src/pe_loader.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added lines are the same text once the call and the prefix are normalised (1184 characters on both sides). Levels (error 13, info 3): - error: a running thread that did not take its TLS block or its /GA TLS view (two lines); an exception in thread attach or thread detach, with or without a slot (five lines); "TLS process detach failed"; LoadLibraryEx with DONT_RESOLVE_DLL_REFERENCES, which is refused; a run-time initialise, a run-time load or a forwarder that failed; no TlsAlloc slot below 64 for the index-0 TLS reads. - info: a DLL mapped from game_dir at run time, the count of index-0 TLS reads that now read the module's own TLS, and the "compat: <dll> -> <path>" line of LEONIDA_COMPAT_DIR. Two calls that had the format on the line after `std::fprintf(stderr,` now start with the format on the macro's line; the statements are the same. Behaviour: at the default level (debug) every one of these lines is printed as before. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The "logged once" flags of the two TLS lines are still set when the line is held back, as they are set before the print. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo): the 18 targets that compile src/pe_loader.cpp (gta6rt, the loader and bink tests, pe_loader_fuzz and others) build and link with no error and no warning. No program was executed. Also checked: no fprintf(stderr is left in the file (16 RT_LOG_ lines), git diff --check, no added line over 120 columns. Not tested (nothing was run): ctest loader, loader_tls, pe_loader and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The fourth group of the settings readers: 20 fprintf(stderr, "[rt] ...") lines in two files become RT_LOG_*
lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared
by script: for each file the removed and the added lines are the same text once the call and the prefix are
normalised (510 and 1165 characters on both sides).
Levels:
- shims/registry.cpp (6; error 4, warn 2): the "STOP: unimplemented import" block is error as a whole: its
head with the three "[rt] ..." continuation lines inside the same format, and the two lines that follow
it (debugger attached, no debugger attached). RtlAddFunctionTable failed for the stub: error. The first
call of an unimplemented import ("unimplemented: ...") and a LEONIDA_UNIMPLEMENTED that is not log, fail
or stop: warn.
- shims/d3d12_xs.cpp (14; error 6, warn 1, info 1, debug 6): the host d3d12.dll lacks an export, a 1.2 root
signature that is refused, and the four "failed (hr=...)" lines of D3D12XboxCreateDevice: error. An
unknown root signature version that is forwarded unchanged: warn. "version 1.2 ... serialized as 1.1"
(once per run): info. The adapter, params[24], "params = null", "wrapping the PC ID3D12Device" and the
two "-> proxy" lines: debug.
Kept as fprintf(stderr on purpose: registry.cpp " called: %s" in report_called_unimplemented(). It is a
line of the report gta6rt prints on request, not a log line, and has no "[rt]" prefix.
Behaviour: at the default level (debug) every one of these lines is printed as before, so the
"D3D12XboxCreateDevice params[24] =" line that ctest device_proxy_trace expects is still printed, and the
adapter line is still left out with --trace-d3d12. With LEONIDA_LOG below a line's level, a program that
sets the level (gta6rt) holds the line back. With LEONIDA_LOG=off the STOP block is not printed; the
process still breaks into the debugger or ends with the STOP exit code as before. The "logged once" flags
are still set when their line is held back.
AI-assisted.
Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo): the 39 targets that compile
shims/registry.cpp or shims/d3d12_xs.cpp (gta6rt and 38 test programs and tools) build and link with no
error and no warning. No program was executed. Also checked: one fprintf(stderr is left in registry.cpp
(the report line above) and none in d3d12_xs.cpp, git diff --check, no added line over 120 columns.
Not tested (nothing was run): ctest device_proxy_trace, unimplemented_policy, root_sig and every other
test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game.
Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag,
no file and no test registration.
The fifth group of the settings readers: the 34 fprintf(stderr, "[rt] d3d12_xs: ...") lines of
shims/d3d12_xs_device.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the
"[rt] " prefix moves into the macro. Compared by script: the removed and the added log lines are the same
text once the call and the prefix are normalised (3290 characters on both sides).
Levels (error 5, warn 13, info 1, debug 15):
- error: AddVectoredExceptionHandler failed, slot 67 refused (an inconsistent pointer/size pair), a slot 67
call that failed, committing the pages of a slot 133 buffer failed, set_device_adapter_provider on an
object that is not a device proxy.
- warn: a device slot setting that is too long or not in 3..127 (the default is kept); answers of
E_NOTIMPL or E_NOINTERFACE (IDXGIDevice::CreateSurface and QueryResourceResidency, an interface the proxy
refuses, a slot beyond the PC vtable of a device, a list or a child object); the slot 148 stub; a proxy
table that stays writable or has no guard region; allocators that are not wrapped; ignored extra words
of slot 62.
- info: the "Xbox device slots: ..." line, printed once when a setting moved a slot.
- debug: first calls and (with XS_TRACE) every call of a device, heap, list or child slot, "routed to",
the "proxy ... wraps ..." lines, and the description words of slots 73, 76 and 133. The lines that
XS_TRACE gates keep that switch.
The line report_table_overrun() writes with WriteFile ("... slot N is past the proxy table; the vtable
read faults") is a log line too, put together by hand because it runs inside the vectored exception
handler. It keeps its own writer and now asks rt::log::enabled(Level::Error) first, which is one atomic
read. The overrun counter is still incremented when the line is held back.
One call whose format line was over 120 columns (slot 148) now has the format on its own line after
`RT_LOG_WARN(`; the statement is the same.
Behaviour: at the default level (debug) every one of these lines is printed as before, and the lines that
are left out with --trace-d3d12 are still left out. With LEONIDA_LOG below a line's level, a program that
sets the level (gta6rt) holds the line back. The "logged once" and "first call" flags are still set when
their line is held back.
AI-assisted.
Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo): the 13 targets that compile
shims/d3d12_xs_device.cpp (gta6rt, gta6rt_d3d12_com, device_proxy_test, xs_proxy_mock_test, root_sig_test
and others) build and link with no error and no warning. All 13 have gta6rt_core in their link statement
(read from build.ninja), which the file needs for its settings; the log macros add no dependency. No
program was executed. Also checked: no fprintf(stderr is left in the file (34 RT_LOG_ lines),
git diff --check, no added line over 120 columns.
Not tested (nothing was run): ctest device_proxy, device_proxy_trace, xs_proxy_mock and every other test,
the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game.
Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag,
no file and no test registration.
The sixth group of the settings readers: the 68 fprintf(stderr, "[rt] d3d12: ...") lines of shims/d3d12_vulkan_device.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log lines are the same text once the call and the prefix are normalised (7132 characters on both sides). Levels (error 26, warn 29, info 10, debug 3): - error: something failed or was refused and the call returns an error or the feature is gone: an invalid translated shader path, the shader library that does not load, no translated shader for a program, a shader with set-0 bindings on a device without the bindless set, a mesh limit or f16 link refusal, a stage that writes storage without the Vulkan feature, an input layout that does not feed a shader input, an ambiguous FSPX program, workgroup memory over the device limit, a missing .spv, the GPU address arena or the bindless set 0 that could not be created, a root signature that is not understood or refused, "present failed", the three lines of create_window_presenter, "vulkan-1.dll not found", a validation layer the loader does not list, vkCreateInstance failed, and the reason line of a failed device creation. - warn: a value that is not understood (LEONIDA_VK_MAX_QUEUES_PER_FAMILY is not a number: ignored), a test setting the game's device ignores, a pipeline cache seed that does not match or is declined, the wave64 lines, "no translated shaders: set LEONIDA_SHADERS", an allocation that went to host memory, float depth kept on a D24 target, a root signature usable for one of graphics and compute only, the "the GPU has no ..." and "no VK_EXT_..." lines with their fallbacks, a bindless set that holds less, a capped arena, retired bindless table generations, and the maxPushConstantsSize line (its text already says WARNING). - info: once-per-run status: the Vulkan device and its subgroup sizes, "Vulkan 1.2 device", the bindless set sizes, "upload heaps in", the number of translated shaders, the bytes loaded from the pipeline cache, the arena's peak at the end, and the two queue test settings that are in effect. - debug: the three arena address lines. They keep their own switch (LEONIDA_ARENA_LOG). log_once() prints through RT_LOG_WARN. It has 167 calls in the file and one level: they report a format, a view or a call that is not supported, refused or replaced by a fallback. Its texts are unchanged. Two calls changed their line breaks only: "no translated shaders: ..." now fits on the line of the macro, and "no VK_EXT_custom_border_color; ..." (over 120 columns with the macro in front) has its format on its own line after `RT_LOG_WARN(`. Behaviour: at the default level (debug) every one of these lines is printed as before, so the "is a test setting; the game's device ignores it" line that test/check_tiny_frame.py expects is still printed. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The "logged once" state (the set of log_once, the call_once of the host memory line, the flag of the retired generations line) is still set when its line is held back. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo): gta6rt_d3d12_com, the one target that compiles the file, builds with no error, and the 81 programs that link it (gta6rt and 80 test programs) build and link with no error. gta6rt_d3d12_com has gta6rt_core in its link statement (read from build.ninja). Warnings seen, none in a line of this change: C4189 in src/vulkan_present.h(722), a header the file includes, and C4456 twice in test/d3d12_vulkan_device_test.cpp (7042, 7049), a file this change does not touch. No program was executed. Also checked: no fprintf(stderr is left in the file (68 RT_LOG_ lines), git diff --check, no added line over 120 columns. Not tested (nothing was run): ctest d3d12_vulkan_device, tiny_frame and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The last of the settings readers: 11 fprintf(stderr, "[rt] ...") lines of src/main.cpp become 12 RT_LOG_*
lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared
by script: the removed and the added lines hold the same 29 string literals in the same order once the
leading "[rt] " is dropped (12 literals had it).
Levels (error 3, warn 3, info 6):
- error: "cpu: AddVectoredExceptionHandler failed", and the two "not hooked" lines of the view-mode getter
and the archetype lookup.
- warn: "mods: skipped ..." (a mod that did not load), "cpu: this CPU lacks ...; the game's uses are
emulated", and "archetype swap(s) loaded; not applied: no --archetype-lookup RVA".
- info: the list of mods with their archetype swaps, the first-person view line, "archetype swap(s)
loaded", and the two "hooked" lines.
One call chose its format with ?: ("archetype swap(s) loaded" with or without "; not applied"). The macro
needs a string literal, so it is an if/else with two calls now; the two texts are the same, and they get
info and warn.
Kept as fprintf(stderr on purpose (6): the usage text, the three "error: ..." lines of the settings file,
of a main module without an entry point and of an exception, the "error: ..." line of the trace file (two
texts), and the message of the host CPU check. They are answers of the program to its caller, not log
lines: they have no "[rt]" prefix and must be printed whatever the level is.
Behaviour: at the default level (debug) every one of these lines is printed as before. The level is set
from the settings before the first of them (rt::log::apply_settings, right after the settings are loaded),
so with LEONIDA_LOG below a line's level gta6rt holds the line back. Nothing else depends on the lines:
mods are loaded and hooks are installed whether their line is printed or not.
AI-assisted.
Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo): gta6rt, the one target that compiles
src/main.cpp, builds and links with no error and no warning, and has gta6rt_core in its link statement
(read from build.ninja). No program was executed. Also checked: six fprintf(stderr are left in the file
(the lines above) and none of them has "[rt]", git diff --check, no added line over 120 columns.
Not tested (nothing was run): ctest gta6rt_rejects_*, tiny_game, the mods tests and every other test, the
text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game.
Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag,
no file and no test registration; the usage text and the flags it names are untouched.
The first file of the rest (the files that read no setting): the 8 fprintf(stderr, "[rt] d3d12: ...") lines of shims/d3d12_com.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log lines are the same text once the call and the prefix are normalised (558 characters on both sides). Levels (error 6, warn 2): - error: a call that is refused or failed: a fence signal that is not above the highest one, and the five lines of ExecuteCommandLists (a list that is not a direct command list, a list of a different device, a list whose type is not the queue's, an invalid list, and "ExecuteCommandLists failed: ...; nothing was submitted"). - warn: the two once-per-text helpers. stub() prints "unimplemented <method>" for the generated API stubs and for hand-written callers; note_once() (9 calls in the file) reports a refused call or a deliberate simplification. Each helper has one level for all its callers. Two calls changed their line breaks only: "list %u belongs to a different device; refusing batch" and "ExecuteCommandLists failed" now fit on the line of the macro. Behaviour: at the default level (debug) every one of these lines is printed as before. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The sets of stub() and note_once() still record a text whose line is held back, and stub() still records the method in the d3d12 trace. A refused call returns the same result whether its line is printed or not. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo): gta6rt_d3d12_com, the one target that compiles the file, builds with no error and no warning, and the 81 programs that link it (gta6rt and 80 test programs) link with no error. gta6rt_d3d12_com has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (8 RT_LOG_ lines), git diff --check, no added line over 120 columns. Not tested (nothing was run): ctest d3d12_com, d3d12_queue_handover and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The second file of the rest (the files that read no setting): the 4 fprintf(stderr, "[rt] xmem: ...") lines of shims/xmem.cpp become RT_LOG_WARN lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log lines are the same text once the call and the prefix are normalised (415 characters on both sides). Levels (warn 4): each line reports once that a console memory function is not provided or is simplified on a PC: XMemIsToolsMemAvailable answers FALSE, XMemVirtualQuery zero-fills the fields it does not know, XMemGetWorkingSetStatistics(nullptr) answers FALSE, and XMemTransferMemory returns TRUE without moving anything. Two calls changed their line breaks only: the formats of the XMemVirtualQuery and the XMemTransferMemory line now start on the line of the macro. Behaviour: at the default level (debug) every one of these lines is printed as before. With LEONIDA_LOG below warn, a program that sets the level (gta6rt) holds the lines back. The "logged once" flags are still set when their line is held back, and each function returns the same result whether its line is printed or not. The startup trace events of XMemTransferMemory do not depend on the level. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 14 targets that compile the file (gta6rt and 13 other programs) build and link with no error and no warning, and each of them has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (4 RT_LOG_ lines), git diff --check, no added line over 120 columns. Not tested (nothing was run): ctest xmem, d3d12_xmem_placed and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The third file of the rest (the files that read no setting): the 3 fprintf(stderr, "[rt] process: ...") lines of shims/process.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log lines are the same text once the call and the prefix are normalised (535 characters on both sides). Levels (error 1, warn 2): - error: "the game called abort()". The run ends right after it. - warn: the two affinity lines. SetThreadAffinityMask and SetThreadGroupAffinity were asked for cores or a group the host lacks; the thread stays where it is and the call answers the mask it has. Each is printed for the first 8 calls only, as before. No call changed its line breaks; the argument lines are indented to the new opening parenthesis. Behaviour: at the default level (debug) every one of these lines is printed as before. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The call counters of the affinity lines still count a call whose line is held back. SetLastError(ERROR_SUCCESS) still follows each affinity line, so the thread's last error is 0 when the call returns, whether the line was written, failed to be written (a closed stderr pipe) or was held back. game_abort() raises SIGABRT for an installed handler and ends the run with exit code 3 whether its line is printed or not. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 2 targets that compile the file (gta6rt and process_cmdline_test) build and link with no error and no warning, and each of them has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (3 RT_LOG_ lines), git diff --check, no added line over 120 columns. Not tested (nothing was run): ctest process_cmdline and every other test, the last error after an affinity call with a closed stderr, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The fourth file of the rest (the files that read no setting): the 3 fprintf(stderr, "[rt] xgameruntime: ...") lines of shims/xgameruntime_store.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log lines are the same text once the call and the prefix are normalised (235 characters on both sides). Levels (warn 2, info 1): - warn: the two slot templates. "XStoreImpl slot %d is not available offline (E_FAIL)" is an operation that needs the store service or a store UI, and "XStoreImpl slot %d (no documented signature) called; E_NOTIMPL" is a slot that is not implemented. Each is printed once per slot, as before. - info: "XStore offline: the game license is active, no add-ons, no updates", the once-per-run status of the offline store, printed when the first store context is created. No call changed its line breaks. The file had no include in quotes; "../core/log.h" follows the block of the XAsync and XTaskQueue headers. Behaviour: at the default level (debug) every one of these lines is printed as before. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The "logged once" flags are still set when their line is held back, and each function returns the same result (E_FAIL, E_NOTIMPL, S_OK) whether its line is printed or not. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 6 targets that compile the file (gta6rt and the five xgameruntime test programs) build and link with no error and no warning, and each of them has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (3 RT_LOG_ lines), git diff --check, no added line over 120 columns. Not tested (nothing was run): ctest xgameruntime_store, the other xgameruntime tests and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The fifth file of the rest (the files that read no setting): the 2 fprintf(stderr, "[rt] loader: ...") lines of shims/library_loader.cpp become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log lines are the same text once the call and the prefix are normalised (139 characters on both sides). Levels (info 1, warn 1): - info: "%s is served by the shims (run-time load)", the status line of a library the game loads at run time and the shims serve. It is printed once per library, as before. - warn: "GetProcAddress(%s, %s): not served", a function the game asks such a library for and the shims do not provide. It is printed once per library and name, as before. No call changed its line breaks. Behaviour: at the default level (debug) both lines are printed as before. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The module handle of a served library is returned whether its line is printed or not. The set of names that were not served still records a name whose line is held back, and GetProcAddress still sets ERROR_PROC_NOT_FOUND and returns null. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 7 targets that compile the file (gta6rt, dll_thread_calls_test and the five xgameruntime test programs) build and link with no error and no warning, and each of them has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (2 RT_LOG_ lines), git diff --check, no added line over 120 columns, and no test or CMake file compares one of the two lines as output. Not tested (nothing was run): ctest xgameruntime, run_tiny_gdk_load, run_tiny_bundled_load and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The sixth file of the rest (the files that read no setting): the one fprintf(stderr, "[rt] acphal: ...") line of shims/acphal.cpp becomes an RT_LOG_WARN line (core/log.h). The message text is unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log line are the same text once the call and the prefix are normalised (65 characters on both sides). Level (warn 1): "command accepted and dropped: no audio DSP hardware on PC". The command call of the audio hardware layer accepts a command and does nothing with it, because a PC has no such hardware. The line is printed once, as before. The call changed its line breaks only: the format is on the line of the macro now. Behaviour: at the default level (debug) the line is printed as before. With LEONIDA_LOG below warn, a program that sets the level (gta6rt) holds the line back. The "logged once" flag is still set when the line is held back, and the function (traced as AcpHal::SubmitCommand) still calls trace_call and returns S_OK whether the line is printed or not. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 2 targets that compile the file (gta6rt and acphal_test) build and link with no error and no warning, and each of them has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (1 RT_LOG_ line), git diff --check, no added line over 120 columns, and no test or CMake file compares the line as output. Not tested (nothing was run): ctest acphal and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The seventh file of the rest (the files that read no setting): the one fprintf(stderr, "[rt] xg_xs: ...") line of shims/xg_xs.cpp becomes an RT_LOG_WARN line (core/log.h). The message text is unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log line are the same text once the call and the prefix are normalised (153 characters on both sides). Level (warn 1): "%s: no console texture layout on the PC; E_NOTIMPL (caller %s, logged once)". The line is printed by warn_once(), the helper of the file (3 calls), once per entry point: a function of the console texture layout library that is not provided on a PC. The call did not change its line breaks; the argument line is indented to the new opening parenthesis. Behaviour: at the default level (debug) the line is printed as before. With LEONIDA_LOG below warn, a program that sets the level (gta6rt) holds the line back; the caller's module and offset are then not looked up, because a held-back line evaluates no argument. The "logged once" flag of an entry point is still set when its line is held back, and what the entry points return does not depend on the line. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 2 targets that compile the file (gta6rt and xg_xs_test) build and link with no error and no warning, and each of them has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (1 RT_LOG_ line), git diff --check, no added line over 120 columns, and no test, CMake file or script compares the line as output. Not tested (nothing was run): ctest xg_xs and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The eighth file of the rest (the files that read no setting): the one fprintf(stderr, "[rt] dstorage: ...") line of shims/dstorage.cpp becomes an RT_LOG_WARN line (core/log.h). The message text is unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log line are the same text once the call and the prefix are normalised (34 characters on both sides). Level (warn 1): the line is the one print of log_once(), the once-per-key helper of the file (8 calls). The helper has one level for all its callers. Six of them report something refused, failed or not implemented: an interface that is refused (E_NOINTERFACE), a bad argument of a method, an entry enqueued on a closed queue, BCPack and swizzle requests and physical-page requests (E_NOTIMPL), and an entry that failed. Two are status lines (which interface an unknown id is served with, and that zlib requests are inflated on the CPU); they are warn with the rest, as the helper cannot tell them apart. The call did not change its line breaks. Behaviour: at the default level (debug) every line of the helper is printed as before. With LEONIDA_LOG below warn, a program that sets the level (gta6rt) holds the lines back. The set of keys still records a key whose line is held back, the callers still build the text of such a line, and what the callers return does not depend on the line. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 2 targets that compile the file (gta6rt and dstorage_test) build and link with no error and no warning, and each of them has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (1 RT_LOG_ line), git diff --check, no added line over 120 columns, and no test, CMake file or script compares a line of the helper as output. Not tested (nothing was run): ctest dstorage and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The ninth file of the rest (the files that read no setting): the one fprintf(stderr, "[rt] dxgi: ...") line of shims/dxgi_com.cpp becomes an RT_LOG_WARN line (core/log.h). The message text is unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log line are the same text once the call and the prefix are normalised (67 characters on both sides). Level (warn 1): "unimplemented %s", the one print of stub(), the once-per-method helper of the file. It has the level of stub() in shims/d3d12_com.cpp, which prints the same text for the D3D12 objects: a method that is not implemented. The call did not change its line breaks. "../core/log.h" follows the two quoted includes at the top of the file. Behaviour: at the default level (debug) the line is printed as before. With LEONIDA_LOG below warn, a program that sets the level (gta6rt) holds the line back. The set of method names still records a name whose line is held back. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): gta6rt_d3d12_com, the one target that compiles the file, builds with no error and no warning (/W4), and the 81 programs that link it link with no error. gta6rt_d3d12_com has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (1 RT_LOG_ line), git diff --check, no added line over 120 columns, and no test, CMake file or script compares the line as output. Not tested (nothing was run): ctest dxgi_device, dxgi_swapchain and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The tenth file of the rest (the files that read no setting): shims/winhttp_offline.cpp prints two log lines, and both keep their text. - info: "offline; requests fail with ERROR_WINHTTP_CANNOT_CONNECT", the status line of the first session, printed once per process. Its fprintf(stderr, "[rt] winhttp: ...") becomes an RT_LOG_INFO line (core/log.h); only the "[rt] " prefix moves into the macro. - warn: "offline, refused <host>:<port>", printed once per server by log_refused(). It is a wide string written with std::fwprintf, which the macros do not take. It keeps its writer and its text and asks the level first (rt::log::enabled), as report_table_overrun() in shims/d3d12_xs_device.cpp does. Compared by script: the removed and the added lines hold the same two string literals once the prefix of the macro line is normalised. Behaviour: at the default level (debug) both lines are printed as before. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The set of refused servers still records a server whose line is held back, the once flag of the status line is still used up, and the requests fail in the same way whether a line is printed or not. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 2 targets that compile the file (gta6rt and winhttp_offline_test) build and link with no error, the two objects of the file compile with no warning, and each target has gta6rt_core in its link statement (read from build.ninja). No program was executed. Also checked: no fprintf(stderr is left in the file (1 RT_LOG_ line and the one guarded fwprintf), git diff --check, and no added line over 120 columns. winhttp_offline_test compares the refused line as output; it sets no level, so it runs at the default, where the line is printed with the same text. Not tested (nothing was run): ctest winhttp_offline and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
The eleventh file of the rest (the files that read no setting), and the first header among them: the
one fprintf(stderr, "[rt] d3d12: ...") line of shims/d3d12_com_object.h becomes an RT_LOG_WARN line
(core/log.h). The message text is unchanged; only the "[rt] " prefix moves into the macro. Compared by
script: the removed and the added log line are the same text once the call and the prefix are
normalised (264 characters on both sides).
Level (warn 1): "QueryInterface: unknown IID {...}", printed by Object::QueryInterface when an object
is asked for an interface it does not provide. The call is refused with E_NOINTERFACE.
The call changed its line breaks only: the format is on the line of the macro now (3 lines, were 4).
The header had no quoted include; "../core/log.h" follows its include block. The header uses the
header part of the log layer only.
Behaviour: at the default level (debug) the line is printed as before. With LEONIDA_LOG below warn, a
program that sets the level (gta6rt) holds the line back. QueryInterface still clears the out pointer
and returns E_NOINTERFACE whether the line is printed or not.
AI-assisted.
Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): shims/d3d12_com.cpp and
shims/d3d12_vulkan_device.cpp, the two files that include the header, compile in gta6rt_d3d12_com, the
one target that builds them, and the 81 programs that link it build and link with no error.
gta6rt_d3d12_com has gta6rt_core in its link statement (read from build.ninja). The build printed 6
warnings, none of them in the changed header: C4189 in src/vulkan_present.h(722) and five in test
sources (C4100, C4996, C4189 and C4456 twice). No program was executed. Also checked: no
fprintf(stderr is left in the header (1 RT_LOG_ line), git diff --check, no added line over 120
columns, and no test, CMake file or script compares the line as output.
Not tested (nothing was run): ctest d3d12_com and every other test, the text tests under tests/,
Linux, macOS, Wine, the cl.exe fallback build, anything with the game.
Reviewed by hand instead of the text tests: the change adds no environment variable, no command line
flag, no file and no test registration.
The twelfth file of the rest (the files that read no setting), and the first of them under src/: the one fprintf(stderr, "[rt] cpu: ...") line of src/cpu_emulation.h becomes an RT_LOG_WARN line (core/log.h). The message text is unchanged; only the "[rt] " prefix moves into the macro. Compared by script: the removed and the added log line are the same text once the call and the prefix are normalised (103 characters on both sides). Level (warn 1): "this CPU has no %s; emulating it (first at %p)", printed by the handler for illegal instructions the first time it emulates an instruction the CPU does not have (once per instruction; the two forms of INSERTQ and of EXTRQ share one count). It is a fallback that changes how the instruction is carried out. The call did not change its line breaks; the argument line is indented to the new opening parenthesis. The header had no quoted include; "../core/log.h" follows the include block of its Windows part. The header uses the header part of the log layer only. Behaviour: at the default level (debug) the line is printed as before. With LEONIDA_LOG below warn, a program that sets the level (gta6rt) holds the line back. The count of an instruction still goes up when its line is held back, and the handler still steps past the instruction and continues execution whether the line is printed or not. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 2 targets that compile a file that includes the header (gta6rt through src/main.cpp, and cpu_emulation_test) build and link with no error and no warning. gta6rt has gta6rt_core in its link statement (read from build.ninja); cpu_emulation_test does not and links without it, as the header part of the log layer needs no library. No program was executed. Also checked: no fprintf(stderr is left in the header (1 RT_LOG_ line), git diff --check, no added line over 120 columns, and no test, CMake file or script compares the line as output. Not tested (nothing was run): ctest cpu_emulation and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
…to the log layer The last two files of the rest (the files that read no setting): the 4 fprintf(stderr, "[rt] ...") lines of src/vulkan_backend.h and the 8 of src/vulkan_present.h become RT_LOG_* lines (core/log.h). The message texts are unchanged; only the "[rt] " prefix moves into the macro. Compared by script, per file: the removed and the added log lines are the same text once the call and the prefix are normalised (521 and 695 characters on both sides). Levels (error 4, warn 6, info 1, debug 1): - error, vulkan_backend.h: "a held ExecuteCommandLists failed when it was released" and "a held Signal failed when it was released". - error, vulkan_present.h: "a Present held behind queued work failed when it was released" and "present: cannot write %s" (a captured frame). - warn, vulkan_backend.h: "a fence was released while a queue still held work that names it; that work is dropped" and "queue destroyed with %zu held operation(s) never submitted ...". - warn, vulkan_present.h: "capture is unavailable on this surface; presenting without it", "%zu Presents are queued behind held work; this one waits for it", "the surface has no HDR10 (ST.2084) format ..." and "the surface has no sRGB 8-bit format ...". - info, vulkan_present.h: "capture on: every %d presented frame(s), at most %d, into %s", printed when a presenter is made with a capture folder. - debug, vulkan_present.h: "capture %s (...)", one line per captured frame. Line breaks: the sRGB line was one line of 145 columns and is two lines now (the call on its own line under the if). The other calls keep their line breaks; argument lines are indented to the new opening parenthesis. "../core/log.h" follows the quoted includes of each header. Both headers use the header part of the log layer only. Behaviour: at the default level (debug) all twelve lines are printed as before. With LEONIDA_LOG below a line's level, a program that sets the level (gta6rt) holds the line back. The "logged" and "warned" flags are still set when their line is held back, a failed held batch is still recorded, dropped work is still dropped, and the CPU waits of a destroyed queue are still completed whether a line is printed or not. d3d12_queue_handover_test compares three parts of the "queue destroyed" line as output; it sets no level, so it runs at the default, where the line is printed with the same text. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs): the 100 objects that include one of the two headers (read from the dependency log of ninja) compile, and the 95 targets that build them link, with no error. 82 of the 95 have gta6rt_core in their link statement (read from build.ninja); 13 test programs do not and link without it, as the header part of the log layer needs no library. The build printed warnings, none of them from a changed line: C4189 in src/vulkan_present.h (line 723, was 722 before the include), C4459 in src/buffer_va_index.h, src/shader_library.h and src/vulkan_replay.h, which this change does not touch, and five in test sources. No program was executed. Also checked: no fprintf(stderr is left in the two headers (4 and 8 RT_LOG_ lines), git diff --check, and no added line over 120 columns. Not tested (nothing was run): ctest d3d12_queue_handover and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. Reviewed by hand instead of the text tests: the change adds no environment variable, no command line flag, no file and no test registration.
Phase D, first step of item G7 of docs/ztrx-gap-analysis.md (the frame calls of the device proxy reach the frame pacer). The device proxy answered SetFrameIntervalX, ScheduleFrameEventX and WaitFrameEventX itself, with a counter of its own and a wait that returns at once, and nothing could put the frame pacer behind them. This step adds the place to hang it; it hangs nothing yet. What is new: - shims/d3d12_xs_device.h: struct FrameEventSink (a context pointer and one function per call), set_device_frame_event_sink(device, sink) and device_frame_event_sink(device). The proxy does not know the presentation class, so the header still needs neither a presenter nor Vulkan, and the sink is the same on either backend. - shims/d3d12_xs_device.cpp: the device proxy holds the sink in an atomic pointer. Each of the three handlers asks for it first and, when the sink has a function for that call, passes the title's words on and returns the sink's result. The reserved pointer of slots 79 and 80 (the third word) is not passed on. A null token pointer is refused with E_POINTER before the sink is called, as without a sink. A null function in a sink leaves that call with the proxy's answer. - test/xs_proxy_mock_test.cpp: check_frame_sink(), run by the ctest xs_proxy_mock (no D3D12 runtime, no GPU). A sink in front of a leonida::FramePacer on a ManualFrameClock: a wait before anything is registered gives the pacer's ERROR_INVALID_STATE and leaves the token alone, an interval of 0 and a wrong event or offset give E_INVALIDARG, a zero wait before the next origin times out, the wait after the clock moved returns the pacer's tokens 1 and 2, the output, flags and timeout words arrive in the sink, no call reaches the PC device, a sink without a wait function and no sink at all give the proxy's own answers again, and a pointer that is not a device proxy takes no sink. Behaviour: unchanged in this commit. Nothing sets a sink, so gta6rt and every existing test get the proxy's own answers as before (S_OK, a fresh non-zero token at once). The sink is not copied: it and its context must stay valid until another one (or null) is set and the calls already inside it have returned; the header says so. Left out on purpose: slot 81 (GetFrameStatisticsX). The layout of the console's statistics entries is not measured, and index 81 is a PC method on a device with ID3D12Device13, so routing it would take a slot away from a PC caller on a guess. AI-assisted. Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs). Read from the dependency log of ninja, 42 objects in 24 targets include shims/d3d12_xs_device.h; those targets and the programs that link them, 88 targets, were built: 55 compile steps and 88 link steps, no error. The 13 targets that compile shims/d3d12_xs_device.cpp all have gta6rt_core in their link statement (read from build.ninja). The build printed five warnings, none of them in a changed file: C4189 in src/vulkan_present.h and four in test sources. No program was executed. Also checked: git diff --check, and no added line over 120 columns. Not tested (nothing was run): ctest xs_proxy_mock with the new check, ctest device_proxy and every other test, the text tests under tests/, Linux, macOS, Wine, the cl.exe fallback build, anything with the game. The new check was written against the pacer's code by reading it; its expected values have never been compared with a run. Reviewed by hand instead of the text tests: the change adds no environment variable, no setting, no command line flag, no file and no test registration; the new check runs inside the registered test xs_proxy_mock.
…resent_x_slot (G8)
Phase D, first step of item G8 of docs/ztrx-gap-analysis.md (the present call of the queue proxy
reaches the presentation class). The queue proxy refused every slot past the public chain, so a
PresentX could reach nothing. This step adds the route and the place to hang the presentation
class; it hangs nothing yet.
What is new:
- core/config.h: the setting d3d12.present_x_slot (LEONIDA_XS_PRESENT_X_SLOT), default not set.
kSettings has 51 rows now; the last row is unchanged. runtime/leonida.example.toml lists it.
- shims/d3d12_xs_device.h: struct PresentSink (a context pointer and one function),
set_device_present_sink(device, sink), device_present_sink(device) and queue_present_x_slot().
- shims/d3d12_xs_device.cpp: the setting is read once, on the first queue call past the public
chain. A value that is a slot of the queue proxy's refused tail (19..127) is taken for PresentX
and logged once at info; any other value is logged once at warn and ignored. A call on that slot
goes to the present sink of the queue's device with the real queue behind the proxy and the
title's three words (plane count, planes, parameters), and the sink's result is the title's. With
the slot set and no sink, or a sink with a null function, the call is refused with E_NOTIMPL,
logged once at warn and recorded as unsupported in the D3D12 trace. The two structures are not
read by the proxy.
- test/xs_proxy_mock_test.cpp: run_present_slot(), two modes (--present-slot and
--present-slot-invalid), registered as the ctests xs_proxy_mock_present_slot and
xs_proxy_mock_present_slot_invalid (one process each, because the slot is read once; no D3D12
runtime, no GPU). With slot 32 named: refused without a sink; with a sink the real queue, the low
half of the count word and both pointers arrive, a failure of the sink comes back unchanged, slot
30 stays refused, GetDesc (18) keeps its PC method, a queue made after the sink was set reaches
the same sink with its own real queue, a sink with a null function and no sink are refused, and a
pointer that is not a device proxy takes no sink. With the value 18: no slot is taken, the whole
tail is refused with a sink set and the sink is never called.
- runtime/README.md: the paragraph on the queue extensions names the two sinks and documents the
variable. Two comments in the proxy that said nothing is routed are brought up to date.
Behaviour: unchanged unless the setting is set. No default is taken from the public numbers (30 for
an older runtime layout, 32 for a newer one): they are measurements of other titles, and the proxy
has said so far that the slot is not guessed. With the setting not set, every slot past the public
chain is refused and logged as before. Nothing sets a sink yet, so with the setting set the call is
still refused, with the new log line. A queue call past the public chain now compares its slot with
one value that is read once.
AI-assisted.
Compiled only, on Windows 10 with MSVC and Ninja (RelWithDebInfo, 4 jobs). core/config.h changed,
so the whole build directory was built: 206 compile steps and 137 link steps, no error, and cmake
regenerated without a warning. The 13 targets that compile shims/d3d12_xs_device.cpp all have
gta6rt_core in their link statement (read from build.ninja). The build printed 13 distinct
warnings, none of them in a changed source: C4189 in src/vulkan_present.h and twelve in test
sources. The generated CTestTestfile.cmake has the two new test entries (read, not run). No program
was executed. Also checked: git diff --check, and no added line over 120 columns.
Not tested (nothing was run): the two new ctests, ctest xs_proxy_mock, core_config (which compares
the example file with the table) and every other test, the text tests under tests/, Linux, macOS,
Wine, the cl.exe fallback build, anything with the game. Which slot this title calls for PresentX
is not known; only a real run can name it. The expected values of the new checks were written by
reading the code and have never been compared with a run.
Reviewed by hand instead of the text tests: the new variable is named in runtime/README.md and in
the example file under [d3d12], with the default of the table ('' for not set); the two new test
flags are strings in the test source and are flags of a test program, like --env-slots, which no
document lists either; both registrations are literal add_test(NAME x COMMAND y) lines; the changed
files keep LF line endings; no file was added.
… fixes Phase D, the documentation step. docs/ztrx-gap-analysis.md was written at abdaf16 and still said that the log has no levels, that the frame calls and the present call are not wired, and that the causes of the eight failing d3d12 tests are not determined. This step states what was done since, and what is left. What changed: - The head of the page says when it was studied and that it was brought up to date at 387cc16. - C2 (log levels): from no to part. The levels and the setting log.level (LEONIDA_LOG) are there; the filter by module was left out. - G7 (frame clock and tokens): the note names the frame-event sink of 4ecdc6b and what is left (nothing sets a sink; slot 81 is not routed). The effort goes from M to S. - G8 (present call on the queue): the note names the setting d3d12.present_x_slot (LEONIDA_XS_PRESENT_X_SLOT) and the present sink of 387cc16 and what is left (nothing sets a sink; the slot of this title is not measured). The effort goes from M to S. The sentence that said the two headers disagree on the slot is gone: both now say the public numbers are other titles' and that no slot is taken unless the setting names one. - Section 7: the table of the eight tests now gives the cause found for each, what was changed (the layer once, the test five times), the result and the commit, in place of the first impressions the study had. Two of those were stale (d3d12_existing_heap, d3d12_close_parity). The section names the one failure left, root_signature_oracle, and what a PC of this class no longer covers. - New section 9.1, the state at 387cc16: done, partly or not done for G7, G8, G9, G2 and G1, what was chosen and what was left out and why, and which tests still have to be run elsewhere. It states: integrated and compiled; NOT verified by running anything. - docs/README.md lists the page under "Start here", next to related_projects.md. Behaviour: none. Two Markdown files; no code, no build file and no test changed. AI-assisted. Nothing was compiled for this commit, because no compiled file changed. No program was executed. Checked: git diff --check, and no added line over 120 columns. Not tested (nothing was run): the text tests under tests/ that read the docs (links, repository paths, repeated lines, table rows, table ids, design rows, environment variables), and every other test. The results section 7 gives are from runs made before running anything on this PC was ruled out; they were not repeated. Reviewed by hand instead of the text tests: the 45 backticked repository paths of the page are all tracked; no two prose lines within three lines of each other start with the same 40 characters; no table row has a bold id; every commit id the added lines name is an ancestor of this commit; the five ctest names of section 9.1 are registered under those names; the two variables the added lines name are documented in runtime/README.md; the new row of docs/README.md has two cells like its header and its topic is in that table once; both files keep LF line endings and the added lines are ASCII.
orkan1k
pushed a commit
that referenced
this pull request
Nov 25, 2026
The title's shader-visible view heap has 1,245,184 slots. NVIDIA caps shader-visible view heaps at 1,000,000, so HostHeap::new falls back to a heap of 1,000,000 whose title part ends at 934,464, with the dynamic slots after it. The title binds a per-frame table ring in its top slots (934,464 to 1,245,184, moving 4,096 slots a frame), so those tables' host offsets either aliased the dynamic slots or ran past the heap's end. On NVIDIA the GPU then hangs within the first-boot screens (DXGI_ERROR_DEVICE_HUNG), after black and glitched frames. A table that reaches past the host heap's title slots is now made afresh in dynamic slots, as tables holding constant buffers already are, and the shader is given the new offset. Hosts that take the whole heap (AMD) are unchanged. mirror() logs the highest title slot it meets past the host heap, once per new maximum. Tested on an RTX 3080 (driver 32.0.16.2114): the first-boot screens and menus run without glitches, and the title loads into the intro with no device loss (before: device removed about 45-60 s in, 3 of 3 runs). The slot warning went from 78 lines to none. cargo test --workspace passes. Refs #16, #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as:
Depends on:
Fixes:
What and why
Tested
GPUs tested:
AI-assisted:
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.