diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 8d10ae656..9a92c423b 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -15,7 +15,8 @@ How to build and run the mod from source. If you only want to play, read Adoptium, Microsoft, and Java folders under Program Files. - **Visual Studio 2022 Build Tools** with the Desktop development with C++ workload (MSVC v143). Cross-building the ARM64 bridge additionally needs the - toolset pinned in `rtxremix-java/native/build_native.bat` (currently 14.44). + MSVC ARM64 build tools for some installed toolset; `build_native.bat` uses + the default toolset when it has them, otherwise the newest one that does. - **Git.** Everything is in the clone except the native runtime and the two large runtime textures, which the build pulls through Packman on first use. - **uv 0.13 or newer and Python 3.15 or newer**, for the developer tools that @@ -491,7 +492,7 @@ removes its stale registration. | Symptom | Cause | |---|---| -| `vswhere.exe not found` or `vcvarsall.bat failed` | Visual Studio Build Tools missing, or without the Desktop C++ workload. ARM64 also needs toolset 14.44 | +| `vswhere.exe not found` or `vcvarsall.bat failed` | Visual Studio Build Tools missing, or without the Desktop C++ workload | | `JAVA_HOME is not set`, or `jni.h not found` | `JAVA_HOME` unset or pointing at a JRE rather than a JDK 21 | | Gradle cannot fetch the SDK | Check network access to the Packman remote, or stage a matching local runtime. See [Get A Runtime](#get-a-runtime) | | A launch reports that Prism Launcher is not installed | Install it from [prismlauncher.org](https://prismlauncher.org), or point `prism.executable` in `tools/config.local.json` at its `prismlauncher.exe` | @@ -509,7 +510,7 @@ removes its stale registration. | Empty or partial scene on first launch | Shader compilation. Wait for it to settle before reporting a defect | | Frame-time spikes at high render distance | Garbage collection is one possible cause. Every launch gives the Prism instance the tuned JVM arguments and their heap limit; check that `launch.jvmArgs` does not override them | | A clone or checkout reports `Filename too long` | Enable `git config --global core.longpaths true` before cloning, or choose a shorter checkout path | -| `package` cannot find the ARM64 toolset | Install the version pinned by `build_native.bat`, or use `package -Parch=win64` for a single-architecture artifact | +| `No MSVC toolset ... has the ARM64 C++ libraries` | Add the MSVC ARM64 build tools in the Visual Studio Installer, or use `package -Parch=win64` for a single-architecture artifact | | Initialization reports `DRIVER_VERSION_BELOW_MINIMUM` | Update the driver. The minimum is a capability gate; lowering `dxvk.nvidiaMinDriver` can enable unsupported paths and cause GPU faults | | `Startup` unexpectedly returns `REMIX_DEVICE_WAS_NOT_REGISTERED` after an API change | Check header, bridge and runtime together for a mismatched `remixapi_Interface` layout before continuing native calls | | `/rtx off` is slower than `/rtx on` | The off path renders vanilla GL at full resolution through the Remix swapchain; the on path can use DLSS's lower internal resolution. The toggle is not a standalone vanilla performance baseline | diff --git a/rtxremix-java/native/build_native.bat b/rtxremix-java/native/build_native.bat index 360d44506..3d7bbff16 100644 --- a/rtxremix-java/native/build_native.bat +++ b/rtxremix-java/native/build_native.bat @@ -19,17 +19,14 @@ REM ── Target architecture ──────────────── set "ARCH=%~1" if "%ARCH%"=="" set "ARCH=x64" -REM ── Map ARCH to vcvarsall target. Pin toolset only when cross-compiling -REM for ARM64: cross-compiling needs the ARM64 CRT libraries, which ship -REM with the 14.44 toolset (not the default 14.34). x64 builds use whatever -REM default toolset is installed, so dev machines with any recent VS -REM install keep working without needing 14.44 specifically. +REM ── Map ARCH to vcvarsall target. x64 builds use the default toolset. An +REM ARM64 build picks its toolset after Visual Studio is found, by where +REM the ARM64 C++ libraries are installed (see :pick_arm64_toolset). +set "VCVARS_EXTRA_ARGS=" if /I "%ARCH%"=="x64" ( set "VCARCH=x64" - set "VCVARS_EXTRA_ARGS=" ) else if /I "%ARCH%"=="arm64" ( set "VCARCH=x64_arm64" - set "VCVARS_EXTRA_ARGS=-vcvars_ver=14.44" ) else ( echo ERROR: Unknown architecture: %ARCH%. Use x64 or arm64. exit /b 1 @@ -48,11 +45,16 @@ if not defined VS_PATH ( exit /b 1 ) +if /I "%ARCH%"=="arm64" ( + call :pick_arm64_toolset + if errorlevel 1 exit /b 1 +) + REM ── Set up MSVC environment for target arch ───────────────────────── call "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %VCARCH% %VCVARS_EXTRA_ARGS% >nul 2>&1 if errorlevel 1 ( - echo ERROR: vcvarsall.bat failed. Ensure MSVC v143 C++ workload is installed. - if defined VCVARS_EXTRA_ARGS echo ARM64 builds additionally require toolset 14.44. + echo ERROR: vcvarsall.bat failed. Ensure the MSVC C++ workload is installed. + if defined VCVARS_EXTRA_ARGS echo The ARM64 build asked for: %VCVARS_EXTRA_ARGS% exit /b 1 ) @@ -99,3 +101,37 @@ if errorlevel 1 ( echo remixbridge.dll built successfully: %OUT_DIR%\remixbridge.dll endlocal +exit /b 0 + +REM ── ARM64 toolset ──────────────────────────────────────────────────── +REM /LD links the static C++ runtime, so an ARM64 build needs a toolset +REM with lib\arm64\libcpmt.lib. Visual Studio 2026 installs the ARM64 +REM libraries only for its default toolset, while a Visual Studio 2022 +REM default such as 14.34 may lack them where a newer side-by-side +REM toolset has them. Use the default when it has them, otherwise the +REM newest toolset that does, pinned through -vcvars_ver. +:pick_arm64_toolset +set "MSVC_ROOT=%VS_PATH%\VC\Tools\MSVC" +set "DEFAULT_TOOLSET=" +set "ARM64_TOOLSET=" +set "DEFAULT_TOOLSET_FILE=%VS_PATH%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" +if exist "%DEFAULT_TOOLSET_FILE%" ( + for /f "usebackq tokens=1" %%t in ("%DEFAULT_TOOLSET_FILE%") do set "DEFAULT_TOOLSET=%%t" +) +if defined DEFAULT_TOOLSET ( + if exist "%MSVC_ROOT%\!DEFAULT_TOOLSET!\lib\arm64\libcpmt.lib" ( + echo ARM64 toolset: !DEFAULT_TOOLSET! ^(default^) + exit /b 0 + ) +) +for /f "delims=" %%v in ('dir /b /ad /o-n "%MSVC_ROOT%" 2^>nul') do ( + if not defined ARM64_TOOLSET if exist "%MSVC_ROOT%\%%v\lib\arm64\libcpmt.lib" set "ARM64_TOOLSET=%%v" +) +if not defined ARM64_TOOLSET ( + echo ERROR: No MSVC toolset under %MSVC_ROOT% has the ARM64 C++ libraries. + echo Add "MSVC ARM64 build tools" in the Visual Studio Installer. + exit /b 1 +) +echo ARM64 toolset: %ARM64_TOOLSET% +set "VCVARS_EXTRA_ARGS=-vcvars_ver=%ARM64_TOOLSET%" +exit /b 0