Skip to content

Commit

Permalink
backend: egl: don't assume glEGLImageTargetTexStorage exists
Browse files Browse the repository at this point in the history
Use eglGetProcAddress instead.

Fixes yshui#932
  • Loading branch information
omar-polo authored and FT-Labs committed Jan 23, 2023
1 parent 89690c9 commit 11a1957
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/backend/gl/egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ struct egl_data {
EGLContext ctx;
};

static PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC glEGLImageTargetTexStorage = NULL;

/**
* Free a glx_texture_t.
*/
Expand Down Expand Up @@ -202,6 +204,14 @@ static backend_t *egl_init(session_t *ps) {
goto end;
}

glEGLImageTargetTexStorage =
(PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC)eglGetProcAddress("glEGLImageTargetTexS"
"torageEXT");
if (glEGLImageTargetTexStorage == NULL) {
log_error("Failed to get glEGLImageTargetTexStorageEXT.");
goto end;
}

gd->gl.decouple_texture_user_data = egl_decouple_user_data;
gd->gl.release_user_data = egl_release_image;

Expand Down Expand Up @@ -270,7 +280,7 @@ egl_bind_pixmap(backend_t *base, xcb_pixmap_t pixmap, struct xvisual_info fmt, b
wd->dim = 0;
wd->inner->refcount = 1;
glBindTexture(GL_TEXTURE_2D, inner->texture);
glEGLImageTargetTexStorageEXT(GL_TEXTURE_2D, eglpixmap->image, NULL);
glEGLImageTargetTexStorage(GL_TEXTURE_2D, eglpixmap->image, NULL);
glBindTexture(GL_TEXTURE_2D, 0);

gl_check_err();
Expand Down

0 comments on commit 11a1957

Please sign in to comment.