Merge remote and fix color space

This commit is contained in:
Skyler Lehmkuhl
2026-03-01 15:50:53 -05:00
13 changed files with 1422 additions and 319 deletions
@@ -57,8 +57,10 @@ pub struct DraggingAsset {
/// Command for webcam recording (issued by timeline, processed by main)
#[derive(Debug)]
#[allow(dead_code)]
pub enum WebcamRecordCommand {
/// Start recording on the given video layer
// TODO: remove layer_id — recording_layer_ids now tracks which layers are recording
Start { layer_id: uuid::Uuid },
/// Stop current webcam recording
Stop,
@@ -203,7 +205,7 @@ pub struct SharedPaneState<'a> {
pub is_recording: &'a mut bool, // Whether recording is currently active
pub recording_clips: &'a mut std::collections::HashMap<uuid::Uuid, u32>, // layer_id -> clip_id
pub recording_start_time: &'a mut f64, // Playback time when recording started
pub recording_layer_id: &'a mut Option<uuid::Uuid>, // Layer being recorded to
pub recording_layer_ids: &'a mut Vec<uuid::Uuid>, // Layers being recorded to
/// Asset being dragged from Asset Library (for cross-pane drag-and-drop)
pub dragging_asset: &'a mut Option<DraggingAsset>,
// Tool-specific options for infopanel
@@ -247,6 +249,12 @@ pub struct SharedPaneState<'a> {
pub pending_menu_actions: &'a mut Vec<crate::menu::MenuAction>,
/// Clipboard manager for cut/copy/paste operations
pub clipboard_manager: &'a mut lightningbeam_core::clipboard::ClipboardManager,
// VU meter levels
pub input_level: f32,
pub output_level: (f32, f32),
pub track_levels: &'a std::collections::HashMap<daw_backend::TrackId, f32>,
#[allow(dead_code)] // Available for panes that need reverse track->layer lookup
pub track_to_layer_map: &'a std::collections::HashMap<daw_backend::TrackId, Uuid>,
/// Whether to show waveforms as stacked stereo (true) or combined mono (false)
pub waveform_stereo: bool,
/// Generation counter - incremented on project load to force reloads
@@ -67,17 +67,21 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
}
// The canvas stores premultiplied linear RGBA.
// The srgb_to_linear converter downstream applies the sRGB gamma formula
// channel-by-channel without alpha awareness. To make the round-trip
// transparent we pre-encode with linear_to_srgb here:
// canvas (linear premul) → sRGB buffer → srgb_to_linear → linear premul ✓
// Without this, srgb_to_linear darkens small premultiplied values
// (e.g. white at 10% opacity: 0.1 → 0.01), producing a grey halo.
// The downstream pipeline (srgb_to_linear → compositor) expects the sRGB
// buffer to contain straight-alpha sRGB, i.e. the same format Vello outputs:
// sRGB buffer: srgb(r_straight), srgb(g_straight), srgb(b_straight), a
// srgb_to_linear: r_straight, g_straight, b_straight, a (linear straight)
// compositor: r_straight * a * opacity (premultiplied, correct)
//
// Without unpremultiplying, the compositor would double-premultiply:
// src = (premul_r, premul_g, premul_b, a) → output = premul_r * a = r * a²
// which produces a dark halo over transparent regions.
let c = textureSample(canvas_tex, canvas_sampler, canvas_uv);
let inv_a = select(0.0, 1.0 / c.a, c.a > 1e-6);
return vec4<f32>(
linear_to_srgb(c.r),
linear_to_srgb(c.g),
linear_to_srgb(c.b),
linear_to_srgb(c.r * inv_a),
linear_to_srgb(c.g * inv_a),
linear_to_srgb(c.b * inv_a),
c.a,
);
}
File diff suppressed because it is too large Load Diff