Exemplo n.º 1
0
/*!
    Returns true if the 3D OpenCL \a image object is also an OpenGL
    3D texture object; false otherwise.

    \sa isTexture2D()
*/
bool QCLContextGL::isTexture3D(const QCLImage3D &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_TEXTURE3D;
#else
    Q_UNUSED(image);
    return false;
#endif
}
Exemplo n.º 2
0
/*!
    Copies the contents of this buffer, starting at \a offset to
    \a origin within \a dest, extending for \a size.  Returns an event
    object that can be used to wait for the request to finish.

    The request will not start until all of the events in \a after
    have been signaled as finished.  The request is executed on
    the active command queue for context().

    \sa copyTo()
*/
QCLEvent QCLBuffer::copyToAsync
(size_t offset, const QCLImage3D &dest,
 const size_t origin[3], const size_t size[3],
 const QCLEventList &after)
{
    cl_event event;
    cl_int error = clEnqueueCopyBufferToImage
                   (context()->activeQueue(), memoryId(), dest.memoryId(),
                    offset, origin, size,
                    after.size(), after.eventData(), &event);
    context()->reportError("QCLBuffer::copyToAsync(QCLImage3D):", error);
    if (error == CL_SUCCESS)
        return QCLEvent(event);
    else
        return QCLEvent();
}
Exemplo n.º 3
0
/*!
    Copies the contents of this buffer, starting at \a offset to
    \a origin within \a dest, extending for \a size.  Returns true if
    the copy was successful; false otherwise.

    This function will block until the request finishes.
    The request is executed on the active command queue for context().

    \sa copyToAsync()
*/
bool QCLBuffer::copyTo
(size_t offset, const QCLImage3D &dest,
 const size_t origin[3], const size_t size[3])
{
    cl_event event;
    cl_int error = clEnqueueCopyBufferToImage
                   (context()->activeQueue(), memoryId(), dest.memoryId(),
                    offset, origin, size, 0, 0, &event);
    context()->reportError("QCLBuffer::copyTo(QCLImage3D):", error);
    if (error == CL_SUCCESS) {
        clWaitForEvents(1, &event);
        clReleaseEvent(event);
        return true;
    } else {
        return false;
    }
}