vc4: Work around a HW bug with 2-vert line loops.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17449>
This commit is contained in:
Emma Anholt 2022-07-10 08:11:15 -07:00 committed by Marge Bot
parent 0f37e3c339
commit 2f851f0479
2 changed files with 25 additions and 5 deletions

View file

@ -15,11 +15,6 @@ dEQP-GLES2.functional.clipping.line.wide_line_clip_viewport_corner,Fail
dEQP-GLES2.functional.depth_stencil_clear.depth_stencil_masked,Fail
# 2-count line loop incorrectly draws nothing (HW bug). Need to demote to being
# GL_LINES, though that wouldn't be correct with blending/logicop.
dEQP-GLES2.functional.draw.draw_arrays.line_loop.multiple_attributes,Fail
dEQP-GLES2.functional.draw.draw_arrays.line_loop.single_attribute,Fail
# A glTexImage, glDraw, glTexSubImage sequence into a texture is missing what looks like the drawing.
dEQP-GLES2.functional.fbo.render.texsubimage.after_render_tex2d_rgba,Fail
# A glTexImage, glDraw, glTexSubImage, glDraw sequence into a texture is missing what looks like the first drawing.

View file

@ -287,6 +287,28 @@ vc4_hw_2116_workaround(struct pipe_context *pctx, int vert_count)
}
}
/* A HW bug fails to draw 2-vert line loops. Just draw it as two GL_LINES. */
static bool
vc4_draw_workaround_line_loop_2(struct pipe_context *pctx, const struct pipe_draw_info *info,
unsigned drawid_offset,
const struct pipe_draw_indirect_info *indirect,
const struct pipe_draw_start_count_bias *draw)
{
if (draw->count != 2 || info->mode != PIPE_PRIM_LINE_LOOP)
return false;
struct pipe_draw_info local_info = *info;
local_info.mode = PIPE_PRIM_LINES;
/* Draw twice. The vertex order will be wrong on the second prim, but
* that's probably not worth rewriting an index buffer over.
*/
for (int i = 0; i < 2; i++)
pctx->draw_vbo(pctx, &local_info, drawid_offset, indirect, draw, 1);
return true;
}
static void
vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
unsigned drawid_offset,
@ -309,6 +331,9 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
!u_trim_pipe_prim(info->mode, (unsigned*)&draws[0].count))
return;
if (vc4_draw_workaround_line_loop_2(pctx, info, drawid_offset, indirect, draws))
return;
/* Before setting up the draw, do any fixup blits necessary. */
vc4_predraw_check_textures(pctx, &vc4->verttex);
vc4_predraw_check_textures(pctx, &vc4->fragtex);