[Mesa-dev] [PATCH 01/10] i965/fs: Do not mark direct used surfaces in VARYING_PULL_CONSTANT_LOAD

Francisco Jerez currojerez at riseup.net
Fri Oct 30 06:33:06 PDT 2015


Francisco Jerez <currojerez at riseup.net> writes:

> Iago Toral Quiroga <itoral at igalia.com> writes:
>
>> Right now the generator marks direct surfaces as used but leaves marking of
>> indirect surfaces to the caller. Just make the callers handle marking in both
>> cases for consistency.
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs.cpp           | 4 +++-
>>  src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 8 --------
>>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp       | 6 ++++--
>>  3 files changed, 7 insertions(+), 11 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index d9e2f2c..e55417d 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -1907,7 +1907,8 @@ fs_visitor::demote_pull_constants()
>>  
>>           /* Set up the annotation tracking for new generated instructions. */
>>           const fs_builder ibld(this, block, inst);
>> -         fs_reg surf_index(stage_prog_data->binding_table.pull_constants_start);
>> +         unsigned index = stage_prog_data->binding_table.pull_constants_start;
>
> const
>
>> +         fs_reg surf_index(index);

And I'd also just go ahead and get rid of the surf_index temporary, it's
just fs_reg(index)...

>>           fs_reg dst = vgrf(glsl_type::float_type);
>>  
>>           assert(inst->src[i].stride == 0);
>> @@ -1920,6 +1921,7 @@ fs_visitor::demote_pull_constants()
>>                                         pull_index);
>>              inst->src[i].reladdr = NULL;
>>              inst->src[i].stride = 1;
>> +            brw_mark_surface_used(prog_data, index);
>>           } else {
>>              const fs_builder ubld = ibld.exec_all().group(8, 0);
>>              fs_reg offset = fs_reg((unsigned)(pull_index * 4) & ~15);
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
>> index 58bd23f..5e877e1 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
>> @@ -1340,8 +1340,6 @@ fs_generator::generate_varying_pull_constant_load(fs_inst *inst,
>>                             inst->header_size != 0,
>>                             simd_mode,
>>                             return_format);
>> -
>> -   brw_mark_surface_used(prog_data, surf_index);
>>  }
>>  
>>  void
>> @@ -1386,8 +1384,6 @@ fs_generator::generate_varying_pull_constant_load_gen7(fs_inst *inst,
>>                                simd_mode,
>>                                0);
>>  
>> -      brw_mark_surface_used(prog_data, surf_index);
>> -
>>     } else {
>>  
>>        struct brw_reg addr = vec1(retype(brw_address_reg(0), BRW_REGISTER_TYPE_UD));
>> @@ -1418,10 +1414,6 @@ fs_generator::generate_varying_pull_constant_load_gen7(fs_inst *inst,
>>                                false /* header */,
>>                                simd_mode,
>>                                0);
>> -
>> -      /* visitor knows more than we do about the surface limit required,
>> -       * so has already done marking.
>> -       */
>>     }
>>  }
>>  
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
>> index 9c1f95c..349b428 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
>> @@ -1446,8 +1446,10 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
>>        fs_reg surf_index;
>>  
>>        if (const_index) {
>> -         surf_index = fs_reg(stage_prog_data->binding_table.ubo_start +
>> -                             const_index->u[0]);
>> +        unsigned index = stage_prog_data->binding_table.ubo_start +
>> +                         const_index->u[0];
>
> const -- With these fixed:
>
> Reviewed-by: Francisco Jerez <currojerez at riseup.net>
>
>> +        surf_index = fs_reg(index);
>> +        brw_mark_surface_used(prog_data, index);
>>        } else {
>>           /* The block index is not a constant. Evaluate the index expression
>>            * per-channel and add the base UBO index; we have to select a value
>> -- 
>> 1.9.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151030/7d59ec65/attachment.sig>


More information about the mesa-dev mailing list