wined3d: The source texture is always non-NULL in surface_cpu_blt().

Since fills no longer go through the blitter.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-04-11 23:24:22 +02:00 committed by Alexandre Julliard
parent 3e36857557
commit 1b034f7fdb
1 changed files with 265 additions and 282 deletions

View File

@ -2845,12 +2845,12 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
struct wined3d_texture *converted_texture = NULL;
unsigned int src_fmt_flags, dst_fmt_flags;
struct wined3d_map_desc dst_map, src_map;
const BYTE *sbase = NULL;
unsigned int x, sx, xinc, y, sy, yinc;
HRESULT hr = WINED3D_OK;
BOOL same_sub_resource;
const BYTE *sbase;
const BYTE *sbuf;
BYTE *dbuf;
int x, y;
TRACE("dst_texture %p, dst_sub_resource_idx %u, dst_box %s, src_texture %p, "
"src_sub_resource_idx %u, src_box %s, flags %#x, fx %p, filter %s.\n",
@ -2872,8 +2872,6 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
same_sub_resource = FALSE;
dst_format = dst_texture->resource.format;
dst_fmt_flags = dst_texture->resource.format_flags;
if (src_texture)
{
if (dst_texture->resource.format->id != src_texture->resource.format->id)
{
if (!(converted_texture = surface_convert_format(src_texture, src_sub_resource_idx, dst_format)))
@ -2888,12 +2886,6 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_resource_map(&src_texture->resource, src_sub_resource_idx, &src_map, NULL, WINED3D_MAP_READONLY);
src_format = src_texture->resource.format;
src_fmt_flags = src_texture->resource.format_flags;
}
else
{
src_format = dst_format;
src_fmt_flags = dst_fmt_flags;
}
wined3d_resource_map(&dst_texture->resource, dst_sub_resource_idx, &dst_map, dst_box, 0);
}
@ -2905,7 +2897,6 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
dst_width = dst_box->right - dst_box->left;
row_byte_count = dst_width * bpp;
if (src_texture)
sbase = (BYTE *)src_map.data
+ ((src_box->top / src_format->block_height) * src_map.row_pitch)
+ ((src_box->left / src_format->block_width) * src_format->block_byte_count);
@ -2940,11 +2931,6 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
goto release;
}
/* Now the 'with source' blits. */
if (src_texture)
{
int sx, xinc, sy, yinc;
if (filter != WINED3D_TEXF_NONE && filter != WINED3D_TEXF_POINT
&& (src_width != dst_width || src_height != dst_height))
{
@ -2962,8 +2948,8 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
{
if (dst_height == src_height)
{
/* No stretching in either direction. This needs to be as
* fast as possible. */
/* No stretching in either direction. This needs to be as fast
* as possible. */
sbuf = sbase;
/* Check for overlapping surfaces. */
@ -3015,7 +3001,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
else
{
/* Stretching in X direction. */
int last_sy = -1;
unsigned int last_sy = ~0u;
for (y = sy = 0; y < dst_height; ++y, sy += yinc)
{
sbuf = sbase + (sy >> 16) * src_map.row_pitch;
@ -3065,7 +3051,7 @@ do { \
break;
}
default:
FIXME("Stretched blit not implemented for bpp %u!\n", bpp * 8);
FIXME("Stretched blit not implemented for bpp %u.\n", bpp * 8);
hr = WINED3DERR_NOTAVAILABLE;
goto error;
}
@ -3084,7 +3070,7 @@ do { \
if (flags & (WINED3D_BLT_SRC_CKEY | WINED3D_BLT_DST_CKEY
| WINED3D_BLT_SRC_CKEY_OVERRIDE | WINED3D_BLT_DST_CKEY_OVERRIDE))
{
/* The color keying flags are checked for correctness in ddraw */
/* The color keying flags are checked for correctness in ddraw. */
if (flags & WINED3D_BLT_SRC_CKEY)
{
keylow = src_texture->async.src_blt_color_key.color_space_low_value;
@ -3116,9 +3102,7 @@ do { \
{
DWORD masks[3];
get_color_masks(src_format, masks);
keymask = masks[0]
| masks[1]
| masks[2];
keymask = masks[0] | masks[1] | masks[2];
}
flags &= ~(WINED3D_BLT_SRC_CKEY | WINED3D_BLT_DST_CKEY
| WINED3D_BLT_SRC_CKEY_OVERRIDE | WINED3D_BLT_DST_CKEY_OVERRIDE);
@ -3135,7 +3119,7 @@ do { \
if (fx->fx & WINEDDBLTFX_ARITHSTRETCHY)
{
/* I don't think we need to do anything about this flag */
/* I don't think we need to do anything about this flag. */
WARN("Nothing done for WINEDDBLTFX_ARITHSTRETCHY.\n");
}
if (fx->fx & WINEDDBLTFX_MIRRORLEFTRIGHT)
@ -3160,7 +3144,7 @@ do { \
}
if (fx->fx & WINEDDBLTFX_NOTEARING)
{
/* I don't think we need to do anything about this flag */
/* I don't think we need to do anything about this flag. */
WARN("Nothing done for WINEDDBLTFX_NOTEARING.\n");
}
if (fx->fx & WINEDDBLTFX_ROTATE180)
@ -3200,7 +3184,7 @@ do { \
}
if (fx->fx & WINEDDBLTFX_ZBUFFERBASEDEST)
{
/* I don't think we need to do anything about this flag */
/* I don't think we need to do anything about this flag. */
WARN("Nothing done for WINEDDBLTFX_ZBUFFERBASEDEST.\n");
}
dbuf = dTopLeft;
@ -3268,14 +3252,13 @@ do { \
break;
}
default:
FIXME("%s color-keyed blit not implemented for bpp %u!\n",
FIXME("%s color-keyed blit not implemented for bpp %u.\n",
(flags & WINED3D_BLT_SRC_CKEY) ? "Source" : "Destination", bpp * 8);
hr = WINED3DERR_NOTAVAILABLE;
goto error;
#undef COPY_COLORKEY_FX
}
}
}
error:
if (flags)
@ -3283,7 +3266,7 @@ error:
release:
wined3d_resource_unmap(&dst_texture->resource, dst_sub_resource_idx);
if (src_texture && !same_sub_resource)
if (!same_sub_resource)
wined3d_resource_unmap(&src_texture->resource, src_sub_resource_idx);
if (converted_texture)
wined3d_texture_decref(converted_texture);