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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
49d0c16c9f
commit
4a2ca9115b
@@ -97,6 +97,19 @@ pub fn gpu_supported(id: &str, ctx: &crate::EffectCtx) -> bool {
|
|||||||
match id {
|
match id {
|
||||||
"ec.generate.cellpattern" if (6..=10).contains(&ctx.params.e("cellPattern")) => return false,
|
"ec.generate.cellpattern" if (6..=10).contains(&ctx.params.e("cellPattern")) => return false,
|
||||||
"ec.distort.turbulentdisplace" if ctx.params.e("pinning") >= 8 => 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 /
|
// 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
|
// Vertical Distortion: Newton's inverse wanders chaotically before converging near the
|
||||||
// fold, so f32 lands on other pixels than the CPU's f64.
|
// fold, so f32 lands on other pixels than the CPU's f64.
|
||||||
|
|||||||
@@ -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
|
/// 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).
|
/// 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> {
|
pub(crate) fn foam_plan(ctx: &EffectCtx, b: &Buf) -> Option<crate::sim::SpritePlan> {
|
||||||
let pr = ctx.params;
|
if !crate::catalog::gpu_supported("ec.sim.foam", ctx) {
|
||||||
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"))
|
|
||||||
{
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
foam_impl(ctx, b, true).err()
|
foam_impl(ctx, b, true).err()
|
||||||
|
|||||||
@@ -152,3 +152,11 @@ fn caustics() {
|
|||||||
);
|
);
|
||||||
let _ = (c(0.0, 0.0, 0.0), on());
|
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);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user