From f656ef672d3006e59b6168903ff5d6d85aebaec9 Mon Sep 17 00:00:00 2001 From: Yevhenii Kharchenko Date: Thu, 4 Feb 2021 12:23:30 +0200 Subject: [PATCH] st/mesa: fix PBO download for TEXTURE_1D_ARRAY textures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes 'nir_tex_src_coord' param was provided to NIR 'txf' operation as a vec3 for TEXTURE_1D_ARRAY target, causing an assert. Only following targets require vec3: TEXTURE_2D_ARRAY, TEXTURE_3D, TEXTURE_CUBE, TEXTURE_CUBE_ARRAY. The rest must use vec2. Packing layer value into Y-coordinate the same way it was done in 'create_fs' in commit 2bf6dfac. Fixes: a01ad311 ("st/mesa: Add NIR versions of the PBO upload/download shaders. ") Signed-off-by: Yevhenii Kharchenko Reviewed-by: Marek Olšák Part-of: (cherry picked from commit 1516b6bd9a5307ad37f10b1b1c614e399f4bce2d) --- .pick_status.json | 2 +- src/mesa/state_tracker/st_pbo.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2308f962940..53dfe149dea 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1363,7 +1363,7 @@ "description": "st/mesa: fix PBO download for TEXTURE_1D_ARRAY textures", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "a01ad3110a92e88f815242b59ad1da6d2623decc" }, diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c index b03921c1be6..2a960fe5c7f 100644 --- a/src/mesa/state_tracker/st_pbo.c +++ b/src/mesa/state_tracker/st_pbo.c @@ -482,9 +482,14 @@ create_fs(struct st_context *st, bool download, src_layer = nir_iadd(&b, layer, layer_offset); } - texcoord = nir_vec3(&b, nir_channel(&b, texcoord, 0), - nir_channel(&b, texcoord, 1), - src_layer); + if (target == PIPE_TEXTURE_1D_ARRAY) { + texcoord = nir_vec2(&b, nir_channel(&b, texcoord, 0), + src_layer); + } else { + texcoord = nir_vec3(&b, nir_channel(&b, texcoord, 0), + nir_channel(&b, texcoord, 1), + src_layer); + } } } else { texcoord = pbo_addr;