[GH-ISSUE #3510] OpenGL: entering a world crashes when automatic screenshot readback requires unsupported COPY_SRC #991

Closed
opened 2026-11-02 15:43:24 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Jalu-Er on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3510

Version: Nightly 2026-10-28 · 9b772b2
OS: Arch Linux, kernel 7.2.11-zen1-1-zen, Wayland session
CPU: Intel Core i5-4200U
GPU: Intel HD Graphics 4400 (HSW GT2), Mesa 26.2.5-arch1.1, backend Gl
Minecraft: 26.3

What I did

  1. Opened the launcher, picked the Nightly instance, pressed Play.
  2. The game started on OpenGL — this GPU has no usable Vulkan driver, so Horizon fell back to GL by itself.
  3. Entered a single-player world.

What happened

The game crashes a second or two after the world loads, every time. I have two crash reports from the same Nightly.

panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-30.0.1/src/backend/wgpu_core.rs:2678:18:
wgpu error: Validation Error

Caused by:
  In a CommandEncoder, label = 'Horizon frame'
    Usage flags TextureUsages(RENDER_ATTACHMENT) of Texture with '<Surface Texture>' label do not contain required usage flags TextureUsages(COPY_SRC)


	at wgpu::backend::wgpu_core::default_error_handler
	at <wgpu::backend::wgpu_core::ContextWgpuCore>::handle_error_inner
	at <wgpu::backend::wgpu_core::ContextWgpuCore>::handle_error::<wgpu_core::command::CommandEncoderError>
	at <wgpu::backend::wgpu_core::CoreCommandEncoder as wgpu::dispatch::CommandEncoderInterface>::finish
	at <wgpu::api::command_encoder::CommandEncoder>::finish
	at <horizon_client::gfx::Renderer>::draw_frame
	at <horizon_client::gfx::Renderer>::render
	at <horizon_client::game::Game>::render
	at <horizon_client::game::Game as winit::application::ApplicationHandler>::window_event::{closure#1}
	at <horizon_client::game::Game as winit::application::ApplicationHandler>::window_event
	at <&mut <winit::event_loop::EventLoop<()>>::run_app<horizon_client::game::App>::{closure#0} as core::ops::function::FnMut<(winit::event::Event<()>, &winit::event_loop::ActiveEventLoop)>>::call_mut
	at <winit::platform_impl::linux::wayland::event_loop::EventLoop<()>>::pump_events::<&mut <winit::event_loop::EventLoop<()>>::run_app<horizon_client::game::App>::{closure#0}>
	at horizon_client::game::run_loading
	at horizon_client::game::run
	at horizon_client::main

Last lines of latest.log before it dies:

[11:45:14] [Render thread/WARN]: Horizon renderer: trying OpenGL (Vulkan: No suitable graphics adapter found; noop not requested, vulkan found no adapters, metal not requested, dx12 not requested, gl not requested, webgpu not requested)
[11:45:14] [Render thread/INFO]: Horizon renderer: Mesa Intel(R) HD Graphics 4400 (HSW GT2) (Gl, IntegratedGpu)
[11:45:14] [Render thread/INFO]: Horizon renderer: device ready; configuring the surface (678x713 Bgra8Unorm, Fifo)
...
[11:45:22] [Render thread/WARN]: Horizon: unhandled_configuration_packet update_enabled_features (id 13); see server.protocol_gaps in horizon-ctl status
[11:45:22] [Render thread/ERROR]: Handling wgpu errors as fatal by default
[11:45:22] [Render thread/ERROR]: Horizon crashed: panicked at .../wgpu-30.0.1/src/backend/wgpu_core.rs:2678:18:

What I expected

The game to keep running on OpenGL, since that is the only backend this machine can use.

Where it comes from

The surface configuration only asks for COPY_SRC when the surface advertises it (crates/horizon-client/src/gfx.rs):

// Screenshots copy the presented frame back from the swapchain.
if caps.usages.contains(wgpu::TextureUsages::COPY_SRC) {
    config.usage |= wgpu::TextureUsages::COPY_SRC;
}

An OpenGL surface does not advertise it. take_readback then only checks the pixel format before queueing the copy:

fn take_readback(
    &mut self,
    request: ScreenshotRequest,
    encoder: &mut wgpu::CommandEncoder,
    texture: &wgpu::Texture,
) -> Option<(ScreenshotRequest, wgpu::Buffer)> {
    // The copy and PNG writer both assume 8-bit pixels; a float surface would make
    // the row stride too small for the copy and abort in validation.
    if self.config.format.block_copy_size(None) == Some(4) {
        Some((request, self.copy_frame(encoder, texture)))
    } else {
        self.screenshot_result = Some(Err(format!(
            "screenshots need a 32-bit surface format, not {:?}",
            self.config.format
        )));
        None
    }
}

write_screenshot does check COPY_SRC, but by then copy_texture_to_buffer is already in the encoder, so the validation error fires first and is fatal:

fn write_screenshot(
    &self,
    request: &ScreenshotRequest,
    buffer: &wgpu::Buffer,
) -> Result<[u32; 2]> {
    if !self.config.usage.contains(wgpu::TextureUsages::COPY_SRC) {
        return Err("this surface does not support frame readback".into());
    }

What triggers it

It looks automatic, not something I press. The single-player world icon asks for a 64×64 readback right after the level is drawn (game.rs, ScreenshotRequest { path, size: Some([64, 64]) }), so entering a world is enough. F2 should hit the same path.

Why Vulkan is not an option here

Haswell is no longer supported by Mesa's ANV driver. The only ICD that reports a device is the legacy intel_hasvk:

$ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.json        -> 0 devices
$ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_hasvk_icd.json  -> 1 device

Filed by Jalu with Hermes Agent. The machine, crash reports and logs are mine; the code reading is the agent's.

crash-2026-10-28_19.14.02-client.txt

crash-2026-10-29_11.05.20-client.txt

crash-2026-10-29_11.45.22-client.txt

Originally created by @Jalu-Er on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3510 **Version:** Nightly 2026-10-28 · 9b772b2 **OS:** Arch Linux, kernel 7.2.11-zen1-1-zen, Wayland session **CPU:** Intel Core i5-4200U **GPU:** Intel HD Graphics 4400 (HSW GT2), Mesa 26.2.5-arch1.1, backend `Gl` **Minecraft:** 26.3 ### What I did 1. Opened the launcher, picked the Nightly instance, pressed Play. 2. The game started on OpenGL — this GPU has no usable Vulkan driver, so Horizon fell back to GL by itself. 3. Entered a single-player world. ### What happened The game crashes a second or two after the world loads, every time. I have two crash reports from the same Nightly. ``` panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-30.0.1/src/backend/wgpu_core.rs:2678:18: wgpu error: Validation Error Caused by: In a CommandEncoder, label = 'Horizon frame' Usage flags TextureUsages(RENDER_ATTACHMENT) of Texture with '<Surface Texture>' label do not contain required usage flags TextureUsages(COPY_SRC) at wgpu::backend::wgpu_core::default_error_handler at <wgpu::backend::wgpu_core::ContextWgpuCore>::handle_error_inner at <wgpu::backend::wgpu_core::ContextWgpuCore>::handle_error::<wgpu_core::command::CommandEncoderError> at <wgpu::backend::wgpu_core::CoreCommandEncoder as wgpu::dispatch::CommandEncoderInterface>::finish at <wgpu::api::command_encoder::CommandEncoder>::finish at <horizon_client::gfx::Renderer>::draw_frame at <horizon_client::gfx::Renderer>::render at <horizon_client::game::Game>::render at <horizon_client::game::Game as winit::application::ApplicationHandler>::window_event::{closure#1} at <horizon_client::game::Game as winit::application::ApplicationHandler>::window_event at <&mut <winit::event_loop::EventLoop<()>>::run_app<horizon_client::game::App>::{closure#0} as core::ops::function::FnMut<(winit::event::Event<()>, &winit::event_loop::ActiveEventLoop)>>::call_mut at <winit::platform_impl::linux::wayland::event_loop::EventLoop<()>>::pump_events::<&mut <winit::event_loop::EventLoop<()>>::run_app<horizon_client::game::App>::{closure#0}> at horizon_client::game::run_loading at horizon_client::game::run at horizon_client::main ``` Last lines of `latest.log` before it dies: ``` [11:45:14] [Render thread/WARN]: Horizon renderer: trying OpenGL (Vulkan: No suitable graphics adapter found; noop not requested, vulkan found no adapters, metal not requested, dx12 not requested, gl not requested, webgpu not requested) [11:45:14] [Render thread/INFO]: Horizon renderer: Mesa Intel(R) HD Graphics 4400 (HSW GT2) (Gl, IntegratedGpu) [11:45:14] [Render thread/INFO]: Horizon renderer: device ready; configuring the surface (678x713 Bgra8Unorm, Fifo) ... [11:45:22] [Render thread/WARN]: Horizon: unhandled_configuration_packet update_enabled_features (id 13); see server.protocol_gaps in horizon-ctl status [11:45:22] [Render thread/ERROR]: Handling wgpu errors as fatal by default [11:45:22] [Render thread/ERROR]: Horizon crashed: panicked at .../wgpu-30.0.1/src/backend/wgpu_core.rs:2678:18: ``` ### What I expected The game to keep running on OpenGL, since that is the only backend this machine can use. ### Where it comes from The surface configuration only asks for `COPY_SRC` when the surface advertises it (`crates/horizon-client/src/gfx.rs`): ```rust // Screenshots copy the presented frame back from the swapchain. if caps.usages.contains(wgpu::TextureUsages::COPY_SRC) { config.usage |= wgpu::TextureUsages::COPY_SRC; } ``` An OpenGL surface does not advertise it. `take_readback` then only checks the pixel format before queueing the copy: ```rust fn take_readback( &mut self, request: ScreenshotRequest, encoder: &mut wgpu::CommandEncoder, texture: &wgpu::Texture, ) -> Option<(ScreenshotRequest, wgpu::Buffer)> { // The copy and PNG writer both assume 8-bit pixels; a float surface would make // the row stride too small for the copy and abort in validation. if self.config.format.block_copy_size(None) == Some(4) { Some((request, self.copy_frame(encoder, texture))) } else { self.screenshot_result = Some(Err(format!( "screenshots need a 32-bit surface format, not {:?}", self.config.format ))); None } } ``` `write_screenshot` does check `COPY_SRC`, but by then `copy_texture_to_buffer` is already in the encoder, so the validation error fires first and is fatal: ```rust fn write_screenshot( &self, request: &ScreenshotRequest, buffer: &wgpu::Buffer, ) -> Result<[u32; 2]> { if !self.config.usage.contains(wgpu::TextureUsages::COPY_SRC) { return Err("this surface does not support frame readback".into()); } ``` ### What triggers it It looks automatic, not something I press. The single-player world icon asks for a 64×64 readback right after the level is drawn (`game.rs`, `ScreenshotRequest { path, size: Some([64, 64]) }`), so entering a world is enough. F2 should hit the same path. ### Why Vulkan is not an option here Haswell is no longer supported by Mesa's ANV driver. The only ICD that reports a device is the legacy `intel_hasvk`: ``` $ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.json -> 0 devices $ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_hasvk_icd.json -> 1 device ``` --- Filed by Jalu with Hermes Agent. The machine, crash reports and logs are mine; the code reading is the agent's. [crash-2026-10-28_19.14.02-client.txt](https://github.com/user-attachments/files/34113507/crash-2026-10-28_19.14.02-client.txt) [crash-2026-10-29_11.05.20-client.txt](https://github.com/user-attachments/files/34113534/crash-2026-10-29_11.05.20-client.txt) [crash-2026-10-29_11.45.22-client.txt](https://github.com/user-attachments/files/34113546/crash-2026-10-29_11.45.22-client.txt)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#991
No description provided.