st/mesa: implement EGLImageTargetTexStorage

We can now support this extension.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3375>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3375>
This commit is contained in:
Gurchetan Singh
2020-01-13 18:03:23 -08:00
committed by Marge Bot
parent 2f1032f8f2
commit 6c978b1362
2 changed files with 30 additions and 0 deletions

View File

@@ -268,10 +268,22 @@ st_bind_egl_image(struct gl_context *ctx,
break;
default:
texFormat = st_pipe_format_to_mesa_format(stimg->format);
/* Use previously derived internalformat as specified by
* EXT_EGL_image_storage.
*/
if (tex_storage && texObj->Target == GL_TEXTURE_2D
&& stimg->internalformat) {
internalFormat = stimg->internalformat;
if (internalFormat == GL_NONE) {
_mesa_error(ctx, GL_INVALID_OPERATION, __func__);
return;
}
}
break;
}
assert(texFormat != MESA_FORMAT_NONE);
/* Minify texture size based on level set on the EGLImage. */
uint32_t width = u_minify(stimg->texture->width0, stimg->level);
uint32_t height = u_minify(stimg->texture->height0, stimg->level);
@@ -308,9 +320,26 @@ st_egl_image_target_texture_2d(struct gl_context *ctx, GLenum target,
pipe_resource_reference(&stimg.texture, NULL);
}
static void
st_egl_image_target_tex_storage(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLeglImageOES image_handle)
{
struct st_egl_image stimg;
if (!st_get_egl_image(ctx, image_handle, PIPE_BIND_SAMPLER_VIEW,
"glEGLImageTargetTexture2D", &stimg))
return;
st_bind_egl_image(ctx, texObj, texImage, &stimg, true);
pipe_resource_reference(&stimg.texture, NULL);
}
void
st_init_eglimage_functions(struct dd_function_table *functions)
{
functions->EGLImageTargetTexture2D = st_egl_image_target_texture_2d;
functions->EGLImageTargetTexStorage = st_egl_image_target_tex_storage;
functions->EGLImageTargetRenderbufferStorage = st_egl_image_target_renderbuffer_storage;
}

View File

@@ -1018,6 +1018,7 @@ void st_init_extensions(struct pipe_screen *screen,
extensions->EXT_blend_color = GL_TRUE;
extensions->EXT_blend_func_separate = GL_TRUE;
extensions->EXT_blend_minmax = GL_TRUE;
extensions->EXT_EGL_image_storage = GL_TRUE;
extensions->EXT_gpu_program_parameters = GL_TRUE;
extensions->EXT_pixel_buffer_object = GL_TRUE;
extensions->EXT_point_parameters = GL_TRUE;