Mesa (master): st/mesa: fix pbo upload/download for arrays of textures with only 1 layer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 20 16:20:11 UTC 2021


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

Author: Andrii Simiklit <andrii.simiklit at globallogic.com>
Date:   Mon Jan 18 14:42:05 2021 +0200

st/mesa: fix pbo upload/download for arrays of textures with only 1 layer

Having only one layer we can put 0 as third texture coordinate

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4115
Fixes: 36097fc7 ("st/pbo: fix pbo uploads without PIPE_CAP_TGSI_VS_LAYER_VIEWPORT and skip gs")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8576>

---

 src/mesa/state_tracker/st_pbo.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c
index 627e62e6ac2..0b5c90d30c7 100644
--- a/src/mesa/state_tracker/st_pbo.c
+++ b/src/mesa/state_tracker/st_pbo.c
@@ -435,16 +435,21 @@ create_fs(struct st_context *st, bool download,
    nir_ssa_def *coord = nir_load_var(&b, fragcoord);
 
    nir_ssa_def *layer = NULL;
-   if (st->pbo.layers && need_layer && (!download || target == PIPE_TEXTURE_1D_ARRAY ||
-                                                     target == PIPE_TEXTURE_2D_ARRAY ||
-                                                     target == PIPE_TEXTURE_3D ||
-                                                     target == PIPE_TEXTURE_CUBE ||
-                                                     target == PIPE_TEXTURE_CUBE_ARRAY)) {
-      nir_variable *var = nir_variable_create(b.shader, nir_var_shader_in,
-                                              glsl_int_type(), "gl_Layer");
-      var->data.location = VARYING_SLOT_LAYER;
-      var->data.interpolation = INTERP_MODE_FLAT;
-      layer = nir_load_var(&b, var);
+   if (st->pbo.layers && (!download || target == PIPE_TEXTURE_1D_ARRAY ||
+                                       target == PIPE_TEXTURE_2D_ARRAY ||
+                                       target == PIPE_TEXTURE_3D ||
+                                       target == PIPE_TEXTURE_CUBE ||
+                                       target == PIPE_TEXTURE_CUBE_ARRAY)) {
+      if (need_layer) {
+         nir_variable *var = nir_variable_create(b.shader, nir_var_shader_in,
+                                                glsl_int_type(), "gl_Layer");
+         var->data.location = VARYING_SLOT_LAYER;
+         var->data.interpolation = INTERP_MODE_FLAT;
+         layer = nir_load_var(&b, var);
+      }
+      else {
+         layer = zero;
+      }
    }
 
    /* offset_pos = param.xy + f2i(coord.xy) */



More information about the mesa-commit mailing list