[Mesa-dev] [PATCH 04/12] gallium/util: improve dump functions

Marek Olšák maraeo at gmail.com
Tue Jul 21 07:17:14 PDT 2015


On Tue, Jul 21, 2015 at 3:56 PM, Brian Paul <brianp at vmware.com> wrote:
> Just a couple minor nits...
>
> On 07/16/2015 10:54 AM, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>   src/gallium/auxiliary/util/u_dump.h         |  20 ++-
>>   src/gallium/auxiliary/util/u_dump_defines.c |  41 +++++
>>   src/gallium/auxiliary/util/u_dump_state.c   | 233
>> ++++++++++++++++++++++------
>>   3 files changed, 241 insertions(+), 53 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/util/u_dump.h
>> b/src/gallium/auxiliary/util/u_dump.h
>> index 3ddf518..1c0e879 100644
>> --- a/src/gallium/auxiliary/util/u_dump.h
>> +++ b/src/gallium/auxiliary/util/u_dump.h
>> @@ -88,14 +88,16 @@ util_dump_tex_filter(unsigned value, boolean
>> shortened);
>>   const char *
>>   util_dump_query_type(unsigned value, boolean shortened);
>>
>> +const char *
>> +util_dump_mode(unsigned value, boolean shortened);
>
>
> Maybe util_dump_prim_mode().  And maybe I'm confused, but I don't see the
> implementation of this function in the .c file.

The DEFINE_UTIL_DUMP_CONTINUOUS macro does that.

>
>
>
>> +
>>
>>   /*
>>    * p_state.h, through a FILE
>>    */
>>
>>   void
>> -util_dump_template(FILE *stream,
>> -                   const struct pipe_resource *templat);
>> +util_dump_resource(FILE *stream, const struct pipe_resource *state);
>>
>>   void
>>   util_dump_rasterizer_state(FILE *stream,
>> @@ -157,10 +159,20 @@ void
>>   util_dump_image_view(FILE *stream, const struct pipe_image_view *state);
>>
>>   void
>> +util_dump_sampler_view(FILE *stream, const struct pipe_sampler_view
>> *state);
>> +
>> +void
>>   util_dump_transfer(FILE *stream,
>>                      const struct pipe_transfer *state);
>>
>>   void
>> +util_dump_constant_buffer(FILE *stream,
>> +                          const struct pipe_constant_buffer *state);
>> +
>> +void
>> +util_dump_index_buffer(FILE *stream, const struct pipe_index_buffer
>> *state);
>> +
>> +void
>>   util_dump_vertex_buffer(FILE *stream,
>>                           const struct pipe_vertex_buffer *state);
>>
>> @@ -169,6 +181,10 @@ util_dump_vertex_element(FILE *stream,
>>                            const struct pipe_vertex_element *state);
>>
>>   void
>> +util_dump_stream_output_target(FILE *stream,
>> +                               const struct pipe_stream_output_target
>> *state);
>> +
>> +void
>>   util_dump_draw_info(FILE *stream, const struct pipe_draw_info *state);
>>
>>   void
>> diff --git a/src/gallium/auxiliary/util/u_dump_defines.c
>> b/src/gallium/auxiliary/util/u_dump_defines.c
>> index 03fd15d..9021887 100644
>> --- a/src/gallium/auxiliary/util/u_dump_defines.c
>> +++ b/src/gallium/auxiliary/util/u_dump_defines.c
>> @@ -392,3 +392,44 @@ util_dump_query_type_short_names[] = {
>>   };
>>
>>   DEFINE_UTIL_DUMP_CONTINUOUS(query_type)
>> +
>> +
>> +static const char *
>> +util_dump_mode_names[] = {
>> +   "PIPE_PRIM_POINTS",
>> +   "PIPE_PRIM_LINES",
>> +   "PIPE_PRIM_LINE_LOOP",
>> +   "PIPE_PRIM_LINE_STRIP",
>> +   "PIPE_PRIM_TRIANGLES",
>> +   "PIPE_PRIM_TRIANGLE_STRIP",
>> +   "PIPE_PRIM_TRIANGLE_FAN",
>> +   "PIPE_PRIM_QUADS",
>> +   "PIPE_PRIM_QUAD_STRIP",
>> +   "PIPE_PRIM_POLYGON",
>> +   "PIPE_PRIM_LINES_ADJACENCY",
>> +   "PIPE_PRIM_LINE_STRIP_ADJACENCY",
>> +   "PIPE_PRIM_TRIANGLES_ADJACENCY",
>> +   "PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY",
>> +   "PIPE_PRIM_PATCHES",
>> +};
>> +
>> +static const char *
>> +util_dump_mode_short_names[] = {
>> +   "points",
>> +   "lines",
>> +   "line_loop",
>> +   "line_strip",
>> +   "triangles",
>> +   "triangle_strip",
>> +   "triangle_fan",
>> +   "quads",
>> +   "quad_strip",
>> +   "polygon",
>> +   "lines_adjacency",
>> +   "line_strip_adjacency",
>> +   "triangles_adjacency",
>> +   "triangle_strip_adjacency",
>> +   "patches",
>> +};
>> +
>> +DEFINE_UTIL_DUMP_CONTINUOUS(mode)
>> diff --git a/src/gallium/auxiliary/util/u_dump_state.c
>> b/src/gallium/auxiliary/util/u_dump_state.c
>> index b4c92f0..58f8cbe 100644
>> --- a/src/gallium/auxiliary/util/u_dump_state.c
>> +++ b/src/gallium/auxiliary/util/u_dump_state.c
>> @@ -247,6 +247,42 @@ util_dump_enum_func(FILE *stream, unsigned value)
>>      util_dump_enum(stream, util_dump_func(value, TRUE));
>>   }
>>
>> +static void
>> +util_dump_enum_mode(FILE *stream, unsigned value)
>> +{
>> +   util_dump_enum(stream, util_dump_mode(value, TRUE));
>> +}
>> +
>> +static void
>> +util_dump_enum_tex_target(FILE *stream, unsigned value)
>> +{
>> +   util_dump_enum(stream, util_dump_tex_target(value, TRUE));
>> +}
>> +
>> +static void
>> +util_dump_enum_tex_filter(FILE *stream, unsigned value)
>> +{
>> +   util_dump_enum(stream, util_dump_tex_filter(value, TRUE));
>> +}
>> +
>> +static void
>> +util_dump_enum_tex_mipfilter(FILE *stream, unsigned value)
>> +{
>> +   util_dump_enum(stream, util_dump_tex_mipfilter(value, TRUE));
>> +}
>> +
>> +static void
>> +util_dump_enum_tex_wrap(FILE *stream, unsigned value)
>> +{
>> +   util_dump_enum(stream, util_dump_tex_wrap(value, TRUE));
>> +}
>> +
>> +static void
>> +util_dump_enum_stencil_op(FILE *stream, unsigned value)
>> +{
>> +   util_dump_enum(stream, util_dump_stencil_op(value, TRUE));
>> +}
>> +
>>
>>   /*
>>    * Public functions
>> @@ -254,38 +290,28 @@ util_dump_enum_func(FILE *stream, unsigned value)
>>
>>
>>   void
>> -util_dump_template(FILE *stream, const struct pipe_resource *templat)
>> +util_dump_resource(FILE *stream, const struct pipe_resource *state)
>>   {
>> -   if(!templat) {
>> +   if(!state) {
>
>
> Space after 'if' here and below.

OK. FYI, that was copied from other functions. None of them have space
after "if". :)

Marek


More information about the mesa-dev mailing list