1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Sanitize INF/NaN when copying last frame texture for SSIL/SSR.

This commit is contained in:
Skyth
2025-11-13 16:38:54 +03:00
parent e6aa06d3de
commit d27e4dab16
4 changed files with 14 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
#define FLAG_FORCE_LUMINANCE (1 << 6)
#define FLAG_COPY_ALL_SOURCE (1 << 7)
#define FLAG_ALPHA_TO_ONE (1 << 8)
#define FLAG_SANITIZE_INF_NAN (1 << 9)
layout(push_constant, std430) uniform Params {
ivec4 section;
@@ -226,6 +227,11 @@ void main() {
color.a = 1.0;
}
if (bool(params.flags & FLAG_SANITIZE_INF_NAN)) {
color = mix(color, vec4(100.0, 100.0, 100.0, 1.0), isinf(color));
color = mix(color, vec4(100.0, 100.0, 100.0, 1.0), isnan(color));
}
imageStore(dest_buffer, pos + params.target, color);
#endif // MODE_SIMPLE_COPY