vulkan/screenshot-layer: Add Vulkan screenshot layer
This change adds a Vulkan screenshot layer that allows users to take screenshots from a Vulkan application, but has an emphasis on performance, decreasing the performance impact on the application involved. This allows for automated setups to use this layer to take screenshots for navigating various in-application menus. This layer works by hooking into various common Vulkan setup functions, until it enters the vkQueuePresentKHR function, and from there it copies the current frame's image from the swapchain as an RGB image to host-cached memory, where we will receive the information as a framebuffer pointer. From there, we copy the framebuffer contents to a thread that will detach from the main process so it can write the image to a PNG file without holding back the main thread. This layer was created from using the existing overlay layer as a template, then adding portions of LunarG's VulkanTools screenshot layer: https://github.com/LunarG/VulkanTools/blob/main/layersvt/screenshot.cpp More specifically, there were usages of functions, along with modifications of various functions from screenshot.cpp in the VulkanTools project, used in screenshot.cpp. There are some sections of the screenshotting functionality that remain unmodified from the original screenshot.cpp file in VulkanTools, including the global locking structures and the writeFile() function, which takes care of obtaining the images from the swapchain. There were various areas in which modifications were made, including how images are written to a file (using PNG instead of PPM, introducing threading, added fences/semaphores, etc), along with many smaller changes. v2: Fix segfault upon application exit v3: Fix filename issue with concatenation, along with some leftover memory handling that wasn't cleaned up. v4: Fix some error handling and nits v5: Fix output directory handling Reviewed-by:Ivan Briano <ivan.briano@intel.com> Signed-off-by:
Casey Bowman <casey.g.bowman@intel.com> Part-of: <!30527>
Showing
- meson.build 1 addition, 0 deletionsmeson.build
- meson_options.txt 1 addition, 1 deletionmeson_options.txt
- src/vulkan/meson.build 3 additions, 0 deletionssrc/vulkan/meson.build
- src/vulkan/screenshot-layer/LICENSE.txt 178 additions, 0 deletionssrc/vulkan/screenshot-layer/LICENSE.txt
- src/vulkan/screenshot-layer/README.rst 87 additions, 0 deletionssrc/vulkan/screenshot-layer/README.rst
- src/vulkan/screenshot-layer/VkLayer_MESA_screenshot.json 11 additions, 0 deletionssrc/vulkan/screenshot-layer/VkLayer_MESA_screenshot.json
- src/vulkan/screenshot-layer/mesa-screenshot-control.py 200 additions, 0 deletionssrc/vulkan/screenshot-layer/mesa-screenshot-control.py
- src/vulkan/screenshot-layer/meson.build 47 additions, 0 deletionssrc/vulkan/screenshot-layer/meson.build
- src/vulkan/screenshot-layer/screenshot.cpp 1402 additions, 0 deletionssrc/vulkan/screenshot-layer/screenshot.cpp
- src/vulkan/screenshot-layer/screenshot_params.c 414 additions, 0 deletionssrc/vulkan/screenshot-layer/screenshot_params.c
- src/vulkan/screenshot-layer/screenshot_params.h 98 additions, 0 deletionssrc/vulkan/screenshot-layer/screenshot_params.h
Loading
Please register or sign in to comment