Commit 9d7221b5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Replace WINEDDBLTFX with a new structure that only includes the used fields.

It's a happy coincidence that none of the surface pointers are actually used. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0b6b5176
...@@ -1387,7 +1387,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip(IDirectDrawSurface * ...@@ -1387,7 +1387,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip(IDirectDrawSurface *
static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, const RECT *dst_rect_in, static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, const RECT *dst_rect_in,
struct ddraw_surface *src_surface, const RECT *src_rect_in, DWORD flags, struct ddraw_surface *src_surface, const RECT *src_rect_in, DWORD flags,
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{ {
struct wined3d_texture *wined3d_src_texture; struct wined3d_texture *wined3d_src_texture;
unsigned int src_sub_resource_idx; unsigned int src_sub_resource_idx;
...@@ -1529,71 +1529,74 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons ...@@ -1529,71 +1529,74 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
* See IWineD3DSurface::Blt for more details * See IWineD3DSurface::Blt for more details
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestRect, static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *dst_rect,
IDirectDrawSurface7 *SrcSurface, RECT *SrcRect, DWORD Flags, DDBLTFX *DDBltFx) IDirectDrawSurface7 *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx)
{ {
struct ddraw_surface *dst_surface = impl_from_IDirectDrawSurface7(iface); struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface7(iface);
struct ddraw_surface *src_surface = unsafe_impl_from_IDirectDrawSurface7(SrcSurface); struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface7(src_surface);
struct wined3d_blt_fx wined3d_fx;
HRESULT hr = DD_OK; HRESULT hr = DD_OK;
DDBLTFX rop_fx; DDBLTFX rop_fx;
TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n", TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n",
iface, wine_dbgstr_rect(DestRect), SrcSurface, wine_dbgstr_rect(SrcRect), Flags, DDBltFx); iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx);
/* Check for validity of the flags here. WineD3D Has the software-opengl selection path and would have /* Check for validity of the flags here. WineD3D Has the software-opengl selection path and would have
* to check at 2 places, and sometimes do double checks. This also saves the call to wined3d :-) * to check at 2 places, and sometimes do double checks. This also saves the call to wined3d :-)
*/ */
if((Flags & DDBLT_KEYSRCOVERRIDE) && (!DDBltFx || Flags & DDBLT_KEYSRC)) { if ((flags & DDBLT_KEYSRCOVERRIDE) && (!fx || flags & DDBLT_KEYSRC))
{
WARN("Invalid source color key parameters, returning DDERR_INVALIDPARAMS\n"); WARN("Invalid source color key parameters, returning DDERR_INVALIDPARAMS\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if((Flags & DDBLT_KEYDESTOVERRIDE) && (!DDBltFx || Flags & DDBLT_KEYDEST)) { if ((flags & DDBLT_KEYDESTOVERRIDE) && (!fx || flags & DDBLT_KEYDEST))
{
WARN("Invalid destination color key parameters, returning DDERR_INVALIDPARAMS\n"); WARN("Invalid destination color key parameters, returning DDERR_INVALIDPARAMS\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if (Flags & DDBLT_DDROPS) if (flags & DDBLT_DDROPS)
{ {
FIXME("DDBLT_DDROPS not implemented.\n"); FIXME("DDBLT_DDROPS not implemented.\n");
if (DDBltFx) if (fx)
FIXME(" rop %#x, pattern %p.\n", DDBltFx->dwDDROP, DDBltFx->u5.lpDDSPattern); FIXME(" rop %#x, pattern %p.\n", fx->dwDDROP, fx->u5.lpDDSPattern);
return DDERR_NORASTEROPHW; return DDERR_NORASTEROPHW;
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
if (Flags & (DDBLT_COLORFILL | DDBLT_DEPTHFILL)) if (flags & (DDBLT_COLORFILL | DDBLT_DEPTHFILL))
{ {
if (Flags & DDBLT_ROP) if (flags & DDBLT_ROP)
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("DDBLT_ROP used with DDBLT_COLORFILL or DDBLT_DEPTHFILL, returning DDERR_INVALIDPARAMS.\n"); WARN("DDBLT_ROP used with DDBLT_COLORFILL or DDBLT_DEPTHFILL, returning DDERR_INVALIDPARAMS.\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if (src_surface) if (src_impl)
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("Depth or colorfill is not compatible with source surfaces, returning DDERR_INVALIDPARAMS\n"); WARN("Depth or colorfill is not compatible with source surfaces, returning DDERR_INVALIDPARAMS\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if (!DDBltFx) if (!fx)
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("Depth or colorfill used with DDBltFx = NULL, returning DDERR_INVALIDPARAMS.\n"); WARN("Depth or colorfill used with NULL fx, returning DDERR_INVALIDPARAMS.\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if ((Flags & (DDBLT_COLORFILL | DDBLT_DEPTHFILL)) == (DDBLT_COLORFILL | DDBLT_DEPTHFILL)) if ((flags & (DDBLT_COLORFILL | DDBLT_DEPTHFILL)) == (DDBLT_COLORFILL | DDBLT_DEPTHFILL))
Flags &= ~DDBLT_DEPTHFILL; flags &= ~DDBLT_DEPTHFILL;
if ((dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) && (Flags & DDBLT_COLORFILL)) if ((dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) && (flags & DDBLT_COLORFILL))
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("DDBLT_COLORFILL used on a depth buffer, returning DDERR_INVALIDPARAMS.\n"); WARN("DDBLT_COLORFILL used on a depth buffer, returning DDERR_INVALIDPARAMS.\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if (!(dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) && (Flags & DDBLT_DEPTHFILL)) if (!(dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) && (flags & DDBLT_DEPTHFILL))
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("DDBLT_DEPTHFILL used on a color buffer, returning DDERR_INVALIDPARAMS.\n"); WARN("DDBLT_DEPTHFILL used on a color buffer, returning DDERR_INVALIDPARAMS.\n");
...@@ -1601,65 +1604,71 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Blt(IDirectDrawSurface7 * ...@@ -1601,65 +1604,71 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Blt(IDirectDrawSurface7 *
} }
} }
if (Flags & DDBLT_ROP) if (flags & DDBLT_ROP)
{ {
if (!DDBltFx) if (!fx)
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("DDBLT_ROP used with DDBltFx = NULL, returning DDERR_INVALIDPARAMS.\n"); WARN("DDBLT_ROP used with NULL fx, returning DDERR_INVALIDPARAMS.\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
Flags &= ~DDBLT_ROP; flags &= ~DDBLT_ROP;
switch (DDBltFx->dwROP) switch (fx->dwROP)
{ {
case SRCCOPY: case SRCCOPY:
break; break;
case WHITENESS: case WHITENESS:
case BLACKNESS: case BLACKNESS:
rop_fx = *DDBltFx; rop_fx = *fx;
if (DDBltFx->dwROP == WHITENESS) if (fx->dwROP == WHITENESS)
rop_fx.u5.dwFillColor = 0xffffffff; rop_fx.u5.dwFillColor = 0xffffffff;
else else
rop_fx.u5.dwFillColor = 0; rop_fx.u5.dwFillColor = 0;
if (dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) if (dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
Flags |= DDBLT_DEPTHFILL; flags |= DDBLT_DEPTHFILL;
else else
Flags |= DDBLT_COLORFILL; flags |= DDBLT_COLORFILL;
DDBltFx = &rop_fx; fx = &rop_fx;
break; break;
default: default:
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("Unsupported ROP %#x used, returning DDERR_NORASTEROPHW.\n", DDBltFx->dwROP); WARN("Unsupported ROP %#x used, returning DDERR_NORASTEROPHW.\n", fx->dwROP);
return DDERR_NORASTEROPHW; return DDERR_NORASTEROPHW;
} }
} }
if (Flags & DDBLT_KEYSRC && (!src_surface || !(src_surface->surface_desc.dwFlags & DDSD_CKSRCBLT))) if (flags & DDBLT_KEYSRC && (!src_impl || !(src_impl->surface_desc.dwFlags & DDSD_CKSRCBLT)))
{ {
WARN("DDBLT_KEYDEST blit without color key in surface, returning DDERR_INVALIDPARAMS\n"); WARN("DDBLT_KEYDEST blit without color key in surface, returning DDERR_INVALIDPARAMS\n");
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if (Flags & ~WINED3D_BLT_MASK) if (flags & ~WINED3D_BLT_MASK)
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
FIXME("Unhandled flags %#x.\n", Flags); FIXME("Unhandled flags %#x.\n", flags);
return E_NOTIMPL; return E_NOTIMPL;
} }
/* TODO: Check if the DDBltFx contains any ddraw surface pointers. If it if (fx)
* does, copy the struct, and replace the ddraw surfaces with the wined3d {
* surfaces. So far no blitting operations using surfaces in the bltfx wined3d_fx.fx = fx->dwDDFX;
* struct are supported anyway. */ wined3d_fx.fill_color = fx->u5.dwFillColor;
hr = ddraw_surface_blt_clipped(dst_surface, DestRect, src_surface, SrcRect, wined3d_fx.dst_color_key.color_space_low_value = fx->ddckDestColorkey.dwColorSpaceLowValue;
Flags, (WINEDDBLTFX *)DDBltFx, WINED3D_TEXF_LINEAR); wined3d_fx.dst_color_key.color_space_high_value = fx->ddckDestColorkey.dwColorSpaceHighValue;
wined3d_fx.src_color_key.color_space_low_value = fx->ddckSrcColorkey.dwColorSpaceLowValue;
wined3d_fx.src_color_key.color_space_high_value = fx->ddckSrcColorkey.dwColorSpaceHighValue;
}
hr = ddraw_surface_blt_clipped(dst_impl, dst_rect, src_impl,
src_rect, flags, fx ? &wined3d_fx : NULL, WINED3D_TEXF_LINEAR);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
switch(hr) switch(hr)
......
...@@ -3182,16 +3182,16 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st ...@@ -3182,16 +3182,16 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st
} }
static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RECT *dst_rect, static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *DDBltFx, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
enum wined3d_texture_filter_type filter) const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{ {
struct wined3d_device *device = dst_surface->resource.device; struct wined3d_device *device = dst_surface->resource.device;
const struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(device->fb.render_targets[0]); const struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(device->fb.render_targets[0]);
struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_swapchain *src_swapchain, *dst_swapchain;
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, blt_fx %p, filter %s.\n", TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
flags, DDBltFx, debug_d3dtexturefiltertype(filter)); flags, fx, debug_d3dtexturefiltertype(filter));
/* Get the swapchain. One of the surfaces has to be a primary surface */ /* Get the swapchain. One of the surfaces has to be a primary surface */
if (dst_surface->resource.pool == WINED3D_POOL_SYSTEM_MEM) if (dst_surface->resource.pool == WINED3D_POOL_SYSTEM_MEM)
...@@ -4149,7 +4149,7 @@ static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, ...@@ -4149,7 +4149,7 @@ static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info,
static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data, static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data,
UINT src_pitch, UINT dst_pitch, UINT update_w, UINT update_h, UINT src_pitch, UINT dst_pitch, UINT update_w, UINT update_h,
const struct wined3d_format *format, DWORD flags, const WINEDDBLTFX *fx) const struct wined3d_format *format, DWORD flags, const struct wined3d_blt_fx *fx)
{ {
UINT row_block_count; UINT row_block_count;
const BYTE *src_row; const BYTE *src_row;
...@@ -4173,7 +4173,7 @@ static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data, ...@@ -4173,7 +4173,7 @@ static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data,
return WINED3D_OK; return WINED3D_OK;
} }
if (flags == WINED3D_BLT_FX && fx->dwDDFX == WINEDDBLTFX_MIRRORUPDOWN) if (flags == WINED3D_BLT_FX && fx->fx == WINEDDBLTFX_MIRRORUPDOWN)
{ {
src_row += (((update_h / format->block_height) - 1) * src_pitch); src_row += (((update_h / format->block_height) - 1) * src_pitch);
...@@ -4245,14 +4245,14 @@ static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data, ...@@ -4245,14 +4245,14 @@ static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data,
} }
FIXME("Unsupported blit on compressed surface (format %s, flags %#x, DDFX %#x).\n", FIXME("Unsupported blit on compressed surface (format %s, flags %#x, DDFX %#x).\n",
debug_d3dformat(format->id), flags, flags & WINED3D_BLT_FX ? fx->dwDDFX : 0); debug_d3dformat(format->id), flags, flags & WINED3D_BLT_FX ? fx->fx : 0);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{ {
const struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1}; const struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1};
int bpp, srcheight, srcwidth, dstheight, dstwidth, width; int bpp, srcheight, srcwidth, dstheight, dstwidth, width;
...@@ -4367,7 +4367,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT * ...@@ -4367,7 +4367,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
/* First, all the 'source-less' blits */ /* First, all the 'source-less' blits */
if (flags & WINED3D_BLT_COLOR_FILL) if (flags & WINED3D_BLT_COLOR_FILL)
{ {
hr = _Blt_ColorFill(dbuf, dstwidth, dstheight, bpp, dst_map.row_pitch, fx->u5.dwFillColor); hr = _Blt_ColorFill(dbuf, dstwidth, dstheight, bpp, dst_map.row_pitch, fx->fill_color);
flags &= ~WINED3D_BLT_COLOR_FILL; flags &= ~WINED3D_BLT_COLOR_FILL;
} }
...@@ -4529,8 +4529,8 @@ do { \ ...@@ -4529,8 +4529,8 @@ do { \
} }
else if (flags & WINED3D_BLT_SRC_CKEY_OVERRIDE) else if (flags & WINED3D_BLT_SRC_CKEY_OVERRIDE)
{ {
keylow = fx->ddckSrcColorkey.color_space_low_value; keylow = fx->src_color_key.color_space_low_value;
keyhigh = fx->ddckSrcColorkey.color_space_high_value; keyhigh = fx->src_color_key.color_space_high_value;
} }
if (flags & WINED3D_BLT_DST_CKEY) if (flags & WINED3D_BLT_DST_CKEY)
...@@ -4541,8 +4541,8 @@ do { \ ...@@ -4541,8 +4541,8 @@ do { \
} }
else if (flags & WINED3D_BLT_DST_CKEY_OVERRIDE) else if (flags & WINED3D_BLT_DST_CKEY_OVERRIDE)
{ {
destkeylow = fx->ddckDestColorkey.color_space_low_value; destkeylow = fx->dst_color_key.color_space_low_value;
destkeyhigh = fx->ddckDestColorkey.color_space_high_value; destkeyhigh = fx->dst_color_key.color_space_high_value;
} }
if (bpp == 1) if (bpp == 1)
...@@ -4570,12 +4570,12 @@ do { \ ...@@ -4570,12 +4570,12 @@ do { \
dBottomLeft = dTopLeft + ((dstheight - 1) * dst_map.row_pitch); dBottomLeft = dTopLeft + ((dstheight - 1) * dst_map.row_pitch);
dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp); dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp);
if (fx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY) 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"); WARN("Nothing done for WINEDDBLTFX_ARITHSTRETCHY.\n");
} }
if (fx->dwDDFX & WINEDDBLTFX_MIRRORLEFTRIGHT) if (fx->fx & WINEDDBLTFX_MIRRORLEFTRIGHT)
{ {
tmp = dTopRight; tmp = dTopRight;
dTopRight = dTopLeft; dTopRight = dTopLeft;
...@@ -4585,7 +4585,7 @@ do { \ ...@@ -4585,7 +4585,7 @@ do { \
dBottomLeft = tmp; dBottomLeft = tmp;
dstxinc = dstxinc * -1; dstxinc = dstxinc * -1;
} }
if (fx->dwDDFX & WINEDDBLTFX_MIRRORUPDOWN) if (fx->fx & WINEDDBLTFX_MIRRORUPDOWN)
{ {
tmp = dTopLeft; tmp = dTopLeft;
dTopLeft = dBottomLeft; dTopLeft = dBottomLeft;
...@@ -4595,12 +4595,12 @@ do { \ ...@@ -4595,12 +4595,12 @@ do { \
dBottomRight = tmp; dBottomRight = tmp;
dstyinc = dstyinc * -1; dstyinc = dstyinc * -1;
} }
if (fx->dwDDFX & WINEDDBLTFX_NOTEARING) 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"); WARN("Nothing done for WINEDDBLTFX_NOTEARING.\n");
} }
if (fx->dwDDFX & WINEDDBLTFX_ROTATE180) if (fx->fx & WINEDDBLTFX_ROTATE180)
{ {
tmp = dBottomRight; tmp = dBottomRight;
dBottomRight = dTopLeft; dBottomRight = dTopLeft;
...@@ -4611,7 +4611,7 @@ do { \ ...@@ -4611,7 +4611,7 @@ do { \
dstxinc = dstxinc * -1; dstxinc = dstxinc * -1;
dstyinc = dstyinc * -1; dstyinc = dstyinc * -1;
} }
if (fx->dwDDFX & WINEDDBLTFX_ROTATE270) if (fx->fx & WINEDDBLTFX_ROTATE270)
{ {
tmp = dTopLeft; tmp = dTopLeft;
dTopLeft = dBottomLeft; dTopLeft = dBottomLeft;
...@@ -4623,7 +4623,7 @@ do { \ ...@@ -4623,7 +4623,7 @@ do { \
dstyinc = tmpxy; dstyinc = tmpxy;
dstxinc = dstxinc * -1; dstxinc = dstxinc * -1;
} }
if (fx->dwDDFX & WINEDDBLTFX_ROTATE90) if (fx->fx & WINEDDBLTFX_ROTATE90)
{ {
tmp = dTopLeft; tmp = dTopLeft;
dTopLeft = dTopRight; dTopLeft = dTopRight;
...@@ -4635,7 +4635,7 @@ do { \ ...@@ -4635,7 +4635,7 @@ do { \
dstyinc = tmpxy; dstyinc = tmpxy;
dstyinc = dstyinc * -1; dstyinc = dstyinc * -1;
} }
if (fx->dwDDFX & WINEDDBLTFX_ZBUFFERBASEDEST) 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"); WARN("Nothing done for WINEDDBLTFX_ZBUFFERBASEDEST.\n");
...@@ -4736,13 +4736,11 @@ static HRESULT cpu_blit_color_fill(struct wined3d_device *device, struct wined3d ...@@ -4736,13 +4736,11 @@ static HRESULT cpu_blit_color_fill(struct wined3d_device *device, struct wined3d
{ {
struct wined3d_surface *surface = wined3d_rendertarget_view_get_surface(view); struct wined3d_surface *surface = wined3d_rendertarget_view_get_surface(view);
static const RECT src_rect; static const RECT src_rect;
WINEDDBLTFX BltFx; struct wined3d_blt_fx fx;
memset(&BltFx, 0, sizeof(BltFx)); fx.fill_color = wined3d_format_convert_from_float(surface, color);
BltFx.dwSize = sizeof(BltFx);
BltFx.u5.dwFillColor = wined3d_format_convert_from_float(surface, color);
return surface_cpu_blt(surface, rect, NULL, &src_rect, return surface_cpu_blt(surface, rect, NULL, &src_rect,
WINED3D_BLT_COLOR_FILL, &BltFx, WINED3D_TEXF_POINT); WINED3D_BLT_COLOR_FILL, &fx, WINED3D_TEXF_POINT);
} }
static HRESULT cpu_blit_depth_fill(struct wined3d_device *device, static HRESULT cpu_blit_depth_fill(struct wined3d_device *device,
...@@ -4774,7 +4772,7 @@ const struct blit_shader cpu_blit = { ...@@ -4774,7 +4772,7 @@ const struct blit_shader cpu_blit = {
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{ {
struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_swapchain *src_swapchain, *dst_swapchain;
struct wined3d_device *device = dst_surface->resource.device; struct wined3d_device *device = dst_surface->resource.device;
...@@ -4797,33 +4795,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -4797,33 +4795,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
if (fx) if (fx)
{ {
TRACE("dwSize %#x.\n", fx->dwSize); TRACE("fx %#x.\n", fx->fx);
TRACE("dwDDFX %#x.\n", fx->dwDDFX); TRACE("fill_color 0x%08x.\n", fx->fill_color);
TRACE("dwROP %#x.\n", fx->dwROP); TRACE("dst_color_key {0x%08x, 0x%08x}.\n",
TRACE("dwDDROP %#x.\n", fx->dwDDROP); fx->dst_color_key.color_space_low_value,
TRACE("dwRotationAngle %#x.\n", fx->dwRotationAngle); fx->dst_color_key.color_space_high_value);
TRACE("dwZBufferOpCode %#x.\n", fx->dwZBufferOpCode); TRACE("src_color_key {0x%08x, 0x%08x}.\n",
TRACE("dwZBufferLow %#x.\n", fx->dwZBufferLow); fx->src_color_key.color_space_low_value,
TRACE("dwZBufferHigh %#x.\n", fx->dwZBufferHigh); fx->src_color_key.color_space_high_value);
TRACE("dwZBufferBaseDest %#x.\n", fx->dwZBufferBaseDest);
TRACE("dwZDestConstBitDepth %#x.\n", fx->dwZDestConstBitDepth);
TRACE("lpDDSZBufferDest %p.\n", fx->u1.lpDDSZBufferDest);
TRACE("dwZSrcConstBitDepth %#x.\n", fx->dwZSrcConstBitDepth);
TRACE("lpDDSZBufferSrc %p.\n", fx->u2.lpDDSZBufferSrc);
TRACE("dwAlphaEdgeBlendBitDepth %#x.\n", fx->dwAlphaEdgeBlendBitDepth);
TRACE("dwAlphaEdgeBlend %#x.\n", fx->dwAlphaEdgeBlend);
TRACE("dwReserved %#x.\n", fx->dwReserved);
TRACE("dwAlphaDestConstBitDepth %#x.\n", fx->dwAlphaDestConstBitDepth);
TRACE("lpDDSAlphaDest %p.\n", fx->u3.lpDDSAlphaDest);
TRACE("dwAlphaSrcConstBitDepth %#x.\n", fx->dwAlphaSrcConstBitDepth);
TRACE("lpDDSAlphaSrc %p.\n", fx->u4.lpDDSAlphaSrc);
TRACE("lpDDSPattern %p.\n", fx->u5.lpDDSPattern);
TRACE("ddckDestColorkey {%#x, %#x}.\n",
fx->ddckDestColorkey.color_space_low_value,
fx->ddckDestColorkey.color_space_high_value);
TRACE("ddckSrcColorkey {%#x, %#x}.\n",
fx->ddckSrcColorkey.color_space_low_value,
fx->ddckSrcColorkey.color_space_high_value);
} }
if (dst_surface->resource.map_count || (src_surface && src_surface->resource.map_count)) if (dst_surface->resource.map_count || (src_surface && src_surface->resource.map_count))
...@@ -4855,7 +4834,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -4855,7 +4834,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
} }
} }
if (!fx || !(fx->dwDDFX)) if (!fx || !(fx->fx))
flags &= ~WINED3D_BLT_FX; flags &= ~WINED3D_BLT_FX;
if (flags & WINED3D_BLT_WAIT) if (flags & WINED3D_BLT_WAIT)
...@@ -4942,7 +4921,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -4942,7 +4921,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
TRACE("Depth fill.\n"); TRACE("Depth fill.\n");
if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) if (!surface_convert_depth_to_float(dst_surface, fx->fill_color, &depth))
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth))) if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth)))
...@@ -4986,7 +4965,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -4986,7 +4965,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
TRACE("Color fill.\n"); TRACE("Color fill.\n");
if (!wined3d_format_convert_color_to_float(dst_surface->resource.format, if (!wined3d_format_convert_color_to_float(dst_surface->resource.format,
palette, fx->u5.dwFillColor, &color)) palette, fx->fill_color, &color))
goto fallback; goto fallback;
if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color)))
...@@ -5000,7 +4979,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -5000,7 +4979,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
TRACE("Color blit.\n"); TRACE("Color blit.\n");
if (flags & WINED3D_BLT_SRC_CKEY_OVERRIDE) if (flags & WINED3D_BLT_SRC_CKEY_OVERRIDE)
{ {
color_key = &fx->ddckSrcColorkey; color_key = &fx->src_color_key;
blit_op = WINED3D_BLIT_OP_COLOR_BLIT_CKEY; blit_op = WINED3D_BLIT_OP_COLOR_BLIT_CKEY;
} }
else if (flags & WINED3D_BLT_SRC_CKEY) else if (flags & WINED3D_BLT_SRC_CKEY)
......
...@@ -1347,7 +1347,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct ...@@ -1347,7 +1347,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter) const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{ {
struct wined3d_resource *dst_resource, *src_resource = NULL; struct wined3d_resource *dst_resource, *src_resource = NULL;
......
...@@ -2544,7 +2544,7 @@ static inline GLuint surface_get_texture_name(const struct wined3d_surface *surf ...@@ -2544,7 +2544,7 @@ static inline GLuint surface_get_texture_name(const struct wined3d_surface *surf
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
void surface_set_dirty(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void surface_set_dirty(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
HRESULT surface_color_fill(struct wined3d_surface *s, HRESULT surface_color_fill(struct wined3d_surface *s,
const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN; const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
......
...@@ -1835,54 +1835,13 @@ struct wined3d_color_key ...@@ -1835,54 +1835,13 @@ struct wined3d_color_key
* to be treated as Color Key, inclusive */ * to be treated as Color Key, inclusive */
}; };
typedef struct _WINEDDBLTFX struct wined3d_blt_fx
{ {
DWORD dwSize; /* size of structure */ DWORD fx;
DWORD dwDDFX; /* FX operations */ DWORD fill_color;
DWORD dwROP; /* Win32 raster operations */ struct wined3d_color_key dst_color_key;
DWORD dwDDROP; /* Raster operations new for DirectDraw */ struct wined3d_color_key src_color_key;
DWORD dwRotationAngle; /* Rotation angle for blt */ };
DWORD dwZBufferOpCode; /* ZBuffer compares */
DWORD dwZBufferLow; /* Low limit of Z buffer */
DWORD dwZBufferHigh; /* High limit of Z buffer */
DWORD dwZBufferBaseDest; /* Destination base value */
DWORD dwZDestConstBitDepth; /* Bit depth used to specify Z constant for destination */
union
{
DWORD dwZDestConst; /* Constant to use as Z buffer for dest */
struct wined3d_surface *lpDDSZBufferDest; /* Surface to use as Z buffer for dest */
} DUMMYUNIONNAME1;
DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */
union
{
DWORD dwZSrcConst; /* Constant to use as Z buffer for src */
struct wined3d_surface *lpDDSZBufferSrc; /* Surface to use as Z buffer for src */
} DUMMYUNIONNAME2;
DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */
DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */
DWORD dwReserved;
DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */
union
{
DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */
struct wined3d_surface *lpDDSAlphaDest; /* Surface to use as Alpha Channel */
} DUMMYUNIONNAME3;
DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */
union
{
DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */
struct wined3d_surface *lpDDSAlphaSrc; /* Surface to use as Alpha Channel */
} DUMMYUNIONNAME4;
union
{
DWORD dwFillColor; /* color in RGB or Palettized */
DWORD dwFillDepth; /* depth value for z-buffer */
DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */
struct wined3d_surface *lpDDSPattern; /* Surface to use as pattern */
} DUMMYUNIONNAME5;
struct wined3d_color_key ddckDestColorkey; /* DestColorkey override */
struct wined3d_color_key ddckSrcColorkey; /* SrcColorkey override */
} WINEDDBLTFX,*LPWINEDDBLTFX;
struct wined3d_buffer_desc struct wined3d_buffer_desc
{ {
...@@ -2470,7 +2429,7 @@ HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture ...@@ -2470,7 +2429,7 @@ HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture
UINT layer, const struct wined3d_box *dirty_region); UINT layer, const struct wined3d_box *dirty_region);
HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in, HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in,
struct wined3d_texture *src_texture, unsigned int src_idx, const RECT *src_rect_in, DWORD flags, struct wined3d_texture *src_texture, unsigned int src_idx, const RECT *src_rect_in, DWORD flags,
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter); const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter);
HRESULT __cdecl wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, HRESULT __cdecl wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture); const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment