MaterialGraph::FGraphParam
Compiled-material emission (the path mbt actually compiles, unlike the free-standing EmitHLSL preview): texture nodes are assigned the GBuffer material descriptor slots 0..7 in first-use order (deduped by texture UUID), and the emitted code samples the MatGraphTexN/ MatGraphSampN aliases GBufferFill.hlsl defines under MATERIAL_GRAPH — so the per-material shader keeps the exact pipeline layout of the uber-shader and only the evaluation differs. Textures carries the UUID for each used slot, in slot order; the renderer binds them into the material descriptor set in the same order. Hash is FNV-1a of the emitted source — the shader's stable identity for the cook, the cache and the runtime lookup ("Materials/<hash-hex>"). R4: a NAMED Scalar/Vector parameter no longer constant-folds into the source — it compiles to a read of a parameter lane the renderer feeds per draw, so changing the value never recompiles the shader. Unnamed param nodes keep folding (they are constants with a param-shaped node).
- Module
- AssetSystem
- Header
#include "AssetSystem/Assets/MaterialGraph.h"- Namespace
Mowo
Lane layout. A graph whose parameters fit the ORIGINAL four-lane block keeps that block's exact packing — vectors take whole lanes from the front, scalars pack four per lane from the BACK — and reads them as In.Params[lane]; its emitted source is byte-identical to what it was before the ceiling was lifted, so every cooked blob, committed sidecar and shader hash stands. A graph that does not fit takes the WIDE layout: vectors from the front, scalars four per lane immediately after them, up to kGraphParamLanesMax lanes; lanes 4 and up read MatGraphParamsExt[lane - 4], a static array the emitted source declares (zero unless the pass template fills it), and the source announces its width with #define MATERIAL_GRAPH_PARAM_LANES <n> so the templates and the upload can size their copy by the graph instead of by four. The instance override path addresses lanes by name -> (lane, comp) through this table, never by position.
Properties
| Type | Name | Description |
|---|---|---|
std::string | name | |
bool | isVector | Default false. |
uint8_t | lane | In.Params[lane] below 4, MatGraphParamsExt[lane - 4] from 4 Default 0. |
uint8_t | comp | scalar component within the lane Default 0. |
Vec4 | defaultValue | scalar rides .x Default Vec4(0.0f, 0.0f, 0.0f, 0.0f). |