From d5fb707238afedab601b371414a25af20c3839f4 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 3 Jun 2015 09:47:21 +0200 Subject: [PATCH] i965: do not round line width when multisampling is enabled Following the spec, commit fe74fee8fa721a rounded line width to the nearest integer, but that seems to break a dEQP test that renders wide lines in some multisampling scenarios. This patch avoids rounding the line width when multisampling is enabled to meet dEQP expectations for this test, even though there does not seem to exist any reference in the spec that justifies this expectation. Fixes: dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.lines_wide --- src/mesa/drivers/dri/i965/gen6_sf_state.c | 5 +++-- src/mesa/drivers/dri/i965/gen7_sf_state.c | 6 ++++-- src/mesa/drivers/dri/i965/gen8_sf_state.c | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index e445ce2..1e539a5 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -364,8 +364,9 @@ upload_sf_state(struct brw_context *brw) /* 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)); + float line_width = CLAMP(ctx->Line.Width, 0.0, ctx->Const.MaxLineWidth); + if (!ctx->Multisample._Enabled) + line_width = roundf(line_width); uint32_t line_width_u3_7 = U_FIXED(line_width, 7); /* Line width of 0 is not allowed when MSAA enabled */ diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c index 58e3337..2702ac4 100644 --- a/src/mesa/drivers/dri/i965/gen7_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c @@ -195,9 +195,11 @@ upload_sf_state(struct brw_context *brw) /* 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)); + float line_width = CLAMP(ctx->Line.Width, 0.0, ctx->Const.MaxLineWidth); + if (!ctx->Multisample._Enabled) + line_width = roundf(line_width); uint32_t line_width_u3_7 = U_FIXED(line_width, 7); + /* Line width of 0 is not allowed when MSAA enabled */ if (ctx->Multisample._Enabled) { if (line_width_u3_7 == 0) diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c index 52a21b6..e721ad1 100644 --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c @@ -157,8 +157,9 @@ upload_sf(struct brw_context *brw) /* 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)); + float line_width = CLAMP(ctx->Line.Width, 0.0, ctx->Const.MaxLineWidth); + if (!ctx->Multisample._Enabled) + line_width = roundf(line_width); uint32_t line_width_u3_7 = U_FIXED(line_width, 7); if (line_width_u3_7 == 0) line_width_u3_7 = 1; -- 2.1.0