/*! Returns true if the OpenCL \a buffer object is also an OpenGL buffer object; false otherwise. */ bool QCLContextGL::isGLBuffer(const QCLBuffer &buffer) { #ifndef QT_NO_CL_OPENGL cl_gl_object_type objectType; if (clGetGLObjectInfo (buffer.memoryId(), &objectType, 0) != CL_SUCCESS) return false; return objectType == CL_GL_OBJECT_BUFFER; #else Q_UNUSED(buffer); return false; #endif }
/*! Returns true if the 2D OpenCL \a image object is also an OpenGL 2D texture object; false otherwise. \sa isRenderbuffer(), isTexture3D() */ bool QCLContextGL::isTexture2D(const QCLImage2D &image) { #ifndef QT_NO_CL_OPENGL cl_gl_object_type objectType; if (clGetGLObjectInfo (image.memoryId(), &objectType, 0) != CL_SUCCESS) return false; return objectType == CL_GL_OBJECT_TEXTURE2D; #else Q_UNUSED(image); return false; #endif }
cl_int MemoryObjectWrapper::getGLObjectInfo (cl_gl_object_type *aGLObjectTypeOut, cl_GLuint *aGLObjectNameOut) { #ifdef CL_WRAPPER_ENABLE_OPENGL_SUPPORT D_METHOD_START; cl_int err = clGetGLObjectInfo (mWrapped, aGLObjectTypeOut, aGLObjectNameOut); if (err != CL_SUCCESS) D_LOG (LOG_LEVEL_ERROR, "clGetGLObjectInfo failed. (error %d)", err); return err; #else //CL_WRAPPER_ENABLE_OPENGL_SUPPORT (void)aGLObjectTypeOut; (void)aGLObjectNameOut; D_LOG (LOG_LEVEL_ERROR, "CLWrapper support for OpenCL/OpenGL interoperability API was not enabled at build time."); return CL_INVALID_VALUE; #endif //CL_WRAPPER_ENABLE_OPENGL_SUPPORT }
/// Returns the OpenGL memory object ID. /// /// \see_opencl_ref{clGetGLObjectInfo} GLuint get_opengl_object() const { GLuint object = 0; clGetGLObjectInfo(m_mem, 0, &object); return object; }
/// Returns the OpenGL memory object type. /// /// \see_opencl_ref{clGetGLObjectInfo} cl_gl_object_type get_opengl_type() const { cl_gl_object_type type; clGetGLObjectInfo(m_mem, &type, 0); return type; }