Yotsuba Shader
Documentation

Article

Interface slots and locations

Describe how data flows into and out of a stage with [Location] and built-in attributes.

Locations and user semantics#

[Location(n)] is a concrete attribute in YotsubaShader.SpirvSyntax. YotsubaShader.Concepts.LocationAttribute is its concept marker and has no integer constructor. These are different types.

C#
using Microsoft.Xna.Framework;
using YotsubaShader.HlslSyntax;

public struct StageData
{
    [SV_Position] public Vector4 Position;
    [COLOR] public Vector4 Color;
}

For HLSL user semantics, use [POSITION], [COLOR], [TEXCOORD], [NORMAL], [TANGENT], or [BINORMAL], optionally with an index. The processor maps them to VertexSlot. Numbered locations map to LocationSlot.

Built-in processing#

The current slot resolver handles position/fragment coordinates according to the stage, vertex index, numbered locations, and HLSL user semantics. The syntax packages declare many additional built-ins; declaration alone does not mean the resolver handles them.

Use [return: SV_Target(0)] for an HLSL-style fragment color return. Reusing the vertex-output struct as fragment input is allowed by the authoring model; its position semantic is interpreted for the receiving stage.

Copyright © 2026 Yotsuba Shader contributors · Licensing · GitHub