DXMT 构建
dxmt-er-build 仓库会构建带有 Eternal Return 专用 pixel output sanitization 补丁的 DXMT v0.80 运行时。
该补丁用于减少 Eternal Return 中观察到的闪光和图形破损问题。
补丁会添加 d3d11.sanitizeOutput 选项,并且只对 EternalReturn.exe 默认启用。
它不会启用 dxgi.forceSDR、sampleNaNToZero、defuseFma 等其他实验选项。
需要 macOS、Xcode Command Line Tools、git、curl、cmake、meson 和 ninja。
为了构建 builtin Wine DLL 和 .so 文件,还需要 Wine build tree。
默认 Wine build tree 路径如下。
./wine-build/build64如果使用其他路径,请通过 WINE_BUILD 指定。
WINE_BUILD=/path/to/wine-build/build64 ./scripts/build-dxmt.sh先准备 DXMT toolchain 并获取 DXMT source。
./scripts/fetch-toolchains.sh./scripts/fetch-dxmt.sh然后指定 Wine build tree 构建 DXMT runtime。
WINE_BUILD=/path/to/wine-build/build64 ./scripts/build-dxmt.sh如果 Wine build tree 已连接到默认路径,可以直接执行:
./scripts/build-dxmt.sh构建完成后会生成 dxmt-runtime 和 tarball artifact。
dxmt-runtime/ i386-windows/ x86_64-windows/ x86_64-unix/
artifacts/ dxmt-v0.80-builtin.tar.gz dxmt-v0.80-builtin.tar.gz.sha256archive 解压后会得到 dxmt-v0.80-builtin/ 目录。
runtime 和 archive 会包含相关 DXMT 与 third-party license 文件。
安装与 override
Section titled “安装与 override”需要安装到 Wine Stable 布局时,可以使用安装脚本。 已有文件会以带 timestamp 的 backup 形式保留。
./scripts/install-to-wine-stable.shWine 中需要将 DXMT DLL 设置为优先使用 builtin。
d3d10core = builtin,natived3d11 = builtin,nativedxgi = builtin,nativewinemetal = builtin,native集成到启动器时,应确保 Wine root 和 prefix-local DLL 使用同一 DXMT 版本。 如果旧的 prefix-local DLL 仍然存在,即使安装了新 runtime,也可能加载旧 DXMT。
Eternal Return 修正方式
Section titled “Eternal Return 修正方式”诊断结论认为,该可见问题更像是 D3D shader 转换到 macOS graphics backend 边界上的浮点兼容性问题,而不是 Wine 中常见的 pointer truncation、row pitch、stride、buffer size 等数据传输问题。
当前修正会把 NaN 或 Inf 等 non-finite pixel shader output 替换为 0.0。
概念流程如下。
game DXBC pixel shader -> DXMT LLVM/AIR conversion -> injected non-finite output epilogue -> Metal shader compilation -> GPU execution -> render-target write该处理接近 branchless select,成本可预测但不是完全免费。 另外,从 D3D conformance 的角度看,某些 float render target 可能需要保留 NaN 和 Inf,因此它不会作为全局默认值。
对 Eternal Return 进行 A/B 测试时,请关闭 shader cache,并分别比较 sanitizer 开启和关闭的状态。
DXMT_SHADER_CACHE=0 /path/to/your/steam-launcher.shDXMT_SHADER_CACHE=0 DXMT_DISABLE_OUTPUT_SANITIZE=1 /path/to/your/steam-launcher.sh第一条命令用于确认 sanitizer 路径。 第二条命令用于关闭修正进行对比。
CrossOver 26.1.0 另有单独的 diagnostic build。
它用于收集 shader DXBC dump、DXMT log、Xcode .gputrace capture 和 non-finite output marker。
./scripts/build-crossover-26.1.0-diagnostic.sh./scripts/test-crossover-26.1.0-diagnostic.sh诊断 marker 会把问题 pixel 标为白色,用于定位问题。 它不是面向用户的修复方案,release build 中不应包含诊断 marker 或 tracing 代码。