diff --git a/README.md b/README.md index d07ee11..30ec323 100644 --- a/README.md +++ b/README.md @@ -1713,8 +1713,9 @@ For its first 3 seconds of dark the studio draws the capture's last picture that was not dark in its place, on program and everywhere else but where its background is removed, which shows the dark at once, so a moment of black barely reaches viewers: the black shows until its picture is next -read, up to a quarter of a second, as each picture is drawn before it is -read, never held back for it. After that it shows the dark as it is, so a +read and that read comes back from the GPU, up to a quarter second, plus GPU +readback time, as each picture is drawn before it is read, never held back for +it. After that it shows the dark as it is, so a stale picture never passes for live, and the capture's layer row, its layer on the picture, and each scene pad showing it turn amber, and the health dot counts it. The row's badge says what may have happened and offers diff --git a/rs/moq-studio/src/ui/dark.rs b/rs/moq-studio/src/ui/dark.rs index bb019d0..7878b6a 100644 --- a/rs/moq-studio/src/ui/dark.rs +++ b/rs/moq-studio/src/ui/dark.rs @@ -196,13 +196,16 @@ pub(super) fn counted(dark: usize, stalled: usize) -> Option { } /// Whether the scene called `scene` draws a layer that `lost` its picture, -/// as `lost` says of a source: through the scenes it nests, and not one it -/// hides. +/// as `lost` says of a source: through the scenes it nests, and the masks +/// its layers read, and not one it hides. pub(super) fn draws_lost(collection: &Collection, scene: &str, lost: impl Fn(&str) -> bool) -> bool { - collection - .drawn([Layer::scene(scene)]) - .iter() - .any(|item| lost(&item.source)) + collection.drawn([Layer::scene(scene)]).iter().any(|item| { + let masks = collection.filters(item).filter_map(|filter| match filter { + Filter::Mask { source, .. } => Some(source.as_str()), + _ => None, + }); + std::iter::once(item.source.as_str()).chain(masks).any(&lost) + }) } /// The amber badge in `rect`: a warning sign on amber. @@ -426,12 +429,29 @@ mod tests { }); collection.scenes.push(hidden); collection.scenes[0].items.push(Item::new("inner", fill)); + // A color cut to the camera's shape reads the camera's picture. + collection.sources.insert( + "red".into(), + Source::Color { + color: moq_scene::Rgba([255, 0, 0, 255]), + }, + ); + let mut masked = Scene::new("Masked"); + masked.items.push(Item { + filters: vec![Filter::Mask { + source: "cam".into(), + mode: MaskMode::default(), + }], + ..Item::new("red", fill) + }); + collection.scenes.push(masked); let outer = collection.scenes[0].name.clone(); collection.validate().unwrap(); let lost = |name: &str| name == "cam"; assert!(draws_lost(&collection, "Inner", lost)); assert!(draws_lost(&collection, &outer, lost), "through the scene it nests"); assert!(!draws_lost(&collection, "Hidden", lost), "not what it hides"); + assert!(draws_lost(&collection, "Masked", lost), "through the mask it reads"); } /// The health dot names what the layers lost, and counts them.