Skip to content

llvmpipe: use preferred attribute interpolation for wide lines

Erik Faye-Lund requested to merge kusma/mesa:llvmpipe-wide-lines into main

When rasterizing legacy-lines, OpenGL defines the width as being an extrusion along the minor axis, repeating varyings. While the spec does allow for an alternative method that matches our current results, the OpenGL ES CTS doesn't allow these results even if OpenGL ES has the same wording of an alternative method.

This is technically speaking a bug in the OpenGL ES CTS, but it seems like nobody else is using the alternative formulation, at least not while passing the OpenGL ES CTS. On top of this, the OpenGL specification explicitly lists the extrusion results as the preferred method.

So it seems like a good idea for us to do this the way the OpenGL specification prefers regardless; it's going to give less surprising results to applications, and it's helping us pass some tests.

This math to set these up would "trivially" be:

dx = (dx * dx + dy * dy) / dx;
dy = 0;

and:

dy = (dx * dx + dy * dy) / dy;
dx = 0;

...but since we've already calculated dxdy, we can reformulate this to save a division.

This fixes the following dEQP test-cases:

  • dEQP-GLES2.functional.rasterization.interpolation.basic.line_loop_wide
  • dEQP-GLES2.functional.rasterization.interpolation.basic.line_strip_wide
  • dEQP-GLES2.functional.rasterization.interpolation.basic.lines_wide
  • dEQP-GLES2.functional.rasterization.interpolation.projected.line_loop_wide
  • dEQP-GLES2.functional.rasterization.interpolation.projected.line_strip_wide
  • dEQP-GLES2.functional.rasterization.interpolation.projected.lines_wide
  • dEQP-GLES3.functional.rasterization.fbo.rbo_singlesample.interpolation.lines_wide
  • dEQP-GLES3.functional.rasterization.fbo.texture_2d.interpolation.lines_wide
  • dEQP-GLES3.functional.rasterization.interpolation.basic.line_loop_wide
  • dEQP-GLES3.functional.rasterization.interpolation.basic.line_strip_wide
  • dEQP-GLES3.functional.rasterization.interpolation.basic.lines_wide
  • dEQP-GLES3.functional.rasterization.interpolation.projected.line_loop_wide
  • dEQP-GLES3.functional.rasterization.interpolation.projected.line_strip_wide
  • dEQP-GLES3.functional.rasterization.interpolation.projected.lines_wide
Edited by Erik Faye-Lund

Merge request reports