diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-11-12 11:33:47 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-11-12 11:33:47 -0500 |
| commit | fc3810fb5ca6467f643239b24a871463e96a231d (patch) | |
| tree | 7f47f662fd04429e72550fa9b19a191161dbdee3 | |
| parent | 8d06a5c1d16d8a68421d1499cfcfa9d2a8b71c29 (diff) | |
| download | balls-fc3810fb5ca6467f643239b24a871463e96a231d.zip | |
create command queues
| -rw-r--r-- | balls.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -91,8 +91,8 @@ void drawString(const char *str); float *flatten(Vector *vs, int n); int nBalls; -cl_command_queue queue; cl_context cpuContext, gpuContext; +cl_command_queue cpuQueue, gpuQueue; cl_kernel moveKernel, collideWallsKernel, collideBallsKernel, genVerticesKernel; GLuint vertexVAO, vertexVBO, colorVBO; cl_mem positions, velocities, radii, *collisions, vertexBuf; @@ -223,10 +223,13 @@ initCL(void) { exit(1); } - /* Create command queue. */ - queue = clCreateCommandQueue(context, device, 0, &err); + /* Create command queues. */ + cpuQueue = clCreateCommandQueue(cpuContext, cpuDevice, 0, &err); if (err < 0) - sysfatal("Failed to create command queue.\n"); + sysfatal("Failed to create CPU command queue.\n"); + gpuQueue = clCreateCommandQueue(gpuContext, gpuDevice, 0, &err); + if (err < 0) + sysfatal("Failed to create GPU command queue.\n"); /* Create kernels. */ moveKernel = createKernel(prog, MOVE_KERNEL_FUNC); |