st/pbo: do not use GS for NIR preferred shaders
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Wed, 15 Sep 2021 13:51:37 +0000 (15:51 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 3 Dec 2021 15:32:36 +0000 (15:32 +0000)
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 <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

src/mesa/state_tracker/st_pbo.c

index 66ffb54..a3fb0e6 100644 (file)
@@ -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;
       }