4 ms·
> "All shader languages are very similar to C". Even counting only mainstream shader languages, MSL is explicitly based on C++ and not C. C++ is a C variant. I
by solarmist 5y ago
> "All shader languages are very similar to C". Even counting only mainstream shader languages, MSL is explicitly based on C++ and not C.
C++ is a C variant. I think they were more getting at where’s Shader Pascal, Ruby, Lisp?
- raphlinus 5y agoWhile it has roots in C, I think it's better to consider it a separate language, especially in more modern forms (Metal is C++14). Metal is locked into Apple's proprietary platforms, but there is other work in compiling C++ to portable shaders, particularly Sean Baxter's Circle, as well as some academic work[1]. There's also of course rust-gpu. I think it's fair to say that in 5 to 10 years we will no longer be writing shaders in C, but will have moved on to a higher level language. [1]: https://arxiv.org/pdf/2109.14682.pdf https://arxiv.org/pdf/2109.14682.pdf
- solarmist 5y agoPython has roots in C, but you can still write valid compilable C alongside C++, so I'm not sure what you're trying to imply. Sure it's another language, but the C at it's core isn't going anywhere.
- gfxgirl 5y agoThe deference between C and C++ is vast. You can do templates and meta programming in C++ that you can't in C. Similarly you can do templates and meta programming in Metal So to say all shader languages are based on C is as useful as saying they're all based on assembly. I'm not saying C++ style templates are good or bad but they're vastly more powerful than not having them and if you're using those other C based shader languages you'll end up having to do code generation in some other language to provide the same features as a C++ based shader language
- ncmncm 5y agoYou and I are ape variants. But it is the sum of our differences from apes that matters, almost always. C++ code that looks like C is, typically, bad code. The C legacy is not going away, but is less and less relevant.
- pjmlp 5y agoNow that is something I agree on. :)
- p_l 5y agoBunch of internal lisps generating all kinds of shader code (or OpenCL in at least one case), plus things like CEPL (which also generates shaders from CL data/code) and Shinmera uses in his game engine automatic composition of shaders using CLOS metaobjects, iirc