Hi,
I am trying to create a sample application where i am trying to use a EGLImage as texture. The EGLImage is created from a native pixmap using eglCreateImageKHR.
Most of the open source sample codes available over net using eglCreateImageKHR has the last parameter(image attribute list) set to
NULL/EGL_IMAGE_PRESERVED_KHR is set to EGL_FALSE.
My query is what is the use of EGL_IMAGE_PRESERVED_KHR attribute and what is the difference b/w setting this attribute to EGL_FALSE and EGL_TRUE
and in which scenarios should i set this attribute to EGL_TRUE.
Thanks and Regards,
Prabal Kumar Ghosh
According to the specification:
* If the resource specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> has an off-screen buffer bound to it (e.g., by a previous call to eglBindTexImage), the error EGL_BAD_ACCESS is generated. * If the resource specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> is bound to an off-screen buffer (e.g., by a previous call to eglCreatePbufferFromClientBuffer), the error EGL_BAD_ACCESS is generated. * If the resource specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> is itself an EGLImage sibling, the error EGL_BAD_ACCESS is generated. * If the value specified in <attrib_list> for EGL_IMAGE_PRESERVED_KHR is EGL_TRUE, and an EGLImageKHR handle cannot be created from the specified resource such that the pixel data values in <buffer> are preserved, the error EGL_BAD_ACCESS is generated.
* If the resource specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> has an off-screen buffer bound to it (e.g., by a previous call to eglBindTexImage), the error EGL_BAD_ACCESS is generated.
* If the resource specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> is bound to an off-screen buffer (e.g., by a previous call to eglCreatePbufferFromClientBuffer), the error EGL_BAD_ACCESS is generated.
* If the resource specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> is itself an EGLImage sibling, the error EGL_BAD_ACCESS is generated.
* If the value specified in <attrib_list> for EGL_IMAGE_PRESERVED_KHR is EGL_TRUE, and an EGLImageKHR handle cannot be created from the specified resource such that the pixel data values in <buffer> are preserved, the error EGL_BAD_ACCESS is generated.
Are the possible reasons for you to obtain that error.
The first 2 are unlikely to be the reason, however point 3 looks possible, as does point 4.
The definition of an EGLImage sibling is:
The set of all EGLImage targets (in all client API contexts) which are created from the same EGLImage object, and the EGLImage source resouce which was used to create that EGLImage.
It is also worth pointing out that the previous command:
void EGLImageTargetTexture2DOES(enum target, eglImageOES image); Any existing image arrays associated with any mipmap levels in the texture object are freed (as if TexImage was called for each, with an image of zero size). As a result of this referencing operation, all of the pixel data in the <buffer> used as the EGLImage source resource (i.e., the <buffer> parameter passed to the CreateImageOES command that returned <image>) will become undefined.
void EGLImageTargetTexture2DOES(enum target, eglImageOES image);
Any existing image arrays associated with any mipmap levels in the texture object are freed (as if TexImage was called for each, with an image of zero size). As a result of this referencing operation, all of the pixel data in the <buffer> used as the EGLImage source resource (i.e., the <buffer> parameter passed to the CreateImageOES command that returned <image>) will become undefined.
Which could be an issue.
I hope that helps. Please refer to the Khronos specification for more details.
Kind Regards,
Michael McGeagh
Hi Michael,
Thanks a lot for your reply.