Results 1 to 3 of 3

Thread: clBuildProgram fails when write_imageui is used

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    5

    clBuildProgram fails when write_imageui is used

    Hi!

    I'm trying to build a simple kernel, but it fails when I use write_imageui. The kernel should just copy an image to another. I know that there isn't probably any sense in making such kernel, but I'm just trying to learn the language. Anyway, here is the kernel:

    const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE |
    CLK_ADDRESS_CLAMP_TO_EDGE |
    CLK_FILTER_NEAREST;

    __kernel void copy(image2d_t src, image2d_t dst)
    {
    int2 pos;
    uint4 input;
    int x = get_global_id(0);
    int y = get_global_id(1);

    pos.x = x;
    pos.y = y;

    input = read_imageui(src, sampler, pos);
    write_imageui(dst, pos, input);
    }

    If I put it like above, clBuildProgram gives me error code -42 (btw how can I determine what error that is?). But if I comment the last line out it compiles just fine. Any idea what is going on?

    P.S. I'm using Nvidia SDK and my GPU is GF9500GT.

    -hnyk

  2. #2
    Senior Member
    Join Date
    Jul 2009
    Location
    Northern Europe
    Posts
    311

    Re: clBuildProgram fails when write_imageui is used

    I believe you will need to put "write_only" before your destination image in your kernel definition. By default images are "read_only".

    You can look up what -42 is in the opencl header file.

    You should also try to get back the program build log by calling clGetProgramBuildInfo. That should include a detailed error string as to why the program failed to build.

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Re: clBuildProgram fails when write_imageui is used

    Thanks. The "__write_only" specifier did the trick.

Similar Threads

  1. eglCreateWindowSurface fails with EGL_BAD_MATCH
    By Teraslilja in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 0
    Last Post: 05-12-2011, 08:03 AM
  2. ML always fails
    By JesseM in forum OpenML Coding & Technical Issues
    Replies: 4
    Last Post: 08-06-2003, 07:16 AM

Posting Permissions

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