xref: /aosp_15_r20/external/swiftshader/docs/RuntimeConfiguration.md (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1*03ce13f7SAndroid Build Coastguard WorkerRuntime Configuration
2*03ce13f7SAndroid Build Coastguard Worker=========================
3*03ce13f7SAndroid Build Coastguard Worker
4*03ce13f7SAndroid Build Coastguard WorkerSwiftShader 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*03ce13f7SAndroid Build Coastguard Worker
6*03ce13f7SAndroid Build Coastguard WorkerConfiguration file
7*03ce13f7SAndroid Build Coastguard Worker------------
8*03ce13f7SAndroid Build Coastguard Worker
9*03ce13f7SAndroid Build Coastguard WorkerSwiftShader 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*03ce13f7SAndroid Build Coastguard Worker
11*03ce13f7SAndroid Build Coastguard WorkerThe 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):
12*03ce13f7SAndroid Build Coastguard Worker```
13*03ce13f7SAndroid Build Coastguard Worker[Processor]
14*03ce13f7SAndroid Build Coastguard WorkerThreadCount=4
15*03ce13f7SAndroid Build Coastguard WorkerAffinityMask=0xf
16*03ce13f7SAndroid Build Coastguard Worker
17*03ce13f7SAndroid Build Coastguard Worker# Comment
18*03ce13f7SAndroid Build Coastguard Worker[Profiler]
19*03ce13f7SAndroid Build Coastguard WorkerEnableSpirvProfiling=true
20*03ce13f7SAndroid Build Coastguard Worker```
21*03ce13f7SAndroid Build Coastguard Worker
22*03ce13f7SAndroid Build Coastguard WorkerThe syntax rules are as follows:
23*03ce13f7SAndroid Build Coastguard Worker* Sections are defined via a name in brackets, e.g. `[Processor]`.
24*03ce13f7SAndroid Build Coastguard Worker* Key-value pairs are in the format `Key=Value`.
25*03ce13f7SAndroid Build Coastguard Worker* Keys are always strings, while values can be strings, booleans or integers depending on the semantics of the option:
26*03ce13f7SAndroid Build Coastguard Worker  * For integer options, both decimal and hexademical values are supported.
27*03ce13f7SAndroid Build Coastguard Worker  * For boolean options, both decimal (`1` and `0`) and alphabetical (`true` and `false`) values are supported.
28*03ce13f7SAndroid Build Coastguard Worker* Comments are supported through the use of the `#` character at the beginning of a line.
29*03ce13f7SAndroid Build Coastguard Worker
30*03ce13f7SAndroid Build Coastguard WorkerOptions
31*03ce13f7SAndroid Build Coastguard Worker------------
32*03ce13f7SAndroid Build Coastguard Worker
33*03ce13f7SAndroid Build Coastguard WorkerRefer to the [SwiftConfig.hpp](../src/System/SwiftConfig.hpp) header for an up-to-date overview of available options.
34*03ce13f7SAndroid Build Coastguard Worker
35