[Mesa-dev] [PATCH 1/8] tgsi: add ureg support for image decls

Ilia Mirkin imirkin at alum.mit.edu
Sat Jan 2 23:40:45 PST 2016


On Sun, Jan 3, 2016 at 2:33 AM,  <eocallaghan at alterapraxis.com> wrote:
> There is quite a bit of rename churn happening here at the same time as the
> bring up of ureg support for image declarations.
> Would it be possible to split the rename churn out from the actual
> behavioral changes please?

This is almost exclusively a rename. The only other thing is adding
the format to the tgsi_declaration_image (formerly
tgsi_declaration_resource) and a couple of ureg helpers. I don't think
it's really worth splitting apart, although if others feel similarly I
can go back and do it.

>
>
> On 2016-01-03 15:37, Ilia Mirkin wrote:
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>  src/gallium/auxiliary/tgsi/tgsi_build.c            | 62 +++++++++--------
>>  src/gallium/auxiliary/tgsi/tgsi_dump.c             | 10 +--
>>  src/gallium/auxiliary/tgsi/tgsi_parse.c            |  4 +-
>>  src/gallium/auxiliary/tgsi/tgsi_parse.h            |  2 +-
>>  src/gallium/auxiliary/tgsi/tgsi_strings.c          |  4 +-
>>  src/gallium/auxiliary/tgsi/tgsi_text.c             | 10 +--
>>  src/gallium/auxiliary/tgsi/tgsi_ureg.c             | 77
>> ++++++++++++++++++++++
>>  src/gallium/auxiliary/tgsi/tgsi_ureg.h             |  7 ++
>>  src/gallium/drivers/ilo/shader/toy_tgsi.c          |  8 +--
>>  .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp  | 12 +++-
>>  src/gallium/drivers/svga/svga_tgsi_vgpu10.c        |  2 +
>>  src/gallium/include/pipe/p_shader_tokens.h         |  7 +-
>>  12 files changed, 153 insertions(+), 52 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c
>> b/src/gallium/auxiliary/tgsi/tgsi_build.c
>> index fdb7feb..bb9d0cb 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_build.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
>> @@ -259,36 +259,39 @@ tgsi_build_declaration_semantic(
>>     return ds;
>>  }
>>
>> -static struct tgsi_declaration_resource
>> -tgsi_default_declaration_resource(void)
>> +static struct tgsi_declaration_image
>> +tgsi_default_declaration_image(void)
>>  {
>> -   struct tgsi_declaration_resource dr;
>> +   struct tgsi_declaration_image di;
>>
>> -   dr.Resource = TGSI_TEXTURE_BUFFER;
>> -   dr.Raw = 0;
>> -   dr.Writable = 0;
>> -   dr.Padding = 0;
>> +   di.Resource = TGSI_TEXTURE_BUFFER;
>> +   di.Raw = 0;
>> +   di.Writable = 0;
>> +   di.Format = 0;
>> +   di.Padding = 0;
>>
>> -   return dr;
>> +   return di;
>>  }
>>
>> -static struct tgsi_declaration_resource
>> -tgsi_build_declaration_resource(unsigned texture,
>> -                                unsigned raw,
>> -                                unsigned writable,
>> -                                struct tgsi_declaration *declaration,
>> -                                struct tgsi_header *header)
>> +static struct tgsi_declaration_image
>> +tgsi_build_declaration_image(unsigned texture,
>> +                             unsigned format,
>> +                             unsigned raw,
>> +                             unsigned writable,
>> +                             struct tgsi_declaration *declaration,
>> +                             struct tgsi_header *header)
>>  {
>> -   struct tgsi_declaration_resource dr;
>> +   struct tgsi_declaration_image di;
>>
>> -   dr = tgsi_default_declaration_resource();
>> -   dr.Resource = texture;
>> -   dr.Raw = raw;
>> -   dr.Writable = writable;
>> +   di = tgsi_default_declaration_image();
>> +   di.Resource = texture;
>> +   di.Format = format;
>> +   di.Raw = raw;
>> +   di.Writable = writable;
>>
>>     declaration_grow(declaration, header);
>>
>> -   return dr;
>> +   return di;
>>  }
>>
>>  static struct tgsi_declaration_sampler_view
>> @@ -364,7 +367,7 @@ tgsi_default_full_declaration( void )
>>     full_declaration.Range = tgsi_default_declaration_range();
>>     full_declaration.Semantic = tgsi_default_declaration_semantic();
>>     full_declaration.Interp = tgsi_default_declaration_interp();
>> -   full_declaration.Resource = tgsi_default_declaration_resource();
>> +   full_declaration.Image = tgsi_default_declaration_image();
>>     full_declaration.SamplerView =
>> tgsi_default_declaration_sampler_view();
>>     full_declaration.Array = tgsi_default_declaration_array();
>>
>> @@ -454,20 +457,21 @@ tgsi_build_full_declaration(
>>           header );
>>     }
>>
>> -   if (full_decl->Declaration.File == TGSI_FILE_RESOURCE) {
>> -      struct tgsi_declaration_resource *dr;
>> +   if (full_decl->Declaration.File == TGSI_FILE_IMAGE) {
>> +      struct tgsi_declaration_image *di;
>>
>>        if (maxsize <= size) {
>>           return  0;
>>        }
>> -      dr = (struct tgsi_declaration_resource *)&tokens[size];
>> +      di = (struct tgsi_declaration_image *)&tokens[size];
>>        size++;
>>
>> -      *dr = tgsi_build_declaration_resource(full_decl->Resource.Resource,
>> -                                            full_decl->Resource.Raw,
>> -                                            full_decl->Resource.Writable,
>> -                                            declaration,
>> -                                            header);
>> +      *di = tgsi_build_declaration_image(full_decl->Image.Resource,
>> +                                         full_decl->Image.Format,
>> +                                         full_decl->Image.Raw,
>> +                                         full_decl->Image.Writable,
>> +                                         declaration,
>> +                                         header);
>>     }
>>
>>     if (full_decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
>> b/src/gallium/auxiliary/tgsi/tgsi_dump.c
>> index e29ffb3..dad3839 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
>> @@ -348,12 +348,14 @@ iter_declaration(
>>        }
>>     }
>>
>> -   if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
>> +   if (decl->Declaration.File == TGSI_FILE_IMAGE) {
>>        TXT(", ");
>> -      ENM(decl->Resource.Resource, tgsi_texture_names);
>> -      if (decl->Resource.Writable)
>> +      ENM(decl->Image.Resource, tgsi_texture_names);
>> +      TXT(", ");
>> +      UID(decl->Image.Format);
>> +      if (decl->Image.Writable)
>>           TXT(", WR");
>> -      if (decl->Resource.Raw)
>> +      if (decl->Image.Raw)
>>           TXT(", RAW");
>>     }
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c
>> b/src/gallium/auxiliary/tgsi/tgsi_parse.c
>> index 0729b5d..9a52bbb 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
>> @@ -121,8 +121,8 @@ tgsi_parse_token(
>>           next_token( ctx, &decl->Semantic );
>>        }
>>
>> -      if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
>> -         next_token(ctx, &decl->Resource);
>> +      if (decl->Declaration.File == TGSI_FILE_IMAGE) {
>> +         next_token(ctx, &decl->Image);
>>        }
>>
>>        if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h
>> b/src/gallium/auxiliary/tgsi/tgsi_parse.h
>> index 35e1c7c..5ed1a83 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h
>> @@ -64,7 +64,7 @@ struct tgsi_full_declaration
>>     struct tgsi_declaration_dimension Dim;
>>     struct tgsi_declaration_interp Interp;
>>     struct tgsi_declaration_semantic Semantic;
>> -   struct tgsi_declaration_resource Resource;
>> +   struct tgsi_declaration_image Image;
>>     struct tgsi_declaration_sampler_view SamplerView;
>>     struct tgsi_declaration_array Array;
>>  };
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c
>> b/src/gallium/auxiliary/tgsi/tgsi_strings.c
>> index fd926b3..ae30399 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
>> @@ -54,8 +54,8 @@ static const char *tgsi_file_names[] =
>>     "IMM",
>>     "PRED",
>>     "SV",
>> -   "RES",
>> -   "SVIEW"
>> +   "IMAGE",
>> +   "SVIEW",
>>  };
>>
>>  const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
>> b/src/gallium/auxiliary/tgsi/tgsi_text.c
>> index 4a82c9b..a45ab90 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
>> @@ -1251,10 +1251,10 @@ static boolean parse_declaration( struct
>> translate_ctx *ctx )
>>
>>        cur++;
>>        eat_opt_white( &cur );
>> -      if (file == TGSI_FILE_RESOURCE) {
>> +      if (file == TGSI_FILE_IMAGE) {
>>           for (i = 0; i < TGSI_TEXTURE_COUNT; i++) {
>>              if (str_match_nocase_whole(&cur, tgsi_texture_names[i])) {
>> -               decl.Resource.Resource = i;
>> +               decl.Image.Resource = i;
>>                 break;
>>              }
>>           }
>> @@ -1263,16 +1263,18 @@ static boolean parse_declaration( struct
>> translate_ctx *ctx )
>>              return FALSE;
>>           }
>>
>> +         /* XXX format */
>
>
> Something more meaningful here perhaps?

Is there something confusing about this note? This is a note to a
future implementer that the format should be dealt with here. Pretty
standard notation.

  -ilia


More information about the mesa-dev mailing list