Class SlangMaterialGenerator

java.lang.Object
dev.engine.graphics.shader.SlangMaterialGenerator

public final class SlangMaterialGenerator extends Object
Generates Slang interface + implementation for material parameters.

The shader always accesses data through IMaterialParams. The implementation (UBO, SSBO array, bindless) is generated based on the upload strategy and injected before compilation.

  • Method Details

    • generateInterface

      public static String generateInterface(Set<? extends PropertyKey<?,?>> keys)
      Generates the Slang interface for material parameter access. Each scalar/vector parameter becomes a getter method. Textures are excluded from the interface — they're bound separately.
    • generateUboImplementation

      public static String generateUboImplementation(Set<? extends PropertyKey<?,?>> keys)
      Generates a UBO-backed implementation of IMaterialParams. Each parameter is a field in a cbuffer, accessor returns the field.
    • generateSsboImplementation

      public static String generateSsboImplementation(Set<? extends PropertyKey<?,?>> keys)
      Generates an SSBO-backed implementation for instanced rendering. All instance data in a StructuredBuffer, indexed by instance ID.
    • generate

      public static String generate(Set<? extends PropertyKey<?,?>> keys, SlangMaterialGenerator.UploadMode mode)
      Generates the full material injection block (interface + chosen implementation).