[Mesa-dev] [PATCH 02/10] swrast: rename texture fetch functions (pt. 1)

Ian Romanick idr at freedesktop.org
Mon Apr 7 08:17:02 PDT 2014


On 04/05/2014 03:50 PM, Brian Paul wrote:
> Rename functions to match format names.
> 
> sed commands:
> s/signed_rgba8888_rev/R8G8B8A8_SNORM/g
> s/signed_rgba8888/A8B8G8R8_SNORM/g
> s/f_rgba8888_rev/R8G8B8A_UNORM/g
> s/f_rgba8888/A8B8G8R8_UNORM/g
> s/f_rgbx8888_rev/R8G8B8X8_UNORM/g
> s/f_rgbx8888/X8B8G8R8_UNORM/g
> s/f_argb8888_rev/A8R8G8B8_UNORM/g
> s/f_argb8888/B8G8R8A8_UNORM/g
> s/f_xrgb8888_rev/X8R8G8B8_UNORM/g
> s/f_xrgb8888/B8G8R8X8_UNORM/g
> s/signed_rgbx8888/X8B8G8R8_SNORM/g
> ---
>  src/mesa/swrast/s_texfetch.c     |   66 +++++++++++++++++++-------------------
>  src/mesa/swrast/s_texfetch_tmp.h |   22 ++++++-------
>  2 files changed, 44 insertions(+), 44 deletions(-)
> 
> diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
> index cd09827..e041dd5 100644
> --- a/src/mesa/swrast/s_texfetch.c
> +++ b/src/mesa/swrast/s_texfetch.c
> @@ -151,51 +151,51 @@ texfetch_funcs[] =
>     /* Packed unorm formats */
>     {
>        MESA_FORMAT_A8B8G8R8_UNORM,
> -      fetch_texel_1d_f_rgba8888,
> -      fetch_texel_2d_f_rgba8888,
> -      fetch_texel_3d_f_rgba8888
> +      fetch_texel_1d_A8B8G8R8_UNORM,
> +      fetch_texel_2d_A8B8G8R8_UNORM,
> +      fetch_texel_3d_A8B8G8R8_UNORM
>     },

At the end, is it also worth wrapping this in a macro?

#define FETCH_FUNCS(name) {        \
      MESA_FORMAT_ ## name,        \
      fetch_texel_1d_ ## name,     \
      fetch_texel_2d_ ## name,     \
      fetch_texel_3d_ ## name,     \
   }

