sources/shaders/Stride.Core.Shaders/README.md
Shader source code manipulation library. With it, you can:
It can convert HLSL code to various GLSL dialect, including Core, ES 2.0, ES 3.0+ and Vulkan.
| Feature | Status |
|---|---|
| Vertex & Pixel Shaders | ✔ |
| Geometry Shaders | ✘ |
| Tessellation Shaders | ✘ |
| Compute Shaders | ✘ |
| Standard intrinsics | ✔ except: noise |
| SM5 intrinsics | ✘ missing: dst, ddx_coarse, ddx_fine, ddy_coarse, ddy_fine, firstbithigh, firstbitlow, countbits, f16tof32, f32tof16, fma, mad, msad4, rcp, reversebits |
| Registers | ✔ simple remapping |
| Constant Buffer Offsets & Packing | ✘ cbuffer follow GLSL rules |
| Barriers intrinsics | ✘ (no Compute Shaders) |
| Interlocked intrinsics | ✘ (no Compute Shaders) |
| Shared variables & memory | ✘ (no Compute Shaders) |
| Integer reinterpret intrinsics | ✘ asuint, asint |
| Flow statements | ✔ except: errorf, printf, abort |
| Texture objects | ✔ |
| Buffer objects | ✔ |
| Class/struct methods | ✘ |
| Preprocessor | ✔ |
| Remap VS projected coordinates | ✔ |
| Multiple Render Targets | ✔ |
| Constant Buffers | ✔ |
| StructuredBuffer and RWStructuredBuffer | ✘ |
| RWBuffer and RWTexture | ✘ |
| #extension directives | ✘ not generated |
By default, it generates "combined" samplers:
Texture2D texture;
SamplerState sampler;
texture.Sample(texture, sampler);
will generate a single sampler2D texture_sampler
There is also a mode to generate separate texture/samplers for platforms that support it (i.e. Vulkan).
#define REGISTER_INDEX 1
#define REGISTER_EXPR b ## REGISTER_INDEX
cbuffer A : register(REGISTER_EXPR)