[Mesa-dev] [PATCH 4/5] mesa: replace _mesa_problem() with unreachable() in mipmap.c

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon May 15 10:12:09 UTC 2017



On 05/09/2017 05:04 AM, Timothy Arceri wrote:
> ---
>   src/mesa/main/mipmap.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
> index 8745dd9..fc36d40 100644
> --- a/src/mesa/main/mipmap.c
> +++ b/src/mesa/main/mipmap.c
> @@ -750,21 +750,21 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
>              i++, j += colStride, k += colStride) {
>            GLuint z = ((rowA[j] & 0xffffff) + (rowA[k] & 0xffffff) +
>                        (rowB[j] & 0xffffff) + (rowB[k] & 0xffffff)) / 4;
>            GLuint s = (((rowA[j] >> 24) + (rowA[k] >> 24) +
>                         (rowB[j] >> 24) + (rowB[k] >> 24)) / 4) << 24;
>            dst[i] = z | s;
>         }
>      }
>   
>      else {
> -      _mesa_problem(NULL, "bad format in do_row()");
> +      unreachable("bad format in do_row()");
>      }
>   }

WoW, this function is crazy! :)

>   
>   
>   /**
>    * Average together four rows of a source image to produce a single new
>    * row in the dest image.  It's legal for the two source rows to point
>    * to the same data.  The source width must be equal to either the
>    * dest width or two times the dest width.
>    *
> @@ -1394,21 +1394,21 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
>      else if (datatype == GL_FLOAT_32_UNSIGNED_INT_24_8_REV && comps == 1) {
>         DECLARE_ROW_POINTERS(GLfloat, 2);
>   
>         for (i = j = 0, k = k0; i < (GLuint) dstWidth;
>              i++, j += colStride, k += colStride) {
>            FILTER_F_3D(0);
>         }
>      }
>   
>      else {
> -      _mesa_problem(NULL, "bad format in do_row()");
> +      unreachable("bad format in do_row()");
>      }
>   }
>   
>   
>   /*
>    * These functions generate a 1/2-size mipmap image from a source image.
>    * Texture borders are handled by copying or averaging the source image's
>    * border texels, depending on the scale-down factor.
>    */
>   
> @@ -1747,22 +1747,21 @@ _mesa_generate_mipmap_level(GLenum target,
>   	 make_2d_mipmap(datatype, comps, border,
>   			srcWidth, srcHeight, srcData[i], srcRowStride,
>   			dstWidth, dstHeight, dstData[i], dstRowStride);
>         }
>         break;
>      case GL_TEXTURE_RECTANGLE_NV:
>      case GL_TEXTURE_EXTERNAL_OES:
>         /* no mipmaps, do nothing */
>         break;
>      default:
> -      _mesa_problem(NULL, "bad tex target in _mesa_generate_mipmaps");
> -      return;
> +      unreachable("bad tex target in _mesa_generate_mipmaps");
>      }
>   }
>   
>   
>   /**
>    * compute next (level+1) image size
>    * \return GL_FALSE if no smaller size can be generated (eg. src is 1x1x1 size)
>    */
>   GLboolean
>   _mesa_next_mipmap_level_size(GLenum target, GLint border,
> 


More information about the mesa-dev mailing list