mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 23:04:37 +00:00
55 lines
3.0 KiB
Plaintext
55 lines
3.0 KiB
Plaintext
// Copyright FlecsProj. All Rights Reserved.
|
|
//
|
|
// ShaderLab DSL vocabulary — the UFUNCTION/UPROPERTY-style annotation macros that mark up an
|
|
// otherwise-plain-HLSL `.usl` file. Every macro expands to NOTHING for the preprocessor (and for
|
|
// HLSL Tools / Rider), so the file stays valid HLSL and gets free completion; the ShaderLab C++
|
|
// parser reads these macro invocations + the HLSL declaration that follows to rebuild its model.
|
|
//
|
|
// Included (transitively, via ShaderLab.ush) by every `.usl`. This file is static and checked in;
|
|
// the sibling ShaderLab.ush is generated by the `ShaderLab.IDE.Prepare` console command.
|
|
|
|
#pragma once
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Annotation macros. Two-line UFUNCTION style: the macro sits on its own line
|
|
// directly above the HLSL declaration it annotates.
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Material settings. Standalone (no following declaration).
|
|
// SL_SETTINGS(Domain = Surface, BlendMode = Opaque, TwoSided = false, OpacityMaskClipValue = 0.4)
|
|
#define SL_SETTINGS(...)
|
|
|
|
// Material parameter. Precedes the HLSL declaration whose type selects the DSL type:
|
|
// float -> Scalar | float3 -> Color | float4 -> Vector |
|
|
// Texture2D/TextureCube -> texture | "#define X v" -> StaticBool.
|
|
// Scalar/Color/Vector defaults come from the HLSL initializer; texture default from DefaultTexture.
|
|
#define SL_PROPERTY(...)
|
|
|
|
// Pixel/vertex entry points. Precede a `void Name(inout F... X) { ... }` (Vertex takes FShaderLabVertex).
|
|
#define SL_SURFACE(...)
|
|
#define SL_POSTPROCESS(...)
|
|
#define SL_UI(...)
|
|
#define SL_VERTEX(...)
|
|
|
|
// Multi-slab building blocks.
|
|
#define SL_SLAB(...) // precedes `void Name(inout FShaderLabSurface S) { ... }`
|
|
#define SL_VALUE(...) // precedes `float Name() { return <float>; }`
|
|
#define SL_FRONTMATERIAL(...) // standalone: SL_FRONTMATERIAL(VerticalLayer(Coat, Metal, Thickness))
|
|
#define SL_OPACITY(...) // standalone: SL_OPACITY(SomeValueName)
|
|
#define SL_OPACITY_MASK(...) // standalone: SL_OPACITY_MASK(SomeValueName)
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Specifier vocabulary (canonical, PascalCase — aligned with UE conventions).
|
|
// These are the keys accepted inside the macros above.
|
|
//
|
|
// SL_SETTINGS : Domain, BlendMode, TwoSided, OpacityMaskClipValue, <reflection-allowlist keys...>
|
|
// Domain = Surface | PostProcess | UI | Decal
|
|
// BlendMode = Opaque | Masked | Translucent | Additive | Modulate
|
|
// SL_PROPERTY : DisplayName, Group, SortPriority, Range (Scalar only), DefaultTexture (textures only)
|
|
//
|
|
// Topology operators (used inside SL_FRONTMATERIAL):
|
|
// VerticalLayer(Top, Base, Thickness) | HorizontalMix(Background, Foreground, Mix)
|
|
// Add(A, B) | Weight(A, Weight) | Select(A, B, Threshold)
|
|
// A mix factor is a float literal, a Scalar property name, or an SL_VALUE block name.
|
|
// ---------------------------------------------------------------------------
|