>     {
>        MESA_FORMAT_X8B8G8R8_UNORM,
> -      fetch_texel_1d_f_rgbx8888,
> -      fetch_texel_2d_f_rgbx8888,
> -      fetch_texel_3d_f_rgbx8888
> +      fetch_texel_1d_X8B8G8R8_UNORM,
> +      fetch_texel_2d_X8B8G8R8_UNORM,
> +      fetch_texel_3d_X8B8G8R8_UNORM
>     },
>     {
>        MESA_FORMAT_R8G8B8A8_UNORM,
> -      fetch_texel_1d_f_rgba8888_rev,
> -      fetch_texel_2d_f_rgba8888_rev,
> -      fetch_texel_3d_f_rgba8888_rev
> +      fetch_texel_1d_R8G8B8A_UNORM,
> +      fetch_texel_2d_R8G8B8A_UNORM,
> +      fetch_texel_3d_R8G8B8A_UNORM
>     },
>     {
>        MESA_FORMAT_R8G8B8X8_UNORM,
> -      fetch_texel_1d_f_rgbx8888_rev,
> -      fetch_texel_2d_f_rgbx8888_rev,
> -      fetch_texel_3d_f_rgbx8888_rev
> +      fetch_texel_1d_R8G8B8X8_UNORM,
> +      fetch_texel_2d_R8G8B8X8_UNORM,
> +      fetch_texel_3d_R8G8B8X8_UNORM
>     },
>     {
>        MESA_FORMAT_B8G8R8A8_UNORM,
> -      fetch_texel_1d_f_argb8888,
> -      fetch_texel_2d_f_argb8888,
> -      fetch_texel_3d_f_argb8888
> +      fetch_texel_1d_B8G8R8A8_UNORM,
> +      fetch_texel_2d_B8G8R8A8_UNORM,
> +      fetch_texel_3d_B8G8R8A8_UNORM
>     },
>     {
>        MESA_FORMAT_B8G8R8X8_UNORM,
> -      fetch_texel_1d_f_xrgb8888,
> -      fetch_texel_2d_f_xrgb8888,
> -      fetch_texel_3d_f_xrgb8888
> +      fetch_texel_1d_B8G8R8X8_UNORM,
> +      fetch_texel_2d_B8G8R8X8_UNORM,
> +      fetch_texel_3d_B8G8R8X8_UNORM
>     },
>     {
>        MESA_FORMAT_A8R8G8B8_UNORM,
> -      fetch_texel_1d_f_argb8888_rev,
> -      fetch_texel_2d_f_argb8888_rev,
> -      fetch_texel_3d_f_argb8888_rev
> +      fetch_texel_1d_A8R8G8B8_UNORM,
> +      fetch_texel_2d_A8R8G8B8_UNORM,
> +      fetch_texel_3d_A8R8G8B8_UNORM
>     },
>     {
>        MESA_FORMAT_X8R8G8B8_UNORM,
> -      fetch_texel_1d_f_xrgb8888_rev,
> -      fetch_texel_2d_f_xrgb8888_rev,
> -      fetch_texel_3d_f_xrgb8888_rev
> +      fetch_texel_1d_X8R8G8B8_UNORM,
> +      fetch_texel_2d_X8R8G8B8_UNORM,
> +      fetch_texel_3d_X8R8G8B8_UNORM
>     },
>     {
>        MESA_FORMAT_L16A16_UNORM,
> @@ -467,21 +467,21 @@ texfetch_funcs[] =
>     /* Packed signed/normalized formats */
>     {
>        MESA_FORMAT_A8B8G8R8_SNORM,
> -      fetch_texel_1d_signed_rgba8888,
> -      fetch_texel_2d_signed_rgba8888,
> -      fetch_texel_3d_signed_rgba8888
> +      fetch_texel_1d_A8B8G8R8_SNORM,
> +      fetch_texel_2d_A8B8G8R8_SNORM,
> +      fetch_texel_3d_A8B8G8R8_SNORM
>     },
>     {
>        MESA_FORMAT_X8B8G8R8_SNORM,
> -      fetch_texel_1d_signed_rgbx8888,
> -      fetch_texel_2d_signed_rgbx8888,
> -      fetch_texel_3d_signed_rgbx8888
> +      fetch_texel_1d_X8B8G8R8_SNORM,
> +      fetch_texel_2d_X8B8G8R8_SNORM,
> +      fetch_texel_3d_X8B8G8R8_SNORM
>     },
>     {
>        MESA_FORMAT_R8G8B8A8_SNORM,
> -      fetch_texel_1d_signed_rgba8888_rev,
> -      fetch_texel_2d_signed_rgba8888_rev,
> -      fetch_texel_3d_signed_rgba8888_rev
> +      fetch_texel_1d_R8G8B8A8_SNORM,
> +      fetch_texel_2d_R8G8B8A8_SNORM,
> +      fetch_texel_3d_R8G8B8A8_SNORM
>     },
>     {
>        MESA_FORMAT_R8G8B8X8_SNORM,
> diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
> index f749b49..0acbe4f 100644
> --- a/src/mesa/swrast/s_texfetch_tmp.h
> +++ b/src/mesa/swrast/s_texfetch_tmp.h
> @@ -391,7 +391,7 @@ static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_A8B8G8R8_UNORM ******************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
> -static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
> +static void FETCH(A8B8G8R8_UNORM)( const struct swrast_texture_image *texImage,
>                                 GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -409,7 +409,7 @@ static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_RGBA888_REV ***************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
> -static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
> +static void FETCH(R8G8B8A_UNORM)( const struct swrast_texture_image *texImage,
>                                     GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -425,7 +425,7 @@ static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_B8G8R8A8_UNORM ******************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
> -static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
> +static void FETCH(B8G8R8A8_UNORM)( const struct swrast_texture_image *texImage,
>                                 GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -441,7 +441,7 @@ static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_A8R8G8B8_UNORM **************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
> -static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
> +static void FETCH(A8R8G8B8_UNORM)( const struct swrast_texture_image *texImage,
>                                     GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -457,7 +457,7 @@ static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_X8B8G8R8_UNORM ******************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D rgbx8888 texture, return 4 GLfloats */
> -static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage,
> +static void FETCH(X8B8G8R8_UNORM)( const struct swrast_texture_image *texImage,
>                                 GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -473,7 +473,7 @@ static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_RGBX888_REV ***************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D rgbx8888_rev texture, return 4 GLchans */
> -static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage,
> +static void FETCH(R8G8B8X8_UNORM)( const struct swrast_texture_image *texImage,
>                                     GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -489,7 +489,7 @@ static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_B8G8R8X8_UNORM ******************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */
> -static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
> +static void FETCH(B8G8R8X8_UNORM)( const struct swrast_texture_image *texImage,
>                                 GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -505,7 +505,7 @@ static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
>  /* MESA_FORMAT_X8R8G8B8_UNORM **************************************************/
>  
>  /* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
> -static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage,
> +static void FETCH(X8R8G8B8_UNORM)( const struct swrast_texture_image *texImage,
>                                     GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -1269,7 +1269,7 @@ static void FETCH(signed_al88)( const struct swrast_texture_image *texImage,
>  
>  /* MESA_FORMAT_X8B8G8R8_SNORM ***********************************************/
>  
> -static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
> +static void FETCH(X8B8G8R8_SNORM)( const struct swrast_texture_image *texImage,
>  			            GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -1284,7 +1284,7 @@ static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
>  
>  /* MESA_FORMAT_A8B8G8R8_SNORM ***********************************************/
>  
> -static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
> +static void FETCH(A8B8G8R8_SNORM)( const struct swrast_texture_image *texImage,
>  			            GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> @@ -1296,7 +1296,7 @@ static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
>  
>  
>  
> -static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texImage,
> +static void FETCH(R8G8B8A8_SNORM)( const struct swrast_texture_image *texImage,
>                                          GLint i, GLint j, GLint k, GLfloat *texel )
>  {
>     const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> 



More information about the mesa-dev mailing list