2 Replies Latest reply on Sep 14, 2012 2:49 PM by amdkid

    Program crashes when execute "clCreateImage"..

    xfrex

      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~