summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-01-02 21:56:13 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-12 10:55:35 +0800
commit3bcb08f6c472b3a7cd752c740b3bbe72c90520fd (patch)
treea89c6ebdfb27a62917da7274900c4dc41b0f32d7 /progs
parent033bd95802448bc82fd6f2ebc722ff1306b578ec (diff)
progs: Check the number of configs returned by eglChooseConfig.
A successful eglChooseConfig call does not imply there are valid configs. Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Diffstat (limited to 'progs')
-rw-r--r--progs/egl/xegl_tri.c3
-rw-r--r--progs/egl/xeglbindtex.c6
-rw-r--r--progs/egl/xeglthreads.c3
-rw-r--r--progs/openvg/demos/eglcommon.c4
-rw-r--r--progs/openvg/demos/lion.c4
-rw-r--r--progs/openvg/trivial/eglcommon.c4
6 files changed, 14 insertions, 10 deletions
diff --git a/progs/egl/xegl_tri.c b/progs/egl/xegl_tri.c
index 8c4d7f973c..1f1a005a21 100644
--- a/progs/egl/xegl_tri.c
+++ b/progs/egl/xegl_tri.c
@@ -139,7 +139,8 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) ||
+ !num_configs) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
diff --git a/progs/egl/xeglbindtex.c b/progs/egl/xeglbindtex.c
index 8103a6a148..7e35534f8d 100644
--- a/progs/egl/xeglbindtex.c
+++ b/progs/egl/xeglbindtex.c
@@ -66,7 +66,8 @@ make_pbuffer(int width, int height)
EGLConfig config;
EGLint num_configs;
- if (!eglChooseConfig(dpy, config_attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig(dpy, config_attribs, &config, 1, &num_configs) ||
+ !num_configs) {
printf("Error: couldn't get an EGL visual config for pbuffer\n");
exit(1);
}
@@ -144,7 +145,8 @@ make_window(Display *x_dpy, const char *name,
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
- if (!eglChooseConfig(dpy, attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig(dpy, attribs, &config, 1, &num_configs) ||
+ !num_configs) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
diff --git a/progs/egl/xeglthreads.c b/progs/egl/xeglthreads.c
index 7d056ebc6f..5787faecb9 100644
--- a/progs/egl/xeglthreads.c
+++ b/progs/egl/xeglthreads.c
@@ -485,7 +485,8 @@ create_window(struct winthread *wt, EGLContext shareCtx)
scrnum = DefaultScreen(wt->Dpy);
root = RootWindow(wt->Dpy, scrnum);
- if (!eglChooseConfig(wt->Display, attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig(wt->Display, attribs, &config, 1, &num_configs) ||
+ !num_configs) {
Error("Unable to choose an EGL config");
}
diff --git a/progs/openvg/demos/eglcommon.c b/progs/openvg/demos/eglcommon.c
index dcec1ac4a4..0316e596c6 100644
--- a/progs/openvg/demos/eglcommon.c
+++ b/progs/openvg/demos/eglcommon.c
@@ -61,13 +61,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) ||
+ !num_configs) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
- assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
diff --git a/progs/openvg/demos/lion.c b/progs/openvg/demos/lion.c
index 3645b22bc5..adb269bfd8 100644
--- a/progs/openvg/demos/lion.c
+++ b/progs/openvg/demos/lion.c
@@ -86,13 +86,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) ||
+ !num_configs) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
- assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
diff --git a/progs/openvg/trivial/eglcommon.c b/progs/openvg/trivial/eglcommon.c
index dcec1ac4a4..0316e596c6 100644
--- a/progs/openvg/trivial/eglcommon.c
+++ b/progs/openvg/trivial/eglcommon.c
@@ -61,13 +61,13 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
+ if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) ||
+ !num_configs) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
- assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");