From d12cda0589ee72be8e779980995ca4dc880cff26 Mon Sep 17 00:00:00 2001 From: Jan Berdajs Date: Tue, 27 May 2014 02:02:58 +0200 Subject: [PATCH] refactor that will come handy soon --- driver-opencl.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/driver-opencl.c b/driver-opencl.c index 3ba70d86..a5b3c2b6 100644 --- a/driver-opencl.c +++ b/driver-opencl.c @@ -1310,6 +1310,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, cl_int status; size_t globalThreads[1]; size_t localThreads[1] = { clState->wsize }; + size_t *p_global_work_offset = NULL; int64_t hashes; int found = gpu->algorithm.found_idx; int buffersize = BUFFERSIZE; @@ -1343,15 +1344,10 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, return -1; } - if (clState->goffset) { - size_t global_work_offset[1]; - - global_work_offset[0] = work->blk.nonce; - status = clEnqueueNDRangeKernel(clState->commandQueue, *kernel, 1, global_work_offset, - globalThreads, localThreads, 0, NULL, NULL); - } else - status = clEnqueueNDRangeKernel(clState->commandQueue, *kernel, 1, NULL, - globalThreads, localThreads, 0, NULL, NULL); + if (clState->goffset) + p_global_work_offset = &work->blk.nonce; + status = clEnqueueNDRangeKernel(clState->commandQueue, *kernel, 1, p_global_work_offset, + globalThreads, localThreads, 0, NULL, NULL); if (unlikely(status != CL_SUCCESS)) { applog(LOG_ERR, "Error %d: Enqueueing kernel onto command queue. (clEnqueueNDRangeKernel)", status); return -1;