radeonsi: disallow compute-based culling if polygon mode is enabled
authorMarek Olšák <marek.olsak@amd.com>
Fri, 6 Dec 2019 00:37:59 +0000 (19:37 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 16 Dec 2019 20:06:07 +0000 (20:06 +0000)
Polygon mode can generate thick points or lines.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3095>

src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h
src/gallium/drivers/radeonsi/si_state_draw.c

index ac3d14d8f668e9030029798df92b983fa0d8eee6..b8a2d3504884434b3aa4e34f0c78a7c4a82f1f18 100644 (file)
@@ -919,6 +919,8 @@ static void *si_create_rs_state(struct pipe_context *ctx,
        rs->flatshade_first = state->flatshade_first;
        rs->sprite_coord_enable = state->sprite_coord_enable;
        rs->rasterizer_discard = state->rasterizer_discard;
+       rs->polygon_mode_enabled = state->fill_front != PIPE_POLYGON_MODE_FILL ||
+                                  state->fill_back != PIPE_POLYGON_MODE_FILL;
        rs->pa_sc_line_stipple = state->line_stipple_enable ?
                                S_028A0C_LINE_PATTERN(state->line_stipple_pattern) |
                                S_028A0C_REPEAT_COUNT(state->line_stipple_factor) : 0;
@@ -976,8 +978,7 @@ static void *si_create_rs_state(struct pipe_context *ctx,
                S_028814_POLY_OFFSET_FRONT_ENABLE(util_get_offset(state, state->fill_front)) |
                S_028814_POLY_OFFSET_BACK_ENABLE(util_get_offset(state, state->fill_back)) |
                S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_point || state->offset_line) |
-               S_028814_POLY_MODE(state->fill_front != PIPE_POLYGON_MODE_FILL ||
-                                  state->fill_back != PIPE_POLYGON_MODE_FILL) |
+               S_028814_POLY_MODE(rs->polygon_mode_enabled) |
                S_028814_POLYMODE_FRONT_PTYPE(si_translate_fill(state->fill_front)) |
                S_028814_POLYMODE_BACK_PTYPE(si_translate_fill(state->fill_back)));
 
index 3a16e55e70ab763f82528bfd1570f94be6be3723..d334a5196d1d51dc0c567cca6cf61fe98e8bfd13 100644 (file)
@@ -94,6 +94,7 @@ struct si_state_rasterizer {
        unsigned                cull_back:1;
        unsigned                depth_clamp_any:1;
        unsigned                provoking_vertex_first:1;
+       unsigned                polygon_mode_enabled:1;
 };
 
 struct si_dsa_stencil_ref_part {
index aa974d85811b8738e11f6ae5c8c98ebb1f953d4d..101d8d274201bff368c445e91ba8bb743b5dfd3c 100644 (file)
@@ -1993,6 +1993,7 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
            (!sctx->tes_shader.cso || pd_msg("uses tess")) &&
            (!sctx->gs_shader.cso || pd_msg("uses GS")) &&
            (!sctx->ps_shader.cso->info.uses_primid || pd_msg("PS uses PrimID")) &&
+           !rs->polygon_mode_enabled &&
 #if SI_PRIM_DISCARD_DEBUG /* same as cso->prim_discard_cs_allowed */
            (!sctx->vs_shader.cso->info.uses_bindless_images || pd_msg("uses bindless images")) &&
            (!sctx->vs_shader.cso->info.uses_bindless_samplers || pd_msg("uses bindless samplers")) &&