diff options
author | Marek Olšák <marek.olsak@amd.com> | 2021-05-24 15:43:54 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-06-21 19:03:29 +0000 |
commit | a448074d0507e6a225f3ff97a291bac219486252 (patch) | |
tree | 2ec77558bb272415db24dcaee931af37a5967b46 /src/gallium | |
parent | b35b5926c9b077087bcfc614ecd4203b710a57aa (diff) |
radeonsi: don't compile TES and GS draw_vbo variants for the prim discard CS
This also fixes the incorrect emit_draw_packets template argument.
The condition should be inverted.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11102>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 12 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_draw.cpp | 13 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 2af9365a656..127b6944ff9 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -2021,15 +2021,25 @@ static inline unsigned si_get_shader_wave_size(struct si_shader *shader) static inline void si_select_draw_vbo(struct si_context *sctx) { + bool has_prim_discard_cs = si_compute_prim_discard_enabled(sctx) && + !sctx->shader.tes.cso && !sctx->shader.gs.cso; pipe_draw_vbo_func draw_vbo = sctx->draw_vbo[!!sctx->shader.tes.cso] [!!sctx->shader.gs.cso] [sctx->ngg] - [si_compute_prim_discard_enabled(sctx)]; + [has_prim_discard_cs]; assert(draw_vbo); if (unlikely(sctx->real_draw_vbo)) sctx->real_draw_vbo = draw_vbo; else sctx->b.draw_vbo = draw_vbo; + + if (!has_prim_discard_cs) { + /* Reset this to false if prim discard CS is disabled because draw_vbo doesn't reset it. */ + if (sctx->prim_discard_cs_instancing) { + sctx->do_update_shaders = true; + sctx->prim_discard_cs_instancing = false; + } + } } /* Return the number of samples that the rasterizer uses. */ diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index 9ad7fc0a691..f43fd5afb0a 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -1920,7 +1920,7 @@ static void si_draw_vbo(struct pipe_context *ctx, unsigned original_index_size = index_size; /* Determine if we can use the primitive discard compute shader. */ - if (ALLOW_PRIM_DISCARD_CS && !HAS_TESS && !HAS_GS && + if (ALLOW_PRIM_DISCARD_CS && (total_direct_count > sctx->prim_discard_vertex_count_threshold ? (sctx->compute_num_verts_rejected += total_direct_count, true) : /* Add, then return true. */ @@ -1949,8 +1949,6 @@ static void si_draw_vbo(struct pipe_context *ctx, (!sctx->num_pipeline_stat_queries && !sctx->streamout.prims_gen_query_enabled) || pd_msg("pipestat or primgen query")) && (!sctx->vertex_elements->instance_divisor_is_fetched || pd_msg("loads instance divisors")) && - (!HAS_TESS || pd_msg("uses tess")) && - (!HAS_GS || pd_msg("uses GS")) && (!sctx->shader.ps.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 */ @@ -2180,8 +2178,7 @@ static void si_draw_vbo(struct pipe_context *ctx, } assert(sctx->dirty_atoms == 0); - si_emit_draw_packets<GFX_VERSION, NGG, - !HAS_TESS && !HAS_GS ? PRIM_DISCARD_CS_OFF : ALLOW_PRIM_DISCARD_CS> + si_emit_draw_packets<GFX_VERSION, NGG, ALLOW_PRIM_DISCARD_CS> (sctx, info, drawid_offset, indirect, draws, num_draws, indexbuf, index_size, index_offset, instance_count, dispatch_prim_discard_cs, original_index_size); @@ -2220,8 +2217,7 @@ static void si_draw_vbo(struct pipe_context *ctx, } assert(sctx->dirty_atoms == 0); - si_emit_draw_packets<GFX_VERSION, NGG, - !HAS_TESS && !HAS_GS ? PRIM_DISCARD_CS_OFF : ALLOW_PRIM_DISCARD_CS> + si_emit_draw_packets<GFX_VERSION, NGG, ALLOW_PRIM_DISCARD_CS> (sctx, info, drawid_offset, indirect, draws, num_draws, indexbuf, index_size, index_offset, instance_count, dispatch_prim_discard_cs, original_index_size); @@ -2319,6 +2315,9 @@ static void si_init_draw_vbo(struct si_context *sctx) if (ALLOW_PRIM_DISCARD_CS && GFX_VERSION < GFX7) return; + if (ALLOW_PRIM_DISCARD_CS && (HAS_TESS || HAS_GS)) + return; + if (NGG && GFX_VERSION < GFX10) return; |