webrender icon indicating copy to clipboard operation
webrender copied to clipboard

Differences from upstream WebRender

Open zakorgy opened this issue 7 years ago • 2 comments

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.rs implementations on different platforms and move it in a folder, like we did with device.rs in 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 ron file what we use. Also we could generate the VertexDescriptors from the shaders in build time and save them in a ron file 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 the ron file 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

zakorgy avatar Jul 03 '18 14:07 zakorgy

I think generating shaders at build time (with the RON config) is a good thing to upstream.

kvark avatar Jul 03 '18 17:07 kvark

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

zakorgy avatar Jul 09 '18 14:07 zakorgy