Overview#
Yotsuba Shader is a shader framework and compiler for C#. Your team writes shaders using the types, structures and libraries of its own project, described with attributes. The compiler interprets their interfaces and stages, lowers them to a shared intermediate representation, and generates output for the selected backend.
The syntax you write with does not determine the output target. HLSL, GLSL, MSL, SPIR-V and WGSL provide equivalent authoring vocabularies; choose the one your team knows best.
Topics#
Start here#
Understanding Yotsuba Shader
Discover how a C# class becomes a shader: the language, the intermediate representation and the compiler.
Learn more
Writing your first shader
Declare vertex inputs and outputs, then write a vertex stage and a fragment stage that pass a color through.
Learn more
Reusing your types and libraries
Annotate compatible project types and understand the current limits of referenced shader libraries.
Learn more
Types for engines and frameworks
Current vector, matrix, texture, and sampler declarations for engine authors.
Learn more
Typed shader parameters for your engine
A clearly separated engine-side design example, without assuming a generated runtime parameter API.
Learn more
Choosing a syntax
The HLSL, GLSL, MSL, SPIR-V and WGSL syntaxes express the same intent. Pick the one your team knows.
Learn more
Stages and interfaces#
Shader stages
Mark methods with [ShaderStage] to declare vertex, fragment and compute entry points.
Learn more
Interface slots and locations
Describe how data flows into and out of a stage with [Location] and built-in attributes.
Learn more
Resources and types#
Uniforms and storage buffers
Declare buffers and bindings using the resource namespaces and constructors that exist today.
Learn more
Textures and samplers
Declare textures and samplers, describe exactly what kind of image each one is, and bind them in the syntax you write in.
Learn more
Vectors, matrices and arrays
Use scalars, vectors, matrices, structs and arrays in a shader, and learn how each C# type becomes a GPU type.
Learn more
In your game#
Compilation#
Compilation pipeline
Current compilation stages and the boundaries between implemented APIs and planned build integration.
Learn more
Generating shader binaries
Intended shader build workflow and the current availability of binary generation.
Learn more
Shader diagnostics in your IDE
Available C# checks and exceptions, with planned IDE shader diagnostics identified explicitly.
Learn more
Transpiling from SPIR-V
Use the actual Parser and backend compiler classes of YotsubaShaderCross. WGSL remains planned.
Learn more
Attribute reference#
Built-in values across syntaxes
The same built-in value, spelled in the HLSL, GLSL, MSL, SPIR-V and WGSL syntaxes.
Learn more
Resource attributes across syntaxes
Uniform buffers, storage buffers, textures, samplers and binding slots in each syntax.
Learn more
HLSL syntax attributes
Every attribute of the HLSL syntax: system-value semantics such as SV_Position and numthreads, plus cbuffer and register for resources.
Learn more
GLSL syntax attributes
Every attribute of the GLSL syntax: gl_* built-ins, layout(set, binding), uniform and buffer.
Learn more
MSL syntax attributes
Every attribute of the MSL syntax: attribute names from MSL such as position, vertex_id and thread_position_in_grid, plus buffer(n), texture(n) and sampler(n).
Learn more
SPIR-V syntax attributes
Every attribute of the SPIR-V syntax: SPIR-V BuiltIn names (BuiltIn_Position), DescriptorSet and Binding.
Learn more
WGSL syntax attributes
Every attribute of the WGSL syntax: the @builtin(...), @group and @binding vocabulary of WebGPU, written with @ identifiers that remain valid C#.
Learn more
