# Basic Concept ## Summary 1. [The language](#1) 1. [Why using SDSL](#2) 1. [Understanding SDSL](#3) ## The language SDSL (**S**tri**D**e engine **S**hading **L**anguage) is a language for shaders used in the Stride game engine. It was originally meant to be a superset of HLSL, sharing every aspect of HLSL and was translated to GLSL when needed. This specification will cover the reimplementation of SDSL's compiler in order to compile directly to SPIR-V. The implementation will be closely tied to the SPIR-V specification and understanding SPIR-V will help you understanding this implementation. ## Why using SDSL SDSL implements a mixin system helping the user compose shaders using a powerful composition system. It works like a SPIR-V linker with more features to allow more complex composition. The user can write snippets of code and ask the compiler to produce a SPIR-V byte using the shader mixer. Naturally this also helps the engine generate shader code when mixins are attached to sub-render-passes. Example : ```csharp // We define a mixin using a shader keyword, very similar to object definition in C# shader ColorMixin { // A variable can have a storage decoration (here stream) to indicate where it should be stored. stream float4 color : SV_COLOR; // A mixin can also contain static methods float4 AddColors(float4 a, float4 b) { return a + b; } // And non static method making use of the variable "streams" void DivideColorBy2() { streams.color /= 2; } } // Our main mixin, containing the main method shader MainMixin : ColorMixin { // Our main method for the fragment/pixel stage // Thanks to our mixin inheritance, we can make use of the color // variable (through the "streams" variable) and // the "DivideColorBy2" method. void PSMain() { streams.color = float4(1,0.8,0.2,1) DivideColorBy2(); } } ``` ## Understanding SDSL 1. [Types](/Types/Types.md) 2. [Statements](/) 3. [Mixin system](/MixinSystem/MixinSystem.md) 4. [Compilation](/Compilation/Compilation.md)