nir_to_tgsi: Don't count ZS fbfetch vars as outputs
authorPavel Asyutchenko <sventeam@yandex.ru>
Fri, 3 Dec 2021 21:38:56 +0000 (00:38 +0300)
committerMarge Bot <emma+marge@anholt.net>
Wed, 22 Jun 2022 04:32:44 +0000 (04:32 +0000)
Signed-off-by: Pavel Asyutchenko <sventeam@yandex.ru>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13979>

src/gallium/auxiliary/nir/nir_to_tgsi_info.c

index 80db4e5..72998d2 100644 (file)
@@ -717,7 +717,8 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
             info->colors_written |= 1 << semantic_index;
             break;
          case TGSI_SEMANTIC_STENCIL:
-            info->writes_stencil = true;
+            if (!variable->data.fb_fetch_output)
+               info->writes_stencil = true;
             break;
          case TGSI_SEMANTIC_SAMPLEMASK:
             info->writes_samplemask = true;
@@ -726,10 +727,12 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
             info->writes_edgeflag = true;
             break;
          case TGSI_SEMANTIC_POSITION:
-            if (info->processor == PIPE_SHADER_FRAGMENT)
-               info->writes_z = true;
-            else
+            if (info->processor == PIPE_SHADER_FRAGMENT) {
+               if (!variable->data.fb_fetch_output)
+                  info->writes_z = true;
+            } else {
                info->writes_position = true;
+            }
             break;
          }