Copyright © 2015-2022 LunarG, Inc.
VK_LAYER_LUNARG_api_dump
The VK_LAYER_LUNARG_api_dump
utility layer prints API calls, parameters, and values to the identified output stream.
Configuring the API Dump Layer
For an overview of how to configure layers, refer to the Layers Overview and Configuration document.
The API Dump Layer settings are documented in the Layer Details section below.
The API Dump Layer can also be enabled and configured using vkconfig. See the vkconfig documentation for more information.
Enabling the API Dump Layer
Desktop (Linux/Windows/MacOS)
You must add the location of the VK_LAYER_LUNARG_api_dump.json
file and corresponding VkLayer_api_dump
library to your VK_LAYER_PATH
in order for the Vulkan loader to be able to find the layer.
Then, you must also enable the layer in one of two ways:
- Directly in your application using the layer's name during vkCreateInstance
- Indirectly by using the
VK_INSTANCE_LAYERS
environment variable.
Setting VK_LAYER_PATH
Windows
If your source was located in: C:\my_folder\vulkantools
and your build folder was build64, then you would add it to the layer path in the following way:
set VK_LAYER_PATH=C:\my_folder\vulkantools\build64\layersvt\Debug;%VK_LAYER_PATH%
Linux/MacOS
If your source was located in: /my_folder/vulkantools
and your build folder was build, then you would add it to the layer path in the following way:
export VK_LAYER_PATH=/my_folder/vulkantools/build/layersvt:$VK_LAYER_PATH
Enabling the layer with VK_INSTANCE_LAYERS
To force the layer to be enabled for Vulkan applications, you can set the VK_INSTANCE_LAYERS
environment variable in the following way:
Windows
set VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_api_dump
Linux/MacOS
export VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_api_dump
Android
Permissions
You may need to grant permissions to your application to write to system storage, even if it normally does not. This depends on whether or not you modify API Dump to output to a file or just leave it to output to text.
If you're building with Android Studio, you do this by:
- Click on "Run" in the menu
- Choose "Edit Configurations..."
- In the dialog box, look for the "Install Flags:" text box
- Enter -g
- Click "Apply"
If this does not work, you may still require enabling permissions for your application from the settings menu.
Failure to do so will result in your application crashing during vkCreateInstance since the layer will attempt, but fail, to create the capture file.
Globally Enabling the Layer
Use ADB to enable the layer for your project by:
adb shell "setprop debug.vulkan.layers 'VK_LAYER_LUNARG_api_dump'"
When done, disable the layer using:
adb shell "setprop debug.vulkan.layers ''"
Applying Environment Settings on Android
On Android, you must use properties to set the layer environment variables. The format of the properties to set takes the following form:
debug. + (lower-case environment variable with 'vk_' stripped)
The easiest way to set a property is from the ADB shell:
adb shell "setprop <property_name> '<property_value>'"
For example:
To set the API Dump output log filename, which on desktop uses VK_API_DUMP_LOG_FILENAME
set the following property:
debug.vulkan.api_dump.log_filename
Which you can set in the following way:
adb shell "setprop debug.vulkan.api_dump.log_filename '/sdcard/Android/vk_apidump.txt'"
Layer Properties
- API Version: 1.4.321
- Implementation Version: 2
- Layer Manifest:
VkLayer_api_dump.json
- File Format: 1.2.0
- Layer Binary:
libVkLayer_api_dump.so
- Variables:
vk_layer_settings.txt
namespace:lunarg_api_dump
- Environment Variable prefix:
VK_LUNARG_API_DUMP_
- Android system property prefix:
adb setprop debug.vulkan.lunarg_api_dump.
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
- Number of Layer Settings: 16
- Number of Layer Presets: 4
Layer Settings Overview
Label | Variables Key | Type | Default Value | Platforms |
---|---|---|---|---|
Output Range | output_range |
STRING |
0-0 |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Output Format | output_format |
ENUM |
text |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Pre-dump the parameters. | pre_dump |
BOOL |
false |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Output to File | file |
BOOL |
false |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Log Filename | log_filename |
SAVE_FILE |
stdout |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Log Flush After Write | flush |
BOOL |
true |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Name Size | name_size |
INT |
32 |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Show Types | show_types |
BOOL |
true |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Type Size | type_size |
INT |
0 |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Show Timestamp | timestamp |
BOOL |
false |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Show Shader | show_shader |
BOOL |
false |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Show Parameter Details | detailed |
BOOL |
true |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Hide Addresses | no_addr |
BOOL |
false |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Use Spaces | use_spaces |
BOOL |
true |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Indent Size | indent_size |
INT |
4 |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Show Thread and Frame | show_thread_and_frame |
BOOL |
true |
WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Layer Settings Details
Output Range
Comma separated list of frames to output or a range of frames with a start, count, and optional interval separated by a dash. A count of 0 will output every frame after the start of the range. Example: "5-8-2" will output frame 5, continue until frame 13, dumping every other frame. Example: "3,8-2" will output frames 3, 8, and 9.
- Key:
output_range
- Type:
STRING
- Default Value:
0-0
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
const char* data[] = { "0-0" }; |
vk_layer_settings.txt : |
lunarg_api_dump.output_range = 0-0 |
Environment variables: | export VK_LUNARG_API_DUMP_OUTPUT_RANGE=0-0 |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.output_range 0-0 |
Output Format
Specifies the format used for output; can be HTML, JSON, or Text (default -- outputs plain text).
Sub-setting: Pre-dump the parameters.,
- Key:
output_format
- Type:
ENUM
- Default Value:
text
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Enum Value | Label | Description | Platforms |
---|---|---|---|
text |
Text | Plain text | WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
html |
HTML | HTML | WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
json |
JSON | Json | WINDOWS_X86 , WINDOWS_ARM , LINUX , MACOS , ANDROID |
Methods: | |
---|---|
VK_EXT_layer_settings : |
const char* data[] = { "text" }; |
vk_layer_settings.txt : |
lunarg_api_dump.output_format = text |
Environment variables: | export VK_LUNARG_API_DUMP_OUTPUT_FORMAT=text |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.output_format text |
Pre-dump the parameters.
Setting this to true causes parameters to calls be logged before the function as well as after the function.
Dependences | Variables Key | Type | Value |
---|---|---|---|
Output Format | output_format |
ENUM | text |
- Key:
pre_dump
- Type:
BOOL
- Default Value:
false
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_FALSE }; |
vk_layer_settings.txt : |
lunarg_api_dump.pre_dump = false |
Environment variables: | export VK_LUNARG_API_DUMP_PRE_DUMP=false |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.pre_dump false |
Output to File
Setting this to true indicates that output should be written to file instead of stdout.
Sub-setting: Log Filename,
- Key:
file
- Type:
BOOL
- Default Value:
false
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_FALSE }; |
vk_layer_settings.txt : |
lunarg_api_dump.file = false |
Environment variables: | export VK_LUNARG_API_DUMP_FILE=false |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.file false |
Log Filename
Specifies the file to dump to when output files are enabled.
Dependences | Variables Key | Type | Value |
---|---|---|---|
Output to File | file |
BOOL | true |
- Key:
log_filename
- Type:
SAVE_FILE
- Default Value:
stdout
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
const char* data[] = { "stdout" }; |
vk_layer_settings.txt : |
lunarg_api_dump.log_filename = stdout |
Environment variables: | export VK_LUNARG_API_DUMP_LOG_FILENAME=stdout |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.log_filename stdout |
Log Flush After Write
Setting this to true causes IO to be flushed after each API call that is written.
- Key:
flush
- Type:
BOOL
- Default Value:
true
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_TRUE }; |
vk_layer_settings.txt : |
lunarg_api_dump.flush = true |
Environment variables: | export VK_LUNARG_API_DUMP_FLUSH=true |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.flush true |
Name Size
The number of characters the name of a variable should consume, assuming more are not required.
- Key:
name_size
- Type:
INT
- Default Value:
32
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
int32_t data[] = { 32 }; |
vk_layer_settings.txt : |
lunarg_api_dump.name_size = 32 |
Environment variables: | export VK_LUNARG_API_DUMP_NAME_SIZE=32 |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.name_size 32 |
Show Types
Dump types in addition to values.
Sub-setting: Type Size,
- Key:
show_types
- Type:
BOOL
- Default Value:
true
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_TRUE }; |
vk_layer_settings.txt : |
lunarg_api_dump.show_types = true |
Environment variables: | export VK_LUNARG_API_DUMP_SHOW_TYPES=true |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.show_types true |
Type Size
The number of characters the name of a type should consume, assuming more are not required.
Dependences | Variables Key | Type | Value |
---|---|---|---|
Show Types | show_types |
BOOL | true |
- Key:
type_size
- Type:
INT
- Default Value:
0
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
int32_t data[] = { 0 }; |
vk_layer_settings.txt : |
lunarg_api_dump.type_size = 0 |
Environment variables: | export VK_LUNARG_API_DUMP_TYPE_SIZE=0 |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.type_size 0 |
Show Timestamp
Show the timestamp of function calls since start in microseconds.
- Key:
timestamp
- Type:
BOOL
- Default Value:
false
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_FALSE }; |
vk_layer_settings.txt : |
lunarg_api_dump.timestamp = false |
Environment variables: | export VK_LUNARG_API_DUMP_TIMESTAMP=false |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.timestamp false |
Show Shader
Dump the shader binary code in pCode.
- Key:
show_shader
- Type:
BOOL
- Default Value:
false
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_FALSE }; |
vk_layer_settings.txt : |
lunarg_api_dump.show_shader = false |
Environment variables: | export VK_LUNARG_API_DUMP_SHOW_SHADER=false |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.show_shader false |
Show Parameter Details
Dump parameter details in addition to API calls.
- Key:
detailed
- Type:
BOOL
- Default Value:
true
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_TRUE }; |
vk_layer_settings.txt : |
lunarg_api_dump.detailed = true |
Environment variables: | export VK_LUNARG_API_DUMP_DETAILED=true |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.detailed true |
Hide Addresses
Dump "address" in place of hex addresses.
- Key:
no_addr
- Type:
BOOL
- Default Value:
false
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_FALSE }; |
vk_layer_settings.txt : |
lunarg_api_dump.no_addr = false |
Environment variables: | export VK_LUNARG_API_DUMP_NO_ADDR=false |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.no_addr false |
Use Spaces
Setting this to true causes all tab characters to be replaced with spaces.
Sub-setting: Indent Size,
- Key:
use_spaces
- Type:
BOOL
- Default Value:
true
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_TRUE }; |
vk_layer_settings.txt : |
lunarg_api_dump.use_spaces = true |
Environment variables: | export VK_LUNARG_API_DUMP_USE_SPACES=true |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.use_spaces true |
Indent Size
Specifies the number of spaces that a tab is equal to.
Dependences | Variables Key | Type | Value |
---|---|---|---|
Use Spaces | use_spaces |
BOOL | true |
- Key:
indent_size
- Type:
INT
- Default Value:
4
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
int32_t data[] = { 4 }; |
vk_layer_settings.txt : |
lunarg_api_dump.indent_size = 4 |
Environment variables: | export VK_LUNARG_API_DUMP_INDENT_SIZE=4 |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.indent_size 4 |
Show Thread and Frame
Show the thread and frame of each function called.
- Key:
show_thread_and_frame
- Type:
BOOL
- Default Value:
true
- Platforms:
WINDOWS_X86
,WINDOWS_ARM
,LINUX
,MACOS
,ANDROID
Methods: | |
---|---|
VK_EXT_layer_settings : |
VkBool32 data[] = { VK_TRUE }; |
vk_layer_settings.txt : |
lunarg_api_dump.show_thread_and_frame = true |
Environment variables: | export VK_LUNARG_API_DUMP_SHOW_THREAD_AND_FRAME=true |
Android system properties: | adb setprop debug.vulkan.lunarg_api_dump.show_thread_and_frame true |
Layer Presets
Console Output
Output API dump to stdout
Preset Setting Values:
- Output Format: text
- Log Filename: stdout
- Output to File: false
Text Output
Output API dump to a text file
Preset Setting Values:
- Output Format: text
- Log Filename: ${VK_LOCAL}/vk_apidump.txt
- Output to File: true
HTML Output
Output API dump to a HTML file
Preset Setting Values:
- Output Format: html
- Log Filename: ${VK_LOCAL}/vk_apidump.html
- Output to File: true
JSON Output
Output API dump to a JSON file
Preset Setting Values:
- Output Format: json
- Log Filename: ${VK_LOCAL}/vk_apidump.json
- Output to File: true