Skip to content

Customizing VK_LAYER_PATH or VK_ADD_LAYER_PATH during app initialization #1901

Description

@Toctave

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 :

  1. Run my program with some sort of launcher that sets the environment then runs the actual app
  2. Have my own ((constructor)) function, and somehow ensure that it runs before vulkan's
  3. 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 !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions