From 3ff058ed0b4eaa828f7a7904eed602ac29dbc100 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 11 Jul 2022 08:44:00 -0400 Subject: [PATCH] mesa: update GL_CLAMP emulation when binding/unbinding textures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit binding/unbinding a texture affects the previously specified parameters, so ensure the driver flag for clamp emulation is also set to perform updates as needed Fixes: e8f71f6ac48 ("mesa/st: add PIPE_CAP_GL_CLAMP") Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/texobj.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 8e8cbb948dd..7637acd4add 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1619,6 +1619,14 @@ bind_texture_object(struct gl_context *ctx, unsigned unit, */ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); + /* if the previously bound texture uses GL_CLAMP, flag the driver here + * to ensure any emulation is disabled + */ + if (texUnit->CurrentTex[targetIndex] && + texUnit->CurrentTex[targetIndex]->Sampler.glclamp_mask != + texObj->Sampler.glclamp_mask) + ctx->NewDriverState |= ctx->DriverFlags.NewSamplersWithClamp; + /* If the refcount on the previously bound texture is decremented to * zero, it'll be deleted here. */