public static class StreamPlanAssigns every interstage value its location.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The single place stage-interface locations are decided, for the same reason BindingPlan is the single place descriptor bindings are: both emitters and ReflectionBuilder read this plan, so the GLSL layout(location = …), the SPIR-V Location decoration and the numbers the engine builds a vertex layout from cannot drift.
A stream's location is a property of the shader, not of the stage. It is the stream's index in the shader's declaration order, so the stage that writes it and the stage that reads it arrive at the same number without either knowing about the other — which is the whole reason the feature works. Deriving it from "index among this stage's outputs" instead would have the vertex stage and the fragment stage disagree the moment one of them touches a stream the other does not.
The consequence, stated rather than discovered: a stage's own parameters are located after the streams (ParameterBase), so adding a stream to a shader renumbers its vertex attributes. That is visible in the reflection the engine builds its vertex layout from, which is where a renumbering has to be visible; the alternative — locating streams after the parameters — would make a stream's location depend on which stage was looking at it, and there is no number both stages could agree on.
Methods (5)
public static ImmutableArray<PlannedStream> Of(IrShader shader)The plan for one shader: every declared stream, in declaration order.
public static int ParameterBase(IrShader shader)The location a stage's own parameters and return value start at, which is past every stream the shader declares.
public static int OutputBase(IrShader shader, ShaderStage stage)The location a stage's return value occupies, or 0 for a fragment stage.
public static ImmutableArray<int?> InputLocations(IrShader shader, IrEntryPoint entryPoint)The location each of a stage's own parameters occupies, in order — null for one the pipeline supplies rather than the host.
public static int LocationOf(IrShader shader, IrStream stream)The location assigned to one stream, or -1 when the shader does not declare it.
Used by (4)
- GlslEmitterVixen.Raven
- ReflectionBuilderVixen.Raven
- SpirvEmitterVixen.Raven
- StreamTestsVixen.Raven.Tests