# Input/Output SDSL proposes a stream system for input/output of values in shaders. ## Binding Following the SPIR-V specification, users must bind buffers specifying its location in order to use them. SDSL offers a semantic name system to handle the binding automatically, akin to HLSL's semantic name system. ```csharp shader PositionBase { stream float4 position : WORLD_POSITION; stream float4 color : MY_COLOR; } ``` ### Builtin/System values SPIR-V and HLSL both offer builtin semantic names giving the compiler more information on the type of data handled by the shader. Since SDSL follows the SPIR-V specification, it will automatically translate SPIR-V builtin names and supported HLSL shader values names to their corresponding builtin value. The rest will be translated to locations. ### Stream values between stages SDSL provides a virtual variable scope for shader stages. By declaring one value with the scope `stream` you can possibly declare this variable for both vertex shader output and fragment shader input. The compiler will generate both in and out depending the use of this variable. In SDSL, using a stream variable is as simple as calling a virtual global value called `streams`. As an example : ```csharp shader MyMixin { stream float4 position : POSITION; stream float4 normal : NORMAL; stream float4 color : COLOR; void VSMain() { streams.color = streams.normal * 0.5f; } void PSMain() { streams.color *= 3; } } ``` In this above example, ``color``, ``position`` and ``normal`` are declared. ``position`` and `normal` are never assigned during the vertex shader and never used in the fragment shader, the compiler will generate them only as input to the vertex shader. `color` is present in the fragment shader and is assigned to the vertex shader, the compiler will check if color in the input of the vertex shader and either generate an input and output for the vertex shader or just the output for the vertex shader. The fragment shader only consumes the `color` variable, it will only contain `color` as an input shader.