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

Aperta
#3,735 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
backend, devtools

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
C#
Stelle
8k
Fork
1.2k
Merge medio
2g 7h
PR unite (30g)
316

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stride3d/stride

Tutte le issue di stride3d/stride

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.