They probably wrote their own translator or compiler or even just some find/replace scripts.
Others (don’t bother reading, just noting that this is a common practice):
- unity hlsl -> gl/metal - https://github.com/Unity-Technologies/HLSLcc
- https://github.com/elnormous/OuzelShadingLanguage
-
https://github.com/Thekla/hlslparser
- emscripten demo - http://zz85.github.io/hlslparser/
- https://github.com/SickheadGames/HL2GLSL
- bgfx compile @ runtime lib - https://github.com/fredakilla/brtshaderc
- objc2cpp - https://github.com/stevetranby/cocos2d-utils/blob/master/objc2cpp/objc2cpp.js
- ANGLE’s GLSL->HLSL - https://chromium.googlesource.com/angle/angle/+/0d3537c224c7df5b90a2cf77678eb0987b6b7a30/samples/shader_translator/shader_translator.cpp
Does cocos2d have that many shaders in the default engine? I realize that others will have to rewrite their own custom shaders in part or in full, but why not just either rewrite all of them by hand, or use this translator and then run a find/replace on the functions that don’t translate.
I’d run the glsl-optimizer, then find/replace, get working, use while the first working Metal backend is finished. Later you can cleanup the Metal shaders renaming structs/functions/etc if desired.
You should also bump that issue and add any other issues so that someone can ideally fix it by end of 2018.