Disabling implicit Vulkan Validation Layer via environment variable

36 views Asked by At

Vulkan Layer API specs describe a mechanism to control activation of implicit layers via command line.

Specifically,enable_environment and disable_environment fields can be defined in the JSON manifest file as follows:

 {
   "file_format_version" : "1.0.0",
   "layer" : {
     "name": "VK_LAYER_SAMPLE_SampleLayer",
     "type": "GLOBAL",
     "library_path": ".\\sample_layer.dll",
     "api_version": "1.0.0",
     "implementation_version": "1",
     "description": "Sample layer - https://renderdoc.org/vulkan-layer-guide.html",
     "functions": {
        "vkGetInstanceProcAddr": "SampleLayer_GetInstanceProcAddr",
        "vkGetDeviceProcAddr": "SampleLayer_GetDeviceProcAddr"
     },
     "enable_environment": {
        "ENABLE_SAMPLE_LAYER": "1"
     },
     "disable_environment": {
       "DISABLE_SAMPLE_LAYER": "1"
     }
   }
}

The above manifest is taken from the RenderDoc documentation.I also used the code of the sample layer discussed in that article to create my own.

After building the dll here are the steps I did to active the layer: Opened environment variables window (I am on windows 11) and added to the system vars:

  1. VK_INSTANCE_LAYERS = VK_LAYER_SAMPLE_SampleLayer
  2. VK_LAYER_PATH = C:\Users\defaultUser\Documents\CustomLayers
  3. ENABLE_SAMPLE_LAYER = 1

The above activates the layer. Then I tried to remove the ENABLE_SAMPLE_LAYER and adding DISABLE_SAMPLE_LAYER = 1 instead. But the loader still keeps loading the layer. I found this question where the user tried to do the same but via code,so it should work. What am I missing here?

0

There are 0 answers