minetest CI trace contains shaders with derivatives in non-uniform control flow
minetest.trace
contains this function:
float find_intersection(vec2 dp, vec2 ds)
{
float depth = 1.0;
float best_depth = 0.0;
float size = 0.0625;
for (int i = 0; i < 15; i++) {
depth -= size;
float h = texture2D(normalTexture, dp + ds * depth).a;
if (depth <= h) {
best_depth = depth;
break;
}
}
depth = best_depth;
for (int i = 0; i < 4; i++) {
size *= 0.5;
float h = texture2D(normalTexture,dp + ds * depth).a;
if (depth <= h) {
best_depth = depth;
depth += size;
} else {
depth -= size;
}
}
return best_depth;
}
Note the non-uniform break, which means that the coordinates are calculated without all pixels in the quad enabled, which will lead to garbage derivatives and flakey results.
AFAICT parallax occlusion was enabled when tracing, so this does get used. This code was removed upstream by https://github.com/minetest/minetest/pull/10487, so the trace needs to be regenerated with an updated minetest or parallax occlusion needs to be disabled.