summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-03-30 09:17:20 +0800
committerChia-I Wu <olv@lunarg.com>2010-03-30 11:20:53 +0800
commitc1a392ac4c6a7da4026653de556c2c7698f86860 (patch)
treefb27ed7f708fa648e190a44242d26bdd48146686 /src/gallium
parent8c6f71e01e40075156c8b83f2c5e15ab73e66036 (diff)
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.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/glx/xlib/glx_api.c4
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 4930cd6cd5..eb8d6a1933 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -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;
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 3022d45157..fd03d3c46a 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -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);