arves100 / danmakufu

shh, it's all a secret
Mozilla Public License 2.0
8 stars 3 forks source link

HLSL shader support #12

Open arves100 opened 1 year ago

arves100 commented 1 year ago

BGFX works by having it's own shader compiler and it's GLSL rules. Every platform will need to compile it's own shader. This will be problematic with games that had external shaders by using HLSL (DirectX9), specifically, we would need to take ShaderConductor and build specific GLSL shaders to be built with bgfx shaderc (so some herustic would be required to udnerstand the differences between GLSL or BGFX GLSL) which would be very consuming. Another idea would be having a fork of ShaderConduct specifically made to export BGFX compatible shaders, this would elimiate the need to analyze output shaders but might require more work as bgfx shaderc has to be integrated.

This pipeline would also be required to be made accessible during the game runtime, as Danmakufu has an HLSL string api to compile shaders on the fly.

Precompiled shaders should be putted into a shader cache container, where the game would try to directly access them without compiling them every single time, for shader passed by strings, a simple CRC of the string can work to avoid recompiling the same shader every time (as it would be time consuming)