M13.23: Shatter wireframe views and Foam's texture / map extras fall back via gpu_supported (no readback attempt)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Brandon ThomasandClaude Opus 5.5 committed 2026-10-03 23:59:22 -04:00
1 parent 49d0c16c9f
commit 4a2ca9115b
3 files changed
+22 -7

No files matched your search

+13
View File
@@ -97,6 +97,19 @@ pub fn gpu_supported(id: &str, ctx: &crate::EffectCtx) -> bool {
match id {
"ec.generate.cellpattern" if (6..=10).contains(&ctx.params.e("cellPattern")) => return false,
"ec.distort.turbulentdisplace" if ctx.params.e("pinning") >= 8 => return false,
// Shatter's wireframe views; Foam's User Defined texture, Environment Map and flow-map
// preview (the GPU draws the rendered pieces and the sprite bubbles only).
"ec.sim.shatter" if ctx.params.e("view") != 0 => return false,
"ec.sim.foam" => {
let set = |id: &str| matches!(ctx.params.get(id), Some(effectcraft_keyframe::Value::Layer(Some(_))));
let view = ctx.params.e("view");
if (view == 2 && ctx.params.e("rendering/bubbleTexture") == 5)
|| (view == 2 && ctx.params.f("rendering/reflectionStrength") > 0.0 && set("rendering/environmentMap"))
|| (view == 1 && set("flowMap/flowMap"))
{
return false;
}
}
// Fisheye / Twist (a crease at the unit circle) bent past 50 % or with Horizontal /
// Vertical Distortion: Newton's inverse wanders chaotically before converging near the
// fold, so f32 lands on other pixels than the CPU's f64.
+1 -7
View File
@@ -1525,13 +1525,7 @@ fn foam(ctx: &EffectCtx, b: Buf) -> Buf {
/// Foam's bubbles as sprites, `None` when it draws more than sprites (a User Defined bubble
/// texture, an Environment Map reflection or the Draft + Flow Map view's flow map).
pub(crate) fn foam_plan(ctx: &EffectCtx, b: &Buf) -> Option<crate::sim::SpritePlan> {
let pr = ctx.params;
let set = |id: &str| matches!(pr.get(id), Some(Value::Layer(Some(_))));
let view = pr.e("view");
if (view == 2 && pr.e("rendering/bubbleTexture") == 5)
|| (view == 2 && pr.f("rendering/reflectionStrength") > 0.0 && set("rendering/environmentMap"))
|| (view == 1 && set("flowMap/flowMap"))
{
if !crate::catalog::gpu_supported("ec.sim.foam", ctx) {
return None;
}
foam_impl(ctx, b, true).err()
+8
View File
@@ -152,3 +152,11 @@ fn caustics() {
);
let _ = (c(0.0, 0.0, 0.0), on());
}
#[test]
fn cpu_only_views_fall_back() {
// Shatter's wireframe views and Foam's User Defined texture render on the CPU; composited
// frames still match.
composited("ec.sim.shatter", &[], 1.0, 0.0);
composited("ec.sim.foam", &[("view", e(2)), ("rendering/bubbleTexture", e(5)), ("rendering/bubbleTextureLayer", Value::Layer(Some(0)))], 1.0, 0.0);
}