st/mesa: fix PBO download for TEXTURE_1D_ARRAY textures

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 <yevhenii.kharchenko@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9014>
(cherry picked from commit 1516b6bd9a)
This commit is contained in:
Yevhenii Kharchenko 2021-02-04 12:23:30 +02:00 committed by Dylan Baker
parent 6fd153b6df
commit f656ef672d
2 changed files with 9 additions and 4 deletions

View file

@ -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"
},

View file

@ -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;