Mesa (staging/21.0): 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 19:19:49 UTC 2021
Module: Mesa
Branch: staging/21.0
Commit: 5b1408b95261174a029c0cb6e2a7b92f4d47862f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b1408b95261174a029c0cb6e2a7b92f4d47862f
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>
(cherry picked from commit e87b59f68779a7c838f35323fd9f4dddf146381d)
---
.pick_status.json | 2 +-
src/mesa/state_tracker/st_pbo.c | 25 +++++++++++++++----------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 53eb5c134bc..c58c3b36c51 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -94,7 +94,7 @@
"description": "st/mesa: fix pbo upload/download for arrays of textures with only 1 layer",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "36097fc7ef70471ecfecd428f990233276e9c45b"
},
diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c
index 70dbf554a34..6a74f04b343 100644
--- a/src/mesa/state_tracker/st_pbo.c
+++ b/src/mesa/state_tracker/st_pbo.c
@@ -433,16 +433,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