Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Introducing Slang: A Shader Language That Supports Modularity

A topic by Eren created 3 days ago Views: 31 Replies: 1
Viewing posts 1 to 2

Hello there!

While not many developers build game engines from scratch, I thought this might be helpful for those of you who are curious about graphics programming or are working on lower-level rendering systems. Today, I’d like to introduce a shader language that caught my attention recently — Slang.

The Limitations of Traditional Shader Languages

When writing shaders, developers typically use GLSL (based on C syntax). In certain engines like Unity, HLSL is also widely used. More recently, environments such as WebGPU or WGPU have begun adopting WGSL, a Rust-style shader language.

While these languages are functional and widely adopted, they do come with some significant limitations — the biggest being a lack of modularity.

As your shader codebase grows, things can quickly become messy and hard to maintain. Unfortunately, existing languages don’t provide strong built-in mechanisms to structure code in a modular and reusable way. This becomes particularly problematic when working with compute shaders for GPGPU tasks, which are becoming increasingly common.

Some projects have tried to work around this by implementing custom preprocessor systems to mimic modular structures. For example:

  • naga_oil – a helper project for the Bevy engine

  • WESL – a community-made language that extends WGSL

However, since these are unofficial and community-driven, they often feel like temporary fixes rather than long-term solutions.

What is Slang?

While browsing Reddit, I stumbled upon a post in the Vulkan community that mentioned a shader written in a language called Slang. At first, I thought it referred to some general-purpose scripting language, but the comments clarified that it's actually a shader-specific programming language.

To my surprise, Slang is a shader language that supports full modularity, with a strong emphasis on modern shader development practices. It turns out the project started back in 2015 and was open-sourced in 2017.

Originally developed internally by NVIDIA's R&D team, Slang is now managed by the Khronos Group (the same organization behind Vulkan and OpenGL) as of 2023.

🔗 Official website: https://shader-slang.org

Final Thoughts

Slang seems like a promising language that brings real modularity, reusability, and maintainability to shader programming. While it's still relatively unknown in the broader dev community, it could be especially useful for those working with GPGPU workflows or building sophisticated rendering pipelines at the engine level.

If you’re curious, I highly recommend checking out the official docs and exploring some sample code. Personally, I’ve found it quite fascinating and have started digging into it myself. 😊

Thanks for reading — feel free to share your thoughts or questions!

Moderator(+1)

There's a general-purpose scripting language by that name too! One that's a lot older and more famous. Way to cause confusion, nVidia.