mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
anv: fix ycbcr plane indexing with indirect descriptors
We need to add the plane index to compute the address from which to
load the descriptor (anv_sampled_image_descriptor in this case).
This was likely broken before we added direct descriptor support so
that gets a stable backport.
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11125
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29111>
(cherry picked from commit 665cad6408)
This commit is contained in:
parent
6fc67be3a5
commit
33d6e6f9a2
2 changed files with 26 additions and 12 deletions
|
|
@ -904,7 +904,7 @@
|
|||
"description": "anv: fix ycbcr plane indexing with indirect descriptors",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -743,7 +743,7 @@ build_desc_addr_for_res_index(nir_builder *b,
|
|||
static nir_def *
|
||||
build_desc_addr_for_binding(nir_builder *b,
|
||||
unsigned set, unsigned binding,
|
||||
nir_def *array_index,
|
||||
nir_def *array_index, unsigned plane,
|
||||
const struct apply_pipeline_layout_state *state)
|
||||
{
|
||||
const struct anv_descriptor_set_binding_layout *bind_layout =
|
||||
|
|
@ -759,6 +759,10 @@ build_desc_addr_for_binding(nir_builder *b,
|
|||
array_index,
|
||||
bind_layout->descriptor_surface_stride),
|
||||
bind_layout->descriptor_surface_offset);
|
||||
if (plane != 0) {
|
||||
desc_offset = nir_iadd_imm(
|
||||
b, desc_offset, plane * bind_layout->descriptor_data_surface_size);
|
||||
}
|
||||
|
||||
return nir_vec4(b, nir_unpack_64_2x32_split_x(b, set_addr),
|
||||
nir_unpack_64_2x32_split_y(b, set_addr),
|
||||
|
|
@ -766,14 +770,21 @@ build_desc_addr_for_binding(nir_builder *b,
|
|||
desc_offset);
|
||||
}
|
||||
|
||||
case nir_address_format_32bit_index_offset:
|
||||
case nir_address_format_32bit_index_offset: {
|
||||
nir_def *desc_offset =
|
||||
nir_iadd_imm(b,
|
||||
nir_imul_imm(b,
|
||||
array_index,
|
||||
bind_layout->descriptor_surface_stride),
|
||||
bind_layout->descriptor_surface_offset);
|
||||
if (plane != 0) {
|
||||
desc_offset = nir_iadd_imm(
|
||||
b, desc_offset, plane * bind_layout->descriptor_data_surface_size);
|
||||
}
|
||||
return nir_vec2(b,
|
||||
nir_imm_int(b, state->set[set].desc_offset),
|
||||
nir_iadd_imm(b,
|
||||
nir_imul_imm(b,
|
||||
array_index,
|
||||
bind_layout->descriptor_surface_stride),
|
||||
bind_layout->descriptor_surface_offset));
|
||||
desc_offset);
|
||||
}
|
||||
|
||||
default:
|
||||
unreachable("Unhandled address format");
|
||||
|
|
@ -827,7 +838,8 @@ build_surface_index_for_binding(nir_builder *b,
|
|||
set_offset = nir_imm_int(b, 0xdeaddead);
|
||||
|
||||
nir_def *desc_addr =
|
||||
build_desc_addr_for_binding(b, set, binding, array_index, state);
|
||||
build_desc_addr_for_binding(b, set, binding, array_index,
|
||||
plane, state);
|
||||
|
||||
surface_index =
|
||||
build_load_descriptor_mem(b, desc_addr, 0, 1, 32, state);
|
||||
|
|
@ -908,7 +920,8 @@ build_sampler_handle_for_binding(nir_builder *b,
|
|||
set_offset = nir_imm_int(b, 0xdeaddead);
|
||||
|
||||
nir_def *desc_addr =
|
||||
build_desc_addr_for_binding(b, set, binding, array_index, state);
|
||||
build_desc_addr_for_binding(b, set, binding, array_index,
|
||||
plane, state);
|
||||
|
||||
/* This is anv_sampled_image_descriptor, the sampler handle is always
|
||||
* in component 1.
|
||||
|
|
@ -1384,7 +1397,8 @@ lower_load_accel_struct_desc(nir_builder *b,
|
|||
|
||||
struct res_index_defs res = unpack_res_index(b, res_index);
|
||||
nir_def *desc_addr =
|
||||
build_desc_addr_for_binding(b, set, binding, res.array_index, state);
|
||||
build_desc_addr_for_binding(b, set, binding, res.array_index,
|
||||
0 /* plane */, state);
|
||||
|
||||
/* Acceleration structure descriptors are always uint64_t */
|
||||
nir_def *desc = build_load_descriptor_mem(b, desc_addr, 0, 1, 64, state);
|
||||
|
|
@ -1613,7 +1627,7 @@ lower_image_size_intrinsic(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
}
|
||||
|
||||
nir_def *desc_addr = build_desc_addr_for_binding(
|
||||
b, set, binding, array_index, state);
|
||||
b, set, binding, array_index, 0 /* plane */, state);
|
||||
|
||||
b->cursor = nir_after_instr(&intrin->instr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue