Skip to content

llvmpipe: Add a linear rasterizer optimized for 2D rendering.

Roland Scheidegger requested to merge sroland/mesa:llvmpipe-linear-rast-fix into main

This change adds:

  • an alternative rasterizer, which rasterizes bins in a left->right & top->bottom linear fashion;

  • triangle -> rectangle detection;

  • 1:1 blit detection;

  • a special TGSI -> LLVM IR code generation that uses 8-bit SSE integers in AoS fashion (as opposed to 32bits floats.)

Altogether these changes yield a 2x to 3x performance improvement for 2D workloads. It was designed to render Windows 7 Aero and other Windows built-in 3D applications (like Windows Media Player, Internet Explorer 11, UWP applications) with minimum CPU utilization, but it should be generally applicable to other 2D-on-3D applications, like desktop compositors, HTML browsers, 3D based UI toolkits, etc.

This was mostly the brainchild of Keith Whitwell back in 2010. I wrote TGSI -> AoS translation. And many others added bug-fixes and enhancements over the years: Roland Scheidegger, Brian Paul, and James Benton.

Known issues:

  • piglit spec@!opengl 1.1@quad-invariance will warn that "left and right half should match" due to rounding error difference

  • These optimized paths to kick in is that depth-buffer must not be used, so some applications which want to benefit from these improvements might need to be modified to ensure they use painter's algorithm instead of depth-buffers.

Reviewed-by: Roland Scheidegger Reviewed-by: Brian Paul Acked-by: Keith Whitwell

v2: Incorporate Dave Airlie feedback: cleanup LP_DEBUG_xx; shrink 3+ empty lines.

The code was updated to newest mesa bits, and all ci failures have been addressed.

Merge request reports