// Benchmark case: primary value path + minimal live ddx/ddy on y = x1*x2/(x1+1).
float wave_mix(float a, float b, float phase) {
float w = sin(phase) * 0.5f + cos(phase * 0.73f) * 0.5f;
return a * w + b * (1.0f - w);
}
float rational_shape(float x, float denom) {
float num = x * x + 1.0f;
return num / (denom + 2.0f);
}
float soften(float t) {
return t / (1.0f + t * t);
}
shader main(out float o, out float o_ddx, out float o_ddy) {
float x1 = global_value<x1>;
float x2 = global_value<x2>;
float u = global_value<uv_u>;
float v = global_value<uv_v>;
float p = wave_mix(x1, x2, u + v);
float q = rational_shape(p, x2);
float y = x1 * x2 / (x1 + 1.0f);
o = soften(q) + log(1.0f + u * v) * 0.1f + y * 0.01f;
o_ddx = ddx(y);
o_ddy = ddy(y);
}