summaryrefslogtreecommitdiffstats
path: root/balls.c
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-10-29 20:16:06 -0400
committerSam Anthony <sam@samanthony.xyz>2024-10-29 20:16:06 -0400
commit73a4a9569041c984416466aacb42be2d8868dad3 (patch)
treeb6795d59ac698181db901e636033749f3cdb5e95 /balls.c
parent9b718d4dc1bd21687a6a036cf0168fd7a73f8197 (diff)
downloadballs-73a4a9569041c984416466aacb42be2d8868dad3.zip
ball-ball collisions (untested)
Diffstat (limited to 'balls.c')
-rw-r--r--balls.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/balls.c b/balls.c
index bf81517..9e2522a 100644
--- a/balls.c
+++ b/balls.c
@@ -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);