etnaviv: fix FRONT_AND_BACK culling

HW has no value to cull both faces (setting both CW/CCW bits results in
only CCW being culled). The blob just skips triangle draws when FRONT_AND_BACK
culling is enabled. Lets do the same in draw_vbo(..).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14779>
This commit is contained in:
Christian Gmeiner 2022-01-28 17:56:52 +01:00 committed by Marge Bot
parent 24fef8f33d
commit 708a33d132
3 changed files with 5 additions and 6 deletions

View File

@ -12,12 +12,6 @@ dEQP-GLES2.functional.fbo.render.color.mix_npot_tex2d_rgba_depth_component16
dEQP-GLES2.functional.fbo.render.depth.npot_rbo_rgb565_depth_component16
dEQP-GLES2.functional.fbo.render.depth.npot_tex2d_rgba_depth_component16
dEQP-GLES2.functional.fbo.render.texsubimage.after_render_tex2d_rgb
dEQP-GLES2.functional.rasterization.culling.both_triangle_fan
dEQP-GLES2.functional.rasterization.culling.both_triangle_fan_reverse
dEQP-GLES2.functional.rasterization.culling.both_triangle_strip
dEQP-GLES2.functional.rasterization.culling.both_triangle_strip_reverse
dEQP-GLES2.functional.rasterization.culling.both_triangles
dEQP-GLES2.functional.rasterization.culling.both_triangles_reverse
dEQP-GLES2.functional.shaders.random.all_features.fragment.*
dEQP-GLES2.functional.shaders.random.texture.fragment.*
dEQP-GLES2.functional.shaders.random.texture.vertex.*

View File

@ -272,6 +272,10 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
if (ctx->vertex_elements == NULL || ctx->vertex_elements->num_elements == 0)
return; /* Nothing to do */
if (unlikely(ctx->rasterizer->cull_face == PIPE_FACE_FRONT_AND_BACK &&
u_decomposed_prim(info->mode) == PIPE_PRIM_TRIANGLES))
return;
int prims = u_decomposed_prims_for_vertices(info->mode, draws[0].count);
if (unlikely(prims <= 0)) {
DBG("Invalid draw primitive mode=%i or no primitives to be drawn", info->mode);

View File

@ -47,6 +47,7 @@ translate_cull_face(unsigned cull_face, unsigned front_ccw)
{
switch (cull_face) {
case PIPE_FACE_NONE:
case PIPE_FACE_FRONT_AND_BACK: /* handled in draw_vbo */
return VIVS_PA_CONFIG_CULL_FACE_MODE_OFF;
case PIPE_FACE_BACK:
return front_ccw ? VIVS_PA_CONFIG_CULL_FACE_MODE_CW