How to flip an texture in a shader after or before using texture() ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kirial

Here’s my shader code, I would like to flip the image horizontally, I managed to do it with texture(1.0 - UV.x, UV.y) but I need to use the screen’UVs.
The ‘text’ uniform comes from a Viewport texture.
I tried doing :
var image = viewport.get_texture().get_data()
image.flip_x()
var texture = ImageTexture.new()
texture.create_from_image(image)
and then feed this texture to the shader but I get a black screen, so I have to flip it inside the shader.
Thanks !

shader_type spatial;
render_mode unshaded;
uniform sampler2D text: hint_albedo;

void fragment() {
ALBEDO = texture(text,vec2(1.0 - SCREEN_UV.x, SCREEN_UV.y)).rgb;
}