summaryrefslogtreecommitdiffstats
path: root/wgpu/src/settings.rs
blob: c8a0cadf8e4b9baef22666580ebb9e535a7d4874 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/// The settings of a [`Renderer`].
///
/// [`Renderer`]: struct.Renderer.html
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct Settings {
    /// 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 antialiasing strategy that will be used for triangle primitives.
    pub antialiasing: Option<MSAA>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MSAA {
    X2,
    X4,
    X8,
    X16,
}

impl MSAA {
    pub(crate) fn sample_count(&self) -> u32 {
        match self {
            MSAA::X2 => 2,
            MSAA::X4 => 4,
            MSAA::X8 => 8,
            MSAA::X16 => 16,
        }
    }
}