Yotsuba Shader
Documentation

Tutorial

Uniforms and storage buffers

Declare buffers and bindings using the resource namespaces and constructors that exist today.

Resource namespaces#

Resource attributes belong to each syntax project, not YotsubaShader.Language.Resources. The current SPIR-V vocabulary uses separate DescriptorSet and Binding attributes. There is no shared Binding(set, binding) constructor or ResourceAccess enum.

C#
using YotsubaShader.HlslSyntax.Resources;

public struct Settings
{
    public float Exposure;
}

public class Resources
{
    [cbuffer, register(RegisterPrefix.b, 0)]
    public Settings Settings;

    [register(RegisterPrefix.u, 0)]
    public RWStructuredBuffer<float> Values;
}

StorageBuffer has no Access property. Use the syntax-specific declarations shown below; GLSL and SPIR-V use the same buffer marker for both examples and do not express a read-only choice through that marker.

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;
}

Resource metadata and binding concepts exist. Automatic uploading, complete field discovery, GPU array operations, and layout/reflection integration must not be assumed to work end to end.

Copyright © 2026 Yotsuba Shader contributors · Licensing · GitHub