summaryrefslogtreecommitdiffstats
path: root/wgpu/src/settings.rs
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src/settings.rs')
-rw-r--r--wgpu/src/settings.rs49
1 files changed, 18 insertions, 31 deletions
diff --git a/wgpu/src/settings.rs b/wgpu/src/settings.rs
index f946ce0d..26763e22 100644
--- a/wgpu/src/settings.rs
+++ b/wgpu/src/settings.rs
@@ -1,22 +1,31 @@
-//! Configure a [`Renderer`].
-//!
-//! [`Renderer`]: struct.Renderer.html
+//! Configure a renderer.
+pub use crate::Antialiasing;
-/// The settings of a [`Renderer`].
+/// The settings of a [`Backend`].
///
-/// [`Renderer`]: ../struct.Renderer.html
+/// [`Backend`]: crate::Backend
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Settings {
- /// The output format of the [`Renderer`].
+ /// The output format of the [`Backend`].
///
- /// [`Renderer`]: ../struct.Renderer.html
+ /// [`Backend`]: crate::Backend
pub format: wgpu::TextureFormat,
+ /// The present mode of the [`Backend`].
+ ///
+ /// [`Backend`]: crate::Backend
+ pub present_mode: wgpu::PresentMode,
+
/// The bytes of the font that will be used by default.
///
/// If `None` is provided, a default system font will be chosen.
pub default_font: Option<&'static [u8]>,
+ /// The default size of text.
+ ///
+ /// By default, it will be set to 20.
+ pub default_text_size: u16,
+
/// The antialiasing strategy that will be used for triangle primitives.
pub antialiasing: Option<Antialiasing>,
}
@@ -25,32 +34,10 @@ impl Default for Settings {
fn default() -> Settings {
Settings {
format: wgpu::TextureFormat::Bgra8UnormSrgb,
+ present_mode: wgpu::PresentMode::Mailbox,
default_font: None,
+ default_text_size: 20,
antialiasing: None,
}
}
}
-
-/// An antialiasing strategy.
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum Antialiasing {
- /// Multisample AA with 2 samples
- MSAAx2,
- /// Multisample AA with 4 samples
- MSAAx4,
- /// Multisample AA with 8 samples
- MSAAx8,
- /// Multisample AA with 16 samples
- MSAAx16,
-}
-
-impl Antialiasing {
- pub(crate) fn sample_count(&self) -> u32 {
- match self {
- Antialiasing::MSAAx2 => 2,
- Antialiasing::MSAAx4 => 4,
- Antialiasing::MSAAx8 => 8,
- Antialiasing::MSAAx16 => 16,
- }
- }
-}