neovide/neovide · error

Failed to create Skia context

Error message

Failed to create Skia context

What it means

Thrown when Skia's direct_contexts::make_d3d(&backend_context, None) cannot create a GrDirectContext over the D3D12 backend. Skia wraps the supplied adapter/device/queue into its own GPU context; failure means the backend context is invalid (device lost, unsupported adapter/feature level) or Skia's D3D backend couldn't initialize (memory, unsupported format/query support).

Source

Thrown at src/renderer/d3d.rs:241

                .expect("Failed to create fence")
        };

        let fence_event = unsafe {
            CreateEventW(None, false, false, PCWSTR::null()).expect("Failed to create event")
        };
        let frame_index = unsafe { swap_chain.GetCurrentBackBufferIndex() as usize };

        let backend_context = BackendContext {
            adapter: adapter.clone(),
            device: device.clone(),
            queue: command_queue.clone(),
            memory_allocator: None,
            protected_context: Protected::No,
        };
        let gr_context = unsafe {
            tracy_zone!("create skia context");
            direct_contexts::make_d3d(&backend_context, None)
                .expect("Failed to create Skia context")
        };

        let mut ret = Self {
            _adapter: adapter,
            #[cfg(feature = "gpu_profiling")]
            device,
            command_queue,
            swap_chain,
            swap_chain_desc,
            swap_chain_waitable,
            gr_context,
            _backend_context: backend_context,
            buffers: Vec::new(),
            surfaces: Vec::new(),
            fence_values,
            fence,
            fence_event,
            frame_swapped: true,

View on GitHub (pinned to ade2d9cda7)

Solutions

  1. Verify the D3D12 device is healthy (GetDeviceRemovedReason == S_OK) before make_d3d
  2. Confirm the adapter supports the required D3D12 feature level; try WARP adapter to isolate hardware issues
  3. Check that the skia-safe build enables D3D support (correct feature flags)
  4. Print the returned error HRESULT/Error to distinguish unsupported-adapter from OOM
Defensive patterns

Strategy: try-catch

Validate before calling

let reason = unsafe { device.GetDeviceRemovedReason() };
if reason.is_err() { eprintln!("cannot build Skia context on removed device: {reason:?}"); }
// also confirm feature level:
// device.CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, ...)

Try / catch

let gr_context = unsafe { direct_contexts::make_d3d(&backend_context, None) }
    .map_err(|e| { log::error!("make_d3d failed: {e:?}"); RendererInitError::SkiaContext(e) })?;

Prevention

When it happens

Trigger: BackendContext carries a device-removed or feature-level-incompatible ID3D12Device; memory_allocator None combined with an adapter lacking required features; Skia build without D3D backend support; out-of-memory creating internal command lists/queries.

Common situations: Old GPU/driver below D3D12 feature requirements; software rendering environments; mismatched skia-safe versions where make_d3d semantics changed; WARP adapter with limited feature support.

Related errors


AI-assisted analysis of neovide/neovide@ade2d9cda7 (2026-09-06). Data as JSON: /api/errors/48709fa536043725. Report an issue: GitHub.