diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-29 20:16:06 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-29 20:16:06 -0400 |
| commit | 73a4a9569041c984416466aacb42be2d8868dad3 (patch) | |
| tree | b6795d59ac698181db901e636033749f3cdb5e95 /balls.c | |
| parent | 9b718d4dc1bd21687a6a036cf0168fd7a73f8197 (diff) | |
| download | balls-73a4a9569041c984416466aacb42be2d8868dad3.zip | |
ball-ball collisions (untested)
Diffstat (limited to 'balls.c')
| -rw-r--r-- | balls.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -129,8 +129,13 @@ initCL(void) { #endif /* Get GPU device. */ - if (clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL) < 0) - sysfatal("No GPUs available.\n"); + err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL); + if (err < 0) { + fprintf(stderr, "No GPU available, falling back to CPU.\n"); + err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 1, &device, NULL); + if (err < 0) + sysfatal("No CL devices available.\n"); + } /* Create context. */ context = clCreateContext(properties, 1, &device, NULL, NULL, &err); |