9

Github VulkanTools/screenshot_layer.md at 98f7c5f4268cdccb43ad03b8a55492286cac8b...

 4 years ago
source link: https://github.com/LunarG/VulkanTools/blob/98f7c5f4268cdccb43ad03b8a55492286cac8b91/layersvt/screenshot_layer.md
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copyright © 2015-2020 LunarG, Inc.

VK_LAYER_LUNARG_screenshot

The VK_LAYER_LUNARG_screenshot layer records frames to image files. The layer can easily be enabled and configured using the Vulkan Configurator included with the Vulkan SDK. Or you can manually enable and configure the layer by following the directions below.

VK_SCREENSHOT_FRAMES

The environment variable VK_SCREENSHOT_FRAMES can be set to a comma-separated list of frame numbers. When the frames corresponding to these numbers are presented, the screenshot layer will record the image buffer to PPM files. For example, if VK_SCREENSHOT_FRAMES is set to "4,8,15,16,23,42", the files created will be: 4.ppm, 8.ppm, 15.ppm, etc. VK_SCREENSHOT_FRAMES can also be set to a range of frames by specifying two numbers separated by a dash. The first number is the first frame and the second number is the number of frames. For example, if it is set to "20-3", the files created will be 20.ppm, 21.ppm, and 22.ppm.

VK_SCREENSHOT_DIR

The environment variable VK_SCREENSHOT_DIR can be set to specify the directory in which to create the screenshot files. If it is not set or is set to null, the files will be created in the current working directory.

VK_SCREENSHOT_FORMAT

The environment variable VK_SCREENSHOT_FORMAT can be set to 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.

vk_layer_settings.txt Options

Each environment variable has an equivalent option in the vk_layer_settings.txt file.

  • VK_SCREENSHOT_FRAMES = lunarg_screenshot.frames
  • VK_SCREENSHOT_DIR = lunarg_screenshot.dir
  • VK_SCREENSHOT_FORMAT = lunarg_screenshot.format

Note: Environment variables take precedence over vk_layer_settings.txt options.

Android

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

adb shell setprop debug.vulkan.screenshot <framenumbers>

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

adb shell setprop debug.vulkan.dir <directory>

If debug.vulkan.dir is not set or it is set to an empty string, the value of debug.vulkan.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

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK