aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-10-10 13:58:44 +0200
committerNicolai Hähnle <[email protected]>2017-10-10 13:58:44 +0200
commitd245724399b7ac9e2ddf99d381f7fe092204006a (patch)
treedfe3d07df0a1f8611496d66ef6607c93bd30a243 /src/mesa/main/texobj.c
parenta2c8812f919c59933605c5942d6613e14ec8b3d1 (diff)
st/mesa: fix switching from surface-based to non-surface-based textures
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 <[email protected]>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r--src/mesa/main/texobj.c11
1 files changed, 7 insertions, 4 deletions
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);
}
}