fix(setup): substitute Vulkan layer manifest template vars and detect duplicate layers#259
Conversation
… duplicate layers
On Windows, upstream RenderDoc's Vulkan layer manifest ships with unsubstituted CMake template
vars because upstream's configure_file is UNIX-only. The installer rewrote only library_path, so
@VULKAN_ENABLE_VAR@ survived as the enable key and rdc's own implicit layer could never
self-enable, making Vulkan captures silently time out.
Part 1: in _install_vulkan_layer, thread the in-scope version (RDOC_TAG or --version) through and
resolve every templated field -- force name=VK_LAYER_RENDERDOC_Capture,
enable_environment={ENABLE_VULKAN_RENDERDOC_CAPTURE: 1}, derive the
DISABLE_VULKAN_RENDERDOC_CAPTURE_<major>_<minor> key and implementation_version from the version,
keep library_path=.\renderdoc.dll. Assert no @ remains after serialization so a future template
change fails loudly instead of regressing silently.
Part 2: in _check_win_vulkan_layer, extract a mockable _enumerate_implicit_layers helper, resolve
each registered manifest's layer.name, and warn when more than one resolves to
VK_LAYER_RENDERDOC_Capture (the system + rdc split-brain), listing each manifest path, DLL and
version. A single layer stays green.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughFixes Issue ChangesVulkan Layer Manifest Fix (
Sequence Diagram(s)sequenceDiagram
participant CLI as rdc main()
participant IVL as _install_vulkan_layer
participant PV as _parse_version
participant FS as renderdoc.json
CLI->>IVL: _install_vulkan_layer(install_dir, build_dir, args.version)
IVL->>PV: _parse_version(version)
PV-->>IVL: (major, minor)
IVL->>FS: read template JSON
IVL->>IVL: set name, enable_environment, disable_environment, implementation_version
IVL->>IVL: serialize JSON → assert "@" not in output
IVL->>FS: write resolved renderdoc.json
Note over CLI,FS: At runtime: rdc doctor check
participant REG as Windows Registry (HKCU/HKLM)
participant CWV as _check_win_vulkan_layer
participant MF as manifest files
CWV->>REG: _enumerate_implicit_layers()
REG-->>CWV: list of manifest paths
CWV->>MF: _read_layer_manifest(path) for each
MF-->>CWV: layer objects
CWV->>CWV: filter layer.name == VK_LAYER_RENDERDOC_Capture
CWV->>CWV: deduplicate by resolved path
alt multiple matches
CWV-->>CLI: FAIL – lists each manifest path, DLL, version
else single match
CWV->>MF: check library_path exists on disk
CWV-->>CLI: OK or FAIL (missing DLL)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Addresses #256 (Parts 1 and 2; Part 3 deferred).
Problem
On Windows, rdc's installed Vulkan layer manifest (
renderdoc.json) kept unsubstituted CMake template vars, because upstream'sconfigure_fileruns only in the UNIX CMake branch. The installer rewrote onlylibrary_path, so@VULKAN_ENABLE_VAR@survived as the enable-environment key and rdc's own implicit layer could never self-enable. Combined with a system RenderDoc install (a secondVK_LAYER_RENDERDOC_Capturelayer), Vulkan captures silently timed out, andrdc doctorstayed green.Fix
Part 1 — manifest substitution (
_build_renderdoc.py:_install_vulkan_layer): thread the in-scope version (RDOC_TAG/--version) through and resolve every templated field — forcename=VK_LAYER_RENDERDOC_Capture,enable_environment={ENABLE_VULKAN_RENDERDOC_CAPTURE: "1"}(matching the env varcapture_corealready sets for the child), derive theDISABLE_VULKAN_RENDERDOC_CAPTURE_<major>_<minor>key andimplementation_versionfrom the version, keeplibrary_path=.\renderdoc.dll. A post-serialization guard raises if any@remains, so a future template change fails loudly instead of regressing silently.Part 2 — duplicate-layer detection (
doctor.py:_check_win_vulkan_layer): enumerate HKLM+HKCU implicit layers (mockablewinreghelper), resolve each manifest'slayer.name, dedup by resolved path, and warn when more than one distinct layer resolves toVK_LAYER_RENDERDOC_Capture— listing each manifest path, DLL, and version. A single layer stays green.Deferred (Part 3)
Forcing rdc's own layer for the spawned child via
VK_ADD_LAYER_PATH/VK_LOADER_LAYERS_ENABLE/VK_LOADER_LAYERS_DISABLEis documented in the proposal as a follow-up: it needs a real Windows box with a dual RenderDoc install to verify, and because both layers share the exact nameVK_LAYER_RENDERDOC_Capture, a name-basedVK_LOADER_LAYERS_DISABLEwould disable both — an unresolved design question.Tests
New cases in
test_build_renderdoc.py(real-template substitution → zero@, correct values;@guard raises; version threading) andtest_doctor.py(duplicate warn; single green; same-manifest-both-hives dedup; both-hive enumeration), all cross-platform via mockedwinreg.pixi run lint && pixi run typecheck && pixi run test: all green (2998 passed, 6 skipped, 93.09% coverage).Verification note
Parts 1 and 2 are fully covered by deterministic unit tests. Their end-to-end effect (capture succeeds with a dual install) is only fully confirmable on a real Windows machine with two RenderDoc installs, which the deferred Part 3 also requires.
Summary by CodeRabbit
Bug Fixes
rdc doctorto detect and report duplicate Vulkan layer registrations across system registries that could interfere with capture operations.Tests