From d8245ab6f1bdf34c37c7d079496683272c181e54 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 10 Mar 2010 14:26:41 +0100 Subject: Tidy up --- src/diffraction-gpu.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/diffraction-gpu.c') diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c index f71df74e..ecc04446 100644 --- a/src/diffraction-gpu.c +++ b/src/diffraction-gpu.c @@ -57,7 +57,6 @@ struct gpu_context static void check_sinc_lut(struct gpu_context *gctx, int n) { cl_int err; - size_t sinc_lut_size; cl_image_format fmt; int i; @@ -78,12 +77,13 @@ static void check_sinc_lut(struct gpu_context *gctx, int n) gctx->max_sinc_lut = n; } - fmt.image_channel_order = CL_INTENSITY; - fmt.image_channel_data_type = CL_FLOAT; - sinc_lut_size = SINC_LUT_ELEMENTS*sizeof(cl_float); + if ( gctx->sinc_lut_ptrs[n-1] != NULL ) { + STATUS("Already have %i\n", n); + return; + } /* Create a new sinc LUT */ - gctx->sinc_lut_ptrs[n-1] = malloc(sinc_lut_size); + gctx->sinc_lut_ptrs[n-1] = malloc(SINC_LUT_ELEMENTS*sizeof(cl_float)); gctx->sinc_lut_ptrs[n-1][0] = n; if ( n == 1 ) { for ( i=1; isinc_luts[n-1] = clCreateImage2D(gctx->ctx, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, &fmt, SINC_LUT_ELEMENTS, 1, 0, gctx->sinc_lut_ptrs[n-1], &err); + if ( err != CL_SUCCESS ) { + ERROR("Couldn't create LUT for %i\n", n); + return; + } } -- cgit v1.2.3