[Mesa-dev] [PATCH 4/4] mesa/formats: refactor by globbing on types in switch statement
Emil Velikov
emil.l.velikov at gmail.com
Thu Aug 20 11:34:56 PDT 2015
2015-08-12 0:07 GMT+01:00 Nanley Chery <nanleychery at gmail.com>:
> From: Nanley Chery <nanley.g.chery at intel.com>
>
> Combine the adjacent cases which have the same GL type in the switch statemnt.
>
> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
> src/mesa/main/formats.c | 152 ++++++------------------------------------------
> 1 file changed, 17 insertions(+), 135 deletions(-)
>
> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> index cb5ad21..9b9d79b 100644
> --- a/src/mesa/main/formats.c
> +++ b/src/mesa/main/formats.c
> @@ -1005,13 +1005,10 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format,
> case MESA_FORMAT_R8G8B8X8_UNORM:
> case MESA_FORMAT_B8G8R8X8_UNORM:
> case MESA_FORMAT_X8R8G8B8_UNORM:
> - *datatype = GL_UNSIGNED_BYTE;
> - *comps = 4;
> - return;
> case MESA_FORMAT_BGR_UNORM8:
> case MESA_FORMAT_RGB_UNORM8:
> *datatype = GL_UNSIGNED_BYTE;
> - *comps = 3;
> + *comps = _mesa_format_num_components(format);
With the datatype aside what is stopping us from using a single
_mesa_format_num_components(format) ?
Thanks
Emil
More information about the mesa-dev
mailing list