webrender
webrender copied to clipboard
Differences from upstream WebRender
This issue is to track those differences between our gfx based implementation and the upstream WR, which requires additional feedback. And here is the first one:
The upstream WR generates shaders in runtime, while our code generates them in build time, since we have to process (concatenate, extend, compile, extract data for pipeline creation ... etc.) them before usage. (For the shader generation we have a helper ron file, from which we read the required features for each shader.) That's why our shade.rs implementation differs from the original in the program creation part. Here are some ideas for the solution:
- Splitting the
shade.rsimplementations on different platforms and move it in a folder, like we did withdevice.rsin https://github.com/servo/webrender/pull/2840. - Another possibility is, that we could generate the shaders during build time in the upstream WR as well and it could use the same helper
ronfile what we use. Also we could generate theVertexDescriptors from the shaders in build time and save them in aronfile and load them later. This is similar what we do to get the required data(attribute descriptors, descriptor range descriptors... etc. ) for pipeline creation in our implementation. The only con I can think, that theronfile must be maintained if the shaders are changed. Hopefully this could bring the two implementation close enough that they could exist in the same file.
Any thoughts on this? @kvark @gw3583
I think generating shaders at build time (with the RON config) is a good thing to upstream.
It turned out that our and the original shade.rs implementation can live together in the same file without upstream changes.
For that we just had to move the parsing of shader_bindings.ron (we store the data for pipeline creation in this file) down to the device level: https://github.com/szeged/webrender/pull/196/commits/03e19ca9945482599f4a9eaf1f634aef5f849ca5.
After that using the original shader creation functions for our code became possible, so the original shade.rs could be restored with some additional cfg-s to separate the few existing gleam related parts: https://github.com/szeged/webrender/pull/196/commits/4358a7763fbf4987f3035069e4ee2b8a4cc0495b