cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

klkblake
Journeyman III

OpenCL kernel not run when passed a Renderbuffer

When an image2d_t created from an OpenGL Renderbuffer is passed to a kernel, the kernel completes instantly without actually running whenever it is enqueued. For example, in the following:


__kernel void sample(__write_only image2d_t output) {
        printf("The kernel is being executed.\n");
        uint2 pixel = {get_global_id(0), get_global_id(1)};
        write_imagef(output, as_int2(pixel), (float4)(1, 1, 1, 1));
}


no text is ever printed to the screen, and the renderbuffer is not written to. I've attached a testcase.

I'm running on 64bit linux, with a Core i5 3570, and a Radeon HD 7970.

0 Likes
6 Replies
himanshu_gautam
Grandmaster

Thanks for the testcase. I will look into it, and let you know.

0 Likes
himanshu_gautam
Grandmaster

Can you confirm this is a duplicate of http://devgurus.amd.com/message/1299102#1299102

0 Likes

Not a duplicate. Using a renderbuffer the OpenCL kernel is ignored entirely. Using a texture the kernel is run, but only the first write to the texture affects it (when run on CPU).

0 Likes

Can you please go through CL_GL Interop sample from APP SDK. I do not see the usage of GLContext, as present in SimpleGL.cpp. I am myself not very familiar with OpenGL, but as I understand a GL context should also be created.

#ifdef _WIN32

static HWND   gHwnd;

HDC           gHdc;

HGLRC         gGlCtx;

BOOL quit = FALSE;

MSG msg;

#else

GLXContext gGlCtx;

#define GLX_CONTEXT_MAJOR_VERSION_ARB           0x2091

#define GLX_CONTEXT_MINOR_VERSION_ARB           0x2092

typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display*, GLXFBConfig, GLXContext, Bool, const int*);

Window          win;

Display         *displayName;

XEvent          xev;

#endif

0 Likes

glutInit() handles cross-platform OpenGL context creation.

0 Likes

Sorry for the late reply.

using glut for CL-GL interop is not recommended as there does not seem to be a way to get hold of the GL context from glut API. Can you try to use raw windowing capabilities, and create a testcase. You can refer to SimpleGL sample for testcase creation.

0 Likes