servo/third_party/webrender/glsl-to-cxx
Martin Robinson a9d37cb85a
Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323)
* Upgrade vendored version of WebRender

* Patch WebRender: upgrade version of gleam

* Restore hit testing implementation

* Fix WebRender warnings

* Adapt Servo to new WebRender

* Update results

* Add a workaround for #30313

This slightly expands text boundaries in order to take into account the
fact that layout isn't measuring glyph boundaries.
2023-09-10 12:38:56 +00:00
..
src Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323) 2023-09-10 12:38:56 +00:00
Cargo.toml Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323) 2023-09-10 12:38:56 +00:00
README.md Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323) 2023-09-10 12:38:56 +00:00

A GLSL to C++ translator.

Translates GLSL to vectorized C++. Intended for use with WebRender software backend.

Architecture

GLSL code is parsed by the glsl crate. In hir.rs we traverse the resulting AST and build a higher level representation by doing type checking and name resolution. The resulting hir tree is traversed by lib.rs to output C++ code.

The generated C++ code is 4x wider then the original glsl. i.e. a glsl 'float' becomes a C++ 'Float' which is represented by a xmm register (a vector of 4 floats). Likewise, a vec4 becomes a struct of 4 'Float's for a total of 4 xmm registers and 16 floating point values.

Vector branching is flattened to non-branching code that unconditionally runs both sides of the branch and combines the results with a mask based on the condition.

The compiler also supports scalarization. Values that are known to be the same across all vector lanes are translated to scalars instead of vectors. Branches on scalars are translated as actual branches.