### Godot version

v4.2.beta1.official [b1371806a]

### System information

Ubuntu 22.04.3 LTS 22.04 - X11 - GLES3 (Compatibility) - AMD Radeon RX 560 Series (polaris11, LLVM 15.0.7, DRM 3.42, 5.15.0-88-generic) () - AMD Ryzen 3 1200 Quad-Core Processor (4 Threads)

### Issue description

![image](https://github.com/godotengine/godot/assets/1330325/7a986599-5a68-42a4-beb1-5d3b4bf7db6b)
![image](https://github.com/godotengine/godot/assets/1330325/e8b8546b-b47b-4add-9567-7f70709ab03c)

Culling 3D goes bellow 60 fps even with just about 50 simple animated models. With v4.2.dev6.official [57a6813bb] many more models can be spawned without fps drop. However, both versions do show high cpu usage for culling 3D. Without animations there's barely any usage.

### Steps to reproduce

Spawn models with animation with the Compatibility renderer.

### Minimal reproduction project

[CullMRP.zip](https://github.com/godotengine/godot/files/13400514/CullMRP.zip)

const RID *textures = p_textures.ptr();
	const ShaderCompiler::GeneratedCode::Texture *texture_uniforms = p_texture_uniforms.ptr();
	int texture_uniform_index = 0;
	int texture_uniform_count = 0;
	for (int ti = 0; ti < p_textures.size(); ti++) {
		ERR_FAIL_COND_MSG(texture_uniform_index >= p_texture_uniforms.size(), "texture_uniform_index out of bounds");
		GLES3::Texture *texture = TextureStorage::get_singleton()->get_texture(textures[ti]);
		const ShaderCompiler::GeneratedCode::Texture &texture_uniform = texture_uniforms[texture_uniform_index];
		if (texture) {
			glActiveTexture(GL_TEXTURE0 + texture_offset + ti);
			glBindTexture(target_from_type[texture_uniform.type], texture->tex_id);
			if (texture->render_target) {
				texture->render_target->used_in_frame = true;
			}
			texture->gl_set_filter(filter_mapping[int(texture_uniform.filter)]);
			texture->gl_set_repeat(repeat_mapping[int(texture_uniform.repeat)]);
		}
		texture_uniform_count++;
		if (texture_uniform_count >= texture_uniform.array_size) {
			texture_uniform_index++;
			texture_uniform_count = 0;
		}
	}
}
void CanvasMaterialData::bind_uniforms() {
	
	glBindBufferBase(GL_UNIFORM_BUFFER, RasterizerCanvasGLES3::MATERIAL_UNIFORM_LOCATION, uniform_buffer);
	bind_uniforms_generic(texture_cache, shader_data->texture_uniforms, 1, filter_from_uniform_canvas, repeat_from_uniform_canvas); 
}
CanvasMaterialData::~CanvasMaterialData() {