st/glx: Remove a wrong assertion in choose_pixel_format.

There are X visuals that Gallium or the code does not support.  We could
not assert the color format to be supported.  Return PIPE_FORMAT_NONE in
such cases and let the caller handle it.
This commit is contained in:
Chia-I Wu 2010-03-30 09:17:20 +08:00
parent 8c6f71e01e
commit c1a392ac4c
2 changed files with 11 additions and 2 deletions

View file

@ -1758,6 +1758,10 @@ glXGetFBConfigs( Display *dpy, int screen, int *nelements )
}
for (i = 0; i < *nelements; i++) {
results[i] = create_glx_visual(dpy, visuals + i);
if (!results[i]) {
*nelements = i;
break;
}
}
return (GLXFBConfig *) results;
}

View file

@ -327,8 +327,7 @@ choose_pixel_format(XMesaVisual v)
return PIPE_FORMAT_B5G6R5_UNORM;
}
assert(0);
return 0;
return PIPE_FORMAT_NONE;
}
@ -737,6 +736,12 @@ XMesaVisual XMesaCreateVisual( Display *display,
}
v->stvis.color_format = choose_pixel_format(v);
if (v->stvis.color_format == PIPE_FORMAT_NONE) {
FREE(v->visinfo);
FREE(v);
return NULL;
}
v->stvis.depth_stencil_format =
choose_depth_stencil_format(xmdpy, depth_size, stencil_size);