4 ms·
Regardless of Apple’s motivations those still are real benefits, I think at least one major WebGL framework uses dynamic shader generation and was looking at go
by throwaway34241 7y ago
Regardless of Apple’s motivations those still are real benefits, I think at least one major WebGL framework uses dynamic shader generation and was looking at going the bundled-shader-compiler route. Hopefully this approach cuts back on the projects that find it necessary to do that and encourages faster adoption from WebGL.
- kevingadd 7y agoIf you're willing to do dynamic shader generation as text, you can generate shader bytecode. The real question is which of the two options produces more performant shaders and faster compile times, since naively-generated shader bytecode isn't being optimized like your text is. If you care about compile times text-based can be a lot worse (this matters for the Dolphin emulator, for example)
- throwaway34241 7y agoThat’s true, even if the semantics are the same (and parsing time isn’t a big factor) the assumptions for what optimizations have been applied to bytecode might be different. I remember seeing in one of the meeting notes that they didn’t expect browsers to end up making assumptions about the optimization level of the SPIR-V they ingest anyway but I don’t remember the specific rationale for that. There’s of course also the time for the SPIR-V -> gpu native step. It would be nice if they could just cache that and skip the whole process most of the time.
- kvark 7y agoThat is correct, in theory, but there is a large gap between theory and practice. How practical would it be for, say Three.JS to generate shader bytecode? Would it need to depend on a sophisticated WASM module that allows to build such bytecode? Who is going to build that? Google has spent a lot of effort trying to answer these questions, and they got close, but in the end the text-based solution prevailed. In part, because it was easy to agree on for all parties.
- Jasper_ 7y agoDo you not expect GLSL -> WGSL compilers in actual practice? I don't think anybody using Three.JS today would switch to writing WGSL unless they could also ingest it on WebGL.
- kvark 7y agoIn one of the futures, our shader translation infrastructure will support GLSL input and produce WGSL output :)