Skip to content

Commit

Permalink
Revert "[DDRAW] Sync the fix for swap_interval from Wine (reactos#4831)"
Browse files Browse the repository at this point in the history
This reverts commit 6755921.
  • Loading branch information
DarkFire01 committed Sep 14, 2023
1 parent 5c7a578 commit 5ceaebf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 47 deletions.
2 changes: 1 addition & 1 deletion dll/directx/wine/ddraw/ddraw_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
const RECT *rect, BOOL read, unsigned int swap_interval) DECLSPEC_HIDDEN;
const RECT *rect, BOOL read) DECLSPEC_HIDDEN;

static inline struct ddraw_surface *impl_from_IDirect3DTexture(IDirect3DTexture *iface)
{
Expand Down
2 changes: 1 addition & 1 deletion dll/directx/wine/ddraw/palette.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static HRESULT WINAPI ddraw_palette_SetEntries(IDirectDrawPalette *iface,
hr = wined3d_palette_set_entries(palette->wined3d_palette, flags, start, count, entries);

if (SUCCEEDED(hr) && palette->flags & DDPCAPS_PRIMARYSURFACE)
ddraw_surface_update_frontbuffer(palette->ddraw->primary, NULL, FALSE, 0);
ddraw_surface_update_frontbuffer(palette->ddraw->primary, NULL, FALSE);

wined3d_mutex_unlock();

Expand Down
59 changes: 15 additions & 44 deletions dll/directx/wine/ddraw/surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ static inline struct ddraw_surface *impl_from_IDirectDrawGammaControl(IDirectDra
* applications from drawing to the screen while we've locked the frontbuffer.
* We'd like to do this in wined3d instead, but for that to work wined3d needs
* to support windowless rendering first. */
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RECT *rect, BOOL read, unsigned int swap_interval)
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RECT *rect, BOOL read)
{
struct wined3d_texture *dst_texture;
struct ddraw *ddraw = surface->ddraw;
HDC surface_dc, screen_dc;
int x, y, w, h;
Expand Down Expand Up @@ -71,18 +70,8 @@ HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RE
if (read)
return DD_OK;

if (swap_interval)
dst_texture = wined3d_swapchain_get_back_buffer(ddraw->wined3d_swapchain, 0);
else
dst_texture = ddraw->wined3d_frontbuffer;

if (SUCCEEDED(hr = wined3d_texture_blt(dst_texture, 0, rect,
surface->wined3d_texture, surface->sub_resource_idx, rect, 0, NULL, WINED3D_TEXF_POINT))){
hr = wined3d_swapchain_present(ddraw->wined3d_swapchain, rect, rect, NULL, swap_interval, 0);
ddraw->flags |= DDRAW_GDI_FLIP;
}

return hr;
return wined3d_texture_blt(ddraw->wined3d_frontbuffer, 0, rect,
surface->wined3d_texture, surface->sub_resource_idx, rect, 0, NULL, WINED3D_TEXF_POINT);
}

if (FAILED(hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, &surface_dc)))
Expand Down Expand Up @@ -485,7 +474,7 @@ static HRESULT ddraw_surface_set_palette(struct ddraw_surface *surface, IDirectD
palette_impl->flags |= DDPCAPS_PRIMARYSURFACE;
wined3d_swapchain_set_palette(surface->ddraw->wined3d_swapchain,
palette_impl ? palette_impl->wined3d_palette : NULL);
ddraw_surface_update_frontbuffer(surface, NULL, FALSE, 0);
ddraw_surface_update_frontbuffer(surface, NULL, FALSE);
}
if (palette_impl)
IDirectDrawPalette_AddRef(&palette_impl->IDirectDrawPalette_iface);
Expand Down Expand Up @@ -1001,7 +990,7 @@ static HRESULT surface_lock(struct ddraw_surface *surface,
}

