Shader System Rewrite
PROJECT
Part of: Stride Game Engine
Fiscal Host: Open Source Collective
Rewrite the shader system so that it's much faster, easy to keep up to date and port to new platforms.

About
Stride has a powerful effect and shader system.
Current Status
Currently, the shader system works by manipulating and combining shader directly by manipulating pieces of SDSL (our superset of HLSL), using AST representation, and then convert it to the various target languages (i.e. keep HLSL as is, or convert to GLSL using our own tooling).
Disadvantages
Current Status
Currently, the shader system works by manipulating and combining shader directly by manipulating pieces of SDSL (our superset of HLSL), using AST representation, and then convert it to the various target languages (i.e. keep HLSL as is, or convert to GLSL using our own tooling).
Disadvantages
- Extremely slow
- It works at the source level (lot of string manipulation, nodes, allocations, etc.)
- Lot of analysis needed
- Can't parse file once and reuse (every include for a specific effect will have to be parsed again)
- Mixing shaders is very inefficient (lot of defensive copies, many passes, allocation, etc.)
- Also, the code is hard to understand, extend and maintain
- To the point that almost nobody work on it anymore
- As a result, it's very inefficient to add new shader features (compute, raytracing, etc.)
- Also, it's problematic to add new platforms
Planned Work
We would like to re-implement the system in a different way. Here is how it would work:
It would parse our shaders to a superset of SPIR-V intermediate language, specific to Stride (let's call it SPIR-S for Stride).
Youness Kafia already started to work on a SDSL to SPIR-S prototype (kudo to him for all his work!), and there is a good enough base to start scaling up the effort and work on the next parts (mixing SPIR-S to SPIR-V, prototype in progress).
Advantages
- It will be very easy and lightweight to manipulate those SPIR-V blocks and mix them to generate regular SPIR-V.
- Finally, we can leverage on existing tools to convert SPIR-V to HLSL, Metal, etc.
- As a side note, Microsoft is also moving on from DXIL (their own IL) to support SPIR-V, so we should hopefully be soon able to feed it directly to the D3D shader compiler.
Our team

Contribute
Become a financial contributor.