3 ms·
> > The language is insprired by HLSL, the dominant shading language for graphics app developers. > sorry wat ? https://trends.google.com/trends/explore?q=glsl
by flohofwoe 8y ago
> > The language is insprired by HLSL, the dominant shading language for graphics app developers.
> sorry wat ? https://trends.google.com/trends/explore?q=glsl,hlsl https://trends.google.com/trends/explore?q=glsl,hlsl
Pretty much all "big" game engines use HLSL (or their own custom variant of HLSL) for shader authoring and cross-compile to platform-specific shader languages.
The problem with GLSL is that there are many versions that are completely incompatible to each other for no apparent reason. The GLSL used in WebGL is incompatible with the GLSL used for desktop GL, it's even incompatible with WebGL2. GLSL for OpenGL 2 is incompatible with the GLSL for OpenGL 3. There are different versions of HLSL too, but the compatibility between different versions of D3D and HLSL is better.
Apart from that GLSL and HLSL are similar enough in spirit that using one or the other as a blueprint for a new language doesn't really matter.
> And since Windows ... don’t support Vulkan
Vulkan is not supported by Microsoft, it's only supported on Win32 (not UWP) through 3rd party drivers. Having a browser API rely on 3rd party drivers is a bad idea (same with OpenGL on Windows, and that's the reason why WebGL implementations on Windows run on top of D3D).
- skohan 8y agoBut why do we need another high-level language, and why should it be W3C's domain to come up with it? One of the biggest mistakes with the web platform was using Javascript as the singular first-class way to implement executable logic on the web, and now when WASM is on the verge of becoming a reality, it looks like we are heading down the same path for web-based graphics. If you ask me, W3C should create a single low-level standard for how to interact with graphics hardware from the web, and leave it up to 3rd parties to solve the problem of how developers should interface with it.
- flohofwoe 8y agoThis I definitely agree with. The standard should focus on a safe byte code representation, similar to SPIRV. The actual shader language should be an offline tool or JS/WASM module and shouldn't matter much as long as it can compile to the standardized byte code format.
- astrange 8y agoA bytecode is more difficult to specify safely, harder to parse securely (partially because it looks like an easy problem), and View Source doesn't work. The various text formats in the history of browsers have better security stories than binary formats like PNG, SWF, fonts. That said the binary formats usually have more features, and if you invent a byte code it's not hard to assemble/disassemble or allow delivering it in text form. What I find unfortunate is that GLSL should be usable here, but every OpenGL variant really does have an wildly incompatible GLSL for no reason.
- pizlonator 8y ago> But why do we need another high-level language, and why should it be W3C's domain to come up with it? One of the biggest mistakes with the web platform was using Javascript as the singular first-class way to implement executable logic on the web, and now when WASM is on the verge of becoming a reality, it looks like we are heading down the same path for web-based graphics. WebAssembly has been widely supported for a while now. So the fact that it isn't catching on should tell you something about how great binary formats are. Text formats are more natural in every way: - They are more natural to specify. - They are more natural to codegen. It's easier to write a tool that emits a text format (just use printf) than to emit a binary format (usually need some library). - They are more natural to parse. Parsing text is super clearly understood, and there are off-the-shelf tools to do it. In particular, WHLSL is designed to have a simple-enough grammar that you can use an off-the-shelf parser generator like antlr. - They are easier to introspect. View Source is important on the web.
- skohan 8y ago> WebAssembly has been widely supported for a while now. So the fact that it isn't catching on should tell you something about how great binary formats are. I could argue that this also has a lot to do with inertia: the relative effort of implementing a web application in WASM is not comparable to using Javascript. It's not clear to me that things would be in the same state if there were also decades of work on tooling and libraries for WASM. > They are easier to introspect. View Source is important on the web. In theory yes, but is this really the case in practice? How often can you view source on a modern website and meaningfully understand the javascript? More likely it has been minified and uglified. Besides, it's possible to provide a source-map with binary formats to make source available if the author chooses to do so. As to your other points, it is true that high-level languages are nicer to work with from a developer perspective, but the question is whether the fundamental web interfaces should be optimized for developer experience. I would argue that since web is the most prevalent way that people use software on the planet, web technologies should be optimized for performance and flexibility over developer experience. The advantage of a low-level interface is that it's not opinionated. It's just a thin abstraction layer on top of what the hardware can do, it's not making assumptions about what use-cases should be optimized over what others. The situation with Javascript in that regard is insane: each browser vendor is constantly optimizing their JIT compilers in response to how people use Javascript most often. So the ones writing the code, and the ones optimizing the code are two disconnected groups, each with moving targets. A low level interface lets the end software developer have a consistent baseline to optimize against. Also you don't lose any of the advantages you mentioned with a low-level binary interface. Inevitably there would quickly be tools released to compile HLSL or GLSL down to WSPIRV or whatever the low-level format would be. So if you want to work with a high-level language instead of WSPIRV, you could easily choose another high-level shader language as your target. However you do lose the advantages of a low-level language if you start with a high-level one. It's easy to build nice tooling on top of a low-level interface. But if you require every application to have a nice-tooling-layer as part of its stack, you're essentially incurring a performance penalty on all software whether the application requires it or not.
- lucideer 8y ago> The problem with GLSL is that there are many versions that are completely incompatible to each other for no apparent reason. The GLSL used in WebGL is incompatible with the GLSL used for desktop GL Are you saying that WHLSL will be compatible with HLSL? The quote above seems to imply it's merely "inspired by" it, in which case GLSL's compatibility issues aren't a valid counterpoint.
- astrange 8y agoThe article does say they want HLSL shaders to just work. It doesn’t explain how all the new syntax at the end fits into it.