gled-ui 2.31.1

gled's egui interface, shared by the desktop app and the browser
Documentation
//! The GPU egui draws with, which also renders the effect thumbnails and the
//! LED preview. Set once when the app starts, on the desktop and in the
//! browser alike.

use std::sync::OnceLock;

use eframe::egui_wgpu::RenderState;

static RENDER_STATE: OnceLock<RenderState> = OnceLock::new();

/// Keeps the app's render state. Returns `false` if one was set before.
pub fn set(render_state: RenderState) -> bool {
    RENDER_STATE.set(render_state).is_ok()
}

/// The app's render state, once the app started.
pub(crate) fn get() -> Option<RenderState> {
    RENDER_STATE.get().cloned()
}