Skip to content

Debugging Tool Vulkan Validation Layers

OpenAI Codex edited this page Nov 1, 2026 · 2 revisions

Vulkan validation layers

← Debugging Tools and Commands

The Khronos validation layer intercepts Vulkan calls and reports API misuse that drivers are not required to diagnose. Use it for object lifetime, parameter, descriptor, command-buffer, render-pass, and synchronization investigations.

Property Details
Supported OS Windows, Linux, macOS through portability implementations, and Android
Layer VK_LAYER_KHRONOS_validation
Download Install the current LunarG Vulkan SDK or platform validation-layer package.
Verify vulkaninfo --summary and vulkaninfo | Select-String VK_LAYER_KHRONOS_validation on PowerShell
Output Vulkan debug-messenger messages containing severity, type, message ID/VUID, objects, and call context

What it is good for

Use validation when a graphics failure suggests:

  • invalid object lifetime or destruction order;
  • descriptor, image-view, render-pass, or pipeline incompatibility;
  • missing or incorrect image/buffer barriers;
  • simultaneous or conflicting resource access;
  • invalid command-buffer state;
  • out-of-bounds shader/resource use that GPU-assisted validation can observe;
  • a problem that differs across drivers because undefined Vulkan behavior is involved.

Validation does not verify Xbox/NV2A semantics, game rendering intent, shader arithmetic, correct pixels, or performance. A clean log narrows the investigation but does not prove correctness.

Install and verify

Install the SDK or distribution package, then confirm that the Vulkan loader can enumerate the layer.

Windows PowerShell

vulkaninfo --summary
vulkaninfo | Select-String 'VK_LAYER_KHRONOS_validation'

Linux

vulkaninfo --summary
vulkaninfo | rg 'VK_LAYER_KHRONOS_validation'

If enumeration fails, verify the selected process architecture, Vulkan loader, layer manifest paths, SDK environment, and GPU driver before changing xemu.

Enable validation in xemu

Use an isolated diagnostic configuration. The relevant TOML shape is:

[display]
renderer = "VULKAN"

[display.vulkan]
validation_layers = true
assert_on_validation_msg = false

Keep assert_on_validation_msg false for evidence collection unless the investigation explicitly needs a debugger break. An assertion can stop the run at the first message and hide later context.

Confirm effective enablement in xemu's log. The configuration request is not proof that the layer was found and loaded.

Core validation workflow

  1. Reproduce with an exact optimized diagnostic executable and isolated configuration.
  2. Start logging before xemu initializes Vulkan.
  3. Reproduce the shortest deterministic failing sequence.
  4. Retain complete messages, including VUID/message ID, object handles/types, severity, and surrounding xemu markers.
  5. Deduplicate repeated messages by VUID and relevant object/state, while preserving counts and first/last occurrence.
  6. Locate each VUID in the Vulkan specification.
  7. Trace the reported host object back to its renderer-owned guest resource and lifetime.
  8. Implement one focused correction, rerun validation, then validate rendering without layers.

Synchronization validation

Synchronization validation tracks conflicting buffer/image accesses around draws, dispatches, copies, clears, and barriers. Enable it with Vulkan Configurator or the layer-settings mechanism supplied by the installed SDK.

A typical vk_layer_settings.txt entry is:

khronos_validation.enables = VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT

Record the exact settings file and SDK/layer version. Do not assume core validation implies synchronization validation was active.

Synchronization validation can report a hazard between host Vulkan operations. It cannot by itself prove which guest NV2A rule was intended or whether the visible defect is caused by that hazard.

GPU-assisted validation

GPU-assisted validation instruments shaders to detect some GPU-time resource errors. It can materially alter shader code, descriptor use, memory pressure, pipeline creation, and timing.

Use it only after core validation and a narrow target justify the extra perturbation. Record whether shader instrumentation, descriptor validation, or reserve-binding-slot features were enabled. Do not use GPU-assisted results as ordinary performance evidence.

Reading a message

Retain the whole record. The useful fields are:

severity and type
VUID or message ID
Vulkan command
object type and handle
reported access/stage/layout/range
xemu draw/submit/resource identity near the message

Look up the VUID in the current Vulkan specification. Fix the violated contract at the ownership boundary rather than filtering the message because one driver appears to tolerate it.

Warnings and best-practice messages are not automatically correctness failures. Classify them by the referenced rule, actual renderer contract, and reproduction.

Common mistakes

  • Running a performance comparison with validation enabled on only one role.
  • Treating an empty log as proof that the layer loaded.
  • Setting an environment variable to 0 when the program treats any nonempty value as enabled or as a file path.
  • Enabling core, synchronization, and GPU-assisted validation together without recording the configuration.
  • Publishing only a cropped line that omits the VUID and object context.
  • Suppressing a repeated message before counting when and where it occurs.
  • Changing queue waits or fence assertions to hide a device-loss symptom.
  • Assuming a validation-clean run rules out host-memory races, incorrect guest translation, or shader logic bugs.

Performance and cleanup

Validation is diagnostic instrumentation and can be expensive. Keep it disabled in release and acceptance-performance configurations. After the run:

  • restore validation_layers = false;
  • remove temporary layer settings and SDK override variables;
  • confirm the next ordinary run does not load validation;
  • retain the diagnostic config separately from the release config.

Evidence to retain

  • xemu commit/tree and executable SHA-256;
  • Vulkan loader, SDK/layer, GPU, and driver versions;
  • full effective xemu configuration and layer settings;
  • complete log and reproduction timestamps;
  • whether core, synchronization, GPU-assisted, or best-practices validation was enabled;
  • VUID counts and the first relevant occurrence;
  • rendering result with validation enabled and again after the fix with validation disabled.

Official references

Related xemu guides

Clone this wiki locally