Creates an EGLImage target from an EGLImage source.
cl_mem clCreateFromEGLImageKHR(cl_context context, CLeglDisplayKHR display, CLeglImageKHR image, cl_mem_flags flags, const cl_egl_image_properties_khr * properties, cl_int * errcode_ret)
Should be of type
EGLDisplay, cast into the type
Should be of type
EGLImageKHR, cast into the type
CLeglImageKHR. Assuming no errors are generated in this function, the resulting image object will be an EGLImage target of the specified EGLImage
image. The resulting
cl_memis an image object which may be used normally by all OpenCL operations. This maps to an
image2d_ttype in OpenCL kernel code.
A bit-field that is used to specify usage information about the memory object being created. The possible values for
For OpenCL 1.2
This extension only requires support for
CL_MEM_READ_ONLY, and for OpenCL 1.2
CL_MEM_HOST_NO_ACCESS. For OpenCL 1.1, a
CL_INVALID_OPERATIONwill be returned for images which do not support host mapping.
If the value passed in
flagsis not supported by the OpenCL implementation it will return
CL_INVALID_VALUE. The accepted
flagsmay be dependent upon the texture format used.
Specifies a list of property names and their corresponding values. Each property name is immediately followed by the corresponding desired value. The list is terminated with 0. No properties are currently supported with this version of the extension.
propertiescan be NULL.
clCreateFromEGLImageKHR creates an EGLImage target of type
cl_mem from the EGLImage source provided as
An OpenCL memory object created from an EGL image remains valid according to the lifetime behaviour as described in EGL_KHR_image_base.
"Any EGLImage siblings exist in any client API context"
For OpenCL this means that while the application retains a reference on the
cl_mem (EGL sibling) the image remains valid.
In order to ensure data integrity, the application is responsible for synchronizing access to shared CL/EGL objects by their respective APIs. Failure to provide such synchronization may result in race conditions and other undefined behavior including non-portability between implementations.
Prior to calling
clEnqueueAcquireEGLObjectsKHR, the application must ensure that any pending operations which access the objects specified in
mem_objects have completed.
This may be accomplished in a portable way by ceasing all client operations on the resource, and issuing and waiting for completion of a
glFinish command on all GL contexts with pending references to these objects.
Implementations may offer more efficient synchronization methods, such as synchronisation primitives or fence operations.
Similarly, after calling
clEnqueueReleaseEGLImageObjects, the application is responsible for ensuring that any pending OpenCL operations which access the objects specified in
mem_objects have completed prior to executing subsequent commands in other APIs which reference these objects.
This may be accomplished in a portable way by calling
clWaitForEvents with the event object returned by
clEnqueueReleaseGLObjects , or by calling
As above, some implementations may offer more efficient methods.
Attempting to access the data store of an EGLImage object after it has been acquired by OpenCL and before it has been released will result in undefined behavior. Similarly, attempting to access a shared EGLImage object from OpenCL before it has been acquired by the OpenCL command queue or after it has been released, will result in undefined behavior.
contextis not a valid OpenCL context.
propertiescontains invalid values, if
displayis not a valid display object or if
flagsare not in the set defined above.
imageis not a valid EGLImage object.
CL_IMAGE_FORMAT_NOT_SUPPORTEDif the OpenCL implementation is not able to create a
cl_memcompatible with the provided
CLeglImageKHRfor an implementation-dependent reason (this could be caused by, but not limited to, reasons such as unsupported texture formats, etc).
CL_INVALID_OPERATIONif there are no devices in
contextthat support images (i.e.
CL_DEVICE_IMAGE_SUPPORTspecified in table 4.3 (see
CL_FALSE) or if the flags passed are not supported for that image type.
CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.
CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.