Skip to content
TareHimselfPublic

About

C# game engine with a Vulkan renderer, a retained-mode UI/views system, and Rin.Shade, a Roslyn-based C#-to-Slang shader transpiler.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

391 Commits

Folders and files

Repository files navigation

Rin

Prerequisites

  • .NET SDK 10 - pinned in global.json (rollForward: latestMajor); every project targets net10.0 (set in Directory.Build.props)
  • Vulkan SDK
  • uv - installs Python and the native build tools (Conan, CMake and Task) from pyproject.toml, so you do not install those yourself
  • A C++ toolchain, only if you build the native modules: Visual Studio Build Tools with "Desktop development with C++" on Windows, or gcc or clang on Linux and macOS

First-time setup

The managed projects pull the native libraries (Vulkan graphics backend, Miniaudio, the Slang shader compiler, etc.) as NuGet packages from a local feed (.feed/, wired up in NuGet.Config). Build and pack them once before opening the solution:

uv run task pack-all

This builds each native module (via Conan + CMake) and dotnet packs it into .feed/. Re-run the relevant task (pack-native, pack-audio-miniaudio-native, pack-graphics-vulkan-native, pack-slang-native) whenever you change that module's C++ source.

Building

dotnet build rin.sln

Running an example

All examples live in one project. Run it with no argument for a launcher, or pass an example name (scene-test, sponza, views-test, ui-gallery, and the rest listed in its ReadMe):

dotnet run --project Examples/Examples/Examples.csproj
dotnet run --project Examples/Examples/Examples.csproj -- scene-test

Or open rin.sln in Visual Studio/Rider and run the Examples project directly.

Testing

Each test project runs on its own, for example:

dotnet test Engine/Rin.Core.Tests/Rin.Core.Tests.csproj -p:RinShadeSkipCompile=true
dotnet test Shade/Rin.Shade.Tests/Rin.Shade.Tests.csproj

-p:RinShadeSkipCompile=true skips compiling the shaders through the native Slang compiler, which tests that never load shader content do not need. Shade/Rin.Shade.CpuTests runs transpiled shaders on the CPU and needs the real native Slang package. CI (.github/workflows/ci.yml) runs one job per test project, plus a job that builds the real native Slang and runs the tests and the full shader compile that need it. See native/ReadMe.md for how real, stub and fake native libraries differ.

Shaders

Shaders are written in C# with Rin.Shade, which transpiles them to Slang at build time (Shade/ReadMe.md). There are no hand-written .slang sources in the repo.

Repository layout

Each project has its own ReadMe.md, and Shade/ and native/ have one for the subsystem as a whole.

  • Engine/: core engine (Rin.Core, Rin.World, graphics and audio backends, glTF loading, source generators) and its tests
  • Shade/: Rin.Shade, the C# to Slang shader transpiler, with its source generator, MSBuild task and tests
  • Slang/: managed Slang compiler wrapper and command line tool
  • native/: native C++ modules, their packaging, and the fakes used in CI
  • Examples/: sample and demo apps
  • Experiments/: prototype projects
  • msbuild/: MSBuild targets shared by the shader projects (RinShade.targets)
  • scripts/: CI helpers (native stub packages, native fakes)

How the pieces fit together is in ARCHITECTURE.md. Conventions for contributors and coding agents are in AGENTS.md, with extra rules for Shade/ and native/.

All READMEs

Engine

  • Rin.Audio.Miniaudio: Audio backend built on miniaudio, implementing IAudioModule from Rin.Core.
  • Rin.Audio.Null: An audio backend that does nothing, for headless runs and tests.
  • Rin.Core.Tests: NUnit tests for Rin.Core.
  • Rin.Core: The base library: views, the graphics graph, audio interfaces and shared types.
  • Rin.GLTF.Tests: NUnit tests for Rin.GLTF.
  • Rin.GLTF: Imports glTF/glb files into Rin meshes and animations, using SharpGLTF.Core.
  • Rin.Graphics.Null: A graphics backend that does nothing, for headless runs and tests.
  • Rin.Graphics.Vulkan: Vulkan backend for the IGraphicsModule interface from Rin.Core.
  • Rin.SourceGenerators.Tests: xUnit tests for the generators in Rin.SourceGenerators.
  • Rin.SourceGenerators: Roslyn incremental source generators, referenced as an analyzer by Rin.Core and Rin.World.
  • Rin.World.Tests: NUnit tests for Rin.World.
  • Rin.World: The scene layer: actors, components, physics and the default render pipeline.

Shade (overview)

  • Rin.Shade.Cli: Command line wrapper over the transpiler.
  • Rin.Shade.CpuTests: Transpiles a shader, runs it on the CPU through Slang and compares the result with System.Numerics.
  • Rin.Shade.MSBuild: The MSBuild task Rin.Shade.MSBuild.CompileRinShadeShaders.
  • Rin.Shade.SourceGenerator: Roslyn incremental source generators for Rin.Shade.
  • Rin.Shade.Tests: NUnit tests for the transpiler and the source generators.
  • Rin.Shade.Transpiler: Roslyn-based transpiler from C# shader classes to Slang source text.
  • Rin.Shade: The C# authoring API for shaders.
  • Samples: Three tiny assemblies that exist only to test cross-assembly shader transpilation.

Slang

native (overview)

Examples

  • Common: Shared library for the example and experiment apps, not runnable on its own.
  • Examples: Every example app in one executable, picked by name or from a launcher window.
  • Examples.Tests: NUnit tests for the P2P chat networking and the render graph overlay's layout.

Experiments

About

C# game engine with a Vulkan renderer, a retained-mode UI/views system, and Rin.Shade, a Roslyn-based C#-to-Slang shader transpiler.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages