Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,15 @@ if(Vulkan_FOUND)
src/host/copy_census.cpp src/host/copy_compare.cpp
src/host/shader_patch.cpp src/host/translation_cache.cpp src/host/dxc.cpp src/host/shader_bundles.cpp)
target_link_libraries(bbhost PRIVATE Vulkan::Vulkan gcn replay_common)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
target_sources(bbhost PRIVATE src/host/pe_loader.cpp)
endif()
file(GLOB FSR_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/upscaler_bridge/bin/*.dll")
foreach(dll ${FSR_DLLS})
add_custom_command(TARGET bbhost POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${dll}" "${CMAKE_BINARY_DIR}/"
COMMENT "Copying ${dll} to binary dir")
endforeach()
# The render probe (plugin API 27's frame info, render hooks and
# anti-aliasing claim checked on the GPU: examples/plugins/render_probe): an
# example and a test aid, built beside bbhost, never into plugins/ - where
Expand Down Expand Up @@ -594,7 +603,7 @@ if(UNIX AND NOT APPLE AND Vulkan_FOUND)
# -fms-extensions, src/ffx_vk/ffx_linux.h the rest; its MSVC pragmas and
# deprecations are AMD's. A float handed to int abs() fails the build
# (ffx_linux.h says why).
target_compile_options(bbhost_fidelityfx_vk PRIVATE -fms-extensions -include ${CMAKE_SOURCE_DIR}/src/ffx_vk/ffx_linux.h
target_compile_options(bbhost_fidelityfx_vk PRIVATE -fms-extensions -fext-numeric-literals -include ${CMAKE_SOURCE_DIR}/src/ffx_vk/ffx_linux.h
-Wno-unknown-pragmas -Wno-unknown-warning-option -Wno-deprecated-declarations -Werror=absolute-value)
target_link_libraries(bbhost_fidelityfx_vk PRIVATE Vulkan::Vulkan ZLIB::ZLIB Threads::Threads m)
# The five API functions out, libstdc++ and libgcc inside, nothing left
Expand Down Expand Up @@ -830,6 +839,9 @@ if(UNIX)
target_include_directories(ngx_bridge_test PRIVATE src third_party/upscaler_bridge)
target_link_libraries(ngx_bridge_test PRIVATE Vulkan::Headers ${CMAKE_DL_LIBS})
add_executable(upscaler_load_test tests/upscaler_load_test.cpp src/host/upscaler.cpp src/host/upscaler_ffx.cpp)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
target_sources(upscaler_load_test PRIVATE src/host/pe_loader.cpp)
endif()
target_include_directories(upscaler_load_test PRIVATE src third_party/upscaler_bridge third_party/fidelityfx ${CMAKE_BINARY_DIR}/gen)
target_link_libraries(upscaler_load_test PRIVATE Vulkan::Headers ${CMAKE_DL_LIBS})
add_dependencies(upscaler_load_test bbhost_version)
Expand Down Expand Up @@ -1597,6 +1609,11 @@ if(UNIX)
target_link_libraries(indirect_clamp_test PRIVATE Vulkan::Vulkan)
add_test(NAME indirect_clamp_test COMMAND indirect_clamp_test)
set_tests_properties(indirect_clamp_test PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 60)
add_executable(fsr_hardware_test tests/fsr_hardware_test.cpp src/host/upscaler.cpp src/host/upscaler_ffx.cpp src/host/pe_loader.cpp)
target_include_directories(fsr_hardware_test PRIVATE src include ${CMAKE_BINARY_DIR}/gen third_party/upscaler_bridge third_party/fidelityfx)
target_link_libraries(fsr_hardware_test PRIVATE Vulkan::Vulkan)
add_dependencies(fsr_hardware_test bbhost_version)
add_test(NAME fsr_hardware_test COMMAND fsr_hardware_test)
endif()
endif()
endif()
Expand Down
4 changes: 2 additions & 2 deletions docs/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,8 @@ picture drawn at the Resolution and stretched to the window.
|---|---|
| TAA | bbhost's own temporal anti-aliasing: any GPU, Windows and Linux, the 3D at the Resolution - one below the window keeps the game and its HUD at the window's size, as DLSS and FSR do |
| DLSS | NVIDIA RTX cards, on Windows and on Linux: DLAA, Quality, Balanced or Performance (the 3D at the full Resolution, two thirds, about 59% or half each way) and its model (DLSS preset K, J, L or M) |
| FSR 3 | AMD FidelityFX FSR 3.1.6, any GPU, on Windows and Linux (the Steam Deck included): Native AA, Quality, Balanced or Performance |
| FSR 4 | AMD's newest, on Windows only, where the GPU and driver run it (FSR 3 elsewhere) |
| FSR 3 | AMD FidelityFX FSR 3.1.6, any GPU (the Steam Deck included): Native AA, Quality, Balanced or Performance |
| FSR 4 | AMD's newest, where the GPU and driver run it (FSR 3 elsewhere) |

Frame generation (AMD FidelityFX) runs on Windows only. Sharpness sharpens
what TAA, FSR or DLSS gives. While one of them runs, the game's own
Expand Down
7 changes: 7 additions & 0 deletions src/ffx_vk/ffx_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
#include <math.h> // libstdc++'s: std::abs(float) and the other overloads in the global namespace too
#include <string>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wliteral-suffix"
constexpr unsigned long long operator""ui64(unsigned long long val) {
return val;
}
#pragma GCC diagnostic pop

#define FFX_UNUSED(x) ((void)(x)) // (ffx_util.h's own, which ffx_message.cpp uses without including it)
#define UNREFERENCED_PARAMETER(x) ((void)(x))
#define __declspec(x) __attribute__((visibility("default")))
Expand Down
2 changes: 1 addition & 1 deletion src/host/launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ LauncherResult launcher_run(const HostConfig& cfg, const std::string& reason, bo
if (ui::toggle_row("Frame generation", nullptr, &fg,
"AMD FidelityFX frame generation: a frame made between each two of "
"the game's, from the 3D alone - the HUD and the menus are never interpolated. Works "
"with any Upscaling choice, Off included. While on, the game runs at most half your monitor's refresh rate and frame generation doubles it to the refresh rate (90 + 90 at 180 Hz): higher Frame rates are greyed out, and one set higher comes down to half as it turns on. Display-Limited runs the game at half the refresh rate and generates the frames between. Loading screens stay uncapped."))
"with any Upscaling choice, Off included. Runs on Windows only. While on, the game runs at most half your monitor's refresh rate and frame generation doubles it to the refresh rate (90 + 90 at 180 Hz): higher Frame rates are greyed out, and one set higher comes down to half as it turns on. Display-Limited runs the game at half the refresh rate and generates the frames between. Loading screens stay uncapped."))
host_opt_set("frame_generation", fg);
// While on, a Frame rate above half the refresh rate comes down to it (F10: as it turns on).
if (fg) host_frame_rate_fit(&cap_choice, &cap_custom, &cap_custom_fps);
Expand Down
64 changes: 35 additions & 29 deletions src/host/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,13 @@ Setting g_set[kSettingCount] = {
"TAA (bbhost's own temporal anti-aliasing, any GPU), FSR 4 (AMD's newest, where the GPU and driver offer it), FSR 3 "
"(any GPU) or DLSS (NVIDIA RTX) in place of the game's own anti-aliasing. FSR and DLSS need upscaler_bridge.dll and "
"AMD's FidelityFX files beside bbhost.exe, and for DLSS nvngx_dlss.dll; without them they stay off. FSR 4 runs as "
"FSR 3 where it cannot run. Changes at once.",
"FSR 3 where it cannot run. Frame generation runs on Windows only. Changes at once.",
#else
// (host/upscaler.h upscaler_offered: FSR 3 and DLSS where they run, never FSR 4.)
"TAA (bbhost's own temporal anti-aliasing, any GPU), FSR 3 (AMD's, any GPU: the same FSR 3.1.6 as on Windows) or "
"DLSS (an NVIDIA RTX card with NVIDIA's driver) in place of the game's own anti-aliasing. FSR 3 needs "
"libbbhost_fidelityfx_vk.so beside bbhost, DLSS libbbhost_ngx_bridge.so and NVIDIA's libnvidia-ngx-dlss.so, as the "
"packages have them. FSR 4 and frame generation run on Windows only. Changes at once.",
// (host/upscaler.h upscaler_offered: FSR 4, FSR 3 and DLSS where they run.)
"TAA (bbhost's own temporal anti-aliasing, any GPU), FSR 4 (AMD's newest, where the GPU and driver offer it), FSR 3 "
"(AMD's, any GPU) or DLSS (an NVIDIA RTX card with NVIDIA's driver) in place of the game's own anti-aliasing. FSR and "
"DLSS need their libraries beside bbhost; without them they stay off. FSR 4 runs as FSR 3 where it cannot run. "
"Frame generation runs on Windows only. Changes at once.",
#endif
false},
// TAA's blend (host/upscale_pass.cpp record_taa): how much of each new
Expand Down Expand Up @@ -555,7 +555,7 @@ Setting g_set[kSettingCount] = {
// size (host/upscale_pass.cpp).
{"frame_generation", "Frame generation", {"Off", "On"}, 0,
"AMD FidelityFX frame generation: a frame made between each two of the game's, from the 3D alone - "
"the HUD and the menus are never interpolated. Works with any Upscaling choice, Off included, on any GPU. "
"the HUD and the menus are never interpolated. Works with any Upscaling choice, Off included, on any GPU (Windows only). "
"While on, the game runs at most half your monitor's refresh rate and frame generation doubles it to the refresh rate (90 + 90 at 180 Hz): higher Frame rates are greyed out, and one set higher comes down to half as it turns on. Display-Limited runs the game at half the refresh rate and generates the frames between. Loading screens stay uncapped. Needs AMD's amd_fidelityfx_framegeneration_vk.dll and its loader beside bbhost.exe. Changes at once.",
false},
// Where the upscaler's motion for what moves of itself comes from
Expand Down Expand Up @@ -583,6 +583,8 @@ Setting g_set[kSettingCount] = {
{"char_motion", "Character motion", {"Precise", "Off"}, 0,
#if defined(_WIN32)
"How TAA, FSR, DLSS and frame generation follow the hunter, enemies and other moving characters (the camera's own "
#elif defined(__linux__) && defined(__x86_64__)
"How TAA, FSR and DLSS follow the hunter, enemies and other moving characters (the camera's own "
#else
"How TAA, FSR 3 and DLSS follow the hunter, enemies and other moving characters (the camera's own "
#endif
Expand Down Expand Up @@ -2082,11 +2084,7 @@ const char* const* value_tips(int id, bool dlss) {
"The game's own anti-aliasing; the 3D at the Resolution.",
"TAA: bbhost's own temporal anti-aliasing - steadier edges and less shimmer, a little softer. Any GPU, the 3D at the "
"Resolution; one below the window keeps the HUD at the window's size. The fastest of these.",
#if defined(_WIN32)
"AMD FSR 3: any GPU.",
#else
"AMD FSR 3: any GPU, the same FSR 3.1.6 as on Windows. FSR 4 and frame generation run on Windows only.",
#endif
"AMD FSR 4: AMD's newest, where the GPU and driver run it; FSR 3 where they do not.",
"NVIDIA DLSS: RTX cards only.",
};
Expand Down Expand Up @@ -2606,17 +2604,37 @@ const char* upscaler_note() {
if (u <= 1 || g_setup_page) return g_set[kUpscaler].note;
const UpscalerCaps caps = upscaler_caps();
const bool dlss = u == 4;
#if !defined(_WIN32)
// Linux: FSR 3 through bbhost's FidelityFX library, DLSS through the NGX bridge, no FSR 4 (a Windows choice kept
// runs FSR 3).
if (!dlss && !caps.fsr_loaded) {
note = "Not running: libbbhost_fidelityfx_vk.so did not load (it belongs beside bbhost, as the packages have it). The game's "
#if defined(_WIN32)
if (!caps.loaded) {
note = "Not running: upscaler_bridge.dll did not load (it and AMD's FidelityFX files belong beside bbhost.exe). The "
"game's own anti-aliasing runs instead; Frame generation works without it.";
} else if (dlss ? !caps.dlss : !caps.fsr) {
const std::string why = dlss ? caps.dlss_reason : caps.fsr_reason;
note = std::string(dlss ? "DLSS" : "FSR") + " is not available here" + (why.empty() ? "" : " (" + why + ")") +
": the game's own anti-aliasing runs instead. Frame generation works without it." +
(dlss ? " On an AMD or Intel GPU choose FSR 4 or FSR 3." : "");
} else {
return g_set[kUpscaler].note;
}
#else
if (caps.loaded && caps.fsr4) {
// Linux with PE loader upscaler_bridge.dll (FSR 4 available)
if (dlss ? !caps.dlss : !caps.fsr) {
const std::string why = dlss ? caps.dlss_reason : caps.fsr_reason;
note = std::string(dlss ? "DLSS" : "FSR") + " is not available here" + (why.empty() ? "" : " (" + why + ")") +
": the game's own anti-aliasing runs instead." +
(dlss ? " On an AMD or Intel GPU choose FSR 4 or FSR 3." : "");
} else {
return g_set[kUpscaler].note;
}
} else if (!dlss && !caps.fsr_loaded) {
note = "Not running: libbbhost_fidelityfx_vk.so or upscaler_bridge.dll did not load. The game's "
"own anti-aliasing runs instead.";
} else if (!dlss && !caps.fsr) {
note = "FSR 3 is not available here" + (caps.fsr_reason.empty() ? std::string() : " (" + caps.fsr_reason + ")") +
": the game's own anti-aliasing runs instead.";
} else if (!dlss && u == 3) {
note = "FSR 4 runs on Windows only: FSR 3 runs here instead.";
note = "FSR 4 is not available on this GPU or driver: FSR 3 runs here instead.";
} else if (!dlss) {
return g_set[kUpscaler].note;
} else if (!caps.loaded) {
Expand All @@ -2628,18 +2646,6 @@ const char* upscaler_note() {
} else {
return g_set[kUpscaler].note;
}
#else
if (!caps.loaded) {
note = "Not running: upscaler_bridge.dll did not load (it and AMD's FidelityFX files belong beside bbhost.exe). The "
"game's own anti-aliasing runs instead; Frame generation works without it.";
} else if (dlss ? !caps.dlss : !caps.fsr) {
const std::string why = dlss ? caps.dlss_reason : caps.fsr_reason;
note = std::string(dlss ? "DLSS" : "FSR") + " is not available here" + (why.empty() ? "" : " (" + why + ")") +
": the game's own anti-aliasing runs instead. Frame generation works without it." +
(dlss ? " On an AMD or Intel GPU choose FSR 4 or FSR 3." : "");
} else {
return g_set[kUpscaler].note;
}
#endif
return note.c_str();
}
Expand Down
Loading