diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index 7866ee0fdb3..be33a6b8a2b 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -435,7 +435,9 @@ dri_get_egl_image(struct st_manager *smapi, __DRIimage *img = NULL; const struct dri2_format_mapping *map; - if (screen->lookup_egl_image) { + if (screen->lookup_egl_image_validated) { + img = screen->lookup_egl_image_validated(screen, egl_image); + } else if (screen->lookup_egl_image) { img = screen->lookup_egl_image(screen, egl_image); } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index f9797ba6fc4..a848c1df799 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2749,6 +2749,13 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) return; } + if (!image || (ctx->Driver.ValidateEGLImage && + !ctx->Driver.ValidateEGLImage(ctx, image))) { + _mesa_error(ctx, GL_INVALID_VALUE, + "EGLImageTargetRenderbufferStorageOES"); + return; + } + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 71c5f2b299f..41714dc9b0d 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3421,7 +3421,8 @@ egl_image_target_texture(struct gl_context *ctx, return; } - if (!image) { + if (!image || (ctx->Driver.ValidateEGLImage && + !ctx->Driver.ValidateEGLImage(ctx, image))) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(image=%p)", caller, image); return; }