pan/blit: Fix 3D blittering
authorBoris Brezillon <boris.brezillon@collabora.com>
Mon, 6 Sep 2021 10:38:22 +0000 (12:38 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 27 Sep 2021 07:45:41 +0000 (07:45 +0000)
commitc49f22188847a6d783f5574bacc5450e1ea97f90
treee2028a4c4cca61e6cdf618244ef3dd95808d9ec8
parentc7204ab7fcd7acf0f260ad655f346063a771a580
pan/blit: Fix 3D blittering

Fixes several problems in the pan_blit() logic:

1. We actually need the reciprocal of the depth scaling in z_scale (maybe
   we should rename this field z_scale_rcp to make it clear)

2. When Z end < Z start we should remove one to the cur_layer/layer_offset
   instead of doing it on the last_layer field, otherwise there's an
   off-by-one error

3. The Z src offset should be adjusted to account for scaling. If we don't
   do that we won't sample from the right layer when upscaling.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12961>
src/panfrost/lib/pan_blitter.c