[Mesa-dev] [PATCH 01/23] i965/fs: fix subreg_offset overflow in byte_offset()

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue May 10 12:04:29 UTC 2016


On 03/05/16 19:57, Jordan Justen wrote:
> 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;
> 

Yes, it would work. I am going to adjust the UNIFORM case to do the same
but with 4 instead of 32.

Sam

> -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