cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

xfrex
Journeyman III

Program crashes when execute "clCreateImage"..

As a beginner, I download a small source code to start my study.

The code is implemented based on OpenCL1.1 while my version is OpenCL1.2, so I have to change some codes.

When I wrote the following codes to create a 2D image, the program crashed.

...........................

    // Create OpenCL image

    cl_image_format clImageFormat;

    clImageFormat.image_channel_order = CL_RGBA;

    clImageFormat.image_channel_data_type = CL_UNORM_INT8;

    cl_image_desc clImageDesc;

    clImageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;

    clImageDesc.image_width = width; //100

    clImageDesc.image_height = height; //100

    clImageDesc.image_array_size = 1;

    clImageDesc.image_depth = 0;

    clImageDesc.image_row_pitch = width*4;  //rgba mode, that is 400 bytes

    clImageDesc.image_slice_pitch = height;

    clImageDesc.num_mip_levels = 0;

    clImageDesc.num_samples = 0;

    clImageDesc.buffer = NULL;

   clImage = clCreateImage(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,                                                                      &clImageFormat,   &clImageDesc,    buffer,   &errNum);

----------------------------------

Thank you for your help~


0 Likes
2 Replies
binying
Challenger

well, it would be better if you upload your code.

0 Likes
amdkid
Adept I

Xfrex

I think your problem with Width and height, try to use 256x256

0 Likes