Shader Conversion
Table of contents
HLSL to GLSL
Converting HLSL shaders to Flair GLSL shaders is quite straightforward. Here is the main syntax that needs to be changed.
- Replace
Texture2Dwithsampler2D - Replace fragment function with
void main() { - Replace matrices
- Replace
float2x2withmat2 - Replace
float3x3withmat3 - Replace
float4x4withmat4 - Change order of elements. HLSL is row mayor, whereas GLSL is column major
- Replace
- replace
float2withvec2 - replace
float3withvec3 - replace
float4withvec4 - Change Load to texelFetch
- replace
LoadwithtexelFetch - replace
int3 loc = int3(i.pos.xywithivec2 loc = ivec2(gl_FragCoord.xy
- replace
- Replace Sample with texture
- replace
Samplewithtexture - replace
i.uvwithf_texcoord
- replace
- Replace
returnwithOutput =