Fixes possibly of reading memory past end of lightGridData or reading wrong light grid data (wrapping around to next row).
Also change light grid bounds clamping to make it more clear what invalid values are.