backdrop: avoid a (benign) zero-sized read

Found with MEM_DEBUG added in later change.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur 2020-12-24 11:36:05 +01:00
parent c4f5a69a0d
commit 8b62022749
2 changed files with 11 additions and 9 deletions

View file

@ -85,16 +85,18 @@ void main() {
el_ix = probe; el_ix = probe;
} }
} }
uint seq_ix = row - (el_ix > 0 ? sh_row_count[el_ix - 1] : 0);
uint width = sh_row_width[el_ix]; uint width = sh_row_width[el_ix];
// Process one row sequentially if (width > 0) {
// Read backdrop value per tile and prefix sum it // Process one row sequentially
uint tile_el_ix = sh_row_base[el_ix] + seq_ix * 2 * width; // Read backdrop value per tile and prefix sum it
uint sum = memory[tile_el_ix]; uint seq_ix = row - (el_ix > 0 ? sh_row_count[el_ix - 1] : 0);
for (uint x = 1; x < width; x++) { uint tile_el_ix = sh_row_base[el_ix] + seq_ix * 2 * width;
tile_el_ix += 2; uint sum = memory[tile_el_ix];
sum += memory[tile_el_ix]; for (uint x = 1; x < width; x++) {
memory[tile_el_ix] = sum; tile_el_ix += 2;
sum += memory[tile_el_ix];
memory[tile_el_ix] = sum;
}
} }
} }
} }

Binary file not shown.