[Mesa-dev] [PATCH 01/23] i965/fs: fix subreg_offset overflow in byte_offset()
Jordan Justen
jordan.l.justen at intel.com
Tue May 3 17:57:17 UTC 2016
On 2016-05-03 05:21:50, Samuel Iglesias Gonsálvez wrote:
> From: Iago Toral Quiroga <itoral at igalia.com>
>
> This can happen if the register already has a non-zero subreg_offset
> when byte_offset() is called.
> ---
> src/mesa/drivers/dri/i965/brw_ir_fs.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> index 2f72326..8faca08 100644
> --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> @@ -109,6 +109,10 @@ byte_offset(fs_reg reg, unsigned delta)
> assert(delta == 0);
> }
> reg.subreg_offset += delta % 32;
> + if (reg.subreg_offset >= 32) {
> + reg.reg_offset += reg.subreg_offset / 32;
> + reg.subreg_offset %= 32;
> + }
What if at the top of the function, we have
reg.subreg_offset += delta;
Then, in the middle we use reg.subreg_offset instead of delta for
adjusting the register offset.
Then, at the end:
reg.subreg_offset = reg.subreg_offset % 32;
-Jordan
> return reg;
> }
>
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list