[PATCH 3/6] wined3d: Store color keys in textures instead of in surfaces.
Henri Verbeet
hverbeet at codeweavers.com
Thu Jan 9 05:17:00 CST 2014
---
dlls/ddraw/surface.c | 49 +++++++++-------
dlls/wined3d/arb_program_shader.c | 2 +-
dlls/wined3d/device.c | 2 +-
dlls/wined3d/state.c | 26 ++++-----
dlls/wined3d/surface.c | 114 +++++++++----------------------------
dlls/wined3d/texture.c | 61 ++++++++++++++++++++
dlls/wined3d/utils.c | 4 +-
dlls/wined3d/wined3d.spec | 2 +-
dlls/wined3d/wined3d_private.h | 14 ++---
include/wine/wined3d.h | 4 +-
10 files changed, 139 insertions(+), 139 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index bab396a..8137157 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -4611,7 +4611,8 @@ static HRESULT WINAPI ddraw_surface7_SetColorKey(IDirectDrawSurface7 *iface, DWO
return DDERR_INVALIDPARAMS;
}
}
- ctx.ret = wined3d_surface_set_color_key(This->wined3d_surface, Flags, ctx.color_key);
+ if (This->wined3d_texture)
+ ctx.ret = wined3d_texture_set_color_key(This->wined3d_texture, Flags, ctx.color_key);
ddraw_surface7_EnumAttachedSurfaces(iface, &ctx, SetColorKeyEnum);
wined3d_mutex_unlock();
@@ -5897,6 +5898,19 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
root->is_complex_root = TRUE;
texture->root = root;
+ if (desc->dwFlags & DDSD_CKDESTOVERLAY)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_DESTOVERLAY,
+ (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay);
+ if (desc->dwFlags & DDSD_CKDESTBLT)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_DESTBLT,
+ (struct wined3d_color_key *)&desc->ddckCKDestBlt);
+ if (desc->dwFlags & DDSD_CKSRCOVERLAY)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_SRCOVERLAY,
+ (struct wined3d_color_key *)&desc->ddckCKSrcOverlay);
+ if (desc->dwFlags & DDSD_CKSRCBLT)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_SRCBLT,
+ (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
+
for (i = 0; i < layers; ++i)
{
attach = &root->complex_array[layers - 1 - i];
@@ -5987,6 +6001,19 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
last->wined3d_texture = wined3d_texture;
texture->root = last;
+ if (desc->dwFlags & DDSD_CKDESTOVERLAY)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_DESTOVERLAY,
+ (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay);
+ if (desc->dwFlags & DDSD_CKDESTBLT)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_DESTBLT,
+ (struct wined3d_color_key *)&desc->ddckCKDestBlt);
+ if (desc->dwFlags & DDSD_CKSRCOVERLAY)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_SRCOVERLAY,
+ (struct wined3d_color_key *)&desc->ddckCKSrcOverlay);
+ if (desc->dwFlags & DDSD_CKSRCBLT)
+ wined3d_texture_set_color_key(wined3d_texture, DDCKEY_SRCBLT,
+ (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
+
*attach = last;
attach = &last->complex_array[0];
}
@@ -6070,26 +6097,6 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, s
surface->surface_desc.u1.lPitch = wined3d_surface_get_pitch(wined3d_surface);
}
- if (desc->dwFlags & DDSD_CKDESTOVERLAY)
- {
- wined3d_surface_set_color_key(wined3d_surface, DDCKEY_DESTOVERLAY,
- (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay);
- }
- if (desc->dwFlags & DDSD_CKDESTBLT)
- {
- wined3d_surface_set_color_key(wined3d_surface, DDCKEY_DESTBLT,
- (struct wined3d_color_key *)&desc->ddckCKDestBlt);
- }
- if (desc->dwFlags & DDSD_CKSRCOVERLAY)
- {
- wined3d_surface_set_color_key(wined3d_surface, DDCKEY_SRCOVERLAY,
- (struct wined3d_color_key *)&desc->ddckCKSrcOverlay);
- }
- if (desc->dwFlags & DDSD_CKSRCBLT)
- {
- wined3d_surface_set_color_key(wined3d_surface, DDCKEY_SRCBLT,
- (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
- }
if (desc->dwFlags & DDSD_LPSURFACE)
{
UINT pitch = 0;
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 23ca809..a1bb3e6 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7116,7 +7116,7 @@ static void upload_palette(const struct wined3d_surface *surface, struct wined3d
struct wined3d_device *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct arbfp_blit_priv *priv = device->blit_priv;
- BOOL colorkey = (surface->CKeyFlags & WINEDDSD_CKSRCBLT) != 0;
+ BOOL colorkey = !!(surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
d3dfmt_p8_init_palette(surface, table, colorkey);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 46492c4..925f879 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -603,7 +603,7 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
color_key.color_space_low_value = 0;
color_key.color_space_high_value = 0;
- wined3d_surface_set_color_key(surface, WINEDDCKEY_SRCBLT, &color_key);
+ wined3d_texture_set_color_key(device->logo_texture, WINEDDCKEY_SRCBLT, &color_key);
}
else
{
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 52eac88..f450f20 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -531,19 +531,15 @@ static void state_alpha(struct wined3d_context *context, const struct wined3d_st
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
- /* Find out if the texture on the first stage has a ckey set
- * The alpha state func reads the texture settings, even though alpha and texture are not grouped
- * together. This is to avoid making a huge alpha+texture+texture stage+ckey block due to the hardly
- * used WINED3D_RS_COLORKEYENABLE state(which is d3d <= 3 only). The texture function will call alpha
- * in case it finds some texture+colorkeyenable combination which needs extra care.
- */
- if (state->textures[0])
- {
- struct wined3d_surface *surface = surface_from_resource(state->textures[0]->sub_resources[0]);
-
- if (surface->CKeyFlags & WINEDDSD_CKSRCBLT)
- enable_ckey = TRUE;
- }
+ /* Find out if the texture on the first stage has a ckey set. The alpha
+ * state func reads the texture settings, even though alpha and texture
+ * are not grouped together. This is to avoid making a huge alpha +
+ * texture + texture stage + ckey block due to the hardly used
+ * WINED3D_RS_COLORKEYENABLE state(which is d3d <= 3 only). The texture
+ * function will call alpha in case it finds some texture + colorkeyenable
+ * combination which needs extra care. */
+ if (state->textures[0] && (state->textures[0]->color_key_flags & WINEDDSD_CKSRCBLT))
+ enable_ckey = TRUE;
if (enable_ckey || context->last_was_ckey)
context_apply_state(context, state, STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP));
@@ -3220,9 +3216,7 @@ void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *st
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
- struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]);
-
- if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_size)
+ if (texture->color_key_flags & WINEDDSD_CKSRCBLT && !texture->resource.format->alpha_size)
{
/* Color keying needs to pass alpha values from the texture through to have the alpha test work
* properly. On the other hand applications can still use texture combiners apparently. This code
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 91b35fd..60539c0 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1814,7 +1814,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
static HRESULT d3dfmt_get_conv(const struct wined3d_surface *surface, BOOL need_alpha_ck, BOOL use_texturing,
struct wined3d_format *format, enum wined3d_conversion_type *conversion_type)
{
- BOOL colorkey_active = need_alpha_ck && (surface->CKeyFlags & WINEDDSD_CKSRCBLT);
+ BOOL colorkey_active = need_alpha_ck && (surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
const struct wined3d_device *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
BOOL blit_supported = FALSE;
@@ -2269,13 +2269,15 @@ void surface_load(struct wined3d_surface *surface, BOOL srgb)
if (surface->resource.pool == WINED3D_POOL_SCRATCH)
ERR("Not supported on scratch surfaces.\n");
- ck_changed = !(surface->flags & SFLAG_GLCKEY) != !(surface->CKeyFlags & WINEDDSD_CKSRCBLT);
+ ck_changed = !(surface->flags & SFLAG_GLCKEY) != !(surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
/* Reload if either the texture and sysmem have different ideas about the
* color key, or the actual key values changed. */
- if (ck_changed || ((surface->CKeyFlags & WINEDDSD_CKSRCBLT)
- && (surface->gl_color_key.color_space_low_value != surface->src_blt_color_key.color_space_low_value
- || surface->gl_color_key.color_space_high_value != surface->src_blt_color_key.color_space_high_value)))
+ if (ck_changed || ((surface->container->color_key_flags & WINEDDSD_CKSRCBLT)
+ && (surface->gl_color_key.color_space_low_value
+ != surface->container->src_blt_color_key.color_space_low_value
+ || surface->gl_color_key.color_space_high_value
+ != surface->container->src_blt_color_key.color_space_high_value)))
{
TRACE("Reloading because of color keying\n");
/* To perform the color key conversion we need a sysmem copy of
@@ -2511,68 +2513,6 @@ void CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struct w
surface->surface_ops->surface_realize_palette(surface);
}
-HRESULT CDECL wined3d_surface_set_color_key(struct wined3d_surface *surface,
- DWORD flags, const struct wined3d_color_key *color_key)
-{
- TRACE("surface %p, flags %#x, color_key %p.\n", surface, flags, color_key);
-
- if (flags & WINEDDCKEY_COLORSPACE)
- {
- FIXME(" colorkey value not supported (%08x) !\n", flags);
- return WINED3DERR_INVALIDCALL;
- }
-
- /* Dirtify the surface, but only if a key was changed. */
- if (color_key)
- {
- switch (flags & ~WINEDDCKEY_COLORSPACE)
- {
- case WINEDDCKEY_DESTBLT:
- surface->dst_blt_color_key = *color_key;
- surface->CKeyFlags |= WINEDDSD_CKDESTBLT;
- break;
-
- case WINEDDCKEY_DESTOVERLAY:
- surface->dst_overlay_color_key = *color_key;
- surface->CKeyFlags |= WINEDDSD_CKDESTOVERLAY;
- break;
-
- case WINEDDCKEY_SRCOVERLAY:
- surface->src_overlay_color_key = *color_key;
- surface->CKeyFlags |= WINEDDSD_CKSRCOVERLAY;
- break;
-
- case WINEDDCKEY_SRCBLT:
- surface->src_blt_color_key = *color_key;
- surface->CKeyFlags |= WINEDDSD_CKSRCBLT;
- break;
- }
- }
- else
- {
- switch (flags & ~WINEDDCKEY_COLORSPACE)
- {
- case WINEDDCKEY_DESTBLT:
- surface->CKeyFlags &= ~WINEDDSD_CKDESTBLT;
- break;
-
- case WINEDDCKEY_DESTOVERLAY:
- surface->CKeyFlags &= ~WINEDDSD_CKDESTOVERLAY;
- break;
-
- case WINEDDCKEY_SRCOVERLAY:
- surface->CKeyFlags &= ~WINEDDSD_CKSRCOVERLAY;
- break;
-
- case WINEDDCKEY_SRCBLT:
- surface->CKeyFlags &= ~WINEDDSD_CKSRCBLT;
- break;
- }
- }
-
- return WINED3D_OK;
-}
-
struct wined3d_palette * CDECL wined3d_surface_get_palette(const struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
@@ -3721,7 +3661,7 @@ void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[25
* alpha component of pixels that should be masked away is set to 0. */
if (index_in_alpha)
table[i][3] = i;
- else if (colorkey && color_in_range(&surface->src_blt_color_key, i))
+ else if (colorkey && color_in_range(&surface->container->src_blt_color_key, i))
table[i][3] = 0x00;
else if (pal->flags & WINED3D_PALETTE_ALPHA)
table[i][3] = pal->palents[i].peFlags;
@@ -3796,7 +3736,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++ ) {
WORD color = *Source++;
*Dest = ((color & 0xffc0) | ((color & 0x1f) << 1));
- if (!color_in_range(&surface->src_blt_color_key, color))
+ if (!color_in_range(&surface->container->src_blt_color_key, color))
*Dest |= 0x0001;
Dest++;
}
@@ -3817,7 +3757,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++ ) {
WORD color = *Source++;
*Dest = color;
- if (!color_in_range(&surface->src_blt_color_key, color))
+ if (!color_in_range(&surface->container->src_blt_color_key, color))
*Dest |= (1 << 15);
else
*Dest &= ~(1 << 15);
@@ -3838,7 +3778,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++) {
DWORD color = ((DWORD)source[0] << 16) + ((DWORD)source[1] << 8) + (DWORD)source[2] ;
DWORD dstcolor = color << 8;
- if (!color_in_range(&surface->src_blt_color_key, color))
+ if (!color_in_range(&surface->container->src_blt_color_key, color))
dstcolor |= 0xff;
*(DWORD*)dest = dstcolor;
source += 3;
@@ -3859,7 +3799,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; x++) {
DWORD color = 0xffffff & *(const DWORD*)source;
DWORD dstcolor = color << 8;
- if (!color_in_range(&surface->src_blt_color_key, color))
+ if (!color_in_range(&surface->container->src_blt_color_key, color))
dstcolor |= 0xff;
*(DWORD*)dest = dstcolor;
source += 4;
@@ -3879,7 +3819,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
for (x = 0; x < width; ++x)
{
DWORD color = *(const DWORD *)source;
- if (color_in_range(&surface->src_blt_color_key, color))
+ if (color_in_range(&surface->container->src_blt_color_key, color))
color &= ~0xff000000;
*(DWORD*)dest = color;
source += 4;
@@ -4422,7 +4362,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
* away have alpha set to 0. */
if (swapchain_is_p8(context->swapchain))
gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL,
- (float)src_surface->src_blt_color_key.color_space_low_value / 256.0f);
+ (float)src_surface->container->src_blt_color_key.color_space_low_value / 256.0f);
else
gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL, 0.0f);
checkGLcall("glAlphaFunc");
@@ -4598,8 +4538,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
else if (src_surface)
{
/* Blit from offscreen surface to render target */
- struct wined3d_color_key old_blt_key = src_surface->src_blt_color_key;
- DWORD oldCKeyFlags = src_surface->CKeyFlags;
+ struct wined3d_color_key old_blt_key = src_surface->container->src_blt_color_key;
+ DWORD old_color_key_flags = src_surface->container->color_key_flags;
TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface);
@@ -4625,21 +4565,21 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
else if (flags & WINEDDBLT_KEYSRCOVERRIDE)
{
/* Use color key from DDBltFx */
- src_surface->CKeyFlags |= WINEDDSD_CKSRCBLT;
- src_surface->src_blt_color_key = DDBltFx->ddckSrcColorkey;
+ src_surface->container->color_key_flags |= WINEDDSD_CKSRCBLT;
+ src_surface->container->src_blt_color_key = DDBltFx->ddckSrcColorkey;
}
else
{
/* Do not use color key */
- src_surface->CKeyFlags &= ~WINEDDSD_CKSRCBLT;
+ src_surface->container->color_key_flags &= ~WINEDDSD_CKSRCBLT;
}
surface_blt_to_drawable(device, filter, flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE),
src_surface, src_rect, dst_surface, dst_rect);
/* Restore the color key parameters */
- src_surface->CKeyFlags = oldCKeyFlags;
- src_surface->src_blt_color_key = old_blt_key;
+ src_surface->container->color_key_flags = old_color_key_flags;
+ src_surface->container->src_blt_color_key = old_blt_key;
surface_validate_location(dst_surface, dst_surface->draw_binding);
surface_invalidate_location(dst_surface, ~dst_surface->draw_binding);
@@ -5071,10 +5011,10 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
surface_prepare_texture(surface, context, srgb);
wined3d_texture_bind_and_dirtify(surface->container, context, srgb);
- if (surface->CKeyFlags & WINEDDSD_CKSRCBLT)
+ if (surface->container->color_key_flags & WINEDDSD_CKSRCBLT)
{
surface->flags |= SFLAG_GLCKEY;
- surface->gl_color_key = surface->src_blt_color_key;
+ surface->gl_color_key = surface->container->src_blt_color_key;
}
else surface->flags &= ~SFLAG_GLCKEY;
@@ -5806,8 +5746,8 @@ do { \
/* The color keying flags are checked for correctness in ddraw */
if (flags & WINEDDBLT_KEYSRC)
{
- keylow = src_surface->src_blt_color_key.color_space_low_value;
- keyhigh = src_surface->src_blt_color_key.color_space_high_value;
+ keylow = src_surface->container->src_blt_color_key.color_space_low_value;
+ keyhigh = src_surface->container->src_blt_color_key.color_space_high_value;
}
else if (flags & WINEDDBLT_KEYSRCOVERRIDE)
{
@@ -5818,8 +5758,8 @@ do { \
if (flags & WINEDDBLT_KEYDEST)
{
/* Destination color keys are taken from the source surface! */
- destkeylow = src_surface->dst_blt_color_key.color_space_low_value;
- destkeyhigh = src_surface->dst_blt_color_key.color_space_high_value;
+ destkeylow = src_surface->container->dst_blt_color_key.color_space_low_value;
+ destkeyhigh = src_surface->container->dst_blt_color_key.color_space_high_value;
}
else if (flags & WINEDDBLT_KEYDESTOVERRIDE)
{
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 31eb2b0..0d6b974 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -623,6 +623,67 @@ enum wined3d_texture_filter_type CDECL wined3d_texture_get_autogen_filter_type(c
return texture->filter_type;
}
+HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture,
+ DWORD flags, const struct wined3d_color_key *color_key)
+{
+ TRACE("texture %p, flags %#x, color_key %p.\n", texture, flags, color_key);
+
+ if (flags & WINEDDCKEY_COLORSPACE)
+ {
+ FIXME("Unhandled flags %#x.\n", flags);
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (color_key)
+ {
+ switch (flags & ~WINEDDCKEY_COLORSPACE)
+ {
+ case WINEDDCKEY_DESTBLT:
+ texture->dst_blt_color_key = *color_key;
+ texture->color_key_flags |= WINEDDSD_CKDESTBLT;
+ break;
+
+ case WINEDDCKEY_DESTOVERLAY:
+ texture->dst_overlay_color_key = *color_key;
+ texture->color_key_flags |= WINEDDSD_CKDESTOVERLAY;
+ break;
+
+ case WINEDDCKEY_SRCOVERLAY:
+ texture->src_overlay_color_key = *color_key;
+ texture->color_key_flags |= WINEDDSD_CKSRCOVERLAY;
+ break;
+
+ case WINEDDCKEY_SRCBLT:
+ texture->src_blt_color_key = *color_key;
+ texture->color_key_flags |= WINEDDSD_CKSRCBLT;
+ break;
+ }
+ }
+ else
+ {
+ switch (flags & ~WINEDDCKEY_COLORSPACE)
+ {
+ case WINEDDCKEY_DESTBLT:
+ texture->color_key_flags &= ~WINEDDSD_CKDESTBLT;
+ break;
+
+ case WINEDDCKEY_DESTOVERLAY:
+ texture->color_key_flags &= ~WINEDDSD_CKDESTOVERLAY;
+ break;
+
+ case WINEDDCKEY_SRCOVERLAY:
+ texture->color_key_flags &= ~WINEDDSD_CKSRCOVERLAY;
+ break;
+
+ case WINEDDCKEY_SRCBLT:
+ texture->color_key_flags &= ~WINEDDSD_CKSRCBLT;
+ break;
+ }
+ }
+
+ return WINED3D_OK;
+}
+
void CDECL wined3d_texture_generate_mipmaps(struct wined3d_texture *texture)
{
/* TODO: Implement filters using GL_SGI_generate_mipmaps. */
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index c37b677..5d0b428 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3324,9 +3324,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
- struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]);
-
- if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_size)
+ if (texture->color_key_flags & WINEDDSD_CKSRCBLT && !texture->resource.format->alpha_size)
{
if (aop == WINED3D_TOP_DISABLE)
{
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 33f88b4..3a6dd33 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -222,7 +222,6 @@
@ cdecl wined3d_surface_preload(ptr)
@ cdecl wined3d_surface_releasedc(ptr ptr)
@ cdecl wined3d_surface_restore(ptr)
-@ cdecl wined3d_surface_set_color_key(ptr long ptr)
@ cdecl wined3d_surface_set_overlay_position(ptr long long)
@ cdecl wined3d_surface_set_palette(ptr ptr)
@ cdecl wined3d_surface_set_priority(ptr long)
@@ -260,6 +259,7 @@
@ cdecl wined3d_texture_incref(ptr)
@ cdecl wined3d_texture_preload(ptr)
@ cdecl wined3d_texture_set_autogen_filter_type(ptr long)
+@ cdecl wined3d_texture_set_color_key(ptr long ptr)
@ cdecl wined3d_texture_set_lod(ptr long)
@ cdecl wined3d_texture_set_priority(ptr long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6d38ec2..f8109bc 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2082,6 +2082,13 @@ struct wined3d_texture
const struct min_lookup *min_mip_lookup;
const GLenum *mag_lookup;
GLenum target;
+
+ /* Color keys for DDraw */
+ struct wined3d_color_key dst_blt_color_key;
+ struct wined3d_color_key src_blt_color_key;
+ struct wined3d_color_key dst_overlay_color_key;
+ struct wined3d_color_key src_overlay_color_key;
+ DWORD color_key_flags;
};
static inline struct wined3d_texture *wined3d_texture_from_resource(struct wined3d_resource *resource)
@@ -2212,13 +2219,6 @@ struct wined3d_surface
HDC hDC;
void *getdc_map_mem;
- /* Color keys for DDraw */
- struct wined3d_color_key dst_blt_color_key;
- struct wined3d_color_key src_blt_color_key;
- struct wined3d_color_key dst_overlay_color_key;
- struct wined3d_color_key src_overlay_color_key;
- DWORD CKeyFlags;
-
struct wined3d_color_key gl_color_key;
struct list renderbuffers;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index bde05d3..0f23fa2 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2311,8 +2311,6 @@ HRESULT __cdecl wined3d_surface_map(struct wined3d_surface *surface,
void __cdecl wined3d_surface_preload(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc);
HRESULT __cdecl wined3d_surface_restore(struct wined3d_surface *surface);
-HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface,
- DWORD flags, const struct wined3d_color_key *color_key);
HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
void __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette);
DWORD __cdecl wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD new_priority);
@@ -2370,6 +2368,8 @@ ULONG __cdecl wined3d_texture_incref(struct wined3d_texture *texture);
void __cdecl wined3d_texture_preload(struct wined3d_texture *texture);
HRESULT __cdecl wined3d_texture_set_autogen_filter_type(struct wined3d_texture *texture,
enum wined3d_texture_filter_type filter_type);
+HRESULT __cdecl wined3d_texture_set_color_key(struct wined3d_texture *texture,
+ DWORD flags, const struct wined3d_color_key *color_key);
DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod);
DWORD __cdecl wined3d_texture_set_priority(struct wined3d_texture *texture, DWORD priority);
--
1.7.10.4
More information about the wine-patches
mailing list