mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Update wgpu to 27.0.0 (#7580)
This commit is contained in:
@@ -179,15 +179,13 @@ impl Default for WgpuSetupCreateNew {
|
||||
|
||||
wgpu::DeviceDescriptor {
|
||||
label: Some("egui wgpu device"),
|
||||
required_features: wgpu::Features::default(),
|
||||
required_limits: wgpu::Limits {
|
||||
// When using a depth buffer, we have to be able to create a texture
|
||||
// large enough for the entire surface, and we want to support 4k+ displays.
|
||||
max_texture_dimension_2d: 8192,
|
||||
..base_limits
|
||||
},
|
||||
memory_hints: wgpu::MemoryHints::default(),
|
||||
trace: wgpu::Trace::Off,
|
||||
..Default::default()
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ use std::iter;
|
||||
use std::mem::size_of;
|
||||
use std::sync::mpsc::channel;
|
||||
|
||||
use crate::wgpu::WAIT_TIMEOUT;
|
||||
|
||||
pub(crate) fn texture_to_image(device: &Device, queue: &Queue, texture: &Texture) -> RgbaImage {
|
||||
let buffer_dimensions =
|
||||
BufferDimensions::new(texture.width() as usize, texture.height() as usize);
|
||||
@@ -48,7 +50,10 @@ pub(crate) fn texture_to_image(device: &Device, queue: &Queue, texture: &Texture
|
||||
|
||||
// Poll the device in a blocking manner so that our future resolves.
|
||||
device
|
||||
.poll(wgpu::PollType::WaitForSubmissionIndex(submission_index))
|
||||
.poll(wgpu::PollType::Wait {
|
||||
submission_index: Some(submission_index),
|
||||
timeout: Some(WAIT_TIMEOUT),
|
||||
})
|
||||
.expect("Failed to poll device");
|
||||
|
||||
receiver.recv().unwrap().unwrap();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::iter::once;
|
||||
use std::sync::Arc;
|
||||
use std::{iter::once, time::Duration};
|
||||
|
||||
use egui::TexturesDelta;
|
||||
use egui_wgpu::{RenderState, ScreenDescriptor, WgpuSetup, wgpu};
|
||||
@@ -7,6 +7,9 @@ use image::RgbaImage;
|
||||
|
||||
use crate::texture_to_image::texture_to_image;
|
||||
|
||||
/// Timeout for waiting on the GPU to finish rendering.
|
||||
pub(crate) const WAIT_TIMEOUT: Duration = Duration::from_secs(1);
|
||||
|
||||
/// Default wgpu setup used for the wgpu renderer.
|
||||
pub fn default_wgpu_setup() -> egui_wgpu::WgpuSetup {
|
||||
let mut setup = egui_wgpu::WgpuSetupCreateNew::default();
|
||||
@@ -205,7 +208,10 @@ impl crate::TestRenderer for WgpuTestRenderer {
|
||||
|
||||
self.render_state
|
||||
.device
|
||||
.poll(wgpu::PollType::Wait)
|
||||
.poll(wgpu::PollType::Wait {
|
||||
submission_index: None,
|
||||
timeout: Some(WAIT_TIMEOUT),
|
||||
})
|
||||
.map_err(|err| format!("PollError: {err}"))?;
|
||||
|
||||
Ok(texture_to_image(
|
||||
|
||||
Reference in New Issue
Block a user