diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index 02567b07619..1c143091166 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -32,6 +32,7 @@ #include "util/u_inlines.h" #include "util/format/u_format.h" #include "st_cb_eglimage.h" +#include "st_cb_texture.h" #include "st_context.h" #include "st_texture.h" #include "st_format.h" @@ -272,6 +273,11 @@ st_bind_egl_image(struct gl_context *ctx, GLenum internalFormat; mesa_format texFormat; + if (stimg->texture->target != gl_target_to_pipe(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, __func__); + return; + } + if (stimg->internalformat) { internalFormat = stimg->internalformat; } else { diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h index 1d5d3a39e2e..45984c87616 100644 --- a/src/mesa/state_tracker/st_cb_texture.h +++ b/src/mesa/state_tracker/st_cb_texture.h @@ -43,7 +43,7 @@ struct gl_pixelstore_attrib; struct gl_memory_object; struct gl_sampler_object; -extern enum pipe_texture_target +enum pipe_texture_target gl_target_to_pipe(GLenum target); unsigned