Build from source
Build the solution, run the tests and validate the SPIR-V module the example produces.
Build
dotnet build YotsubaShader.sln
Run the example
The example project assembles a fragment-shader module instruction by instruction with SpirVModule and encodes it with SpirVCompiler.
dotnet run --project YotsubaShader.Example/YotsubaShader.Example.csproj
This creates mi modulo spirv.spv in the working directory.
Validate the module
If you have SPIRV-Tools installed, validate and disassemble the output:
spirv-val "mi modulo spirv.spv"
spirv-dis "mi modulo spirv.spv"
Run the tests
The frontend test project covers shader discovery and analysis.
dotnet test YotsubaShader.Frontend.Tests
Repository architecture
| Project | Role |
|---|---|
YotsubaShader.Language | Authoring layer: stages, attributes, resources and the types you map to the GPU. |
YotsubaShader.Roslyn | Discovery and semantic analysis of C# shaders. |
YotsubaShader.IR | Shared model between the frontend and backends. |
YotsubaShader.Compiler.SpirV | SPIR-V module construction and encoding. |
YotsubaShader.Generator | SPIR-V operation table generated from the Khronos grammar. |
YotsubaShader.Example | Executable example of low-level SPIR-V assembly. |
YotsubaShader.Frontend.Tests | Frontend discovery and analysis tests. |
