Build the FSR 3.1.5 upscaler - #10
Merged
Merged
Conversation
Space Engineers 2 P/Invokes five entry points -- ffxCreateContext,
ffxDestroyContext, ffxConfigure, ffxQuery and ffxDispatch -- from
"amd_fidelityfx_loader_dx12.dll" when the graphics Quality setting
selects FSR upscaling. That is AMD's flat ffx_api ABI, with
vkd3d-proton's own ID3D12Device/ID3D12Resource pointers passed straight
through, so a native SysV .so exporting those five symbols works as-is.
- Adds `Scripts/build_fidelityfx.sh`, which builds
`libamd_fidelityfx_loader_dx12.so` from the AMD FSR SDK v2.3.0 and
stages it into the SE2 archive. The ffx_api dispatcher, the DX12 backend
and the FSR 3.1.5 provider are linked into one object, so AMD's
provider-DLL discovery never runs. FSR 4.x has no source and the
driver-side provider lives in AMD's closed tree, so 3.1.5 is the only
upscaler included.
- Compiles the DX12 backend against vkd3d-proton's installed headers, so
the vtables it is built against are by construction the ones the game
passes in. The step therefore runs after `build_vkd3d_proton.sh`, and
invokes it when those headers are missing.
- Compiles the ten FSR 3.1 passes to DXIL during the build, in four
variants each (wave32/wave64 x fp32/fp16) with six boolean shader
options expanded into 64 permutations, transcribing the SDK's own
`BuildFSR3UpscalerShaders.bat`. The compiler is AMD's FidelityFX_SC,
ported to Linux from SDK v1.1.4 -- the 2.x releases ship it as a Windows
binary only.
- Builds a second, STOCK DXC for that tool (`build/dxc-host`, same pin as
`build_dxc.sh`, read out of it rather than duplicated): the shipped
libdxcompiler.so carries the SE2 2-byte-WCHAR ABI patch and is
deliberately incompatible with a normal 4-byte-wchar_t caller. It is
cached under its own stamp and is not shipped.
- Adds `Patches/fidelityfx/{sdk,ffx-sc}/`, the Linux port itself:
MSVC-only CRT calls, the AGS and PIX tracing paths, MSVC-only d3dx12.h
helpers, Win32 diagnostics, `D3D12SerializeRootSignature` resolved
through dlopen against libvkd3d-proton-d3d12.so, and two consequences of
4-byte wchar_t (narrowing at the D3D12 ABI, and a private context that
outgrows the SDK's own size reservation). It also supplies
`GetProvider()`/`GetProviderVersions()`, which the SDK declares but
leaves for each shipping loader DLL to define.
- Ships `LICENSES/FidelityFX-{LICENSE,README}.txt`. The SDK's default
terms are binary-redistribution-only; MIT applies through the exception
list in its own `docs/license.md`, and every one of the 107 files this
build compiles is named there.
- Caches the new step in CI, with the host DXC keyed on the DXC commit
alone so editing `Patches/dxc/` does not cost another 19-minute build.
Verified in-game: "FSR upscaler provider selected: 3.1.5" in the Render12
log, a loaded world rendering with no ffx asserts and no artifacts.
The FidelityFX build compiles its DX12 backend against the headers vkd3d-proton installs, but CI cached only that step's staged .so files. On a warm run the vkd3d-proton build was skipped, the install destdir never existed, and the FidelityFX step aborted with "vkd3d-proton headers not found". - Treats `build/vkd3d-proton-out/include/vkd3d-proton/` as an output of `build_vkd3d_proton.sh`: its presence is part of the cache check, so a tree (or a restored cache entry) that has the libraries but not the headers rebuilds instead of being re-used, and the build asserts the headers were installed before staging. - Adds `ARTEFACT_REV` to that script's stamp, following `build_sdl3.sh`'s `CONFIG_REV`. The commit and patch hash alone would still match the cache entry saved before this change, and cache entries are immutable, so the identity has to move for CI to save an entry that contains the headers. - Caches `build/vkd3d-proton-out/include` alongside the libraries.
viktor-ferenczi
added a commit
to CometWorks/linux-compat2
that referenced
this pull request
Aug 29, 2026
- Maps `amd_fidelityfx_loader_dx12` onto the bundled `libamd_fidelityfx_loader_dx12.so` in `LinuxNativeLibraryResolver`, with `SE2_FIDELITYFX_LIBRARY` as the override. The name-to-path switch becomes a shared helper, reused by a new non-throwing probe. - Turns `UpsamplingPatch` from an unconditional FSR-to-FXAA substitution into an availability gate: the library is probed once, and only a missing or unloadable one falls back to FXAA. The gate has to stay because `FSR4_1.TryCreateContext` does not guard against a failing context despite its name, so the P/Invoke would otherwise take down the render thread. - Forces `ForceUseFSR_3_1` in the same postfix, since the bundled library carries the FSR 3.1.5 provider only. The getter returns a copy of the settings struct, so the player's own setting is untouched. Depends on the SE2 dependency archive gaining the upscaler library (CometWorks/linux-dependencies#10).
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.
Scripts/build_fidelityfx.sh, which buildslibamd_fidelityfx_loader_dx12.so— the FSR upscaler Space Engineers 2 P/Invokes asamd_fidelityfx_loader_dx12.dll— from the AMD FSR SDK v2.3.0 and stages it into the SE2 archive. The ffx_api dispatcher, the DX12 backend and the FSR 3.1.5 provider are linked into one object, so AMD's provider-DLL discovery never runs.build_vkd3d_proton.shand invokes it when those headers are missing.libdxcompiler.socarries the SE2 WCHAR ABI patch and cannot be called by a normal 4-byte-wchar_thost tool.Patches/fidelityfx/{sdk,ffx-sc}/, the Linux port itself, together with the provider registry the SDK declares but leaves for each shipping loader DLL to define. Only FSR 3.1.5 is registered — FSR 4.x is a prebuilt Windows DLL and the driver-side provider is closed source.LICENSES/FidelityFX-{LICENSE,README}.txt. The SDK's default terms are binary-redistribution-only; MIT applies through the exception list in its owndocs/license.md, and every one of the 107 files this build compiles is named there.Patches/dxc/does not trigger another full DXC build.README.mdanddocs/.