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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 27 15:02:51 UTC 2022


Module: Mesa
Branch: main
Commit: 0d28de212a4b71749f3e0bef8768aa58c0ca354d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d28de212a4b71749f3e0bef8768aa58c0ca354d

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>

---

 src/intel/vulkan/anv_pipeline.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index b25411fee07..10e77e5f003 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -1856,18 +1856,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