KhronosGroup / KhronosGroup/Vulkan-Loader
Customizing VK_LAYER_PATH or VK_ADD_LAYER_PATH during app initialization
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 696
- Forks
- 343
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 17
Description
Hi,
I'm trying to ensure that an app I'm developing for Windows and Linux loads a specific version of the validation layers shared library, which is stored alongside the app rather than at the system level.
To that end, I set VK_ADD_LAYER_PATH to point to my shared library (with SetEnvironmentVariableA on Windows and setenv on Linux) before initializing Vulkan. This works on Windows, but not on Linux, because on Linux loader_initialize is called in the loader_init_library constructor function as soon as the .so is loaded, i.e. as soon as the executable starts (in my case, the app links with vulkan dynamically). This means that on Linux, I change the environment variable after it's already been read/
What's the canonical way to go around this issue ? Should I :
- Run my program with some sort of launcher that sets the environment then runs the actual app
- Have my own ((constructor)) function, and somehow ensure that it runs before vulkan's
- Load vulkan dynamically at runtime rather than linking with it ?
If I missed a simpler way to programmatically choose which validation layer shared library is loaded, please let me know !
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the loader_init_library constructor and loader_initialize entry points mentioned in the report, comparing when VK_LAYER_PATH and VK_ADD_LAYER_PATH are read on Windows and Linux. Determine whether an existing runtime mechanism supports selecting the validation-layer library, and document the canonical approach or the required behavior for both platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100