Revert "[DDRAW] Sync the fix for swap_interval from Wine (#4831)" (#5690)

This reverts commit 6755921560.
This commit is contained in:
Justin Miller 2023-09-14 05:16:42 -07:00 committed by GitHub
parent 5c7a5786fd
commit 961893a712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 47 deletions

View file

@ -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, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, 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) static inline struct ddraw_surface *impl_from_IDirect3DTexture(IDirect3DTexture *iface)
{ {

View file

@ -176,7 +176,7 @@ static HRESULT WINAPI ddraw_palette_SetEntries(IDirectDrawPalette *iface,
hr = wined3d_palette_set_entries(palette->wined3d_palette, flags, start, count, entries); hr = wined3d_palette_set_entries(palette->wined3d_palette, flags, start, count, entries);
if (SUCCEEDED(hr) && palette->flags & DDPCAPS_PRIMARYSURFACE) 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(); wined3d_mutex_unlock();

View file

@ -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. * 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 * We'd like to do this in wined3d instead, but for that to work wined3d needs
* to support windowless rendering first. */ * 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; struct ddraw *ddraw = surface->ddraw;
HDC surface_dc, screen_dc; HDC surface_dc, screen_dc;
int x, y, w, h; int x, y, w, h;
@ -71,18 +70,8 @@ HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RE
if (read) if (read)
return DD_OK; return DD_OK;
if (swap_interval) return wined3d_texture_blt(ddraw->wined3d_frontbuffer, 0, rect,
dst_texture = wined3d_swapchain_get_back_buffer(ddraw->wined3d_swapchain, 0); surface->wined3d_texture, surface->sub_resource_idx, rect, 0, NULL, WINED3D_TEXF_POINT);
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;
} }
if (FAILED(hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, &surface_dc))) if (FAILED(hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, &surface_dc)))
@ -485,7 +474,7 @@ static HRESULT ddraw_surface_set_palette(struct ddraw_surface *surface, IDirectD
palette_impl->flags |= DDPCAPS_PRIMARYSURFACE; palette_impl->flags |= DDPCAPS_PRIMARYSURFACE;
wined3d_swapchain_set_palette(surface->ddraw->wined3d_swapchain, wined3d_swapchain_set_palette(surface->ddraw->wined3d_swapchain,
palette_impl ? palette_impl->wined3d_palette : NULL); 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) if (palette_impl)
IDirectDrawPalette_AddRef(&palette_impl->IDirectDrawPalette_iface); IDirectDrawPalette_AddRef(&palette_impl->IDirectDrawPalette_iface);
@ -1001,7 +990,7 @@ static HRESULT surface_lock(struct ddraw_surface *surface,
} }
if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 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)) if (SUCCEEDED(hr))
hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture),
surface->sub_resource_idx, &map_desc, rect ? &box : NULL, surface->sub_resource_idx, &map_desc, rect ? &box : NULL,
@ -1190,7 +1179,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Unlock(IDirectDrawSurface
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_resource_unmap(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx); 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) 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(); wined3d_mutex_unlock();
return hr; return hr;
@ -1235,24 +1224,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Unlock(IDirectDrawSurface
return ddraw_surface7_Unlock(&surface->IDirectDrawSurface7_iface, NULL); 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, static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7 *iface,
IDirectDrawSurface7 *src, DWORD flags) IDirectDrawSurface7 *src, DWORD flags)
{ {
@ -1376,7 +1347,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
} }
if (dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 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 else
hr = DD_OK; hr = DD_OK;
@ -1517,11 +1488,11 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
if (!dst_surface->clipper) if (!dst_surface->clipper)
{ {
if (src_surface && src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 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)) if (SUCCEEDED(hr))
hr = ddraw_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fill_colour, fx, filter); 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)) 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; return hr;
} }
@ -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 (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; break;
} }
} }
@ -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 (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; break;
} }
} }
@ -2248,7 +2219,7 @@ static HRESULT WINAPI ddraw_surface7_GetDC(IDirectDrawSurface7 *iface, HDC *dc)
if (surface->dc) if (surface->dc)
hr = DDERR_DCALREADYCREATED; hr = DDERR_DCALREADYCREATED;
else if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 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)) if (SUCCEEDED(hr))
hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, dc); hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, dc);
@ -2352,7 +2323,7 @@ static HRESULT WINAPI ddraw_surface7_ReleaseDC(IDirectDrawSurface7 *iface, HDC h
{ {
surface->dc = NULL; surface->dc = NULL;
if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 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(); wined3d_mutex_unlock();
@ -4320,12 +4291,12 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltFast(IDirectDrawSurfac
} }
if (src_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 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)) if (SUCCEEDED(hr))
hr = wined3d_texture_blt(dst_impl->wined3d_texture, dst_impl->sub_resource_idx, &dst_rect, 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); 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)) 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(); wined3d_mutex_unlock();
switch(hr) switch(hr)

View file

@ -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/d3drm # Synced to WineStaging-4.18
dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-6.0-rc5 dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-6.0-rc5
dll/directx/wine/d3dxof # Synced to WineStaging-4.18 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/devenum # Synced to WineStaging-4.18
dll/directx/wine/dinput # Synced to WineStaging-4.18 dll/directx/wine/dinput # Synced to WineStaging-4.18
dll/directx/wine/dinput8 # Synced to WineStaging-4.18 dll/directx/wine/dinput8 # Synced to WineStaging-4.18