From d245724399b7ac9e2ddf99d381f7fe092204006a Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Tue, 10 Oct 2017 13:58:44 +0200 Subject: st/mesa: fix switching from surface-based to non-surface-based textures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This can happen with surface-based texture objects derived from EGL images, since those aren't immutable. Fixes tests in dEQP-EGL.functional.sharing.gles2.multithread.random.images.teximage2d.* and others Reviewed-by: Marek Olšák --- src/mesa/main/texobj.c | 11 +++++++---- src/mesa/main/texobj.h | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index b703da01bef..1978898b8b9 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -471,16 +471,19 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, /** - * Free all texture images of the given texture object. + * Free all texture images of the given texture objectm, except for + * \p retainTexImage. * * \param ctx GL context. - * \param t texture object. + * \param texObj texture object. + * \param retainTexImage a texture image that will \em not be freed. * * \sa _mesa_clear_texture_image(). */ void _mesa_clear_texture_object(struct gl_context *ctx, - struct gl_texture_object *texObj) + struct gl_texture_object *texObj, + struct gl_texture_image *retainTexImage) { GLuint i, j; @@ -490,7 +493,7 @@ _mesa_clear_texture_object(struct gl_context *ctx, for (i = 0; i < MAX_FACES; i++) { for (j = 0; j < MAX_TEXTURE_LEVELS; j++) { struct gl_texture_image *texImage = texObj->Image[i][j]; - if (texImage) + if (texImage && texImage != retainTexImage) _mesa_clear_texture_image(ctx, texImage); } } diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 71cc8ffba2e..e67ce3ff9df 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -81,7 +81,8 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, extern void _mesa_clear_texture_object(struct gl_context *ctx, - struct gl_texture_object *obj); + struct gl_texture_object *obj, + struct gl_texture_image *retainTexImage); extern void _mesa_reference_texobj_(struct gl_texture_object **ptr, -- cgit v1.2.3