Mesa (staging/22.0): anv: Don't disable the fragment shader if XFB is enabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 1 20:58:19 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: bac2d7f3839a79112de2c226858906310646bfa1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bac2d7f3839a79112de2c226858906310646bfa1

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Fri May 13 17:09:52 2022 -0500

anv: Don't disable the fragment shader if XFB is enabled

It turns out that we need a fragment shader for streamout.  Whh?  From
Lionel's reading of simulator sources, it seems the streamout unit is
looking at enabled next stages.  It'll generate output to the clipper in
the following cases :

 - 3DSTATE_STREAMOUT::ForceRendering = ON
 - PS enabled
 - Stencil test enabled
 - depth test enabled
 - depth write enabled
 - some other depth/hiz clear condition

Forcing rendering without a PS seems like a recipe for hangs so it's
probably better to just enable the PS in this case.

Fixes: 36ee2fd61c8f ("anv: Implement the basic form of VK_EXT_transform_feedback")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16506>
(cherry picked from commit 0d28de212a4b71749f3e0bef8768aa58c0ca354d)

---

 .pick_status.json               |  2 +-
 src/intel/vulkan/anv_pipeline.c | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8b331b9bd43..4f20b3ed52f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1404,7 +1404,7 @@
         "description": "anv: Don't disable the fragment shader if XFB is enabled",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "36ee2fd61c8f943be1d1e2b0354f7a121ffef28f"
     },
     {
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index c3fa0b1ecab..ecd33311e54 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -2001,18 +2001,21 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
 done:
 
    if (pipeline->shaders[MESA_SHADER_FRAGMENT] != NULL) {
-      const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline);
+      struct anv_shader_bin *fs = pipeline->shaders[MESA_SHADER_FRAGMENT];
+      const struct brw_wm_prog_data *wm_prog_data =
+         brw_wm_prog_data_const(fs->prog_data);
+
       if (wm_prog_data->color_outputs_written == 0 &&
           !wm_prog_data->has_side_effects &&
           !wm_prog_data->uses_omask &&
           !wm_prog_data->uses_kill &&
           wm_prog_data->computed_depth_mode == BRW_PSCDEPTH_OFF &&
-          !wm_prog_data->computed_stencil) {
+          !wm_prog_data->computed_stencil &&
+          fs->xfb_info == NULL) {
          /* This can happen if we decided to implicitly disable the fragment
           * shader.  See anv_pipeline_compile_fs().
           */
-         anv_shader_bin_unref(pipeline->base.device,
-                              pipeline->shaders[MESA_SHADER_FRAGMENT]);
+         anv_shader_bin_unref(pipeline->base.device, fs);
          pipeline->shaders[MESA_SHADER_FRAGMENT] = NULL;
          pipeline->active_stages &= ~VK_SHADER_STAGE_FRAGMENT_BIT;
       }



More information about the mesa-commit mailing list