[Mesa-dev] [PATCH 2/2] mesa: Always return a value in _mesa_format_from_format_and_type
Iago Toral
itoral at igalia.com
Mon May 4 06:51:05 PDT 2015
On Mon, 2015-05-04 at 05:52 -0700, Jason Ekstrand wrote:
>
> On May 4, 2015 4:25 AM, "Iago Toral Quiroga" <itoral at igalia.com>
> wrote:
> >
> > Return MESA_FORMAT_NONE if no matching type was found. We have an
> > assertion here, but we should return something anyway to avoid
> > confusion with non-debug builds.
> > ---
> > src/mesa/main/glformats.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> > index 8ced579..fddd048 100644
> > --- a/src/mesa/main/glformats.c
> > +++ b/src/mesa/main/glformats.c
> > @@ -2752,4 +2752,5 @@ _mesa_format_from_format_and_type(GLenum
> format, GLenum type)
> > * format in that case.
> > */
> > unreachable("Unsupported format");
> > + return MESA_FORMAT_NONE;
>
> If we want this to have well-defined results, this should not be an
> unreachable(). The semantics of unreachable allow the compiler to
> generate wrong code for the case where it does get reached. We could
> switch it to an assert or we could just drop this patch. I'd be a fan
> of the latter.
> --Jason
Ok, let's drop this patch then.
Iago
More information about the mesa-dev
mailing list