How to use custom struct input for sdsl shader

How to use custom struct input for sdsl shader.

I have a:

  • Shader
  • C# File
shader MyCustomShaderBase
{
   // sdsl struct counterpart
   struct MyCustomShaderStruct 
   {
       // stuff
   }
    
    // creates a pin 
    stage MyCustomShaderStruct MyStructInput;
}
// csharp struct counterpart
[StructLayout(LayoutKind.Sequential)]
public struct MyCustomShaderStruct 
{
    // stuff
}


public static class MyCustomShaderStructInitializer
{
  // In theory this discovered automatically when vl sees dll
  public static readonly ValueParameterKey<MyCustomShaderStruct> MyStructInput =
    ParameterKeys.NewValue<MyCustomShaderStruct >(
       new MyCustomShaderStruct(), // default value, 
       "MyCustomShaderBase.MyStructInput" // full exact path to struct
    );
}

The problem is, that I can see shader pin only after I recompile shader, not on stratup.

E.g.:

After restart:

Testbed GitHub - antokhio/VLShaderStructInitializer · GitHub

I try to use this assembly initializer but i can’t figure out is it runs too early?

public sealed class Initializer : AssemblyInitializer<Initializer>
{
    protected override void RegisterServices(VL.Core.IVLFactory factory)
    {
        System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(
            typeof(MyCustomShaderBaseKeys).TypeHandle
        );
    }
}