6 ms·
It seems really odd to me that GLSL and HLSL never unified into a common language.
by thrower123 5y ago
It seems really odd to me that GLSL and HLSL never unified into a common language.
- pjmlp 5y agoBecause neither Nintendo nor Sony consoles use any of them, so in practice there are five major shading languages. You forgot MSL. And for WebGPU, it seems like C++, Rust and HLSL had a baby named WGSL. Finally, GLSL on desktop, GL ES, WebGL and Vulkan isn't the same language anyway, just close enough to port most shaders.
- rectang 5y agoAs an outsider, it's really hard to discern what I might choose to learn amongst graphics tech. I've tried to invest my learning in subjects and technologies that aren't going anywhere and where my knowledge will pay off over decades — computer science fundamentals, math, SQL, C, vanilla JavaScript, HTML, CSS, LaTeX, Git, Python, etc. It looks like everybody's still fighting it out in graphics though.
- Agentlien 5y agoHonestly, if you learn hlsl or glsl it's not much work to learn the other. I originally learned opengl in school and after a few years of working with it I transitioned to a job where we primarily used Direct3D. I guess I had passively picked up enough bits and pieces along the way because I never really thought about the shift. I briefly looked at Vulkan when it first came out, but I haven't had the time to get into it. That's a whole different beast.
- billti 5y agoThis. I wrestled with the same topic a couple years ago. Not only which to use, but once you choose a “common” one (say OpenGL), then actually getting pixels in a window is still different across platforms (hence things like SDL and GLFW). For me I settled on: 1) Learn WebGL in the browser. It’s a pretty good subset of OpenGL [ES] and an easy environment to experiment in. Then 2) learn a more “native” approach with good tooling support, such as Direct3D 11. (I wouldn’t get into D3D12 or Vulkan until you learn the basics pretty well). As others have mentioned, while the landscape is confusing, the concepts across them are pretty similar once you get a foothold.
- Jasper_ 5y agoGLSL and HLSL are close enough; as a professional engine developer I'm biased towards HLSL but just learn whatever you can.
- mhh__ 5y agoFWIW A engine Dev at a Sony owned studio tells me they do have HLSL in their pipeline for their compute shaders
- pjmlp 5y agoGreat, but that isn't what LibGNM and LibGNMX use out of the box.
- Impossible 5y agoPlaystation uses PSSL, which is basically HLSL with some slightly different semantics. It's possible to compile hlsl as pssl with a single (small) header file with some preprocessor defines in it. PSSL and HLSL are not developed in lock step though so all valid PSSL is not valid HLSL and vice a versa even without defines. It's not possible to actually get into details without breaking NDA and I haven't actively done Sony development since PS4 days (5-6 years ago)
- Jasper_ 5y agoNintendo uses GLSL (you can verify this by looking at some of the .sharc files accidentally included in Mario Kart 8 [0]). Sony uses a variant of HLSL called PSSL [1], where one of the goals to it was being HLSL-compatible. [0] https://tcrf.net/Mario_Kart_8/Kiosk_Demo_(April_4th,_2016)/debug_directory#gfx_Folder https://tcrf.net/Mario_Kart_8/Kiosk_Demo_(April_4th,_2016)/d... [1] https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdceurope2013/Presentations/825424RichardStenson.pdf https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdceurope201...
- pjmlp 5y agoNot quite right, the Wii uses a GL based API similar to GL 3.3. Not all Nintendo consoles do so. And the switch has even GL 4.5, Vulkan and NVN to chose from. As anyone with some graphic programming experience in cross platform knows, even among GL variants, being a variant is enough for shaders not to compile the same way and require code rewrites.
- Jasper_ 5y agoWhat? The Wii uses the GX API from the GameCube [0], which is not similar at all to GL 3.3; it was developed in 1999. It does not have any form of programmable shaders; it uses TexEnv-style combinators. The Wii U has a custom GX2 API, where the official shader language is GLSL (again, see the Mario Kart 8 kiosk demo). The Switch has NVN, GL, Vulkan, where the official shader language for all three is GLSL (based on NVIDIA's GLSL compiler). [0] https://libogc.devkitpro.org/gx_8h.html https://libogc.devkitpro.org/gx_8h.html
- deleted 5y ago[deleted]
- pjmlp 5y agoWell, first of all, when I wrote Wii, I wasn't even thinking into the distinction between Wii and Wii U. Secondly, the Cafe SDK documentation clearly refers to OpenGL 3.3, and GX2 is basically OpenGL in spirit while using naming and some utility functions, which fits "GL based API similar to GL 3.3". I assume you also have access to Cafe documentation.
- dahart 5y agoHLSL is proprietary, and GLSL is open. It would be more odd if they had somehow unified. We still have plenty of proprietary vs open choices in computer languages - it doesn’t seem odd C++ and C# haven’t unified, does it?
- thrower123 5y agoMost people are probably working at the Unity or Unreal or Godot level anyway. Interaction with graphics APIs is pretty niche these days.
- gabkins 5y agoI definitely agree with thrower here, most people are focusing on big game engines and the demand are likely to increase.
- Impossible 5y agoVulkan supports both officially, although GLSL support is better. To be fair Vulkan kind of assumes the game engine shader compiler does most of the heavy lifting and using either glsl or hlsl directly in a small Vulkan application is a pain compared to OpenGL or DirectX.