diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_sf_state.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_sf_state.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen8_sf_state.c | 8 |
4 files changed, 20 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 50b138720d8..786e6f5dc07 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -428,8 +428,8 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.MaxLineWidthAA = 40.0; ctx->Const.LineWidthGranularity = 0.125; } else if (brw->gen >= 6) { - ctx->Const.MaxLineWidth = 7.875; - ctx->Const.MaxLineWidthAA = 7.875; + ctx->Const.MaxLineWidth = 7.375; + ctx->Const.MaxLineWidthAA = 7.375; ctx->Const.LineWidthGranularity = 0.125; } else { ctx->Const.MaxLineWidth = 7.0; diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index 7f0bab86c55..f9d8d27fe73 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -361,8 +361,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; diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c index 6644010ca1b..c9815b03bb4 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; diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c index 713ee5f93a0..27116f7e4c8 100644 --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c @@ -154,8 +154,12 @@ upload_sf(struct brw_context *brw) dw1 |= GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; /* _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); if (line_width_u3_7 == 0) line_width_u3_7 = 1; if (brw->gen >= 9 || brw->is_cherryview) { |