radeonsi: document better how X/Y flipping in the compute blit works

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28917>
This commit is contained in:
Marek Olšák
2024-03-29 21:36:44 -04:00
committed by Marge Bot
parent bb86366fee
commit 0c5d727a5e

View File

@@ -456,9 +456,12 @@ void *si_create_blit_cs(struct si_context *sctx, const union si_compute_blit_sha
/* Flip src coordinates. */
for (unsigned i = 0; i < 2; i++) {
if (i ? options->flip_y : options->flip_x) {
/* x goes from 0 to (dim - 1).
* The flipped blit should load from -dim to -1.
* Therefore do: x = -x - 1;
/* A normal blit loads from (box.x + tid.x) where tid.x = 0..(width - 1).
*
* A flipped blit sets box.x = width, so we should make tid.x negative to load from
* (width - 1)..0.
*
* Therefore do: x = -x - 1, which becomes (width - 1) to 0 after we add box.x = width.
*/
nir_def *comp = nir_channel(&b, src_xyz, i);
comp = nir_iadd_imm(&b, nir_ineg(&b, comp), -1);