summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/gen7_sf_state.c
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2015-02-10 16:40:46 +0100
committerIago Toral Quiroga <itoral@igalia.com>2015-02-24 08:58:54 +0100
commitfe74fee8fa721a42448470e063870d24f9453dab (patch)
treeb3dfccdc4d6093043e1e8986ae7e3cd3e0ef2172 /src/mesa/drivers/dri/i965/gen7_sf_state.c
parent6148e3aae7e0d36b59759075bf7a4ce2248ce321 (diff)
downloadexternal_mesa3d-fe74fee8fa721a42448470e063870d24f9453dab.zip
external_mesa3d-fe74fee8fa721a42448470e063870d24f9453dab.tar.gz
external_mesa3d-fe74fee8fa721a42448470e063870d24f9453dab.tar.bz2
i965: Fix non-AA wide line rendering with fractional line widths
"(...)Let w be the width rounded to the nearest integer (...). If the line segment has endpoints given by (x0,y0) and (x1,y1) in window coordinates, the segment with endpoints (x0,y0-(w-1)/2) and (x1,y1-(w-1/2)) is rasterized, (...)" The hardware it not rounding the line width, so we should do it. Also, we should be careful not to go beyond the hardware limits for the line width after it gets rounded. Gen6-7 define a maximum line width slightly below 8.0, so we should advertise a maximum line width lower than 7.5 to make sure that 7.0 is the maximum integer line width that we can select. Since the line width granularity in these platforms is 0.125, we choose 7.375. Other platforms advertise rounded maximum line widths, so those are fine. Fixes the following 3 dEQP tests: dEQP-GLES3.functional.rasterization.primitives.lines_wide dEQP-GLES3.functional.rasterization.fbo.texture_2d.primitives.lines_wide dEQP-GLES3.functional.rasterization.fbo.rbo_singlesample.primitives.lines_wide Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_sf_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sf_state.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 6644010..c9815b0 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -192,8 +192,12 @@ upload_sf_state(struct brw_context *brw)
/* _NEW_LINE */
{
- uint32_t line_width_u3_7 =
- U_FIXED(CLAMP(ctx->Line.Width, 0.0, ctx->Const.MaxLineWidth), 7);
+ /* OpenGL dictates that line width should be rounded to the nearest
+ * integer
+ */
+ float line_width =
+ roundf(CLAMP(ctx->Line.Width, 0.0, ctx->Const.MaxLineWidth));
+ uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
/* TODO: line width of 0 is not allowed when MSAA enabled */
if (line_width_u3_7 == 0)
line_width_u3_7 = 1;