Class SlangParamsBlock
java.lang.Object
dev.engine.graphics.shader.SlangParamsBlock
Generates Slang interface + implementation blocks for shader parameter access.
Two creation modes:
fromKeys(String, Set)— dynamic params from PropertyKeys (materials). Generates an interface for generic specialization: shaders declare<M : IMaterialParams>and the concrete type is injected.fromRecord(String, Class)— static params from a Java record (camera, engine). Generates interface + implementation + a static global instance (e.g.,camera.get_viewProjection()).
The upload strategy (UBO or SSBO) determines the generated implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordEntry type for reflective construction. -
Method Summary
Modifier and TypeMethodDescriptionstatic SlangParamsBlockcreateFromEntries(String name, List<SlangParamsBlock.FieldEntry> entries) Factory for.invalid reference
ReflectiveSlangHelperstatic SlangParamsBlockfromKeys(String name, Set<? extends PropertyKey<?, ?>> keys) Creates a params block from PropertyKeys (for materials).static SlangParamsBlockfromRecord(String name, Class<?> recordType) Creates a params block from a Java record (for camera, engine, etc.).Generates the full SSBO-backed block with a static global instance.generateSsbo(boolean includeGlobal) Generates the full SSBO-backed block (interface + struct + buffer + impl).Generates the full UBO-backed block with a static global instance.generateUbo(boolean includeGlobal) Generates the full UBO-backed block (interface + struct + cbuffer + impl).The interface name, e.g.The concrete SSBO type name, e.g.The concrete UBO type name, e.g.withBinding(int bindingIndex) Returns a copy with an explicit binding index.
-
Method Details
-
withBinding
Returns a copy with an explicit binding index. The generated cbuffer will includeregister(bN). -
fromKeys
Creates a params block from PropertyKeys (for materials). Generates interface + implementation + static global instance. -
fromRecord
Creates a params block from a Java record (for camera, engine, etc.). Generates interface + implementation + static global instance.Uses
RecordRegistryfirst (populated by@NativeStructprocessor), falling back to native reflection for unregistered types (desktop only). -
generateUbo
Generates the full UBO-backed block with a static global instance. -
generateUbo
Generates the full UBO-backed block (interface + struct + cbuffer + impl).- Parameters:
includeGlobal- if true, adds a static global instance (e.g.,static UboMaterialParams material;). Set to false when using generic specialization (the shader creates the instance viaM material;).
-
generateSsbo
Generates the full SSBO-backed block with a static global instance. -
generateSsbo
Generates the full SSBO-backed block (interface + struct + buffer + impl).- Parameters:
includeGlobal- if true, adds a static global instance.
-
interfaceName
The interface name, e.g. "IMaterialParams". -
uboTypeName
The concrete UBO type name, e.g. "UboMaterialParams". -
ssboTypeName
The concrete SSBO type name, e.g. "SsboMaterialParams". -
createFromEntries
public static SlangParamsBlock createFromEntries(String name, List<SlangParamsBlock.FieldEntry> entries) Factory for.invalid reference
ReflectiveSlangHelper
-