Skip to content

fix(rendering): fall back to FXC when bundled DXC fails to load on Windows - #3902

Merged
richiemcilroy merged 15 commits into
mainfrom
fix/windows-dxc-fxc-fallback
Nov 7, 2026
Merged

richiemcilroy merged 15 commits into
mainfrom
fix/windows-dxc-fxc-fallback

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

On Windows the editor could fail to open with only No GPU adapter found in the logs, on machines with DX12 GPUs (user reports: AMD Vega 10, Intel HD 630 on Windows 10). Windows always has WARP, so zero adapters means the DX12 backend itself never initialised.

flowchart LR
  A[create_wgpu_instance_sync] --> B["DX12 instance<br/>DynamicDxc (bundled dlls)"]
  B -->|DXC loads| C[DX12 + DXC, unchanged]
  B -->|DXC fails to load| D["wgpu-hal init returns InstanceError<br/>wgpu-core drops DX12 at debug level"]
  D --> E["no adapters, not even WARP<br/>RenderingError::NoAdapter"]
  D -.this PR.-> F["warn with the real error<br/>rebuild instance on FXC"]
  F --> G["create_shared_device<br/>hardware adapters only"]
Loading
  • vendor/wgpu-hal/src/dx12/instance.rs:69 turns a DynamicDxc load failure into InstanceError("Failed to load dynamic DXC"). wgpu-core's try_add_hal only log::debug!s it and leaves the instance with no DX12 backend, so create_shared_device finds nothing and returns NoAdapter.
  • create_wgpu_instance_sync (crates/rendering/src/lib.rs) now checks whether the DX12 backend came up (Instance::as_hal::<Dx12>(), a pointer check, no extra enumeration). If it did not, it logs a warning and rebuilds the instance with Dx12Compiler::Fxc, which ships with Windows. This is the compiler Cap used on Windows before fix(desktop): use DXC for Windows shaders #2135.
  • The chosen compiler is cached in a OnceLock, so every later instance (editor, export, preview, camera blur) goes straight to FXC instead of retrying DXC.
  • wgpu does not surface the backend error, so on the failure path only the DX12 hal backend is initialised once more to put the cause in the log:
WARN cap_rendering: DX12 with bundled DXC failed to initialise; retrying with FXC error="Failed to load dynamic DXC: Failed to load dxcompiler.dll: LoadLibraryExW failed"
  • On the FXC fallback create_shared_device skips software adapters. WARP crashes (0xc0000005 at the first queue.submit) running frames whose shaders FXC compiled, so a machine whose only adapter is WARP keeps today's NoAdapter error instead of crashing.
  • dx12_compiler_fallback_tests (Windows only, runs in the A/V Sync Tests Windows job) points DXC at zero-byte dxcompiler.dll / dxil.dll, asserts that instance has no adapters, then asserts the fallback picks FXC, creates a device and builds every production pipeline (RendererLayers, TransitionCompositor) without errors. A second test asserts a loadable bundled DXC is kept.
Bundled DXC Adapter Before After
Loads any DX12 + DXC DX12 + DXC (unchanged)
Fails to load hardware GPU No GPU adapter found, editor and export unusable warning with the load error, DX12 + FXC on the GPU
Fails to load WARP only No GPU adapter found No GPU adapter found plus the load error in the log

The whole cap-rendering suite on an NVIDIA T4 (Windows Server 2022, DX12) gives the same result on FXC as on DXC:

Compiler Tests passed Failed Composite pipeline build
DXC 461 1 3.6 s
FXC fallback 461 1 14.7 s

The single failure (decoder::ffmpeg::tests::borrowed_planes_render_the_same_rgba_as_the_copy_path) fails identically on both compilers. FXC builds pipelines more slowly, which is why DXC stays the default; the fallback only runs when DXC cannot load.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new blocking issues were found.

Summary

The PR retries Windows DX12 startup with FXC when bundled DXC cannot load. It caches that choice and excludes software adapters on the fallback.

  • Windows rendering switches to FXC when bundled DXC cannot start.

Reviews (3) · Last reviewed commit: "test(rendering): drop the temporary WARP..." · Reviewed by Greptile

@sandchest-com

sandchest-com Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Sandchest

Sandchest reviewed 82d3a7c: nothing exploitable found in this change.

Sandchest reviews every change for vulnerabilities an attacker could use · 1 credit · Review details

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

Comment thread crates/rendering/src/lib.rs Resolved
@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Ignored Ignored Preview Nov 7, 2026 12:26am UTC

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

Open in Capy

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 2 other findings in Capy.

Open in Capy

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 2 other findings in Capy.

Open in Capy

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 5 other findings in Capy.

Open in Capy

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

Open in Capy

@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 4 other findings in Capy.

Open in Capy

@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

Open in Capy

@richiemcilroy
richiemcilroy merged commit c48546e into main Nov 7, 2026
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants