[Mesa-dev] [PATCH v2 03/12] tgsi/build: always generate two-dimensional constant file accesses

Timothy Arceri tarceri at itsqueeze.com
Tue Aug 29 00:43:45 UTC 2017



On 29/08/17 10:22, Timothy Arceri wrote:
> On 28/08/17 18:58, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> ---
>>   src/gallium/auxiliary/tgsi/tgsi_build.c     | 11 +++++
>>   src/gallium/auxiliary/tgsi/tgsi_transform.h | 65 
>> +++++++++++++++--------------
>>   2 files changed, 45 insertions(+), 31 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c 
>> b/src/gallium/auxiliary/tgsi/tgsi_build.c
>> index 144a0177689..0c4ec8d1cf9 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_build.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
>> @@ -156,20 +156,30 @@ static struct tgsi_declaration_range
>>   tgsi_default_declaration_range( void )
>>   {
>>      struct tgsi_declaration_range dr;
>>      dr.First = 0;
>>      dr.Last = 0;
>>      return dr;
>>   }
>> +static struct tgsi_declaration_dimension
>> +tgsi_default_declaration_dimension()
>> +{
>> +   struct tgsi_declaration_dimension dim;
>> +
>> +   dim.Index2D = 0;
>> +
>> +   return dim;
>> +}
>> +
>>   static struct tgsi_declaration_range
>>   tgsi_build_declaration_range(
>>      unsigned first,
>>      unsigned last,
>>      struct tgsi_declaration *declaration,
>>      struct tgsi_header *header )
>>   {
>>      struct tgsi_declaration_range declaration_range;
>>      assert( last >= first );
>> @@ -374,20 +384,21 @@ tgsi_build_declaration_array(unsigned arrayid,
>>      return da;
>>   }
>>   struct tgsi_full_declaration
>>   tgsi_default_full_declaration( void )
>>   {
>>      struct tgsi_full_declaration  full_declaration;
>>      full_declaration.Declaration  = tgsi_default_declaration();
>>      full_declaration.Range = tgsi_default_declaration_range();
>> +   full_declaration.Dim = tgsi_default_declaration_dimension();
>>      full_declaration.Semantic = tgsi_default_declaration_semantic();
>>      full_declaration.Interp = tgsi_default_declaration_interp();
>>      full_declaration.Image = tgsi_default_declaration_image();
>>      full_declaration.SamplerView = 
>> tgsi_default_declaration_sampler_view();
>>      full_declaration.Array = tgsi_default_declaration_array();
>>      return full_declaration;
>>   }
>>   unsigned
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.h 
>> b/src/gallium/auxiliary/tgsi/tgsi_transform.h
>> index 7ea82066fcf..e4da0f5debc 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_transform.h
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.h
>> @@ -117,20 +117,22 @@ tgsi_transform_temp_decl(struct 
>> tgsi_transform_context *ctx,
>>   static inline void
>>   tgsi_transform_const_decl(struct tgsi_transform_context *ctx,
>>                             unsigned firstIdx, unsigned lastIdx)
>>   {
>>      struct tgsi_full_declaration decl;
>>      decl = tgsi_default_full_declaration();
>>      decl.Declaration.File = TGSI_FILE_CONSTANT;
>>      decl.Range.First = firstIdx;
>>      decl.Range.Last = lastIdx;
>> +   decl.Declaration.Dimension = 1;
> 
> So for struct tgsi_declaration, struct tgsi_src_register and struct 
> tgsi_dst_register we have:
> 
> unsigned File        : 4;  /* TGSI_FILE_ */
> ...
> unsigned Dimension   : 1;  /* BOOL */
> 
> So we should be able to eliminate Dimension and just use File as we can 
> now imply Dimension == 1 when File == TGSI_FILE_CONSTANT
> 
> There is also a bool in struct tgsi_dimension which seems slightly odd 
> to me (without looking how its used), we might be able to remove this also.
> 
> I'm happy to see these changes as a follow-up patch so you don't have to 
> go back and rework the series, but I'd like to see it done before the 
> series is pushed so we don't forget to clean it up.

Ignore this I just noticed Dimension is still used for other things such 
as input/outputs.


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