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.
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.
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;
}
using YotsubaShader.Language;
using YotsubaShader.GlslSyntax;
using YotsubaShader.GlslSyntax.Resources;
public struct Material
{
public float Exposure;
}
public class Resources
{
// Uniform buffer, with its binding slot
[uniform, layout(0, 0)]
public Material Material;
// Read/write storage buffer
[buffer, layout(0, 1)]
public float[] Output;
// Read-only storage buffer (same attribute)
[buffer, layout(0, 2)]
public float[] Input;
}
using YotsubaShader.Language;
using YotsubaShader.MslSyntax;
using YotsubaShader.MslSyntax.Resources;
public struct Material
{
public float Exposure;
}
public class Resources
{
// Uniform buffer, with its binding slot
[constant, buffer(0)]
public Material Material;
// Read/write storage buffer
[device, buffer(1)]
public float[] Output;
// Read-only storage buffer
[device(readOnly: true), buffer(2)]
public float[] Input;
}
using YotsubaShader.Language;
using YotsubaShader.SpirvSyntax;
using YotsubaShader.SpirvSyntax.Resources;
public struct Material
{
public float Exposure;
}
public class Resources
{
// Uniform buffer, with its binding slot
[Uniform, DescriptorSet(0), @Binding(0)]
public Material Material;
// Read/write storage buffer
[StorageBuffer, DescriptorSet(0), @Binding(1)]
public float[] Output;
// Read-only storage buffer (same attribute)
[StorageBuffer, DescriptorSet(0), @Binding(2)]
public float[] Input;
}
using YotsubaShader.Language;
using YotsubaShader.WgslSyntax;
using YotsubaShader.WgslSyntax.Resources;
public struct Material
{
public float Exposure;
}
public class Resources
{
// Uniform buffer, with its binding slot
[uniform, @group(0), @binding(0)]
public Material Material;
// Read/write storage buffer
[storage(storage_use.read_write), @group(0), @binding(1)]
public float[] Output;
// Read-only storage buffer
[storage(storage_use.read), @group(0), @binding(2)]
public 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.
