> How difficult is it to convert existing CG or GLSL based shaders (RetroArch) to BGFX
It depends. If you pull the MAME source code off of Github and look in src/osd/modules/render/bgfx/shaders, you can see what a number of converted shaders from RetroArch look like.
At build time, the BGFX shaders are converted to either GLSL, GLES-compliant GLSL, or HLSL, and then compiled into binaries. As a result of supporting GLES, the shaders supplied to BGFX must meet a handful of requirements, which can make converting shaders a bit of a pain, requiring manual rather than automatic conversion:
- No implicit conversion between scalar and vector types.
- No implicit conversion between boolean and float types.
- No uniforms other than vec4.
- Most syntax favors GLSL tokens over HLSL tokens: vec4 instead of float4, mix instead of lerp, and so on.