Results 1 to 4 of 4

Thread: Buffer size for clCreateImage3D with CL_INTENSITY

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    7

    Buffer size for clCreateImage3D with CL_INTENSITY

    Hi.

    When creating a 3D image with the following image format:

    cl_image_format imgFormat;
    imgFormat.image_channel_data_type = CL_UNORM_INT8;
    imgFormat.image_channel_order = CL_INTENSITY;

    and using CL_MEM_COPY_HOST_PTR or CL_MEM_USE_HOST_PTR, what should be the size of the buffer pointed to by host_ptr (m_inputData in example below)?
    GRIDSIZE^3 or 4*GRIDSIZE^3?

    example:

    #define GRIDSIZE 256

    m_cl_memin = clCreateImage3D (
    m_clGPUContext,
    CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
    &imgFormat,
    GRIDSIZE,
    GRIDSIZE,
    GRIDSIZE,
    0,
    0,
    m_inputdata,
    &ciErrNum);

    Best regards
    Dag Magne

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Buffer size for clCreateImage3D with CL_INTENSITY

    It should be sizeof(cl_uint)*image_slice_pitch*image_depth, where image_slice_pitch and image_depth are the arguments that you pass to clCreateImage3D().
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    7

    Re: Buffer size for clCreateImage3D with CL_INTENSITY

    Why should it not be sizeof(cl_uchar)*image_slice_pitch*image_depth?

    While struggeling with this, I dropped the CL_MEM_COPY_HOST_PTR or CL_MEM_USE_HOST_PTR flags, and initialised the image using:

    clEnqueueWriteImage, pointing to a buffer of size sizeof(cl_uchar)*image_slice_pitch*image_depth,

    and this works ok. (At the same time i switched to using image_channel_order=CL_A)

    Dag Magne

  4. #4
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Buffer size for clCreateImage3D with CL_INTENSITY

    Why should it not be sizeof(cl_uchar)*image_slice_pitch*image_depth?
    Sorry, that was my mistake. sizeof(cl_uchar) is correct.

    At the same time i switched to using image_channel_order=CL_A
    Did you check first which image formats are supported in your device? Maybe CL_INTENSITY is not supported. clGetSupportedImageFormats() gives that information.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. About data size filled in the buffer
    By BohanLu in forum OpenSL ES - General
    Replies: 1
    Last Post: 03-27-2012, 02:32 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
  •