wined3d: Restore WINEDDBLT_ALPHATEST support.

Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2015-12-10 20:02:34 +00:00 committed by Alexandre Julliard
parent f915f9db4c
commit 080dedaf6e
3 changed files with 32 additions and 6 deletions

View File

@ -7774,6 +7774,7 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info,
TRACE("Color keying not supported with converted textures.\n");
return FALSE;
}
case WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST:
case WINED3D_BLIT_OP_COLOR_BLIT:
break;
@ -7828,7 +7829,7 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info,
}
}
static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
struct wined3d_surface *src_surface, const RECT *src_rect_in,
struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
const struct wined3d_color_key *color_key)
@ -7836,6 +7837,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
struct wined3d_context *context;
RECT src_rect = *src_rect_in;
RECT dst_rect = *dst_rect_in;
struct wined3d_color_key alpha_test_key;
/* Activate the destination context, set it up for blitting */
context = context_acquire(device, dst_surface);
@ -7864,6 +7866,14 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
if (!wined3d_resource_is_offscreen(&dst_surface->container->resource))
surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST)
{
const struct wined3d_format *fmt = src_surface->resource.format;
alpha_test_key.color_space_low_value = 0;
alpha_test_key.color_space_high_value = ~(((1u << fmt->alpha_size) - 1) << fmt->alpha_offset);
color_key = &alpha_test_key;
}
arbfp_blit_set(device->blit_priv, context, src_surface, color_key);
/* Draw a textured quad */

View File

@ -4230,6 +4230,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info,
return FALSE;
}
case WINED3D_BLIT_OP_COLOR_BLIT:
case WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST:
if (TRACE_ON(d3d_surface) && TRACE_ON(d3d))
{
TRACE("Checking support for fixup:\n");
@ -4319,7 +4320,7 @@ static HRESULT ffp_blit_depth_fill(struct wined3d_device *device, struct wined3d
return WINED3D_OK;
}
static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter,
static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
struct wined3d_surface *src_surface, const RECT *src_rect,
struct wined3d_surface *dst_surface, const RECT *dst_rect,
const struct wined3d_color_key *color_key)
@ -4335,8 +4336,16 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, DWORD filter,
wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT, color_key);
context = context_acquire(device, dst_surface);
if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST)
glEnable(GL_ALPHA_TEST);
surface_blt_to_drawable(device, context, filter,
!!color_key, src_surface, src_rect, dst_surface, dst_rect);
if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST)
glDisable(GL_ALPHA_TEST);
context_release(context);
/* Restore the color key parameters */
@ -5000,7 +5009,7 @@ static HRESULT cpu_blit_depth_fill(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
static void cpu_blit_blit_surface(struct wined3d_device *device, DWORD filter,
static void cpu_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
struct wined3d_surface *src_surface, const RECT *src_rect,
struct wined3d_surface *dst_surface, const RECT *dst_rect,
const struct wined3d_color_key *color_key)
@ -5036,7 +5045,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
| WINEDDBLT_KEYSRCOVERRIDE
| WINEDDBLT_WAIT
| WINEDDBLT_DEPTHFILL
| WINEDDBLT_DONOTWAIT;
| WINEDDBLT_DONOTWAIT
| WINEDDBLT_ALPHATEST;
TRACE("dst_surface %p, dst_rect_in %s, src_surface %p, src_rect_in %s, flags %#x, fx %p, filter %s.\n",
dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in),
@ -5264,6 +5274,10 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
color_key = &src_surface->container->async.src_blt_color_key;
blit_op = WINED3D_BLIT_OP_COLOR_BLIT_CKEY;
}
else if (flags & WINEDDBLT_ALPHATEST)
{
blit_op = WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST;
}
else if ((src_surface->locations & WINED3D_LOCATION_SYSMEM)
&& !(dst_surface->locations & WINED3D_LOCATION_SYSMEM))
{
@ -5335,7 +5349,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format);
if (blitter)
{
blitter->blit_surface(device, filter, src_surface, &src_rect, dst_surface, &dst_rect, color_key);
blitter->blit_surface(device, blit_op, filter, src_surface,
&src_rect, dst_surface, &dst_rect, color_key);
return WINED3D_OK;
}
}

View File

@ -1362,6 +1362,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
enum wined3d_blit_op
{
WINED3D_BLIT_OP_COLOR_BLIT,
WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST,
WINED3D_BLIT_OP_COLOR_BLIT_CKEY,
WINED3D_BLIT_OP_COLOR_FILL,
WINED3D_BLIT_OP_DEPTH_FILL,
@ -1385,7 +1386,7 @@ struct blit_shader
const RECT *dst_rect, const struct wined3d_color *color);
HRESULT (*depth_fill)(struct wined3d_device *device,
struct wined3d_surface *surface, const RECT *rect, float depth);
void (*blit_surface)(struct wined3d_device *device, DWORD filter,
void (*blit_surface)(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
struct wined3d_surface *src_surface, const RECT *src_rect,
struct wined3d_surface *dst_surface, const RECT *dst_rect,
const struct wined3d_color_key *color_key);