mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
[WGPU] Allow for depth buffer in web target (#2335)
* Add depth stencil initialization to `Painter` * Move depth stencil initialization into `resize_and_generate_depth_texture_view`, and call it in `set_window` and `on_window_resized` * Allow for depth texture in WASM builds * change `map` to `if let` statement * use reference for render state * Clean up descriptors and move texture generation to on resize events * remove unused field from WebOptions
This commit is contained in:
@@ -55,6 +55,8 @@ pub struct WgpuConfiguration {
|
||||
|
||||
/// Callback for surface errors.
|
||||
pub on_surface_error: Arc<dyn Fn(wgpu::SurfaceError) -> SurfaceErrorAction>,
|
||||
|
||||
pub depth_format: Option<wgpu::TextureFormat>,
|
||||
}
|
||||
|
||||
impl Default for WgpuConfiguration {
|
||||
@@ -68,6 +70,7 @@ impl Default for WgpuConfiguration {
|
||||
backends: wgpu::Backends::PRIMARY | wgpu::Backends::GL,
|
||||
present_mode: wgpu::PresentMode::AutoVsync,
|
||||
power_preference: wgpu::PowerPreference::HighPerformance,
|
||||
depth_format: None,
|
||||
|
||||
on_surface_error: Arc::new(|err| {
|
||||
if err == wgpu::SurfaceError::Outdated {
|
||||
|
||||
Reference in New Issue
Block a user