mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
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@amd.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8576>
This commit is contained in:
parent
13f7224dbf
commit
e87b59f687
1 changed files with 15 additions and 10 deletions
|
|
@ -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) */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue