draw: disable point/line smoothing for multisample (v2)

When MSAA is enabled smoothing is ignored

v2: As pointed out by Roland I got this completely wrong,
fix this to work the other way

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
This commit is contained in:
Dave Airlie 2020-03-10 13:51:24 +10:00 committed by Marge Bot
parent 4c72bb4a96
commit 24cf7a2b36
3 changed files with 12 additions and 12 deletions

View File

@ -502,7 +502,7 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
const struct pipe_rasterizer_state *rast = draw->rasterizer; const struct pipe_rasterizer_state *rast = draw->rasterizer;
void *r; void *r;
assert(draw->rasterizer->line_smooth); assert(draw->rasterizer->line_smooth && !draw->rasterizer->multisample);
if (draw->rasterizer->line_width <= 1.0) if (draw->rasterizer->line_width <= 1.0)
aaline->half_line_width = 1.0; aaline->half_line_width = 1.0;
@ -718,11 +718,11 @@ draw_aaline_prepare_outputs(struct draw_context *draw,
/* update vertex attrib info */ /* update vertex attrib info */
aaline->pos_slot = draw_current_shader_position_output(draw); aaline->pos_slot = draw_current_shader_position_output(draw);
if (!rast->line_smooth) if (!rast->line_smooth || rast->multisample)
return; return;
/* allocate the extra post-transformed vertex attribute */ /* allocate the extra post-transformed vertex attribute */
if (aaline->fs->aaline_fs) if (aaline->fs && aaline->fs->aaline_fs)
aaline->coord_slot = draw_alloc_extra_vertex_attrib(draw, aaline->coord_slot = draw_alloc_extra_vertex_attrib(draw,
TGSI_SEMANTIC_GENERIC, TGSI_SEMANTIC_GENERIC,
aaline->fs->generic_attrib); aaline->fs->generic_attrib);

View File

@ -580,7 +580,7 @@ aapoint_first_point(struct draw_stage *stage, struct prim_header *header)
const struct pipe_rasterizer_state *rast = draw->rasterizer; const struct pipe_rasterizer_state *rast = draw->rasterizer;
void *r; void *r;
assert(draw->rasterizer->point_smooth); assert(draw->rasterizer->point_smooth && !draw->rasterizer->multisample);
if (draw->rasterizer->point_size <= 2.0) if (draw->rasterizer->point_size <= 2.0)
aapoint->radius = 1.0; aapoint->radius = 1.0;
@ -666,10 +666,10 @@ draw_aapoint_prepare_outputs(struct draw_context *draw,
/* update vertex attrib info */ /* update vertex attrib info */
aapoint->pos_slot = draw_current_shader_position_output(draw); aapoint->pos_slot = draw_current_shader_position_output(draw);
if (!rast->point_smooth) if (!rast->point_smooth || rast->multisample)
return; return;
if (aapoint->fs->aapoint_fs) { if (aapoint->fs && aapoint->fs->aapoint_fs) {
/* allocate the extra post-transformed vertex attribute */ /* allocate the extra post-transformed vertex attribute */
aapoint->tex_slot = draw_alloc_extra_vertex_attrib(draw, aapoint->tex_slot = draw_alloc_extra_vertex_attrib(draw,
TGSI_SEMANTIC_GENERIC, TGSI_SEMANTIC_GENERIC,

View File

@ -77,7 +77,7 @@ draw_need_pipeline(const struct draw_context *draw,
return TRUE; return TRUE;
/* AA lines */ /* AA lines */
if (rasterizer->line_smooth && draw->pipeline.aaline) if ((!rasterizer->multisample && rasterizer->line_smooth) && draw->pipeline.aaline)
return TRUE; return TRUE;
if (draw_current_shader_num_written_culldistances(draw)) if (draw_current_shader_num_written_culldistances(draw))
@ -94,7 +94,7 @@ draw_need_pipeline(const struct draw_context *draw,
return TRUE; return TRUE;
/* AA points */ /* AA points */
if (rasterizer->point_smooth && draw->pipeline.aapoint) if ((!rasterizer->multisample && rasterizer->point_smooth) && draw->pipeline.aapoint)
return TRUE; return TRUE;
/* point sprites */ /* point sprites */
@ -162,12 +162,12 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
/* drawing wide, non-AA lines? */ /* drawing wide, non-AA lines? */
wide_lines = rast->line_width != 1.0f && wide_lines = rast->line_width != 1.0f &&
roundf(rast->line_width) > draw->pipeline.wide_line_threshold && roundf(rast->line_width) > draw->pipeline.wide_line_threshold &&
!rast->line_smooth; (!rast->line_smooth || rast->multisample);
/* drawing large/sprite points (but not AA points)? */ /* drawing large/sprite points (but not AA points)? */
if (rast->sprite_coord_enable && draw->pipeline.point_sprite) if (rast->sprite_coord_enable && draw->pipeline.point_sprite)
wide_points = TRUE; wide_points = TRUE;
else if (rast->point_smooth && draw->pipeline.aapoint) else if ((!rast->multisample && rast->point_smooth) && draw->pipeline.aapoint)
wide_points = FALSE; wide_points = FALSE;
else if (rast->point_size > draw->pipeline.wide_point_threshold) else if (rast->point_size > draw->pipeline.wide_point_threshold)
wide_points = TRUE; wide_points = TRUE;
@ -183,13 +183,13 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
* shorter pipelines for lines & points. * shorter pipelines for lines & points.
*/ */
if (rast->line_smooth && draw->pipeline.aaline) { if ((!rast->multisample && rast->line_smooth) && draw->pipeline.aaline) {
draw->pipeline.aaline->next = next; draw->pipeline.aaline->next = next;
next = draw->pipeline.aaline; next = draw->pipeline.aaline;
precalc_flat = TRUE; precalc_flat = TRUE;
} }
if (rast->point_smooth && draw->pipeline.aapoint) { if ((!rast->multisample && rast->point_smooth) && draw->pipeline.aapoint) {
draw->pipeline.aapoint->next = next; draw->pipeline.aapoint->next = next;
next = draw->pipeline.aapoint; next = draw->pipeline.aapoint;
} }