Developer of 'Banished' Develops His Own Shading Language 31
jones_supa writes Luke Hodorowicz, the hard-working developer behind the townbuilding strategy computer game Banished, has
designed a novel GPU shading language and written a compiler for it. The language has been christened 'Shining Rock Shading Language' (SRSL) and it outputs the program in several other shading languages. The first goal for the language was to treat the vertex, fragment and geometry shader as a single program. The language sees the graphics pipeline as a stream of data, followed by some code, which outputs a stream of data, and then more code runs, and another stream of data is output. Body text of the shaders is very C-like and should be understood easily coming from other shading languages. SRSL has all the intrinsic functions you would expect from HLSL or GLSL. All types are HLSL-style. Loops and conditionals are available, but switch statements and global variables are seen redundant and not implemented. Luke's blog post tells more about the details of the language, complemented with examples.
designed a novel GPU shading language and written a compiler for it. The language has been christened 'Shining Rock Shading Language' (SRSL) and it outputs the program in several other shading languages. The first goal for the language was to treat the vertex, fragment and geometry shader as a single program. The language sees the graphics pipeline as a stream of data, followed by some code, which outputs a stream of data, and then more code runs, and another stream of data is output. Body text of the shaders is very C-like and should be understood easily coming from other shading languages. SRSL has all the intrinsic functions you would expect from HLSL or GLSL. All types are HLSL-style. Loops and conditionals are available, but switch statements and global variables are seen redundant and not implemented. Luke's blog post tells more about the details of the language, complemented with examples.
It's the CSS and JS situation again. (Score:1)
Shader languages are just like CSS and JS. They're all quite crappy, but can't really be fixed by the community, so lots of people end up writing "transpilers" to try to work around some of these many problems. That's why we have Sass and LESS and CoffeeScript and TypeScript and now this new shader language. Maybe they fix some problems, but their presence introduces a different set of problems. The right thing to do would be to push for the underlying technologies to be fixed.
Re: (Score:1)
You have to write your shaders twice if you want to support Direct3D and OpenGL.
Considering that you have to write your renderer twice as well if you want to support both Direct3D and OpenGL it is no big deal. If rewriting shader scare you, avoid rewriting your renderer as well and use only OpenGL. OpenGL is portable and available on more platforms, including windows, mac and linux.
With all the new graphic API (Vulkan, Metal, etc) coming out writing multiple renderer backend and the appropriate shader do not scare real programmers.
Re: (Score:2)
For my purposes, I use third-party engines that already can render to OpenGL and Direct3D. It is trivial for me to support both -- unless I have shaders, in which case I have to write my shaders twice. I don't mind doing that for a small number of shaders. I do mind doing that for five dozen shaders.
In the case of SRSL, I think the idea was partly just because he could, and partly because he found himself modifying shaders moderately frequently.
Re: (Score:1)
It isn't even remotely like that.
CSS and JS have very little issues with incompatibility, besides input related stuff, and oddly enough, CSS access from JS. (holy shit that whole set of commands is awful, fix that shit already, it has been a decade for crying out loud)
SASS, LESS, CoffeeScript and TypeScript (less so this) are mainly created to make it easier to work with CSS and JS.
Some have support to export to other languages. But mainly they are designed to enhance and speed up development considerably
SPIR-V makes this more interesting (Score:1)
The good news is that with new standardized intermediate representations like SPIR-V in Vulkan, this shading language can compile down to the same IR that GLSL/HLSL/etc. use so there's more flexibility on the programming language side while maintaining compatibility with the graphics API.
Re: (Score:2)
The nightmare is that you might have to do the compiler job and generate an optimized SPIR-V IR from your language.
Re:So when is the extended version coming out? (Score:5, Funny)
SRSL-E?
The developer wrote in his blog that he wants to add a "Y" to the end but can't think of something for it to stand for.
Re: (Score:1)
Kind of Pointless (Score:2)
Why? (Score:2)
Re: (Score:1)
Keep reading the guy's blog for the why... he started from nothing and wrote the game engine, the game logic, and designed all the graphics and sound himself. I think he did it because he wanted to.
Re: (Score:3, Insightful)
Why not? (and, some of his reasons are described in his blog entry.)
I think this is newsworthy because this developer single-handedly wrote it, after (nearly) single-handedly writing an entire game. This level of motivation and productivity is something special. I'd rather celebrate it (or at least give it a tip o' the hat), instead of deriding it.
Re: (Score:1)
Re: Why? (Score:1)
This will solve everything (Score:2)
Relevant XKCD [xkcd.com]
This just in! Software developer develops software (Score:1)
This is getting silly!.
Wolfenstein (Score:4, Informative)
Re: (Score:2)
As Bender would say... (Score:3)
Banished, never really finished... (Score:1)
On redundancy (Score:1)
global variables are seen redundant
As is the word "as," apparently.
screw that what i want to know is (Score:1)
why my towns start starving? i keep building farms, gathering and hunting lodges yet starvation. fix that first!