### Godot version

4.0.2

### System information

Windows 10

### Issue description

I have a meshinstance3d with a shader attached, and this is inside a subviewport. ( I instanced a bunch to make the memory rise faster, for testing purposes ).
The shader uses render_mode wireframe.
Whenever the object is onscreen, the memory will increase continuously! If the object goes offscreen, it will stop.
If I remove render_mode wireframe from the shader, the memory won't increase.
If I set debug_mode to wireframe on the subviewport, the memory won't increase.

Edit: I originally thought a subviewport was required, but it isn't. It happens even when there are no subviewports being used!


### Steps to reproduce

Open the attached project, and run the test.tscn
Watch as your memory continues to go up.
It stops if you either remove render_mode wireframe from the shader, or if you set the subviewport debug_mode to wireframe.
It also stops if the object isn't onscreen.

### Minimal reproduction project

[subViewportWireframeBug.zip](https://github.com/godotengine/godot/files/11267138/subViewportWireframeBug.zip)

#ifdef DEBUG_ENABLED
		ERR_FAIL_COND_V_MSG(shader.is_null(), RID(),
				"Attempted to use an unused shader variant (shader is null),");
#endif
		spin_lock.lock();
		RID result;
		for (uint32_t i = 0; i < version_count; i++) {
			if (versions[i].vertex_id == p_vertex_format_id && versions[i].framebuffer_id == p_framebuffer_format_id && versions[i].wireframe == p_wireframe && versions[i].render_pass == p_render_pass && versions[i].bool_specializations == p_bool_specializations) {
				result = versions[i].pipeline;
				spin_lock.unlock();
				return result;
			}
		}
		result = _generate_version(p_vertex_format_id, p_framebuffer_format_id, p_wireframe, p_render_pass, p_bool_specializations);
		spin_lock.unlock();
		return result;
	}
	_FORCE_INLINE_ uint32_t get_vertex_input_mask() const {
		return input_mask;
	}
	void clear();
	PipelineCacheRD();
	~PipelineCacheRD();
};
#endif