This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

glEGLImageTargetTexture2DOES does not set properly the state of an attached framebuffer

Hi,

I have recently encountered a problem with OpenGL/EGL on ARM Mali 450, Android 4.4.2. In my opinion this is a bug.

I have the following setup. A texture with no storage and a frame buffer attached to the texture. An EGLImageKHR is set as the texture's storage with glEGLImageTargetTexture2DOES. Then the frame buffer status is not complete, while it should be.

Here is an example code:

GLuint tex;
glGenTextures(1, &tex);
GLuint frmBuff;
glGenFramebuffers(1, &frmBuff);

glBindFramebuffer(GL_FRAMEBUFFER, frmBuff);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);

ANativeWindowBuffer* graphicBuffer = ...; // Init a graphic buffer in some manner
EGLClientBuffer cbuf = (EGLClientBuffer)graphicBuffer;

EGLint attrs[] = {
        EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
        EGL_NONE,
};

EGLImageKHR eglImg = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, cbuf, attrs);

glBindTexture(GL_TEXTURE_2D, tex);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)eglImg);

GLenum framebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER); // Returns GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT

The frame buffer check should return GL_FRAMEBUFFER_COMPLETE, because a storage of the texture has been just given with glEGLImageTargetTexture2DOES. If we substitute glEGLImageTargetTexture2DOES

with the semantically equivalent

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);

we get nice behavior and the framebuffer is in complete state afterwards. This leads me to believe, if there has not been any texture storage beforehand, that glEGLImageTargetTexture2DOES does not properly set the state of the attached framebuffer.