LunarG

Copyright © 2015-2022 LunarG, Inc.

Creative Commons

VK_LAYER_LUNARG_screenshot

The VK_LAYER_LUNARG_screenshot layer records frames to image files.

Configuring the Screenshot Layer

For an overview of how to configure layers, refer to the Layers Overview and Configuration document.

The Screenshot Layer settings are documented in the Layer Details section below.

The Screenshot Layer can also be enabled and configured using the Vulkan Configurator included with the Vulkan SDK.

Android

Frame numbers can be specified with the debug.vulkan.screenshot.frames property:

adb shell setprop debug.vulkan.screenshot.frames <framenumbers>

The directory in which to create the image files can be specified with the debug.vulkan.screenshot.dir property:

adb shell setprop debug.vulkan.screenshot.dir <directory>

If debug.vulkan.screenshot.dir is not set or it is set to an empty string, the value of debug.vulkan.screenshot.dir will default to "/sdcard/Android".

For production builds, if the files are to be written to external storage, make sure your application is able to read and write external storage by adding the following to AndroidManifest.xml:

<!-- This allows writing log files to sdcard -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

You may also need to grant it access with package manager. For example, using the Vulkan Cube demo from Khronos/Vulkan-Tools:

adb shell pm grant com.example.VkCube android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant com.example.VkCube android.permission.WRITE_EXTERNAL_STORAGE

Layer Settings

The options for this layer are specified in VK_LAYER_LUNARG_screenshot.json. The layer option details are documented in the screenshot layer documentation.

Layer Details

Layer Properties

Layer Settings Overview

Setting Type Default Value vk_layer_settings.txt Variable Environment Variable Platforms
Frames STRING lunarg_screenshot.frames VK_SCREENSHOT_FRAMES WINDOWS, LINUX, MACOS, ANDROID
Directory SAVE_FOLDER lunarg_screenshot.dir VK_SCREENSHOT_DIR WINDOWS, LINUX, MACOS, ANDROID
Format ENUM USE_SWAPCHAIN_COLORSPACE lunarg_screenshot.format VK_SCREENSHOT_FORMAT WINDOWS, LINUX, MACOS, ANDROID

Layer Settings Details

Frames

Specifies list of frames to output as screenshots. It is specified as a comma-separated list of frames or a range of frames with a start, count, and optional interval separated by a dash. Setting the variable to "all" will output every frame. 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. If it is not set or it set to an empty string, no screenshots are created.

Setting Properties:

Directory

Specifies the directory in which to create the screenshot files. If it is not set or is set to an empty string, the files will be created in the current working directory.

Setting Properties:

Format

Specify a color space for the output. If it is not set, set to null, or set to USE_SWAPCHAIN_COLORSPACE the format will be set to use the same color space as the swapchain object.

Setting Properties:
Enum Value Label Description Platforms
UNORM UNORM N/A WINDOWS, LINUX, MACOS, ANDROID
SNORM SNORM N/A WINDOWS, LINUX, MACOS, ANDROID
USCALED USCALED N/A WINDOWS, LINUX, MACOS, ANDROID
SSCALED SSCALED N/A WINDOWS, LINUX, MACOS, ANDROID
UINT UINT N/A WINDOWS, LINUX, MACOS, ANDROID
SINT SINT N/A WINDOWS, LINUX, MACOS, ANDROID
SRGB SRGB N/A WINDOWS, LINUX, MACOS, ANDROID
USE_SWAPCHAIN_COLORSPACE USE_SWAPCHAIN_COLORSPACE N/A WINDOWS, LINUX, MACOS, ANDROID