Skip to content

Fix crashing when generating 4K outputs#163

Merged
AzurIce merged 2 commits intoAzurIce:mainfrom
pointertobios:master
Apr 7, 2026
Merged

Fix crashing when generating 4K outputs#163
AzurIce merged 2 commits intoAzurIce:mainfrom
pointertobios:master

Conversation

@pointertobios
Copy link
Copy Markdown
Contributor

It's because the default device buffer limits is too small for 4K output. Just use adapter's limits.

Copilot AI review requested due to automatic review settings April 6, 2026 17:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts WgpuContext device creation to avoid crashes when generating 4K outputs by requesting device limits based on the selected adapter rather than using default (more restrictive) limits.

Changes:

  • Use adapter.limits() as required_limits when requesting the wgpu device.
  • Replace the non-profiling DeviceDescriptor::default() call with an explicit DeviceDescriptor that applies the same requested limits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 169 to 171
info!("wgpu adapter info: {:?}", adapter.get_info());
let required_limits = adapter.limits();

Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

required_limits is assigned from adapter.limits() (i.e., the adapter’s maximum supported limits). The variable name reads like “minimum required limits”, which is easy to misinterpret when debugging device-creation failures; consider renaming to something like adapter_limits/requested_limits to reflect what’s being passed to required_limits:.

Copilot uses AI. Check for mistakes.
Comment on lines 172 to +194
@@ -183,7 +184,14 @@ impl WgpuContext {
.unwrap();
#[cfg(not(feature = "profiling"))]
let (device, queue) = adapter
.request_device(&wgpu::DeviceDescriptor::default())
.request_device(&wgpu::DeviceDescriptor {
label: None,
required_features: wgpu::Features::empty(),
required_limits,
memory_hints: wgpu::MemoryHints::default(),
trace: wgpu::Trace::Off,
experimental_features: wgpu::ExperimentalFeatures::disabled(),
})
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The DeviceDescriptor fields are duplicated across the profiling and not(profiling) branches (label, limits, memory_hints, trace, experimental_features). Consider constructing a shared base descriptor (or using ..Default::default() with only the differing required_features) to reduce the chance of the branches drifting if fields are added/changed later.

Copilot uses AI. Check for mistakes.
@AzurIce
Copy link
Copy Markdown
Owner

AzurIce commented Apr 7, 2026

Thanks! Waiting checks to pass for merging!

@AzurIce AzurIce merged commit c7717ff into AzurIce:main Apr 7, 2026
4 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.

3 participants