From 307485c37292d1ce6010d7b31eb410014dee6e05 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Sat, 5 Jul 2025 18:36:13 +0200 Subject: [PATCH] update buildscript and docs --- CMakeLists.txt | 5 ++++- README.md | 21 ++++++++++++--------- VkLayer_LS_frame_generation.json | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a29f9a6..e20ec99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,4 +53,7 @@ target_compile_options(lsfg-vk PRIVATE -Wno-cast-function-type-strict ) -install(FILES "${CMAKE_BINARY_DIR}/liblsfg-vk.so" DESTINATION lib) +install(FILES "${CMAKE_BINARY_DIR}/liblsfg-vk.so" + DESTINATION lib) +install(FILES "${CMAKE_SOURCE_DIR}/VkLayer_LS_frame_generation.json" + DESTINATION share/vulkan/explicit_layer.d) diff --git a/README.md b/README.md index 504dd0a..9d1363b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # lsfg-vk This project brings [Lossless Scaling's Frame Generation](https://store.steampowered.com/app/993090/Lossless_Scaling/) to Linux! - -## How does it work? -LSFG is primarily written in DirectX 11 compute shaders, which means we can use DXVK to translate it into SPIR-V. The surrounding parts have been rewritten in plain Vulkan code in order to make LSFG run natively on Linux. -By specifying an `LD_PRELOAD`, lsfg-vk can place itself inbetween your game and Vulkan. That way it can fetch frames from the game and insert its own frames without any problems. (Beware of anticheats please!) +>[!NOTE] +> This is a work-in-progress. While frame generation has worked in a few games, there's still a long way to go. Please review the wiki for support (the wiki is not written yet) ## Building, Installing and Running + +>[!CAUTION] +> The build instructions have recently changed. Please review them. + In order to compile LSFG, make sure you have the following components installed on your system: - Traditional build tools (+ sed, git) - Clang compiler (this project does NOT compile easily with GCC) @@ -18,25 +20,26 @@ Compiling lsfg-vk is relatively straight forward, as everything is neatly integr ```bash $ cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=$PWD/release \ + -DCMAKE_INSTALL_PREFIX=~/.local \ -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ -DCMAKE_CXX_CLANG_TIDY="" $ cmake --build build $ cmake --install build ``` -(Make sure you change `$PWD/release` to the path you'd like to install this project to) +This will install lsfg-vk to ~/.local/lib and ~/.local/share/vulkan. Next, you'll need to download Lossless Scaling from Steam. Switch to the `legacy_2.13` branch or download the corresponding depot. Copy or note down the path of "Lossless.dll" from the game files. Finally, let's actually start a program with frame generation enabled. I'm going to be using `vkcube` for this example: ```bash -LD_PRELOAD="/home/pancake/.lsfg-vk/liblsfg-vk.so" LSFG_DLL_PATH="/home/pancake/games/Lossless Scaling/Lossless.dll" LSFG_MULTIPLIER=4 vkcube +VK_INSTANCE_LAYERS="VK_LAYER_LS_frame_generation" LSFG_DLL_PATH="/home/pancake/games/Lossless Scaling/Lossless.dll" LSFG_MULTIPLIER=4 vkcube ``` Make sure you adjust the paths. Let's examine each one: -- `LD_PRELOAD`: This is how you let the loader know that you want to load lsfg-vk before anything else. This HAS to be either an ABSOLUTE path, or a path starting with `./` to make it relative. Specify `liblsfg-vk.so` here. -- `LSFG_DLL_PATH`: Here you specify the Lossless.dll you downloaded from Steam. This is either an absolute path, or a relative path from where you are running the app. +- `LVK_INSTANCE_LAYERS`: Specify `VK_LAYER_LS_frame_generation` here. This forces any Vulkan app to load the lsfg-vk layer. +- `LSFG_DLL_PATH`: Here you specify the Lossless.dll you downloaded from Steam. lsfg-vk will extract and translate the shaders from here. - `LSFG_MULTIPLIER`: This is the multiplier you should be familiar with. Specify `2` for doubling the framerate, etc. +- `VK_LAYER_PATH`: If you did not install to `~/.local` or `/usr`, you have to specify the `explicit_layer.d` folder here. >[!WARNING] > Unlike on Windows, LSFG_MULTIPLIER is heavily limited here (at the moment!). If your hardware can create 8 swapchain images, then setting LSFG_MULTIPLIER to 4 occupies 4 of those, leaving only 4 to the game. If the game requested 5 or more, it will crash. diff --git a/VkLayer_LS_frame_generation.json b/VkLayer_LS_frame_generation.json index e7040ff..4761d40 100644 --- a/VkLayer_LS_frame_generation.json +++ b/VkLayer_LS_frame_generation.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LS_frame_generation", "type": "GLOBAL", "api_version": "1.4.313", - "library_path": "./build/liblsfg-vk.so", + "library_path": "../../../lib/liblsfg-vk.so", "implementation_version": "1", "description": "Lossless Scaling frame generation layer", "functions": {