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. */
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. */
(!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 */
}
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);
}
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);
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;