[Mesa-dev] [PATCH 01/57] i965/fs: Replace fs_reg::reg_offset with fs_reg::offset expressed in bytes.

Francisco Jerez currojerez at riseup.net
Fri Sep 9 00:46:16 UTC 2016


Iago Toral <itoral at igalia.com> writes:

> On Wed, 2016-09-07 at 18:48 -0700, Francisco Jerez wrote:
> (...)
>> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp
>> b/src/mesa/drivers/dri/i965/brw_shader.cpp
>> index ea39252..29435f6 100644
>> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
>> @@ -672,7 +672,7 @@ backend_shader::backend_shader(const struct
>> brw_compiler *compiler,
>>  bool
>>  backend_reg::equals(const backend_reg &r) const
>>  {
>> -   return brw_regs_equal(this, &r) && reg_offset == r.reg_offset;
>> +   return brw_regs_equal(this, &r) && offset == r.offset;
>>  }
>>  
>>  bool
>> @@ -750,7 +750,9 @@ backend_reg::in_range(const backend_reg &r,
>> unsigned n) const
>>     return (file == r.file &&
>>             nr == r.nr &&
>>             reg_offset >= r.reg_offset &&
>> -           reg_offset < r.reg_offset + n);
>> +           reg_offset < r.reg_offset + n &&
>
> Are you keeping the checks with reg_offset here for a reason or is this
> just an omission? I would expect that these would be replaced with the
> checks below like we do everywhere else in this patch.
>
Yeah, the reason is that this code is shared between both back-ends, and
the VEC4 back-end is still using the old reg_offset field until PATCH 2,
so I left these lying around for the moment until PATCH 3 in order to
avoid a temporary regression.

>> +           offset >= r.offset &&
>> +           offset < r.offset + n * REG_SIZE);
>>  }
>>  
>>  bool
>> diff --git a/src/mesa/drivers/dri/i965/brw_shader.h
>> b/src/mesa/drivers/dri/i965/brw_shader.h
>> index 0102098..72b94b6 100644
>> --- a/src/mesa/drivers/dri/i965/brw_shader.h
>> +++ b/src/mesa/drivers/dri/i965/brw_shader.h
>> @@ -44,14 +44,14 @@ struct backend_reg : private brw_reg
>>     const brw_reg &as_brw_reg() const
>>     {
>>        assert(file == ARF || file == FIXED_GRF || file == MRF || file
>> == IMM);
>> -      assert(reg_offset == 0);
>> +      assert(reg_offset == 0 && offset == 0);
>
> Same here.
>
>>        return static_cast<const brw_reg &>(*this);
>>     }
>>  
>>     brw_reg &as_brw_reg()
>>     {
>>        assert(file == ARF || file == FIXED_GRF || file == MRF || file
>> == IMM);
>> -      assert(reg_offset == 0);
>> +      assert(reg_offset == 0 && offset == 0);
>
> And here.
>
>
>>        return static_cast<brw_reg &>(*this);
>>     }
>>  
>> @@ -75,6 +75,9 @@ struct backend_reg : private brw_reg
>>      */
>>     uint16_t reg_offset;
>>  
>> +   /** Offset from the start of the (virtual) register in bytes. */
>> +   uint16_t offset;
>> +
>>     using brw_reg::type;
>>     using brw_reg::file;
>>     using brw_reg::negate;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160908/9643d94f/attachment.sig>


More information about the mesa-dev mailing list