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 /// The WebGL 2 rendering backend (`WebGl2RenderingContext`).
21 ///
22 /// GPU-accelerated rendering with GLSL ES 3.00 shaders. Supported by
23 /// every modern browser, making it the GPU fallback for browsers that
24 /// do not expose WebGPU.
25 WebGl,
26}
27
28/// The power preference hint passed to `navigator.gpu.requestAdapter`.
29///
30/// Maps to the WebGPU `GPUPowerPreference` enum. The browser uses this
31/// hint to select a GPU adapter when multiple are available.
32#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
33pub enum GpuPowerPreference {
34 /// Prefers a low-power adapter to conserve energy, suitable for
35 /// mobile devices and battery-conscious scenarios.
36 #[default]
37 LowPower,
38 /// Prefers a high-performance adapter for maximum rendering throughput,
39 /// suitable for desktop gaming and compute-intensive scenes.
40 HighPerformance,
41}