From da0cdc84d554e568b51f75e38a559a646003489d Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Wed, 15 Sep 2021 15:51:37 +0200 Subject: [PATCH] st/pbo: do not use GS for NIR preferred shaders If PBO require to use a GS, this is created with TGSI. For drivers preferring NIR shaders, they need to translate it from TGSI to NIR. But unfortunately TGSI to NIR for GS is not implemented, which makes it crash. So let's use a GS only for drivers preferring TGSI. v3: - Add comment (Iago and Alejandro) Signed-off-by: Juan A. Suarez Romero Reviewed-by: Iago Toral Quiroga Part-of: --- src/mesa/state_tracker/st_pbo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c index 66ffb54428a..a3fb0e65208 100644 --- a/src/mesa/state_tracker/st_pbo.c +++ b/src/mesa/state_tracker/st_pbo.c @@ -648,7 +648,13 @@ st_init_pbo_helpers(struct st_context *st) if (screen->get_param(screen, PIPE_CAP_TGSI_INSTANCEID)) { if (screen->get_param(screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT)) { st->pbo.layers = true; - } else if (screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES) >= 3) { + } else if (screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES) >= 3 && + screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, + PIPE_SHADER_CAP_PREFERRED_IR) != PIPE_SHADER_IR_NIR) { + /* As the download GS is created in TGSI, and TGSI to NIR translation + * is not implemented for GS, avoid using GS for drivers preferring + * NIR shaders. + */ st->pbo.layers = true; st->pbo.use_gs = true; }