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

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Tue Feb  9 21:50:07 2021 +0100

radeonsi: fix si_check_render_feedback

si_check_render_feedback only relied on si_images::enabled_mask and
si_samplers::enabled_mask to determine if a texture was being used
both as input and output.

Given that some samplers/images can be considered active (so accounted
for by enabled_mask) but not used by the current shader this could
lead to false-positive.

This commit fixes this by and-ing the above mask with the information
from shader_info for each active shader.

Reviewed-by: Zoltán Böszörményi <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4227
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9677>

---

 .gitlab-ci/traces-radeonsi.yml         |  4 ++--
 src/gallium/drivers/radeonsi/si_blit.c | 30 +++++++++++++++++++++++-------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci/traces-radeonsi.yml b/.gitlab-ci/traces-radeonsi.yml
index 66c30c5e792..96dc165d08a 100644
--- a/.gitlab-ci/traces-radeonsi.yml
+++ b/.gitlab-ci/traces-radeonsi.yml
@@ -225,7 +225,7 @@ traces:
   - path: supertuxkart/supertuxkart-antediluvian-abyss.rdc
     expectations:
       - device: gl-radeonsi-stoney
-        checksum: 499e93c37e33cc6430c7a9f94266f2f7
+        checksum: f1774fc459aa0734838888dd44db052e
   - path: supertuxkart/supertuxkart-menu.rdc
     expectations:
       - device: gl-radeonsi-stoney
@@ -233,4 +233,4 @@ traces:
   - path: supertuxkart/supertuxkart-ravenbridge-mansion.rdc
     expectations:
       - device: gl-radeonsi-stoney
-        checksum: 38a9f26c60a0bc4245b97d32da84ef75
+        checksum: 66b6dee290642bd25dfd817d190f6906
diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index 71037726863..abc1f68370e 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -586,9 +586,10 @@ static void si_check_render_feedback_texture(struct 
si_context *sctx, struct si_
       si_texture_disable_dcc(sctx, tex);
 }
 
-static void si_check_render_feedback_textures(struct si_context *sctx, struct 
si_samplers *textures)
+static void si_check_render_feedback_textures(struct si_context *sctx, struct 
si_samplers *textures,
+                                              uint32_t in_use_mask)
 {
-   uint32_t mask = textures->enabled_mask;
+   uint32_t mask = textures->enabled_mask & in_use_mask;
 
    while (mask) {
       const struct pipe_sampler_view *view;
@@ -607,9 +608,10 @@ static void si_check_render_feedback_textures(struct 
si_context *sctx, struct si
    }
 }
 
-static void si_check_render_feedback_images(struct si_context *sctx, struct 
si_images *images)
+static void si_check_render_feedback_images(struct si_context *sctx, struct 
si_images *images,
+                                            uint32_t in_use_mask)
 {
-   uint32_t mask = images->enabled_mask;
+   uint32_t mask = images->enabled_mask & in_use_mask;
 
    while (mask) {
       const struct pipe_image_view *view;
@@ -673,9 +675,23 @@ static void si_check_render_feedback(struct si_context 
*sctx)
    if (!si_get_total_colormask(sctx))
       return;
 
-   for (int i = 0; i < SI_NUM_SHADERS; ++i) {
-      si_check_render_feedback_images(sctx, &sctx->images[i]);
-      si_check_render_feedback_textures(sctx, &sctx->samplers[i]);
+   struct si_shader_ctx_state *shaders[SI_NUM_SHADERS] = {
+      [PIPE_SHADER_VERTEX] = &sctx->vs_shader,
+      [PIPE_SHADER_TESS_CTRL] = &sctx->tcs_shader,
+      [PIPE_SHADER_TESS_EVAL] = &sctx->tes_shader,
+      [PIPE_SHADER_GEOMETRY] = &sctx->gs_shader,
+      [PIPE_SHADER_FRAGMENT] = &sctx->ps_shader,
+   };
+
+   for (int i = 0; i < SI_NUM_GRAPHICS_SHADERS; ++i) {
+      if (!shaders[i]->cso)
+         continue;
+
+      struct si_shader_info *info = &shaders[i]->cso->info;
+      si_check_render_feedback_images(sctx, &sctx->images[i],
+                                      u_bit_consecutive(0, 
info->base.num_images));
+      si_check_render_feedback_textures(sctx, &sctx->samplers[i],
+                                        info->base.textures_used);
    }
 
    si_check_render_feedback_resident_images(sctx);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to