In the spirit of "not invented here", because OpenCL Layers are following the success of Vulkan layers, it makes sense to follow the same format and locations for setting settings on how layers should behave when loaded.
File structure example
# Comments start with #
# settings (by convention) are prefixed by layer name
layer.setting1 = 10
# Empty lines are ignored, trailing and leading whitespace is trimmed
layer.setting2 = true # Line comments
In general this is a direct translation of vk_layer_settings.txt
$VARIABLE is used for environment variables.
Search locations for the file
The order of precedence through which config files are found are as follows:
- If
$OPENCL_LAYERS_SETTINGS_PATH is set to a path to a directory, use the file cl_layer_settings.txt file from it. Otherwise if set it should be set to the file name to read the settings from.
- If
$OPENCL_LAYERS_SETTINGS_PATH is not set search for platform specific directories listed below.
- If no settings are found in any of the platform specific locations, then fall back to
cl_layer_settings.txt in the current working directory.
Platform specific locations
Linux and MacOS
$XDG_DATA_HOME/settings.d/opencl/cl_layer_settings.txt
- if
$XDG_DATA_HOME is not set try with $HOME/.local/share
Windows
- If
{HKEY_LOCAL_MACHINE}\Software\Khronos\OpenCL\Settings has key with zero value, the the name of
the key is used as filename.
- Non admin only:
HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE
Android
The vulkan validation layers use the same locations as in linux, but environment variables are
replaced by properties.
In the spirit of "not invented here", because OpenCL Layers are following the success of Vulkan layers, it makes sense to follow the same format and locations for setting settings on how layers should behave when loaded.
File structure example
In general this is a direct translation of
vk_layer_settings.txt$VARIABLEis used for environment variables.Search locations for the file
The order of precedence through which config files are found are as follows:
$OPENCL_LAYERS_SETTINGS_PATHis set to a path to a directory, use the filecl_layer_settings.txtfile from it. Otherwise if set it should be set to the file name to read the settings from.$OPENCL_LAYERS_SETTINGS_PATHis not set search for platform specific directories listed below.cl_layer_settings.txtin the current working directory.Platform specific locations
Linux and MacOS
$XDG_DATA_HOME/settings.d/opencl/cl_layer_settings.txt$XDG_DATA_HOMEis not set try with$HOME/.local/shareWindows
{HKEY_LOCAL_MACHINE}\Software\Khronos\OpenCL\Settingshas key with zero value, the the name ofthe key is used as filename.
HKEY_CURRENT_USERinstead ofHKEY_LOCAL_MACHINEAndroid
The vulkan validation layers use the same locations as in linux, but environment variables are
replaced by properties.