VulkanTools Documentation

repository·main·Indexed 21 days ago

https://github.com/lunarg/vulkantools

A collection of utilities and layers for the Vulkan ecosystem. Includes the Vulkan Configurator GUI for managing loaders, drivers, and layers, as well as diagnostic layers such as VK_LAYER_LUNARG_api_dump for API call logging, VK_LAYER_LUNARG_screenshot for frame capture, and VK_LAYER_LUNARG_monitor for FPS tracking.

Tokens
6.9K
Snippets
20
Records
44
Agent score
73%

What's inside VulkanTools

  1. What is the VK_LAYER_LUNARG_api_dump layer?

    main
    The VK_LAYER_LUNARG_api_dump utility layer is a Vulkan layer used to capture and print API calls, their parameters, and their values to a specified output stream. This is useful for debugging Vulkan applications by inspecting the exact data being passed to the driver.
  2. Manage dependencies with UPDATE_DEPS

    main

    VulkanTools uses a custom process for managing C/C++ dependencies, similar to vcpkg.

    • Enable dependency updates: Pass -D UPDATE_DEPS=ON during CMake configuration. This will grab dependencies listed in scripts/known_good.json.
    • Default behavior: UPDATE_DEPS is OFF by default to remain compatible with system package managers.

    Testing custom dependency versions: To test a specific dependency version without modifying known_good.json, you can modify CMAKE_PREFIX_PATH. Important: You must delete CMakeCache.txt (or the entire build directory) to clear cached search results before re-configuring.

    # Delete the CMakeCache.txt which will cache find_* results
    rm build -rf/
    cmake -S . -B build/ ... -D CMAKE_PREFIX_PATH=~/foobar/my_custom_glslang_install/ ...
  3. Configure Vulkan Layers

    main

    The Vulkan Layers Configuration tab is used to enable and set the execution order of Vulkan layers for Vulkan applications.

    Through the layer configuration context menu, you can generate various configuration outputs, including:

    • Documentation
    • vk_layer_settings.txt files
    • Environment variable scripts
    • VK_EXT_layer_settings C++ helper library code
  4. How Vulkan layers work

    main

    Vulkan layers are libraries that intercept or hook Vulkan entry points for debugging, validation, or monitoring. They function in a hierarchy: when a layer intercepts an entry point, it processes it; otherwise, the call is passed to the next layer in the chain (which could be the driver).

    Types of Layers:

    • Instance Layers: Intercept instance-level entry points (functions where VkInstance or VkPhysicalDevice is the first parameter). These are activated at vkCreateInstance time.
    • Device Layers: Intercept device-level entry points (functions where VkDevice, VkCommandBuffer, or VkQueue is the first parameter). These are activated at vkCreateDevice time.
    • Global Layers: Intercept both instance and device level entry points.

    Layers can be activated via vkCreateDevice/vkCreateInstance calls or by setting the VK_INSTANCE_LAYERS environment variable.

  5. Generate Vulkan Diagnostics and Logs

    main

    The Vulkan Diagnostics tab is used to generate diagnostic information for debugging. You can generate and export various logs, such as:

    • Vulkan Loader logs
    • Vulkan Loader configuration
    • vulkaninfo output

    These logs are intended to be shared when submitting bug reports to Vulkan GitHub repositories.

  6. Build VulkanTools for Android

    main

    Requirements:

    • CMake >= 3.22.1
    • NDK r25+
    • Ninja 1.10+
    • Android Studio with SDK Platforms (API 26+), Build-Tools, Platform-Tools, SDK Tools, NDK, and CMake installed.

    Method 1: Direct CMake Build

    Set ANDROID_NDK_HOME and use the Android toolchain file:

    export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/X.Y.Z
    
    cmake -S . -B build \
      -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
      -D ANDROID_PLATFORM=29 \
      -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a \
      -D CMAKE_ANDROID_STL_TYPE=c++_static \
      -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO \
      -D CMAKE_BUILD_TYPE=Release \
      -D UPDATE_DEPS=ON \
      -G Ninja
    
    cmake --build build
    cmake --install build --prefix build/install

    Method 2: Using scripts/android.py

    This script places binaries in the build-android/libs directory.

    Build for a single ABI:

    python3 scripts/android.py --config Release --app-abi arm64-v8a

    Build for multiple ABIs:

    python3 scripts/android.py --config Release --app-abi 'armeabi-v7a arm64-v8a x86 x86_64'
    # Build release binary for arm64-v8a using the script
    python3 scripts/android.py --config Release --app-abi arm64-v8a