diff options
author | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-04-10 19:39:40 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-04-12 14:13:25 +0800 |
commit | 3d2147443651e0edfdecc71635ea3730b8a3ac0c (patch) | |
tree | cdf897ec09a0551a8cdb2484be69288c464dd747 /utests/utest_helper.hpp | |
parent | dad2c6773fb46902029f6af018ce666495871b75 (diff) | |
download | beignet-3d2147443651e0edfdecc71635ea3730b8a3ac0c.tar.gz |
utests: added cl_khr_gl_sharing related helper functions.
This is the preparation to add clgl interoperate test cases.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Lu, Guanqun <guanqun.lu@intel.com>
Diffstat (limited to 'utests/utest_helper.hpp')
-rw-r--r-- | utests/utest_helper.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp index 112c74d5..f364ff9b 100644 --- a/utests/utest_helper.hpp +++ b/utests/utest_helper.hpp @@ -34,6 +34,15 @@ #include <cstdio> #include <cstdlib> +#ifdef HAS_EGL +#define EGL_WINDOW_WIDTH 256 +#define EGL_WINDOW_HEIGHT 256 +#include <GL/gl.h> +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include <CL/cl_gl.h> +#endif + #define OCL_THROW_ERROR(FN, STATUS) \ do { \ char msg[2048]; \ @@ -57,6 +66,11 @@ OCL_CALL(cl_kernel_init, FILE_NAME".cl", KERNEL_NAME, SOURCE); \ } while (0) +#define OCL_FLUSH() \ + do { \ + OCL_CALL(clFlush, queue); \ + } while(0) + #define OCL_CREATE_BUFFER(BUFFER, FLAGS, SIZE, DATA) \ do { \ cl_int status; \ @@ -71,6 +85,21 @@ if (status != CL_SUCCESS) OCL_THROW_ERROR(FN, status); \ } while (0) +#define OCL_CREATE_GL_IMAGE(IMAGE, FLAGS, TARGET, LEVEL, TEXTURE) \ + do { \ + cl_int status; \ + IMAGE = clCreateFromGLTexture(ctx, FLAGS, TARGET, LEVEL, TEXTURE, &status);\ + if (status != CL_SUCCESS) OCL_THROW_ERROR(FN, status); \ + } while (0) + +#define OCL_ENQUEUE_ACQUIRE_GL_OBJECTS(ID) \ + do { \ + clEnqueueAcquireGLObjects(queue, 1, &buf[ID], 0,0, 0); \ + } while(0) + +#define OCL_SWAP_EGL_BUFFERS() \ + eglSwapBuffers(eglDisplay, eglSurface); + #define OCL_CREATE_SAMPLER(SAMPLER, ADDRESS_MODE, FILTER_MODE) \ do { \ cl_int status; \ @@ -118,6 +147,10 @@ extern cl_mem buf[MAX_BUFFER_N]; extern void* buf_data[MAX_BUFFER_N]; extern size_t globals[3]; extern size_t locals[3]; +extern Display *xDisplay; +extern EGLDisplay eglDisplay; +extern EGLSurface eglSurface; + enum { SOURCE = 0, |