Results 1 to 2 of 2

Thread: Compiling Kernel With Struct Pointer in Argument

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    5

    Compiling Kernel With Struct Pointer in Argument

    All, I am trying to compile a very simple RGB kernel. However, my compilation fail and my build log is empty... I am at a complete loss. Could anyone offer any assistance?

    Code :
    typedef struct OpenCLImage_t
    {
    	int width;
    	int widthStep;
    	int height;
    	int channels;
    } OpenCLImage;
     
    __kernel void opencl_rgb_kernel(__global OpenCLImage* input, __global unsigned char*  input_data, __global OpenCLImage* output, __global unsigned char * output_data)
    {
    	int pixel_x = get_global_id(0);
    	int pixel_y = get_global_id(1);
    	unsigned char * cur_in_pixel, *cur_out_pixel;
    	float avg = 0;
     
    	if(pixel_x < input.width && pixel_y < input.height)
    	{
    		cur_in_pixel = (unsigned char *)(input_data + pixel_y*input.widthStep + pixel_x * input.channels);
    		cur_out_pixel = (unsigned char *)(output_data + pixel_y*output.widthStep + pixel_x * output.channels);
     
    		avg += cur_in_pixel[0];
    		avg += cur_in_pixel[1];
    		avg+= cur_in_pixel[2];
    		avg /=3.0f;
     
    		if(avg > 255.0)
    			avg = 255.0;
    		else if(avg < 0)
    			avg = 0;
     
    		*cur_out_pixel = avg;
    	}
    }

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    5

    Re: Compiling Kernel With Struct Pointer in Argument

    I apologize, I just realized I switched from by value structs to pointer structs and forgot to implement update the kernel itself...

    I wish an error was given by the build log. Who do I contact to provide some feedback on this?

Similar Threads

  1. Kernel argument size
    By perlish in forum OpenCL
    Replies: 5
    Last Post: 09-03-2012, 05:55 AM
  2. Replies: 7
    Last Post: 02-09-2011, 05:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •