// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Validation.gdshaderinc"

float ensureValidFloat( float value )
{
  if ( isnan( value ) || isinf( value ) )
  {
    return 0.0;
  }

  return value;
}

vec2 ensureValidVec2( vec2 value )
{
  value.x = ensureValidFloat( value.x );
  value.y = ensureValidFloat( value.y );

  return value;
}

vec3 ensureValidVec3( vec3 value )
{
  value.x = ensureValidFloat( value.x );
  value.y = ensureValidFloat( value.y );
  value.z = ensureValidFloat( value.z );

  return value;
}

vec4 ensureValidVec4( vec4 value )
{
  value.x = ensureValidFloat( value.x );
  value.y = ensureValidFloat( value.y );
  value.z = ensureValidFloat( value.z );
  value.w = ensureValidFloat( value.w );

  return value;
}
