Live data from Hacker News

The Slang Shading Language

shader-slang.com

11–20 of 50 posts

Re: The Slang Shading Language

#11

Also check out Rust GPU, which has similar features and uses Rust rather than a new language: https://github.com/Rust-GPU/rust-gpu

Don't we already have a shader language with Rust-syntax in WGSL? It also works everywhere, given that WebGPU works wherever Vulkan, Metal & DirectX do...

Re: The Slang Shading Language

#12
I have to wonder how this fits in with other shader technologies that seem to have overlapping purposes. (There's Khronos' own Spir-V, SDL's SDLSL, Three's TSL, and WebGPU's WGSL) The reflection and automatic differentiation look interesting, I just wish I understood better what problems they're trying to solve. I actually think WebGPU/WGSL will and should become ubiquitous, though it's a shame it's not more C/GLSL-like, Slang may yet be a missing part of that solution. I wonder if this is Khronos trying to fix the shader lang debacle with Apple that led to WGSL being what it is? Thoughts?

Re: The Slang Shading Language

#15

I have to wonder how this fits in with other shader technologies that seem to have overlapping purposes. (There's Khronos' own Spir-V, SDL's SDLSL, Three's TSL, and WebGPU's WGSL) The reflection and automatic differentiation look interesting, I just wish I understood better what problems they're trying to solve. I actually think WebGPU/WGSL will and should become ubiquitous, though it's a shame it's not more C/GLSL-l…

IMHO Slang fixes two problems in one tool:

- the frontend language is mostly compatible with HLSL, which is the defacto shader authoring standard in the gamedev industry

- it compiles to the 'shader language/bytecode zoo' of the different 3D APIs (since recently even WGSL/WebGPU)

So it lets you author your shaders in a single language that's already accepted by most of the industry, and target the various 3D APIs (D3D, Metal, GL, WebGPU, ...).

It is already possible to build such a tool yourself by glueing together existing libraries (like glslang, SPIRVTools, SPIRVCross and Tint), but it requires quite some work and there are little annoying details like SPIRVCross never supporting WGSL output for some non-technical reasons (so that you need a separate library like Tint just for the SPIRV-to-WGSL conversion). In fact there are tons of such engine-specific shader cross-compilers, all built around the same few Khronos libraries and doing more or less the same thing. Slang looks like it could be the standard replacement for all those custom solutions.

For my own needs, the main thing I'll need to investigate is how easy it is to add engine-specific custom annotations to Slang resources and then output those as part of the reflection information.

Re: The Slang Shading Language

#16

[flagged]

...which is only a problem on Linux though (turns out that system-wide shared locations for headers and linker libraries are not a great idea). Most Slang users will probably be on Windows, and apart from that there's also most likely not much overlap with S-Lang users.

Re: The Slang Shading Language

#17
post #4

I've been very impressed by Slang as an open source project. The development team is quick to respond to issues and review pull requests. It's clear from their repository and their presentations that they take Slang seriously as a user-facing project, not a research demo.

It isn't weird it started inside NV and folks from there are still working on the project.

Re: The Slang Shading Language

#18

I have to wonder how this fits in with other shader technologies that seem to have overlapping purposes. (There's Khronos' own Spir-V, SDL's SDLSL, Three's TSL, and WebGPU's WGSL) The reflection and automatic differentiation look interesting, I just wish I understood better what problems they're trying to solve. I actually think WebGPU/WGSL will and should become ubiquitous, though it's a shame it's not more C/GLSL-l…

IMHO Slang fixes two problems in one tool: - the frontend language is mostly compatible with HLSL, which is the defacto shader authoring standard in the gamedev industry - it compiles to the 'shader language/bytecode zoo' of the different 3D APIs (since recently even WGSL/WebGPU) So it lets you author your shaders in a single language that's already accepted by most of the industry, and target the various 3D APIs (D3…

Thanks. Yes I do tend to overlook HLSL, despite being a windows user and a game developer, I tend to focus on gfx technologies that come out of Khronos and the W3C. Slang does look a lot like GLSL, I am trying to get used to WGSL at the moment and it's slow going.

Re: The Slang Shading Language

#19

Also check out Rust GPU, which has similar features and uses Rust rather than a new language: https://github.com/Rust-GPU/rust-gpu

Don't we already have a shader language with Rust-syntax in WGSL? It also works everywhere, given that WebGPU works wherever Vulkan, Metal & DirectX do...

One problem with WGSL is that the binding annotations (e.g. @group and @binding) are closely tied to the WebGPU resource binding model via BindGroups, but doesn't match other 3D APIs (except Vulkan's descriptor sets maybe). Don't know how Slang solves this problem though (e.g. if it is HLSL compatible it might suffer from the same problem - just with D3D's resource binding model).

WGSL will also always only cover the WebGPU feature set, which is very conservative by definition (e.g. no modern features like mesh shaders, raytracing, etc...). Again, I don't know how much of this Slang provides though.

Post reply on HN