eglCreateImageKHR fails when the EGLImage source is a one component GL texture

I’m currently trying to understand what constraints PVR drivers have regarding which GL textures can be EGLImage sources. From my testing it appears that eglCreateImageKHR fails for at least GL_RED and GL_LUMINANCE textures on PVR (but not Qualcomm or NV GPUs).

It seems like the EGL_KHR_gl_texture_2D_image spec doesn’t say what texture formats must be supported, and I’ve found other indications that it might not be reasonable to expect that formats other than RGB/RGBA will work in all cases.

The following errors are logged when an Android WebView instance tries to create a GL_RED or GL_LUMINANCE EGLImage to share YUV video frames between threads.

E/IMGSRV (19548): :0: GLESGetImageSource: Format mismatch with texture
E/IMGSRV (19548): :0: IMGeglCreateImageKHR: Generic error

At this point I think I will have to find a workaround involving another texture format, but it would be good to know more clearly what’s going on here from a driver perspective.

Hi Tobias,

Thanks for getting in touch. I’m not familiar with this issue, so cannot give an answer at the moment. We will investigate and will aim to get back to you in the next few days.

Thanks,
Joe

Hi Tobias,

Can you provide a code snippet to reproduce this problem?

Thanks,
Kevin

Hi Tobias,

I just try the follow code snippets, but I can not reproduce you problem.

glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 540, 888, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);

EGLImageKHR imageKHR;
EGLint khrAttribList[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
EGL_GL_TEXTURE_LEVEL_KHR, 0,
EGL_NONE};
eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress(“eglCreateImageKHR”);
imageKHR = eglCreateImageKHR(display, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, (EGLClientBuffer) tex,
khrAttribList);

Platform : MEIZU MX4
Version Rogue_DDK_Android_RSCompute rogueddk 1.3@3304414 (release) mt6595
System Version String: RGX HW
MTK Version String: 1682274 1730656
Rogue Version: 1.75.2.20 (HW)

Thanks,
Kevin