How arm-software/vktrace-arm works
Project type and purpose
• This repository is a Vulkan tooling monorepo providing:
• A capture tool (vktrace) and a replay engine (vkreplay) for Vulkan API calls
• A suite of validation and diagnostic layers (layersvt) and a layer‐factory for generating custom layers
• CLI utilities (vktrace_dump, trace tests, code‐generation scripts)
• A configuration GUI (vkconfig) and a trace viewer UI (vktrace_viewer)
• Cross-platform support (Linux, Android, partial Windows) via CMake, shell scripts, Gradle (Android), and helper “via” wrappers
File structure
• Top-level categories:
• build-android/ – Android JNI, Gradle projects, sample UI for replay
• cmake/ – Find modules, platform toolchain setups
• external/ – Third-party submodules (jsoncpp, lz4, gfxreconstruct, etc.)
• layer_factory/ – Codegen input/output, demo & starter layers, generator scripts
• layersvt/ – A set of diagnostic and validation layers (API dump, screenshot, device_sim, hwcprofiler…)
• scripts/ – Python and shell scripts to generate code, update dependencies, enforce style
• tests/ – Shell/PowerShell/Python tests for vktrace, vkreplay, layers
• via/ – Cross‐platform abstraction layer for system interfaces
• vkconfig/ – Qt/C++ GUI for enabling/disabling layers and editing settings
• vktrace/ –
• vktrace_common: shared library for capturing and writing trace files
• vktrace_dump: text dumper of binary traces
• vktrace_layer: Vulkan layer that intercepts API calls for capture
• vktrace_replay: engine that reads binary traces and replays calls
• vktrace_rq_pp: post‐processing passes on trace files
• vktrace_trace: the low‐level tracer implementation
README
• Confirms: this is an Arm-enhanced fork, preferred build script is build_vktrace.sh, contains capture/replay, layers, tests
• Lists ecosystem components: vktrace, layer factory, layers, tests
Main components & interactions
a. Components
• Application under test (user’s Vulkan app or sample “via” app)
• Vulkan Loader (the official loader with layer chain support)
• Layer Chain (ordered JSON manifests + shared libraries from layer_factory, layersvt, vktrace_layer)
• GPU Driver (vendor-supplied)
• vktrace_common (in memory or I/O)
• Trace File (binary .vktrace)
• vktrace_dump (CLI)
• vkreplay (CLI engine + optional headless EGL/Wayland)
• vktrace_viewer (Qt GUI)
• vkconfig (Qt GUI for configuring loader & layers)
• Build & Codegen Scripts (CMake, shell, Python)
• Android path: JNI layer library + vkreplayUI app
b. Relationships & data flows
1. App → Vulkan Loader → Layer Chain → Driver
– vktrace_layer intercepts Vulkan calls → vktrace_common buffers/writes trace file
– layersvt modules may additionally inspect or modify calls
2. vktrace_dump reads trace file → outputs text
3. vkreplay reads trace file → vktrace_common → reissues Vulkan calls via Loader → Driver
– In headless mode, EGL/Wayland subsystem (arm_wayland) provides offscreen surfaces
4. vktrace_viewer reads trace file → GUI visualization
5. vkconfig configures which layers & their order in loader manifest
6. build scripts & CMake coordinate compilation and packaging (Linux vs Android vs Windows)
c. Architectural patterns & principles
– Plugin/Layered Architecture (Vulkan layers as interceptors)
– Code Generation (Python scripts generate JSON manifests, C headers, etc.)
– Cross-Platform Abstraction (via/ folder, CMake toolchain files, Android JNI, Wayland headers)
– Separation of Concerns (capture vs replay vs dump vs config vs viewer)
d. Key technologies
– Language: C++ (CLI and layers), Qt (vkconfig, viewer), Python/Shell (scripts)
– Build: CMake (with custom Find modules), Gradle (Android)
– External libs: jsoncpp, lz4, zlib, gfxreconstruct, Wayland API (arm_wayland)
Be comprehensive yet clear
– Label sub-components only where it helps (e.g., “vktrace_common” inside both vktrace & vkreplay)