Skip to main content

euv_engine/config/
enum.rs

1/// The rendering backend type used by the engine.
2///
3/// Selects between the Canvas 2D immediate-mode API and the WebGPU
4/// pipeline-based API. Canvas 2D is universally supported and suitable
5/// for 2D games and simple 3D software rendering. WebGPU provides
6/// GPU-accelerated rendering for demanding 2D and 3D scenes.
7#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
8pub(crate) enum RenderBackendType {
9    /// The Canvas 2D rendering backend (`CanvasRenderingContext2d`).
10    ///
11    /// Universal browser support, immediate-mode drawing API, suitable
12    /// for 2D games and software-rendered 3D.
13    #[default]
14    Canvas2D,
15    /// The WebGPU rendering backend (`GpuDevice` + `GpuCanvasContext`).
16    ///
17    /// GPU-accelerated rendering with shaders, buffers, and pipelines.
18    /// Requires a WebGPU-capable browser.
19    WebGpu,
20}
21
22/// The power preference hint passed to `navigator.gpu.requestAdapter`.
23///
24/// Maps to the WebGPU `GPUPowerPreference` enum. The browser uses this
25/// hint to select a GPU adapter when multiple are available.
26#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
27pub enum GpuPowerPreference {
28    /// Prefers a low-power adapter to conserve energy, suitable for
29    /// mobile devices and battery-conscious scenarios.
30    #[default]
31    LowPower,
32    /// Prefers a high-performance adapter for maximum rendering throughput,
33    /// suitable for desktop gaming and compute-intensive scenes.
34    HighPerformance,
35}