OpenGL gradient rendering improvements and additions
This patch improves performance on MacOS by:
- Evaluating gradient data which is intended to be constant per-draw call and pass it as shader uniforms
- Reducing alu operations by:
- Exploiting algebric and geometric identities (example: projection of point to segment)
- Avoiding integer to float conversions in favor of interpolated coords in the object frame
- Avoiding shader divisions by uniforms and constants, whenever possible
- Perform color premultiplication on the host then passing already premultiplied colors
System information
- MacOS Catalina 10.15.7
- CPU: 2.8 GHz Intel Core i7 quad-core
- Memory: 16 GB 2133 MHz LPDDR3
- GPU: Intel Iris Plus Graphics 655 1536 MB
- Benchmark: fishbowl (from gtk4-demo)
- Widget type: button
- Count: 512
Results
vsync on:
Master | This merge request |
---|---|
15 fps | 30 fps |
vsync off:
Master | This merge request |
---|---|
14 fps | 41 fps |
No other improvements / regressions detected on the other widget types.
Second part of the patch adds support for repeating gradients, by adding a new uniform repeat
that performs wrapping in [0, 1] when set to true
. This allows to avoid rendering a fallback node.
Edited by Fabio Lagalla