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,10 +85,11 @@ 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];
if (width > 0) {
// Process one row sequentially // Process one row sequentially
// Read backdrop value per tile and prefix sum it // Read backdrop value per tile and prefix sum it
uint seq_ix = row - (el_ix > 0 ? sh_row_count[el_ix - 1] : 0);
uint tile_el_ix = sh_row_base[el_ix] + seq_ix * 2 * width; uint tile_el_ix = sh_row_base[el_ix] + seq_ix * 2 * width;
uint sum = memory[tile_el_ix]; uint sum = memory[tile_el_ix];
for (uint x = 1; x < width; x++) { for (uint x = 1; x < width; x++) {
@ -97,4 +98,5 @@ void main() {
memory[tile_el_ix] = sum; memory[tile_el_ix] = sum;
} }
} }
}
} }

Binary file not shown.