{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiaewhi2fpqycfpipx7qa7c6i7ox5243deacaibledvxlvsy2xwuji",
    "uri": "at://did:plc:dxjzgxe7cvirxkwfjr2tjspt/app.bsky.feed.post/3mmmqhurfr5h2"
  },
  "path": "/t/jme-vulkan/49551#post_11",
  "publishedAt": "2026-05-24T17:31:06.000Z",
  "site": "https://hub.jmonkeyengine.org",
  "textContent": "I tried using regular expressions to patch and replace OpenGL GLSL code, but it turned out to be far too fragile—there are just too many edge cases and unexpected patterns.\nRecently I discovered SPIRV‑Cross, which can cross‑compile Vulkan-style GLSL back into OpenGL GLSL. In theory this works, but it would require rewriting allexisting shaders into Vulkan-compatible GLSL first… and that is a massive engineering effort.\nSo, I’ve decided to put that approach aside for now.\nIf I still can’t find a cleaner solution by next week, I’m seriously considering switching to Slang. Rather than refactoring hundreds of shader files, it seems much more reasonable to adopt a mature, unified shading language from the start. Slang doesn’t have official Java bindings yet, but at this point that’s not a dealbreaker\n\nOf course, there is always the brute-force approach: maintaining two completely parallel shader codebases. One written strictly for Vulkan GLSL and another for OpenGL GLSL, with the engine selecting the appropriate material definition based on the active rendering API.(The transitional period can only be like this for the time being.)\n\nIf we look at this from a long-term upgrade perspective, Vulkan serves as a comprehensive cross-platform API. Assuming JME eventually phases out OpenGL in favor of Vulkan, migrating all shader code to the Vulkan dialect becomes a necessary evolution.\nWhile Slang is appealing, I am concerned it might introduce higher maintenance overhead down the line (though perhaps my worries are unfounded). My current plan is to thoroughly evaluate the cost of integrating Slang’s bindings. Based on that assessment, I will decide whether it is more feasible to simply migrate the shaders to Vulkan GLSL or to invest the time in developing Java bindings for Slang.\n\nThat said, if you have any better ideas, alternative strategies, or practical experience dealing with this kind of cross-API shader migration, I’d really appreciate hearing them. Thanks a lot!",
  "title": "jme-Vulkan"
}