Whew, that was a long title.

Either way, I'm asking this question, since I like to think about various things, and it occurred to me that there isn't really any simple, open source layers on top of GLSL, even if only to add simple things such as includes, or commonly used functions.

As research of sorts, I'm asking this question, since my own awareness of such languages is minuscule to say the least - I know of bgfx's shading language, and Unity's ShaderLab, but I don't really know what they accomplish - or why - being a relative newbie to computer graphics.

Alternatively, what would your wishlist for a shading language like this be? Mine so far is includes, some compatibility between versions, optional "hidden" inputs that allow easily accessing textures at pixel offsets, or image sizes, etc. and probably passes - for, say, two-pass gaussian blur.


  • 4
    $\begingroup$ This sounds more like a forum discussion than a specific question. This site works best with questions that can be answered with a single, factual answer. The "what is your wishlist" part is definitely not suitable for an SE site. $\endgroup$
    – Dan Hulme
    Dec 8, 2015 at 15:09
  • 1
    $\begingroup$ You can come to the cornell box our chatroom and fire up a discussion $\endgroup$ Dec 8, 2015 at 18:45

1 Answer 1


I think it is fair to say that the reason there are so many niche variations of GLSL/HLSL/Cg/whatnot is because no programming language is nor will ever be a one size fits all tool. Different problems require different tools, so sometimes it is worth the effort of developing a custom built tool if it is going to pay off in the long run.

Stock GLSL is by itself pretty much unusable. It hasn't even acquired much stability across versions, so for a program that targets more than one OpenGL version, some sort of preprocessing is a must. HLSL is a bit more stable across versions, but again, if targeting more than one D3D version, some work will need to done to get good portability.

The kinds of things people usually do are pretty much what you said, like a adding support for basic programming features such as modules and uniform syntax across versions, or even portability across different APIs (GL/D3D) without having to rewrite the shader code. More sophisticated things include fully fledged material systems or things like generating shader programs on-the-fly.

Shading languages will probably get better and more generic in the future, incorporating things that today are commonly hand-rolled as core features. The new GCN architecture is a sign of that. So shading languages will be more usable out-of-the-box a while from now, but custom built solutions will never go away because there's only so much you can generalize.

  • $\begingroup$ I'm curious - what languages like this are out there? I know there are engine-specific ones like Unity's or UE4's shader systems, plus some academic researchy things like Spark, but I'm not aware of anything else in current use in this space. $\endgroup$ Dec 15, 2015 at 1:22
  • $\begingroup$ @NathanReed, probably Apple's Metal is one of the most notable, as of now, but I haven't looked into much detail... $\endgroup$
    – glampert
    Dec 15, 2015 at 2:42
  • $\begingroup$ Oh, OK. Metal isn't on top of HLSL or GLSL though; it's a primary shading language for Apple GPUs that compiles directly to HW microcode (via a proprietary LLVM backend I believe). $\endgroup$ Dec 15, 2015 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.