Skip to content

Adopt Windows DX12-First GPU Backend Policy with Ordered Vulkan Fallback #99

Description

@GoCoder7

Hi everyone,

1. Problem

When running on Windows with Intel integrated GPUs (e.g., Intel HD Graphics 520, Skylake generation, driver 27.20.100.8854), the application window displays a permanent solid white screen (#FFFFFF).

The root cause is that wgpu selects the Vulkan backend by default on Windows. While Intel's Windows Vulkan driver returns VK_SUCCESS on vkQueuePresentKHR, it silently fails to flip or blit swapchain buffers to the Windows Desktop Window Manager (DWM).

In contrast, selecting DirectX 12 (dx12) on the same hardware immediately succeeds because DXGI swapchains present natively to DWM.


2. Current Workaround

Setting std::env::set_var("WGPU_BACKEND", "dx12") at application startup avoids the white screen, but this is fragile:

  • It only protects the specific binary setting it, leaving other embedders broken.
  • It mutates global process state.
  • It provides no fallback if DX12 device creation fails (e.g. headless CI or remote environments).

3. Desired Behavior

A sensible default backend policy in wgpu_context:

  1. Explicit override wins: If WGPU_BACKEND (or WGPU_ADAPTER_NAME) is set, honor it directly.
  2. Windows default (DX12-first): When unset on Windows, attempt DirectX 12 adapter enumeration and device creation first.
  3. Sequential Vulkan fallback: If DX12 adapter/device creation fails, automatically fall back to Vulkan before exhausting options.

4. Why This Belongs in wgpu_context

Instance initialization, adapter enumeration, and device creation reside in wgpu_context::DeviceHandle::new_from_compatible_surface. Downstream renderers (anyrender_vello_hybrid, anyrender_vello) and application frameworks (Blitz, dioxus-native) delegate directly to this context layer. Fixing it here ensures all downstream consumers benefit without renderer-specific workarounds.


5. Proposed Fix

A PR implementing this sequential fallback policy is open at #100.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions