Daniele Vettorel | da0c7ac | 2022-04-04 17:04:27 +0000 | [diff] [blame] | 1 | Runtime Configuration |
| 2 | ========================= |
| 3 | |
| 4 | SwiftShader provides a simple configuration mechanism based on a configuration file to control a variety of runtime options without needing to re-compile from source. |
| 5 | |
| 6 | Configuration file |
| 7 | ------------ |
| 8 | |
| 9 | SwiftShader looks for a file named `SwiftShader.ini` (case-sensitive) in the working directory. At startup, SwiftShader reads this file, if it exists, and sets the options specified in it. |
| 10 | |
Nicolas Capens | 79d4c6c | 2022-04-22 17:20:26 -0400 | [diff] [blame] | 11 | The configuration file syntax is a series of key-value pairs, divided into sections. The following example shows three key-value pairs in two sections (`ThreadCount` and `AffinityMask` in the `[Processor]` section, and `EnableSpirvProfiling` in the `[Profiler]` section): |
Daniele Vettorel | da0c7ac | 2022-04-04 17:04:27 +0000 | [diff] [blame] | 12 | ``` |
| 13 | [Processor] |
| 14 | ThreadCount=4 |
| 15 | AffinityMask=0xf |
| 16 | |
| 17 | # Comment |
Nicolas Capens | 79d4c6c | 2022-04-22 17:20:26 -0400 | [diff] [blame] | 18 | [Profiler] |
| 19 | EnableSpirvProfiling=true |
Daniele Vettorel | da0c7ac | 2022-04-04 17:04:27 +0000 | [diff] [blame] | 20 | ``` |
| 21 | |
| 22 | The syntax rules are as follows: |
| 23 | * Sections are defined via a name in brackets, e.g. `[Processor]`. |
| 24 | * Key-value pairs are in the format `Key=Value`. |
| 25 | * Keys are always strings, while values can be strings, booleans or integers depending on the semantics of the option: |
| 26 | * For integer options, both decimal and hexademical values are supported. |
| 27 | * For boolean options, both decimal (`1` and `0`) and alphabetical (`true` and `false`) values are supported. |
| 28 | * Comments are supported through the use of the `#` character at the beginning of a line. |
| 29 | |
| 30 | Options |
| 31 | ------------ |
| 32 | |
| 33 | Refer to the [SwiftConfig.hpp](../src/System/SwiftConfig.hpp) header for an up-to-date overview of available options. |
| 34 | |