diff options
| author | Ian Elliott <ian@LunarG.com> | 2015-04-03 15:24:55 -0600 |
|---|---|---|
| committer | Ian Elliott <ian@LunarG.com> | 2015-04-03 15:24:55 -0600 |
| commit | 3979e28e2db350a42156ed127864a5d422b091ee (patch) | |
| tree | 82b08464b385a985c2f9caa85aed51dd6a810914 | |
| parent | 31aaa22fd655accfec4ea4d8c755741732cc3e3a (diff) | |
| download | usermoji-3979e28e2db350a42156ed127864a5d422b091ee.tar.xz | |
Have demos give a useful error if no compatible ICD found.
| -rw-r--r-- | demos/cube.c | 15 | ||||
| -rw-r--r-- | demos/tri.c | 15 | ||||
| -rw-r--r-- | demos/xglinfo.c | 8 |
3 files changed, 35 insertions, 3 deletions
diff --git a/demos/cube.c b/demos/cube.c index dca54328..920a542f 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -1700,7 +1700,14 @@ static void demo_init_xgl(struct demo *demo) uint32_t i; err = xglCreateInstance(&app, NULL, &demo->inst); - assert(!err); + if (err == XGL_ERROR_INCOMPATIBLE_DRIVER) { + printf("Cannot find a compatible Vulkan installable client driver " + "(ICD).\nExiting ...\n"); + fflush(stdout); + exit(1); + } else { + assert(!err); + } err = xglEnumerateGpus(demo->inst, 1, &gpu_count, &demo->gpu); assert(!err && gpu_count == 1); @@ -1727,6 +1734,12 @@ static void demo_init_connection(struct demo *demo) int scr; demo->connection = xcb_connect(NULL, &scr); + if (demo->connection == NULL) { + printf("Cannot find a compatible Vulkan installable client driver " + "(ICD).\nExiting ...\n"); + fflush(stdout); + exit(1); + } setup = xcb_get_setup(demo->connection); iter = xcb_setup_roots_iterator(setup); diff --git a/demos/tri.c b/demos/tri.c index 39b1513c..efbd1a99 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -1322,7 +1322,14 @@ static void demo_init_xgl(struct demo *demo) uint32_t i; err = xglCreateInstance(&app, NULL, &demo->inst); - assert(!err); + if (err == XGL_ERROR_INCOMPATIBLE_DRIVER) { + printf("Cannot find a compatible Vulkan installable client driver " + "(ICD).\nExiting ...\n"); + fflush(stdout); + exit(1); + } else { + assert(!err); + } err = xglEnumerateGpus(demo->inst, 1, &gpu_count, &demo->gpu); assert(!err && gpu_count == 1); @@ -1352,6 +1359,12 @@ static void demo_init_connection(struct demo *demo) int scr; demo->connection = xcb_connect(NULL, &scr); + if (demo->connection == NULL) { + printf("Cannot find a compatible Vulkan installable client driver " + "(ICD).\nExiting ...\n"); + fflush(stdout); + exit(1); + } setup = xcb_get_setup(demo->connection); iter = xcb_setup_roots_iterator(setup); diff --git a/demos/xglinfo.c b/demos/xglinfo.c index 4544c23d..e0887a20 100644 --- a/demos/xglinfo.c +++ b/demos/xglinfo.c @@ -659,8 +659,14 @@ int main(int argc, char **argv) XGL_RESULT err; err = xglCreateInstance(&app_info, NULL, &inst); - if (err) + if (err == XGL_ERROR_INCOMPATIBLE_DRIVER) { + printf("Cannot find a compatible Vulkan installable client driver " + "(ICD).\nExiting ...\n"); + fflush(stdout); + exit(1); + } else if (err) { ERR_EXIT(err); + } err = xglEnumerateGpus(inst, MAX_GPUS, &gpu_count, objs); if (err) ERR_EXIT(err); |
