OPT_BOOL(halt_shaders, false, "Halt shaders at the start (will hang)")
OPT_BOOL(vs_fetch_always_opencode, false, "Always open code vertex fetches (less efficient, purely for testing)")
OPT_BOOL(prim_restart_tri_strips_only, false, "Only enable primitive restart for triangle strips")
+OPT_BOOL(disable_ngg, false, "Unconditionally disable NGG (gfx10+)")
#undef OPT_BOOL
if (!sctx->border_color_map)
goto fail;
+ if (sctx->chip_class >= GFX10)
+ sctx->ngg = !sscreen->options.disable_ngg;
+
/* Initialize context functions used by graphics and compute. */
if (sctx->chip_class >= GFX10)
sctx->emit_cache_flush = gfx10_emit_cache_flush;
sctx->ps_shader.cso->info.uses_primid);
}
+static bool si_update_ngg(struct si_context *sctx)
+{
+ if (sctx->chip_class <= GFX9 ||
+ sctx->screen->options.disable_ngg)
+ return false;
+
+ bool new_ngg = true;
+
+ /* EN_MAX_VERT_OUT_PER_GS_INSTANCE does not work with tesselation. */
+ if (sctx->gs_shader.cso && sctx->tes_shader.cso &&
+ sctx->gs_shader.cso->gs_num_invocations * sctx->gs_shader.cso->gs_max_out_vertices > 256)
+ new_ngg = false;
+
+ if (new_ngg != sctx->ngg) {
+ sctx->ngg = new_ngg;
+ sctx->last_rast_prim = -1; /* reset this so that it gets updated */
+ return true;
+ }
+ return false;
+}
+
static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader *old_hw_vs_variant = si_get_vs_state(sctx);
struct si_shader_selector *sel = state;
bool enable_changed = !!sctx->gs_shader.cso != !!sel;
+ bool ngg_changed;
if (sctx->gs_shader.cso == sel)
return;
si_update_common_shader_state(sctx);
sctx->last_rast_prim = -1; /* reset this so that it gets updated */
- if (enable_changed) {
+ ngg_changed = si_update_ngg(sctx);
+ if (ngg_changed || enable_changed)
si_shader_change_notify(sctx);
+ if (enable_changed) {
if (sctx->ia_multi_vgt_param_key.u.uses_tess)
si_update_tess_uses_prim_id(sctx);
}
sctx->last_rast_prim = -1; /* reset this so that it gets updated */
if (enable_changed) {
+ si_update_ngg(sctx);
si_shader_change_notify(sctx);
sctx->last_tes_sh_base = -1; /* invalidate derived tess state */
}