Yotsuba Shader
Documentation

Article

Reusing your types and libraries

Annotate compatible project types and understand the current limits of referenced shader libraries.

Map your types to the GPU#

Vector mapping uses YotsubaShader.Language.Native.Types.Vector. Mark the type with [Vector] and its ordered components with [VectorComponent(index)]. Components must share a supported scalar type.

C#
using YotsubaShader.Language.Native.Types.Vector;

[Vector]
public struct Float2
{
    [VectorComponent(0)] public float X;
    [VectorComponent(1)] public float Y;

    public Float2(float x, float y) { X = x; Y = y; }
}

A name such as Vector2 does not provide native vector semantics. You can annotate types you own; an unchanged third-party assembly cannot acquire these attributes through a using directive. Unannotated structs are inspected as fields and properties.

Sharing libraries#

You can distribute C# types and shader source through NuGet. GPU compilation of arbitrary library methods is not implemented: shader discovery only searches the current assembly, and invocation processing is unfinished. Packaging code does not establish GPU compatibility.

Copyright © 2026 Yotsuba Shader contributors · Licensing · GitHub