diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2018-06-20 12:31:13 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2018-06-20 12:31:13 +0200 |
commit | b75d0b81ce753ade86916ecd265fb3c1a7477654 (patch) | |
tree | 5e3eb49424be0f906ff6c0c705e08fa564fb1215 | |
parent | 69ca2b497ed71c8e71bee33940f0377e1d9f814f (diff) | |
download | ufo-filters-b75d0b81ce753ade86916ecd265fb3c1a7477654.tar.gz ufo-filters-b75d0b81ce753ade86916ecd265fb3c1a7477654.tar.bz2 ufo-filters-b75d0b81ce753ade86916ecd265fb3c1a7477654.tar.xz ufo-filters-b75d0b81ce753ade86916ecd265fb3c1a7477654.zip |
Fix #166: propagate OpenCL errors if possible
46 files changed, 127 insertions, 129 deletions
diff --git a/contrib/ufo-med-mad-reject-task.c b/contrib/ufo-med-mad-reject-task.c index 7c634d9..14d03a4 100644 --- a/contrib/ufo-med-mad-reject-task.c +++ b/contrib/ufo-med-mad-reject-task.c @@ -88,7 +88,7 @@ ufo_med_mad_reject_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "med-mad-reject.cl", "outliersRej_MedMad_3x3x3_f32", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_AND_SET (clRetainKernel (priv->kernel), error); } // This one is called for each frame, so that it can adapt from one to the other frame diff --git a/contrib/ufo-ocl-1liner-task.c b/contrib/ufo-ocl-1liner-task.c index e941fdd..b0a0e4e 100644 --- a/contrib/ufo-ocl-1liner-task.c +++ b/contrib/ufo-ocl-1liner-task.c @@ -119,7 +119,7 @@ ufo_ocl_1liner_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel_from_source (resources, kernel_src, "ocl_1liner", NULL, error); /* Done compiling sources into a kernel, if existing retain it */ if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_AND_SET (clRetainKernel (priv->kernel), error); exit: /* Releasing resources no longer used */ diff --git a/contrib/ufo-stat-monitor-task.c b/contrib/ufo-stat-monitor-task.c index 2a11d6d..ab31c9b 100644 --- a/contrib/ufo-stat-monitor-task.c +++ b/contrib/ufo-stat-monitor-task.c @@ -87,8 +87,8 @@ ufo_stat_monitor_task_setup (UfoTask *task, node = UFO_GPU_NODE (ufo_task_node_get_proc_node (UFO_TASK_NODE (task))); cmd_queue = ufo_gpu_node_get_cmd_queue (node); - UFO_RESOURCES_CHECK_CLERR (clGetCommandQueueInfo (cmd_queue, CL_QUEUE_DEVICE, sizeof (cl_device_id), &dev_cl, NULL)); - UFO_RESOURCES_CHECK_CLERR (clGetCommandQueueInfo (cmd_queue, CL_QUEUE_CONTEXT, sizeof (cl_context), &context_cl, NULL)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetCommandQueueInfo (cmd_queue, CL_QUEUE_DEVICE, sizeof (cl_device_id), &dev_cl, NULL), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetCommandQueueInfo (cmd_queue, CL_QUEUE_CONTEXT, sizeof (cl_context), &context_cl, NULL), error); priv = UFO_STAT_MONITOR_TASK_GET_PRIVATE (task); @@ -107,14 +107,14 @@ ufo_stat_monitor_task_setup (UfoTask *task, if (priv->kernel == NULL || priv->kernel_final == NULL) return; - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel_final)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel_final), error); - UFO_RESOURCES_CHECK_CLERR (clGetDeviceInfo (dev_cl, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), &(priv->max_local_mem), NULL)); - UFO_RESOURCES_CHECK_CLERR (clGetDeviceInfo (dev_cl, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(cl_uint), &num_cu, NULL)); - UFO_RESOURCES_CHECK_CLERR (clGetDeviceInfo (dev_cl, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &max_wgs, NULL)); - UFO_RESOURCES_CHECK_CLERR (clGetDeviceInfo (dev_cl, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(max_wis), max_wis, NULL)); - UFO_RESOURCES_CHECK_CLERR (clGetKernelWorkGroupInfo (priv->kernel, dev_cl, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, sizeof(size_t), &ker_pref_wgs, NULL)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetDeviceInfo (dev_cl, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), &(priv->max_local_mem), NULL), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetDeviceInfo (dev_cl, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(cl_uint), &num_cu, NULL), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetDeviceInfo (dev_cl, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &max_wgs, NULL), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetDeviceInfo (dev_cl, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(max_wis), max_wis, NULL), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetKernelWorkGroupInfo (priv->kernel, dev_cl, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, sizeof(size_t), &ker_pref_wgs, NULL), error); /* 4 work-groups per comput unit. */ priv->wg_num = num_cu << 2; @@ -179,18 +179,18 @@ ufo_stat_monitor_task_setup (UfoTask *task, if ( priv->node_has_fp64 ) { /* min, max, mean, sd (one 4-tuple per work-group) */ priv->stat_out_buff = clCreateBuffer (context_cl, CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS, priv->wg_num << 5, NULL, &err_code); - UFO_RESOURCES_CHECK_CLERR (err_code); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err_code, error); /* min, max, mean, sd (one 4-tuple once only) */ priv->stat_out_red = clCreateBuffer (context_cl, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY, 1 << 5, NULL, &err_code); - UFO_RESOURCES_CHECK_CLERR (err_code); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err_code, error); } else { /* min, max, mean, sd (one 4-tuple per work-group) */ priv->stat_out_buff = clCreateBuffer (context_cl, CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS, priv->wg_num << 4, NULL, &err_code); - UFO_RESOURCES_CHECK_CLERR (err_code); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err_code, error); /* min, max, mean, sd (one 4-tuple once only) */ priv->stat_out_red = clCreateBuffer (context_cl, CL_MEM_READ_WRITE | CL_MEM_HOST_READ_ONLY, 1 << 4, NULL, &err_code); - UFO_RESOURCES_CHECK_CLERR (err_code); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err_code, error); } } diff --git a/src/ufo-backproject-task.c b/src/ufo-backproject-task.c index c123aeb..e500e9d 100644 --- a/src/ufo-backproject-task.c +++ b/src/ufo-backproject-task.c @@ -161,13 +161,13 @@ ufo_backproject_task_setup (UfoTask *task, priv->nearest_kernel = ufo_resources_get_kernel (resources, "backproject.cl", "backproject_nearest", NULL, error); priv->texture_kernel = ufo_resources_get_kernel (resources, "backproject.cl", "backproject_tex", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); if (priv->nearest_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->nearest_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->nearest_kernel), error); if (priv->texture_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->texture_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->texture_kernel), error); } static cl_mem diff --git a/src/ufo-bin-task.c b/src/ufo-bin-task.c index 866a6b8..1b7bc90 100644 --- a/src/ufo-bin-task.c +++ b/src/ufo-bin-task.c @@ -66,12 +66,12 @@ ufo_bin_task_setup (UfoTask *task, priv->kernel_2d = ufo_resources_get_kernel (resources, "bin.cl", "binning_2d", NULL, error); if (priv->kernel_2d != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel_2d)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel_2d), error); priv->kernel_3d = ufo_resources_get_kernel (resources, "bin.cl", "binning_3d", NULL, error); if (priv->kernel_3d != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel_3d)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel_3d), error); } static void diff --git a/src/ufo-binarize-task.c b/src/ufo-binarize-task.c index ce9467b..94d652e 100644 --- a/src/ufo-binarize-task.c +++ b/src/ufo-binarize-task.c @@ -64,7 +64,7 @@ ufo_binarize_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "binarize.cl", "binarize", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-blur-task.c b/src/ufo-blur-task.c index 16b4b41..c004de5 100644 --- a/src/ufo-blur-task.c +++ b/src/ufo-blur-task.c @@ -78,11 +78,11 @@ ufo_blur_task_setup (UfoTask *task, if (error && *error) return; - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->h_kernel)); - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->v_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->h_kernel), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->v_kernel), error); priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); } static void diff --git a/src/ufo-calculate-task.c b/src/ufo-calculate-task.c index 0c5cac5..e42ae38 100644 --- a/src/ufo-calculate-task.c +++ b/src/ufo-calculate-task.c @@ -70,9 +70,8 @@ make_kernel (UfoCalculateTaskPrivate *priv, UfoResources *resources, GError **er return; } - if (priv->kernel) { - UFO_RESOURCES_CHECK_CLERR (clReleaseKernel (priv->kernel)); - } + if (priv->kernel) + UFO_RESOURCES_CHECK_SET_AND_RETURN (clReleaseKernel (priv->kernel), error); if ((gsize) g_sprintf (source, template, expression) != strlen (source)) { g_set_error (error, UFO_TASK_ERROR, UFO_TASK_ERROR_SETUP, @@ -81,7 +80,7 @@ make_kernel (UfoCalculateTaskPrivate *priv, UfoResources *resources, GError **er } priv->kernel = ufo_resources_get_kernel_from_source(resources, source, "calculate", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); g_free (source); } @@ -101,7 +100,7 @@ ufo_calculate_task_setup (UfoTask *task, priv = UFO_CALCULATE_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); make_kernel (priv, resources, error); } diff --git a/src/ufo-clip-task.c b/src/ufo-clip-task.c index 243d00e..56a0ddb 100644 --- a/src/ufo-clip-task.c +++ b/src/ufo-clip-task.c @@ -74,7 +74,7 @@ ufo_clip_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "clip.cl", "clip", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-correlate-stacks-task.c b/src/ufo-correlate-stacks-task.c index de98c74..8a0af17 100644 --- a/src/ufo-correlate-stacks-task.c +++ b/src/ufo-correlate-stacks-task.c @@ -85,13 +85,13 @@ ufo_correlate_stacks_task_setup (UfoTask *task, priv->sum_kernel = ufo_resources_get_kernel (resources, "correlate.cl", "sum", error); if (priv->diff_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->diff_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->diff_kernel), error); if (priv->sum_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->sum_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->sum_kernel), error); priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); #endif priv->current = 0; diff --git a/src/ufo-cut-task.c b/src/ufo-cut-task.c index fcf5d9d..1f8a91d 100644 --- a/src/ufo-cut-task.c +++ b/src/ufo-cut-task.c @@ -64,7 +64,7 @@ ufo_cut_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "cut.cl", "cut", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-denoise-task.c b/src/ufo-denoise-task.c index c3da254..4ebd1e1 100644 --- a/src/ufo-denoise-task.c +++ b/src/ufo-denoise-task.c @@ -75,17 +75,17 @@ ufo_denoise_task_setup (UfoTask *task, priv->k_sort_and_set = ufo_resources_get_kernel (resources, "denoise.cl", "sort_and_set", NULL, error); if (priv->k_sort_and_set != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_sort_and_set)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->k_sort_and_set), error); priv->k_load_elements = ufo_resources_get_kernel (resources, "denoise.cl", "load_elements", NULL, error); if (priv->k_load_elements != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_load_elements)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->k_load_elements), error); priv->k_remove_background = ufo_resources_get_kernel (resources, "denoise.cl", "remove_background", NULL, error); if (priv->k_remove_background != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_remove_background)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->k_remove_background), error); } static void diff --git a/src/ufo-detect-edge-task.c b/src/ufo-detect-edge-task.c index a0a4f9e..c51a963 100644 --- a/src/ufo-detect-edge-task.c +++ b/src/ufo-detect-edge-task.c @@ -93,11 +93,11 @@ ufo_detect_edge_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "edge.cl", "filter", NULL, error); if (priv->mask_mem) - UFO_RESOURCES_CHECK_CLERR (clReleaseMemObject (priv->mask_mem)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clReleaseMemObject (priv->mask_mem), error); priv->mask_mem = clCreateBuffer (priv->context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, 9 * sizeof (gfloat), FILTER_MASKS[priv->type], &err); - UFO_RESOURCES_CHECK_CLERR (err); + UFO_RESOURCES_CHECK_AND_SET (err, error); } static void diff --git a/src/ufo-fft-task.c b/src/ufo-fft-task.c index a953791..f1e3978 100644 --- a/src/ufo-fft-task.c +++ b/src/ufo-fft-task.c @@ -91,11 +91,10 @@ ufo_fft_task_setup (UfoTask *task, } priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); - if (priv->kernel != NULL) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - } + if (priv->kernel != NULL) + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void @@ -129,7 +128,7 @@ ufo_fft_task_get_requisition (UfoTask *task, } queue = ufo_gpu_node_get_cmd_queue (UFO_GPU_NODE (ufo_task_node_get_proc_node (UFO_TASK_NODE (task)))); - UFO_RESOURCES_CHECK_CLERR (ufo_fft_update (priv->fft, priv->context, queue, &priv->param)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (ufo_fft_update (priv->fft, priv->context, queue, &priv->param), error); *requisition = in_req; /* keep third dimension for 2D batching */ requisition->dims[0] = 2 * priv->param.size[0]; diff --git a/src/ufo-fftmult-task.c b/src/ufo-fftmult-task.c index 6e722c1..5fd68a5 100644 --- a/src/ufo-fftmult-task.c +++ b/src/ufo-fftmult-task.c @@ -61,7 +61,7 @@ ufo_fftmult_task_setup (UfoTask *task, priv->k_fftmult = ufo_resources_get_kernel (resources, "fftmult.cl", "mult", NULL, error); if (priv->k_fftmult != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_fftmult)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->k_fftmult), error); } static void diff --git a/src/ufo-filter-stripes-task.c b/src/ufo-filter-stripes-task.c index 6a0eedd..3b6aebd 100644 --- a/src/ufo-filter-stripes-task.c +++ b/src/ufo-filter-stripes-task.c @@ -90,7 +90,7 @@ ufo_filter_stripes_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "filter.cl", "stripe_filter", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-filter-stripes1d-task.c b/src/ufo-filter-stripes1d-task.c index 816f3aa..16a9c9c 100644 --- a/src/ufo-filter-stripes1d-task.c +++ b/src/ufo-filter-stripes1d-task.c @@ -116,10 +116,10 @@ ufo_filter_stripes1d_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "complex.cl", "c_mul_real_sym", NULL, error); priv->filter_mem = NULL; - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); if (priv->kernel) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-filter-task.c b/src/ufo-filter-task.c index 64016eb..762a231 100644 --- a/src/ufo-filter-task.c +++ b/src/ufo-filter-task.c @@ -155,7 +155,7 @@ ufo_filter_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "filter.cl", "filter", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-flat-field-correct-task.c b/src/ufo-flat-field-correct-task.c index fe39439..446c166 100644 --- a/src/ufo-flat-field-correct-task.c +++ b/src/ufo-flat-field-correct-task.c @@ -69,9 +69,8 @@ ufo_flat_field_correct_task_setup (UfoTask *task, priv = UFO_FLAT_FIELD_CORRECT_TASK_GET_PRIVATE (task); priv->kernel = ufo_resources_get_kernel (resources, "ffc.cl", "flat_correct", NULL, error); - if (priv->kernel) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - } + if (priv->kernel) + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-forwardproject-task.c b/src/ufo-forwardproject-task.c index 6b59f9c..fe200a8 100644 --- a/src/ufo-forwardproject-task.c +++ b/src/ufo-forwardproject-task.c @@ -68,7 +68,7 @@ ufo_forwardproject_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "forwardproject.cl", "forwardproject", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); if (priv->angle_step == 0) priv->angle_step = G_PI / priv->num_projections; diff --git a/src/ufo-gradient-task.c b/src/ufo-gradient-task.c index ce3f878..da6ada3 100644 --- a/src/ufo-gradient-task.c +++ b/src/ufo-gradient-task.c @@ -77,7 +77,7 @@ ufo_gradient_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "gradient.cl", direction_values[priv->direction].value_nick, NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-ifft-task.c b/src/ufo-ifft-task.c index 6a7ede4..6c51df5 100644 --- a/src/ufo-ifft-task.c +++ b/src/ufo-ifft-task.c @@ -73,11 +73,10 @@ ufo_ifft_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "fft.cl", "fft_pack", NULL, error); priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); - if (priv->kernel != NULL) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - } + if (priv->kernel != NULL) + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void @@ -117,7 +116,7 @@ ufo_ifft_task_get_requisition (UfoTask *task, } queue = ufo_gpu_node_get_cmd_queue (UFO_GPU_NODE (ufo_task_node_get_proc_node (UFO_TASK_NODE (task)))); - UFO_RESOURCES_CHECK_CLERR (ufo_fft_update (priv->fft, priv->context, queue, &priv->param)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (ufo_fft_update (priv->fft, priv->context, queue, &priv->param), error); *requisition = in_req; /* keep third dimension for 2-D batching */ requisition->dims[0] = priv->crop_width > 0 ? (gsize) priv->crop_width : priv->param.size[0]; diff --git a/src/ufo-interpolate-stream-task.c b/src/ufo-interpolate-stream-task.c index f2a9ad7..a3c854d 100644 --- a/src/ufo-interpolate-stream-task.c +++ b/src/ufo-interpolate-stream-task.c @@ -69,7 +69,7 @@ ufo_interpolate_stream_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-interpolate-task.c b/src/ufo-interpolate-task.c index a0d0725..02d9c42 100644 --- a/src/ufo-interpolate-task.c +++ b/src/ufo-interpolate-task.c @@ -70,7 +70,7 @@ ufo_interpolate_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-lamino-backproject-task.c b/src/ufo-lamino-backproject-task.c index a6e9863..362ed88 100644 --- a/src/ufo-lamino-backproject-task.c +++ b/src/ufo-lamino-backproject-task.c @@ -215,14 +215,14 @@ ufo_lamino_backproject_task_setup (UfoTask *task, priv->scalar_kernel = ufo_resources_get_kernel (resources, kernel_filename, "backproject_burst_1", NULL, error); priv->sampler = clCreateSampler (priv->context, (cl_bool) FALSE, priv->addressing_mode, CL_FILTER_LINEAR, &cl_error); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); - UFO_RESOURCES_CHECK_CLERR (cl_error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (cl_error, error); if (priv->vector_kernel) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->vector_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->vector_kernel), error); if (priv->scalar_kernel) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->scalar_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->scalar_kernel), error); for (i = 0; i < BURST; i++) priv->images[i] = NULL; diff --git a/src/ufo-mask-task.c b/src/ufo-mask-task.c index 0d99bd6..78ef646 100644 --- a/src/ufo-mask-task.c +++ b/src/ufo-mask-task.c @@ -55,7 +55,7 @@ ufo_mask_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "mask.cl", "circular", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-measure-task.c b/src/ufo-measure-task.c index eff40fb..4e74ed3 100644 --- a/src/ufo-measure-task.c +++ b/src/ufo-measure-task.c @@ -163,14 +163,14 @@ ufo_measure_task_setup (UfoTask *task, /* Reduction kernels */ kernel_name = g_strconcat ("reduce_", axis, metric_values[i].value_name, NULL), priv->kernels[i] = ufo_resources_get_kernel (resources, "reductor.cl", kernel_name, NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernels[i])); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernels[i]), error); /* Postprocessing (normalization) kernels */ priv->postproc_kernels[i] = NULL; if (postproc_codes[i]) { postproc_source = create_postprocessing_kernel (postproc_codes[i]); priv->postproc_kernels[i] = ufo_resources_get_kernel_from_source (resources, postproc_source, "calculate", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->postproc_kernels[i])); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->postproc_kernels[i]), error); g_free (postproc_source); } @@ -178,7 +178,7 @@ ufo_measure_task_setup (UfoTask *task, } priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); g_free (axis); } diff --git a/src/ufo-median-filter-task.c b/src/ufo-median-filter-task.c index 13d2e30..afa2283 100644 --- a/src/ufo-median-filter-task.c +++ b/src/ufo-median-filter-task.c @@ -78,10 +78,10 @@ ufo_median_filter_task_setup (UfoTask *task, "fill", option, error); if (priv->inner_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->inner_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->inner_kernel), error); if (priv->fill_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->fill_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->fill_kernel), error); g_free (option); } diff --git a/src/ufo-metaballs-task.c b/src/ufo-metaballs-task.c index 32a4a42..1be5c16 100644 --- a/src/ufo-metaballs-task.c +++ b/src/ufo-metaballs-task.c @@ -88,7 +88,7 @@ ufo_metaballs_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "metaballs.cl", "draw_metaballs", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); priv->current_iteration = 0; priv->balls = g_malloc0 (priv->num_balls * sizeof (Ball)); @@ -106,7 +106,7 @@ ufo_metaballs_task_setup (UfoTask *task, priv->balls_mem = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, priv->num_balls * sizeof (Ball), priv->balls, &err); - UFO_RESOURCES_CHECK_CLERR (err); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err, error); } static void diff --git a/src/ufo-opencl-reduce-task.c b/src/ufo-opencl-reduce-task.c index 787d178..9195277 100644 --- a/src/ufo-opencl-reduce-task.c +++ b/src/ufo-opencl-reduce-task.c @@ -109,10 +109,11 @@ ufo_opencl_reduce_task_setup (UfoTask *task, if (priv->kernel != NULL) { cl_uint n_args; - UFO_RESOURCES_CHECK_CLERR (clGetKernelInfo (priv->kernel, - CL_KERNEL_NUM_ARGS, - sizeof (cl_uint), - &n_args, NULL)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetKernelInfo (priv->kernel, + CL_KERNEL_NUM_ARGS, + sizeof (cl_uint), + &n_args, NULL), + error); if (n_args != 2) { g_set_error (error, UFO_TASK_ERROR, UFO_TASK_ERROR_SETUP, @@ -121,11 +122,11 @@ ufo_opencl_reduce_task_setup (UfoTask *task, return; } - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } if (priv->finish) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->finish)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->finish), error); priv->generated = FALSE; priv->counter = 0; diff --git a/src/ufo-opencl-task.c b/src/ufo-opencl-task.c index 53ef8b2..1cd889e 100644 --- a/src/ufo-opencl-task.c +++ b/src/ufo-opencl-task.c @@ -141,10 +141,11 @@ ufo_opencl_task_setup (UfoTask *task, if (priv->kernel != NULL) { cl_uint n_args; - UFO_RESOURCES_CHECK_CLERR (clGetKernelInfo (priv->kernel, - CL_KERNEL_NUM_ARGS, - sizeof (cl_uint), - &n_args, NULL)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clGetKernelInfo (priv->kernel, + CL_KERNEL_NUM_ARGS, + sizeof (cl_uint), + &n_args, NULL), + error); if (n_args < 2) { g_set_error (error, UFO_TASK_ERROR, UFO_TASK_ERROR_SETUP, @@ -154,7 +155,7 @@ ufo_opencl_task_setup (UfoTask *task, } priv->n_inputs = n_args - 1; - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } } diff --git a/src/ufo-pad-task.c b/src/ufo-pad-task.c index f012b24..4511621 100644 --- a/src/ufo-pad-task.c +++ b/src/ufo-pad-task.c @@ -93,10 +93,10 @@ ufo_pad_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "pad.cl", "pad", NULL, error); change_sampler (priv); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); - if (priv->kernel) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - } + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); + + if (priv->kernel) + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-polar-coordinates-task.c b/src/ufo-polar-coordinates-task.c index 91a7303..01469c5 100644 --- a/src/ufo-polar-coordinates-task.c +++ b/src/ufo-polar-coordinates-task.c @@ -88,21 +88,21 @@ ufo_polar_coordinates_task_setup (UfoTask *task, priv->populate_polar_kernel = ufo_resources_get_kernel (resources, "polar.cl", "populate_polar_space", NULL, error); priv->populate_cartesian_kernel = ufo_resources_get_kernel (resources, "polar.cl", "populate_cartesian_space", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); - if (priv->populate_polar_kernel) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->populate_polar_kernel)); - } - if (priv->populate_cartesian_kernel) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->populate_cartesian_kernel)); - } + if (priv->populate_polar_kernel) + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->populate_polar_kernel), error); + + if (priv->populate_cartesian_kernel) + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->populate_cartesian_kernel), error); priv->sampler = clCreateSampler (priv->context, (cl_bool) FALSE, CL_ADDRESS_CLAMP_TO_EDGE, CL_FILTER_LINEAR, &err); - UFO_RESOURCES_CHECK_CLERR (err); + + UFO_RESOURCES_CHECK_SET_AND_RETURN (err, error); } static void diff --git a/src/ufo-remove-outliers-task.c b/src/ufo-remove-outliers-task.c index 1bea083..00c6aa8 100644 --- a/src/ufo-remove-outliers-task.c +++ b/src/ufo-remove-outliers-task.c @@ -71,7 +71,7 @@ ufo_remove_outliers_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "rm-outliers.cl", "filter", option, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-rescale-task.c b/src/ufo-rescale-task.c index ff0ab34..11f206d 100644 --- a/src/ufo-rescale-task.c +++ b/src/ufo-rescale-task.c @@ -93,11 +93,12 @@ ufo_rescale_task_setup (UfoTask *task, CL_ADDRESS_NONE, (cl_filter_mode) priv->interpolation, &err); - UFO_RESOURCES_CHECK_CLERR (err); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err, error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); + if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-retrieve-phase-task.c b/src/ufo-retrieve-phase-task.c index a7595a9..d14c728 100644 --- a/src/ufo-retrieve-phase-task.c +++ b/src/ufo-retrieve-phase-task.c @@ -113,7 +113,7 @@ ufo_retrieve_phase_task_setup (UfoTask *task, priv->mult_by_value_kernel = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "mult_by_value", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainContext(priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext(priv->context), error); if (priv->filter_buffer == NULL) { UfoRequisition requisition; @@ -126,12 +126,12 @@ ufo_retrieve_phase_task_setup (UfoTask *task, for (int i = 0; i < N_METHODS; i++) { if (priv->kernels[i] != NULL) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel(priv->kernels[i])); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel(priv->kernels[i]), error); } } if (priv->mult_by_value_kernel != NULL) { - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->mult_by_value_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->mult_by_value_kernel), error); } } diff --git a/src/ufo-rotate-task.c b/src/ufo-rotate-task.c index eda4d87..d96ccc3 100644 --- a/src/ufo-rotate-task.c +++ b/src/ufo-rotate-task.c @@ -133,11 +133,11 @@ ufo_rotate_task_setup (UfoTask *task, /* Normalized coordinates are necessary for repeat addressing mode */ priv->sampler = clCreateSampler (priv->context, (cl_bool) TRUE, priv->addressing_mode, priv->interpolation, &cl_error); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); - UFO_RESOURCES_CHECK_CLERR (cl_error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); + UFO_RESOURCES_CHECK_SET_AND_RETURN (cl_error, error); if (priv->kernel) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-segment-task.c b/src/ufo-segment-task.c index 2554731..acd7b28 100644 --- a/src/ufo-segment-task.c +++ b/src/ufo-segment-task.c @@ -109,16 +109,16 @@ ufo_segment_task_setup (UfoTask *task, priv->render = ufo_resources_get_kernel (resources, "segment.cl", "render", NULL, error); priv->threshold = ufo_resources_get_kernel (resources, "segment.cl", "threshold", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); if (priv->walk != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->walk)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->walk), error); if (priv->render != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->render)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->render), error); if (priv->threshold != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->threshold)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->threshold), error); } static void diff --git a/src/ufo-stitch-task.c b/src/ufo-stitch-task.c index f935899..d6fb9e9 100644 --- a/src/ufo-stitch-task.c +++ b/src/ufo-stitch-task.c @@ -77,16 +77,16 @@ ufo_stitch_task_setup (UfoTask *task, priv->sum_kernel = ufo_resources_get_kernel (resources, "reductor.cl", "parallel_sum_2D", NULL, error); priv->pad_kernel = ufo_resources_get_kernel (resources, "pad.cl", "pad_with_image", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); if (priv->sum_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->sum_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->sum_kernel), error); if (priv->pad_kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->pad_kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->pad_kernel), error); priv->sum_mem = NULL; } diff --git a/src/ufo-subtract-task.c b/src/ufo-subtract-task.c index a381de5..a85a2db 100644 --- a/src/ufo-subtract-task.c +++ b/src/ufo-subtract-task.c @@ -66,7 +66,7 @@ ufo_subtract_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "arithmetics.cl", "subtract", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_AND_SET (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-swap-quadrants-task.c b/src/ufo-swap-quadrants-task.c index 0f786cc..7d2ab30 100644 --- a/src/ufo-swap-quadrants-task.c +++ b/src/ufo-swap-quadrants-task.c @@ -58,10 +58,10 @@ ufo_swap_quadrants_task_setup (UfoTask *task, priv->swap_quadrants_kernel_complex = ufo_resources_get_kernel (resources, "swap-quadrants.cl", "swap_quadrants_kernel_complex", NULL, error); if (priv->swap_quadrants_kernel_complex) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->swap_quadrants_kernel_complex)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->swap_quadrants_kernel_complex), error); if (priv->swap_quadrants_kernel_real) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->swap_quadrants_kernel_real)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->swap_quadrants_kernel_real), error); } static void diff --git a/src/ufo-tile-task.c b/src/ufo-tile-task.c index 005d035..1f3cfe5 100644 --- a/src/ufo-tile-task.c +++ b/src/ufo-tile-task.c @@ -72,7 +72,7 @@ ufo_tile_task_setup (UfoTask *task, priv = UFO_TILE_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); } static void @@ -113,11 +113,10 @@ ufo_tile_task_get_requisition (UfoTask *task, } if (priv->temp == NULL) { - cl_int error; + cl_int err_code; - priv->temp = clCreateBuffer (priv->context, CL_MEM_READ_WRITE, - ufo_buffer_get_size (inputs[0]), NULL, &error); - UFO_RESOURCES_CHECK_CLERR (error); + priv->temp = clCreateBuffer (priv->context, CL_MEM_READ_WRITE, ufo_buffer_get_size (inputs[0]), NULL, &err_code); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err_code, error); } priv->num_horizontal = in_width / requisition->dims[0]; diff --git a/src/ufo-transpose-task.c b/src/ufo-transpose-task.c index 3a9130b..61388d3 100644 --- a/src/ufo-transpose-task.c +++ b/src/ufo-transpose-task.c @@ -52,7 +52,7 @@ ufo_transpose_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "transpose.cl", "transpose_shared", NULL, error); if (priv->kernel) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-unsplit-task.c b/src/ufo-unsplit-task.c index 54d559b..05d7717 100644 --- a/src/ufo-unsplit-task.c +++ b/src/ufo-unsplit-task.c @@ -55,7 +55,7 @@ ufo_unsplit_task_setup (UfoTask *task, priv->kernel = ufo_resources_get_kernel (resources, "split.cl", "unsplit", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_AND_SET (clRetainKernel (priv->kernel), error); } static void diff --git a/src/ufo-volume-render-task.c b/src/ufo-volume-render-task.c index c6393d0..5326d71 100644 --- a/src/ufo-volume-render-task.c +++ b/src/ufo-volume-render-task.c @@ -93,10 +93,10 @@ ufo_volume_render_task_setup (UfoTask *task, priv = UFO_VOLUME_RENDER_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); priv->kernel = ufo_resources_get_kernel (resources, "volume.cl", "rayCastVolume", NULL, error); - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); priv->view_matrix = g_malloc0 (4 * 4 * sizeof(gfloat)); priv->view_matrix[0] = 1.0f; @@ -107,7 +107,7 @@ ufo_volume_render_task_setup (UfoTask *task, priv->view_mem = clCreateBuffer (priv->context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, 4 * 4 * sizeof(gfloat), priv->view_matrix, &err); - UFO_RESOURCES_CHECK_CLERR (err); + UFO_RESOURCES_CHECK_SET_AND_RETURN (err, error); } static void diff --git a/src/ufo-write-task.c b/src/ufo-write-task.c index 80f4c5c..bd43bfc 100644 --- a/src/ufo-write-task.c +++ b/src/ufo-write-task.c @@ -251,12 +251,12 @@ ufo_write_task_setup (UfoTask *task, g_free (dirname); priv->context = ufo_resources_get_context (resources); - UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainContext (priv->context), error); priv->kernel = ufo_resources_get_kernel (resources, "split.cl", "unsplit", NULL, error); if (priv->kernel != NULL) - UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); + UFO_RESOURCES_CHECK_SET_AND_RETURN (clRetainKernel (priv->kernel), error); } static void |