README.md 3.73 KB
Newer Older
torkel104's avatar
torkel104 committed
1
# libstrangle
Björn Spindel's avatar
Björn Spindel committed
2
Frame rate limiter for Linux.
Björn Spindel's avatar
Björn Spindel committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Building
Typically you'll use these commands to build the program
```
make
sudo make install
```

**Debian**, **Ubuntu** and derivates may need some or all of these packages:
```
gcc-multilib
g++-multilib
libx11-dev
mesa-common-dev
```

**OpenSUSE** needs these packages:
```
glibc-devel-32bit
gcc
gcc-32bit
```
torkel104's avatar
torkel104 committed
24
## Usage
25
Cap the FPS (frames per second) of a chosen game by using the included script `strangle`
torkel104's avatar
torkel104 committed
26 27 28 29
Example:
```
strangle 60 /path/to/game
```
30
Run `strangle --help` for full usage info
Björn Spindel's avatar
Björn Spindel committed
31 32 33
### Steam
You can use this with Steam by right-clicking on a game in your library and selecting Properties and then SET LAUNCH OPTIONS... under the General tab. In the input box type:
`strangle <somenumber> %command%`
34 35 36 37 38 39
### Laptops
On laptops you can specify an alternative framerate cap when running on battery power with the `STRANGLE_FPS_BATTERY` env var or by using the `<fps>:<battery_fps>` syntax with the strangle script.
Example:
```
strangle 60:30 /path/to/game
```
Björn Spindel's avatar
Björn Spindel committed
40
### Vsync
41
Vertical sync can be controlled by setting the `STRANGLE_VSYNC` environment variable or with the `-v` or `--vsync` command line options. Beware that OpenGL and Vulkan work differently on the same values:
Björn Spindel's avatar
Björn Spindel committed
42

Björn Spindel's avatar
Björn Spindel committed
43 44 45 46 47 48 49 50 51 52 53 54
**OpenGL**
* -1 - Adaptive sync (unconfirmed if this actually works)
* 0 - Force off
* 1 - Force on
* n - Sync to refresh rate / n.

**Vulkan**
* 0 - Force off
* 1 - Mailbox mode. Vsync with uncapped framerate.
* 2 - Traditional vsync with framerate capped to refresh rate.
* 3 - Adaptive vsync with tearing at low framerates.

55 56
Examples:
```
57
strangle -v 1 /path/to/game
58 59
STRANGLE_VSYNC=2 strangle /path/to/game
STRANGLE_VSYNC=1 strangle 40 /path/to/game
60
```
61
### Options
62 63
Run `strangle --help` to see command line options.<br />
Strangle can also be controlled with the following environment variables:
Björn Spindel's avatar
Björn Spindel committed
64

65 66 67
| ENV VAR                                | Value | Explanation |
| ---                                    | ---   | ---:        |
| STRANGLE_FPS                           | &lt;decimal&gt; | Maximum framerate. 0 to disable. Any positive value to enable |
68
| STRANGLE_FPS_BATTERY                   | &lt;decimal&gt; | Maximum framerate when running on battery power |
69 70 71 72 73 74 75 76 77
| STRANGLE_VSYNC                         | &lt;int&gt;  | See the above section on v-sync |
| STRANGLE_GLFINISH                      | 0 or 1 | Forces glFinish() to run after every frame (OpenGL only) |
| STRANGLE_PICMIP                        | -16 to 16 | Mip-map LoD bias. Negative values will increase texture sharpness (and aliasing). Positive values will increase texture blurriness |
| STRANGLE_AF                            | 1 to 16 | Anisotropic filtering level. Improves sharpness of textures viewed at an angle (Vulkan only) |
| STRANGLE_TRILINEAR                     | 0 or 1 | Force trilinear filtering (Vulkan only) |
| STRANGLE_RETRO                         | 0 or 1 | Disables linear texture filtering. Makes textures look blocky. (Vulkan only) |
| STRANGLE_NODLSYM                       | 0 or 1 | Disables the hooking of dlsym |
| STRANGLE_VKONLY                        | 0 or 1 | Stops strangle's OpenGL libs from loading |
| ENABLE_VK_LAYER_TORKEL104_libstrangle  | 0 or 1 | Enables the implicit Vulkan layer |
78
| DISABLE_VK_LAYER_TORKEL104_libstrangle | 0 or 1 | Disables the implicit Vulkan layer |
Björn Spindel's avatar
Björn Spindel committed
79
### Experimental stuff
80
![Mip map lod bias example](screenshots/picmip_quake.png)*vkQuake with `STRANGLE_PICMIP=1337`*
Björn Spindel's avatar
Björn Spindel committed
81

82 83
You can adjust the mipmap lod bias in both opengl and vulkan with the environment variable `STRANGLE_PICMIP`. A higher value means blurrier textures. A negative value could make textures crisper.
## Notice
84
Might crash if used together with other libs that hijack dlsym, such as Steam Overlay. It seems to work with Steam Overlay when placed at the end of LD_PRELOAD for some reason.