Effect keys: register and unregister per assembly (assembly reload, plugin unload)

Abierto
#3,735 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp
Área
backend, devtools

Línea de trabajo

Start by reading ParameterKeys, ShaderMixinManager, and DataSerializerFactory to understand the existing registration pattern. Then trace the assembly registration calls in PackageSession, ReloadAssembliesOperation, UnloadAssembliesOperation, and LiveAssemblyReloader. Done means keys and effect builders can be registered and removed per assembly, including resolving the open questions about composed or indexed keys and collections that retain old keys.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area-Plugins area-Shaders enhancement

Since #3584, parameter keys are named by source generators (EffectKeysGenerator for hand-written key classes, the shader generator for sdsl/sdfx keys). Both emit a module initializer that calls ParameterKeys.Merge for each key.

ParameterKeys keeps one global table (keyByNames, keys, the composed key cache) that nothing ever clears. Effects work the same way: ShaderMixinManager.Register per effect, and only UnRegisterAll.

So when the editor reloads game assemblies (ReloadAssembliesOperation, and its undo/redo) or a plugin is unloaded, the keys and effect builders of the old assembly stay registered. They stay reachable by name, and they keep the old assembly alive, which blocks unloading a collectible load context.

Proposal, same shape as DataSerializerFactory:

  • The generators output a list of the assembly's keys (and effect builders) instead of calling Merge.
  • ParameterKeys and ShaderMixinManager get RegisterAssembly(Assembly) / UnregisterAssembly(Assembly).
  • Hosts call them where they already call DataSerializerFactory.Register/UnregisterSerializationAssembly (PackageSession, ReloadAssembliesOperation, UnloadAssembliesOperation, LiveAssemblyReloader).
  • Games keep registering at module init, so user code doesn't change.

Open questions:

  • Composed and indexed keys made from an unloaded key (ComposeWith, IndexedKey): drop them too?
  • ParameterCollections that still hold old keys after a reload.
Lenguaje dominante
C#
Estrellas
8k
Forks
1.2k
Merge medio
2 d 7 h
PR fusionados (30 d)
316

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stride3d/stride

Todos los issues de stride3d/stride

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.