Configuring lsfg‐vk - Pahheb/lsfg-vk GitHub Wiki

Configuring lsfg-vk is done by environment variables. Let's quickly go through setting an environment variable:

  1. If you're running from the command line, put the environment variables in this format before the command you are running:
$ VARIABLE_NAME="value" EXAMPLE_PATH="/path/to/something" NUMBER_VARIABLE=5 command
  1. If you're running through Steam, add the environment variables followed by `%COMMAND% into the launch arguments:
SOME_VARIABLE=1 %COMMAND%

Supported environment variables

The following is a table of supported environment variables, their usage and recommended values, as well as some notes.

Variable Recommended Value Description Notes
LSFG_LEGACY 1 Enables the frame generation layer.
LSFG_MULTIPLIER 2-4 Traditional FPS multiplier value. If you set this value higher than your hardware supports, your game will crash. Try lowering this if you encounter any issues.
LSFG_DLL_PATH Override where lsfg-vk looks for Lossless Scaling. Specify the Lossless.dll file here, if you installed LS in a different location.
LSFG_LOG_DEBUG List of modules to enable debugging for. This only works on Debug builds.
LSFG_LOG_FILE Write all messages to a file in addition to the console
LSFG_HDR_MODE 1 when using HDR Switches the shaders to HDR mode (scRGB not supported) Do not set this flag if you're not using HDR
LSFG_FLOW_SCALE 1.0 Lowers the flow scale, where 1.0 equals 100% and 0.25 equals 25%. This can improve performance Use the benchmark to figure out what your system can handle.
LSFG_PERFORMANCE_MODE Enable performance mode, which can as much as quintuple the performance.
LSFG_EXPERIMENTAL_PRESENT_MODE fifo / vsync / immediate / mailbox Overrides the present mode without altering synchronization logic. Very experimental.
LSFG_EXPERIMENTAL_FPS_LIMIT Try to override the FPS limit on DXVK and VKD3D games BEFORE applying lsfg-vk

Usually, specifying LSFG_LEGACY=1 and LSFG_MULTIPLIER is enough:

$ LSFG_LEGACY=1 LSFG_MULTIPLIER=4 vkcube

Benchmark

If you want to see how well lsfg-vk performs on your system, you can use the integrated benchmark. Run the process like this:

$ LD_PRELOAD=~/.local/lib/liblsfg-vk.so LSFG_BENCHMARK=1 (...) /bin/echo -n

Instead of (...) you can specify the flags above as well as LSFG_EXTENT_WIDTH and LSFG_EXTENT_HEIGHT which change the resolution of the test. If you're having issues with the device selection, use LSFG_DEVICE_UUID to override the device used in the benchmark (The device id is 0x(vendorid)(deviceid) in decimal)

The output of the test should look something like this:

$ LD_PRELOAD=/home/pancake/.local/lib/liblsfg-vk.so LSFG_BENCHMARK=1 LSFG_EXTENT_WIDTH=2560 LSFG_EXTENT_HEIGHT=1440 LSFG_MULTIPLIER=3 LSFG_FLOW_SCALE=0.70 /bin/echo -n
lsfg-vk(bench): Running 3x benchmark with 2560x1440 extent and flow scale of 0.7 without HDR
lsfg-vk(bench): Benchmark context created, ready to run
lsfg-vk(bench): 0.00% done (1/4001)
lsfg-vk(bench): 12.50% done (501/4001)
lsfg-vk(bench): 24.99% done (1001/4001)
lsfg-vk(bench): 37.49% done (1501/4001)
lsfg-vk(bench): 49.99% done (2001/4001)
lsfg-vk(bench): 62.48% done (2501/4001)
lsfg-vk(bench): 74.98% done (3001/4001)
lsfg-vk(bench): 87.48% done (3501/4001)
lsfg-vk(bench): 99.98% done (4001/4001)
lsfg-vk(bench): Benchmark completed in 9591 ms
lsfg-vk(bench): Time per iteration: 2.40 ms
lsfg-vk(bench): Generation FPS: 834.32
lsfg-vk(bench): Final FPS: 1251.49
lsfg-vk(bench): Benchmark finished, exiting

It's recommended to have a game running at locked FPS to see just how fast lsfg-vk can run while a game is also running.