Yotsuba Shader
Documentation

Reference

Resource attributes across syntaxes

Uniform buffers, storage buffers, textures, samplers and binding slots in each syntax.

Uniform and storage buffers#

These are declaration examples with binding slots. Access markers differ by syntax; the GLSL and SPIR-V examples do not distinguish read-only access.

Resources.cs
using YotsubaShader.Language;
using YotsubaShader.HlslSyntax;
using YotsubaShader.HlslSyntax.Resources;

public struct Material
{
    public float Exposure;
}

public class Resources
{
    // Uniform buffer, with its binding slot
    [cbuffer, register(RegisterPrefix.b, 0)]
    public Material Material;

    // Read/write storage buffer
    [register(RegisterPrefix.u, 0)]
    public RWStructuredBuffer<float> Output;

    // Read-only storage buffer
    [register("t0")]
    public StructuredBuffer<float> Input;
}

Textures and samplers#

A texture and a sampler bound to their slots.

Surface.cs
using YotsubaShader.HlslSyntax;
using YotsubaShader.HlslSyntax.Resources;

public class Surface
{
    [register(RegisterPrefix.t, 0)]
    public Texture2D Albedo;

    // The same register, written as a string: letter + number
    [register("s0")]
    public SamplerState Sampler;
}

Resource namespaces#

Resources belong to each syntax namespace, such as YotsubaShader.HlslSyntax.Resources or YotsubaShader.SpirvSyntax.Resources. Declarations are not proof of complete resource lowering. See the buffer tutorial for current constructors.

Copyright © 2026 Yotsuba Shader contributors · Licensing · GitHub