From: Elizabeth Figura <zfigura(a)codeweavers.com> --- dlls/wined3d/stateblock.c | 2 +- dlls/wined3d/texture.c | 12 ++++++++++-- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 5d275be1ae1..2cd88497750 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -3332,7 +3332,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, texture = state->textures[i]; wined3d_device_set_texture(device, i, texture); - if (!i && texture) + if (!i && texture && (texture->color_key_flags & WINED3D_CKEY_SRC_BLT)) { wined3d_format_get_float_color_key(texture->resource.format, &texture->src_blt_color_key, float_key); wined3d_device_context_push_constants(context, diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 99c6a89764d..2efdaf91438 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1770,8 +1770,16 @@ HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture, return WINED3DERR_INVALIDCALL; } - if ((flags & WINED3D_CKEY_SRC_BLT) && color_key) - texture->src_blt_color_key = *color_key; + if (color_key) + { + if (flags & WINED3D_CKEY_SRC_BLT) + texture->src_blt_color_key = *color_key; + texture->color_key_flags |= flags; + } + else + { + texture->color_key_flags &= ~flags; + } wined3d_cs_emit_set_color_key(device->cs, texture, flags, color_key); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index c8b437aa524..96bfee21d1b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3348,6 +3348,7 @@ struct wined3d_texture /* Color key field accessed from the client side. */ struct wined3d_color_key src_blt_color_key; + uint32_t color_key_flags; struct wined3d_dirty_regions { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6118