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

Author: Pavel Asyutchenko <[email protected]>
Date:   Wed Sep  8 23:21:18 2021 +0300

llvmpipe: fix wrong assumption on FB fetch shader opacity

In certain cases variant->opaque could be set to true, which
reset command list for tiles fully covered by a triangle
with this shader. This is obviously wrong in presence of
framebuffer fetch.

Signed-off-by: Pavel Asyutchenko <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13252>

---

 src/gallium/auxiliary/nir/nir_to_tgsi_info.c | 1 +
 src/gallium/drivers/llvmpipe/lp_state_fs.c   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c 
b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
index ce1e3412f42..48f132e2e58 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
@@ -460,6 +460,7 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
       info->properties[TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL] =
          nir->info.fs.early_fragment_tests | nir->info.fs.post_depth_coverage;
       info->properties[TGSI_PROPERTY_FS_POST_DEPTH_COVERAGE] = 
nir->info.fs.post_depth_coverage;
+      info->uses_fbfetch = nir->info.fs.uses_fbfetch_output;
 
       if (nir->info.fs.pixel_center_integer) {
          info->properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER] =
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 80dd95f01e9..553bd5c85b1 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -3627,7 +3627,8 @@ generate_variant(struct llvmpipe_context *lp,
          !key->blend.alpha_to_coverage &&
          !key->depth.enabled &&
          !shader->info.base.uses_kill &&
-         !shader->info.base.writes_samplemask;
+         !shader->info.base.writes_samplemask &&
+         !shader->info.base.uses_fbfetch;
 
    variant->opaque =
          no_kill &&

Reply via email to