+ egl_image_target_texture(ctx, texObj, target, image, false, func);
+}
+
+static void
+egl_image_target_texture_storage(struct gl_context *ctx,
+ struct gl_texture_object *texObj, GLenum target,
+ GLeglImageOES image, const GLint *attrib_list,
+ const char *caller)
+{
+ /*
+ * EXT_EGL_image_storage:
+ *
+ * "<attrib_list> must be NULL or a pointer to the value GL_NONE."
+ */
+ if (attrib_list && attrib_list[0] != GL_NONE) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(image=%p)", caller, image);
+ return;
+ }
+
+ switch (target) {
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_EXTERNAL_OES:
+ break;
+ default:
+ /*
+ * The EXT_EGL_image_storage spec allows for many other targets besides
+ * GL_TEXTURE_2D and GL_TEXTURE_EXTERNAL_OES, however these are complicated
+ * to implement.
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported target=%d)",
+ caller, target);
+ return;
+ }
+
+ egl_image_target_texture(ctx, texObj, target, image, true, caller);
+}
+
+
+void GLAPIENTRY
+_mesa_EGLImageTargetTexStorageEXT(GLenum target, GLeglImageOES image,
+ const GLint *attrib_list)
+{
+ struct gl_texture_object *texObj;
+ const char *func = "glEGLImageTargetTexStorageEXT";
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_get_current_tex_object(ctx, target);
+ if (!texObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(target=%d)", func, target);
+ return;
+ }
+
+ egl_image_target_texture_storage(ctx, texObj, target, image, attrib_list,
+ func);
+}
+
+void GLAPIENTRY
+_mesa_EGLImageTargetTextureStorageEXT(GLuint texture, GLeglImageOES image,
+ const GLint *attrib_list)
+{
+ struct gl_texture_object *texObj;
+ const char *func = "glEGLImageTargetTextureStorageEXT";
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!(_mesa_is_desktop_gl(ctx) && ctx->Version >= 45) &&
+ !_mesa_has_ARB_direct_state_access(ctx) &&
+ !_mesa_has_EXT_direct_state_access(ctx)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "direct access not supported");
+ return;
+ }
+
+ texObj = _mesa_lookup_texture_err(ctx, texture, func);
+ if (!texObj)
+ return;
+
+ egl_image_target_texture_storage(ctx, texObj, texObj->Target, image,
+ attrib_list, func);