if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(surface, rect, TRUE, 0);
hr = ddraw_surface_update_frontbuffer(surface, rect, TRUE);
if (SUCCEEDED(hr))
hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture),
surface->sub_resource_idx, &map_desc, rect ? &box : NULL,
Expand Down Expand Up @@ -1190,7 +1179,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock(IDirectDrawSurface
wined3d_mutex_lock();
hr = wined3d_resource_unmap(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx);
if (SUCCEEDED(hr) && surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(surface, &surface->ddraw->primary_lock, FALSE, 0);
hr = ddraw_surface_update_frontbuffer(surface, &surface->ddraw->primary_lock, FALSE);
wined3d_mutex_unlock();

return hr;
Expand Down Expand Up @@ -1235,24 +1224,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Unlock(IDirectDrawSurface
return ddraw_surface7_Unlock(&surface->IDirectDrawSurface7_iface, NULL);
}

static unsigned int ddraw_swap_interval_from_flags(DWORD flags)
{
if (flags & DDFLIP_NOVSYNC)
return 0;

switch (flags & (DDFLIP_INTERVAL2 | DDFLIP_INTERVAL3 | DDFLIP_INTERVAL4))
{
case DDFLIP_INTERVAL2:
return 2;
case DDFLIP_INTERVAL3:
return 3;
case DDFLIP_INTERVAL4:
return 4;
default:
return 1;
}
}

static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7 *iface,
IDirectDrawSurface7 *src, DWORD flags)
{
Expand Down Expand Up @@ -1376,7 +1347,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
}

if (dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(dst_impl, NULL, FALSE,ddraw_swap_interval_from_flags(flags));
hr = ddraw_surface_update_frontbuffer(dst_impl, NULL, FALSE);
else
hr = DD_OK;

Expand Down Expand Up @@ -1517,11 +1488,11 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
if (!dst_surface->clipper)
{
if (src_surface && src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(src_surface, &src_rect, TRUE, 0);
hr = ddraw_surface_update_frontbuffer(src_surface, &src_rect, TRUE);
if (SUCCEEDED(hr))
hr = ddraw_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fill_colour, fx, filter);
if (SUCCEEDED(hr) && (dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
hr = ddraw_surface_update_frontbuffer(dst_surface, &dst_rect, FALSE, 0);
hr = ddraw_surface_update_frontbuffer(dst_surface, &dst_rect, FALSE);

return hr;
}
Expand Down Expand Up @@ -1564,7 +1535,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons

if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
if (FAILED(hr = ddraw_surface_update_frontbuffer(src_surface, &src_rect_clipped, TRUE, 0)))
if (FAILED(hr = ddraw_surface_update_frontbuffer(src_surface, &src_rect_clipped, TRUE)))
break;
}
}
Expand All @@ -1575,7 +1546,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons

if (dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
if (FAILED(hr = ddraw_surface_update_frontbuffer(dst_surface, &clip_rect[i], FALSE, 0)))
if (FAILED(hr = ddraw_surface_update_frontbuffer(dst_surface, &clip_rect[i], FALSE)))
break;
}
}
Expand Down Expand Up @@ -2248,7 +2219,7 @@ static HRESULT WINAPI ddraw_surface7_GetDC(IDirectDrawSurface7 *iface, HDC *dc)
if (surface->dc)
hr = DDERR_DCALREADYCREATED;
else if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(surface, NULL, TRUE, 0);
hr = ddraw_surface_update_frontbuffer(surface, NULL, TRUE);
if (SUCCEEDED(hr))
hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, dc);

Expand Down Expand Up @@ -2352,7 +2323,7 @@ static HRESULT WINAPI ddraw_surface7_ReleaseDC(IDirectDrawSurface7 *iface, HDC h
{
surface->dc = NULL;
if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(surface, NULL, FALSE, 0);
hr = ddraw_surface_update_frontbuffer(surface, NULL, FALSE);
}
wined3d_mutex_unlock();

Expand Down Expand Up @@ -4320,12 +4291,12 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltFast(IDirectDrawSurfac
}

if (src_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(src_impl, src_rect, TRUE, 0);
hr = ddraw_surface_update_frontbuffer(src_impl, src_rect, TRUE);
if (SUCCEEDED(hr))
hr = wined3d_texture_blt(dst_impl->wined3d_texture, dst_impl->sub_resource_idx, &dst_rect,
src_impl->wined3d_texture, src_impl->sub_resource_idx, src_rect, flags, NULL, WINED3D_TEXF_POINT);
if (SUCCEEDED(hr) && (dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
hr = ddraw_surface_update_frontbuffer(dst_impl, &dst_rect, FALSE, 0);
hr = ddraw_surface_update_frontbuffer(dst_impl, &dst_rect, FALSE);
wined3d_mutex_unlock();

switch(hr)
Expand Down
2 changes: 1 addition & 1 deletion media/doc/WINESYNC.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-4.18
dll/directx/wine/d3drm # Synced to WineStaging-4.18
dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-6.0-rc5
dll/directx/wine/d3dxof # Synced to WineStaging-4.18
dll/directx/wine/ddraw # Synced to WineStaging-3.3 (+ partial sync of ddraw_private.h, palette.c, and surface.c to wine-7.19-557-g13cc08e32d6)
dll/directx/wine/ddraw # Synced to WineStaging-3.3
dll/directx/wine/devenum # Synced to WineStaging-4.18
dll/directx/wine/dinput # Synced to WineStaging-4.18
dll/directx/wine/dinput8 # Synced to WineStaging-4.18
Expand Down

0 comments on commit 5ceaebf

Please sign in to comment.