### Godot version

v4.0.rc.custom_build [b12bf7ff0]

### System information

Ubuntu 23.04 (Lunar Lobster)

### Issue description

In a spatial shader: calling textureSize with a texture with hint_screen_texture or hint_depth_texture causes a long list of errors in the terminal, hangs the editor for a minute and fails to run the shader. Shaders using textureSize built fine two weeks ago.



### Steps to reproduce

Open sample project. Errors should be printed to console right away.

[terminal_output.txt](https://github.com/godotengine/godot/files/10700615/terminal_output.txt)




### Minimal reproduction project

[textureSize.zip](https://github.com/godotengine/godot/files/10700628/textureSize.zip)

Shader for MeshInstance3D with a plane mesh:

```
shader_type spatial;

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;

void fragment() {
    textureSize(SCREEN_TEXTURE, 0);  // <- culprit
    ALBEDO = vec3(1, 0, 0);
}
```
RS::GlobalShaderParameterType gvt = RSG::material_storage->global_shader_parameter_get_type(p_name);
	return (ShaderLanguage::DataType)RS::global_shader_uniform_type_get_shader_datatype(gvt);
}
Error ShaderCompiler::compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
	SL::ShaderCompileInfo info;
	info.functions = ShaderTypes::get_singleton()->get_functions(p_mode);
	info.render_modes = ShaderTypes::get_singleton()->get_modes(p_mode);
	info.shader_types = ShaderTypes::get_singleton()->get_types();
	info.global_shader_uniform_type_func = _get_global_shader_uniform_type;
	Error err = parser.compile(p_code, info);
	if (err != OK) {
		Vector<ShaderLanguage::FilePosition> include_positions = parser.get_include_positions();
		String current;
		HashMap<String, Vector<String>> includes;
		includes[""] = Vector<String>();
		Vector<String> include_stack;
		Vector<String> shader_lines = p_code.split("\n");
		
		for (int i = 0; i < shader_lines.size(); i++) {
			String l = shader_lines[i];
			if (l.begins_with("@@>")) {
				String inc_path = l.replace_first("@@>", "");
				l = "#include \"" + inc_path + "\"";
				includes[current].append("#include \"" + inc_path + "\""); 
				include_stack.push_back(current);
				current = inc_path;
				includes[inc_path] = Vector<String>();
			} else if (l.begins_with("@@<")) {
				if (include_stack.size()) {
					current = include_stack[include_stack.size() - 1];