Overlay: Skip passes not needed

Avoid initializing passes (and requesting their shaders) unless they're
actually needed.
Reduces the number of compiled Overlay shaders at startup
from 70 to 22.
Improves startup times.

Pull Request: https://projects.blender.org/blender/blender/pulls/138457
This commit is contained in:
Miguel Pozo
2025-05-06 16:09:12 +02:00
parent ce8f30f92c
commit c0d6675c84
12 changed files with 107 additions and 27 deletions

View File

@@ -122,6 +122,16 @@ void Instance::init()
ED_space_image_get_aspect(space_image, &state.image_aspect.x, &state.image_aspect.y);
}
state.has_mesh = DEG_id_type_any_exists(state.depsgraph, ID_ME);
state.has_curve = DEG_id_type_any_exists(state.depsgraph, ID_CV) ||
DEG_id_type_any_exists(state.depsgraph, ID_CU_LEGACY);
state.has_volume = DEG_id_type_any_exists(state.depsgraph, ID_VO);
state.has_gpencil = DEG_id_type_any_exists(state.depsgraph, ID_GP);
state.has_armature = DEG_id_type_any_exists(state.depsgraph, ID_AR);
state.has_particles = DEG_id_type_any_exists(state.depsgraph, ID_PA);
state.has_lattice = DEG_id_type_any_exists(state.depsgraph, ID_LT);
state.has_ptcloud = DEG_id_type_any_exists(state.depsgraph, ID_PT);
resources.update_theme_settings(ctx, state);
resources.update_clip_planes(state);