mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
anv: fix source/destination layers for 3D blits
When blitting from source depth range [0-3] into destination depth
range [0-2], we'll have to use a source layer that is in between 2
layers of the 3D source image.
Other than having an incorrect formula, we're also using integer which
prevent us from using the right source layer.
v2: Drop + 0.5 on application offsets
v3: Reuse num_layers (Jason)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3458
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6909>
(cherry picked from commit ea32691257)
This commit is contained in:
parent
a7e169380d
commit
35b93d6f8a
1 changed files with 10 additions and 4 deletions
|
|
@ -709,12 +709,19 @@ void anv_CmdBlitImage(
|
|||
}
|
||||
|
||||
bool flip_z = flip_coords(&src_start, &src_end, &dst_start, &dst_end);
|
||||
float src_z_step = (float)(src_end + 1 - src_start) /
|
||||
(float)(dst_end + 1 - dst_start);
|
||||
const unsigned num_layers = dst_end - dst_start;
|
||||
float src_z_step = (float)(src_end - src_start) / (float)num_layers;
|
||||
|
||||
/* There is no interpolation to the pixel center during rendering, so
|
||||
* add the 0.5 offset ourselves here. */
|
||||
float depth_center_offset = 0;
|
||||
if (src_image->type == VK_IMAGE_TYPE_3D)
|
||||
depth_center_offset = 0.5 / num_layers * (src_end - src_start);
|
||||
|
||||
if (flip_z) {
|
||||
src_start = src_end;
|
||||
src_z_step *= -1;
|
||||
depth_center_offset *= -1;
|
||||
}
|
||||
|
||||
unsigned src_x0 = pRegions[r].srcOffsets[0].x;
|
||||
|
|
@ -729,7 +736,6 @@ void anv_CmdBlitImage(
|
|||
unsigned dst_y1 = pRegions[r].dstOffsets[1].y;
|
||||
bool flip_y = flip_coords(&src_y0, &src_y1, &dst_y0, &dst_y1);
|
||||
|
||||
const unsigned num_layers = dst_end - dst_start;
|
||||
anv_cmd_buffer_mark_image_written(cmd_buffer, dst_image,
|
||||
1U << aspect_bit,
|
||||
dst.aux_usage,
|
||||
|
|
@ -738,7 +744,7 @@ void anv_CmdBlitImage(
|
|||
|
||||
for (unsigned i = 0; i < num_layers; i++) {
|
||||
unsigned dst_z = dst_start + i;
|
||||
unsigned src_z = src_start + i * src_z_step;
|
||||
float src_z = src_start + i * src_z_step + depth_center_offset;
|
||||
|
||||
blorp_blit(&batch, &src, src_res->mipLevel, src_z,
|
||||
src_format.isl_format, src_format.swizzle,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue