Skip to content

Create egui_wgpu::RendererOptions#7601

Merged
emilk merged 6 commits intomainfrom
emilk/refactor-wgpu-options
Oct 7, 2025
Merged

Create egui_wgpu::RendererOptions#7601
emilk merged 6 commits intomainfrom
emilk/refactor-wgpu-options

Conversation

@emilk
Copy link
Owner

@emilk emilk commented Oct 7, 2025

This will make it easier to add new options in the future.

Also, we can document struct fields, but not parameters.

@emilk emilk requested a review from Wumpf as a code owner October 7, 2025 14:38
@emilk emilk added egui-winit porblems related to winit egui-wgpu labels Oct 7, 2025
@github-actions
Copy link

github-actions bot commented Oct 7, 2025

Preview available at https://egui-pr-preview.github.io/pr/7601-emilkrefactor-wgpu-options
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@emilk emilk requested a review from lucasmerlin as a code owner October 7, 2025 14:40
Comment on lines +179 to +207
/// Ways to configure [`Renderer`] during creation.
#[derive(Clone, Copy, Debug)]
pub struct RendererOptions {
/// Set the level of the multisampling anti-aliasing (MSAA).
///
/// Must be a power-of-two. Higher = more smooth 3D.
///
/// A value of `0` or `1` turns it off (default).
///
/// `egui` already performs anti-aliasing via "feathering"
/// (controlled by [`egui::epaint::TessellationOptions`]),
/// but if you are embedding 3D in egui you may want to turn on multisampling.
pub msaa_samples: u32,

/// What format to use for the depth and stencil buffers,
/// e.g. [`wgpu::TextureFormat::Depth32FloatStencil8`].
///
/// egui doesn't need depth/stencil, so the default value is `None` (no depth or stancil buffers).
pub depth_stencil_format: Option<wgpu::TextureFormat>,

/// Controls whether to apply dithering to minimize banding artifacts.
///
/// Dithering assumes an sRGB output and thus will apply noise to any input value that lies between
/// two 8bit values after applying the sRGB OETF function, i.e. if it's not a whole 8bit value in "gamma space".
/// This means that only inputs from texture interpolation and vertex colors should be affected in practice.
///
/// Defaults to true.
pub dithering: bool,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@emilk emilk changed the title Clump together wgpu options in a RendererOptions Create egui_wgpu::RendererOptions Oct 7, 2025
@emilk emilk merged commit 9cb4e6a into main Oct 7, 2025
65 of 66 checks passed
@emilk emilk deleted the emilk/refactor-wgpu-options branch October 7, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui-wgpu egui-winit porblems related to winit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants