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