Allowing the creation of the surface is most likely not enough, the backbuffer has to be useable after it has been created. Specifically, when the app attaches the backbuffer to the frontbuffer(assuming this works, needs a test) wined3d has to be made aware of the change - there's a SetFrontBackBuffers method in the wined3d device to reconfigure the primary swapchain.
Am 19.07.2010 um 19:27 schrieb Oldřich Jedlička:
> This fixes bug #9008.
> ---
> dlls/ddraw/ddraw.c | 25 +++++++++++++++++++++----
> dlls/ddraw/ddraw_private.h | 3 +++
> dlls/ddraw/ddraw_thunks.c | 24 ++++++++++++------------
> 3 files changed, 36 insertions(+), 16 deletions(-)
>
> diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
> index 05c8c62..cf90c39 100644
> --- a/dlls/ddraw/ddraw.c
> +++ b/dlls/ddraw/ddraw.c
> @@ -2295,6 +2295,7 @@ static HRESULT IDirectDrawImpl_CreateGDISwapChain(IDirectDrawImpl *ddraw, IDirec
> * Surf: Address to store the interface pointer at
> * UnkOuter: Basically for aggregation support, but ddraw doesn't support
> * aggregation, so it has to be NULL
> + * AllowBackBuffer: Allow (TRUE) creation of explicit back buffer
> *
> * Returns:
> * DD_OK on success
> @@ -2302,11 +2303,12 @@ static HRESULT IDirectDrawImpl_CreateGDISwapChain(IDirectDrawImpl *ddraw, IDirec
> * DDERR_* if an error occurs
> *
> *****************************************************************************/
> -static HRESULT WINAPI
> +HRESULT WINAPI
> IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
> DDSURFACEDESC2 *DDSD,
> IDirectDrawSurface7 **Surf,
> - IUnknown *UnkOuter)
> + IUnknown *UnkOuter,
> + BOOL AllowBackBuffer)
> {
> IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
> IDirectDrawSurfaceImpl *object = NULL;
> @@ -2368,7 +2370,13 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
> return DDERR_NOEXCLUSIVEMODE;
> }
>
> - if(DDSD->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER)) {
> + if(AllowBackBuffer && (DDSD->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER))) {
> + WARN("Application tried to create an explicit front buffer\n");
> + LeaveCriticalSection(&ddraw_cs);
> + return DDERR_INVALIDCAPS;
> + }
> +
> + if (!AllowBackBuffer && (DDSD->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER))) {
> WARN("Application tried to create an explicit front or back buffer\n");
> LeaveCriticalSection(&ddraw_cs);
> return DDERR_INVALIDCAPS;
> @@ -2727,6 +2735,15 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
> return hr;
> }
>
> +static HRESULT WINAPI
> +IDirectDraw7Impl_CreateSurface(IDirectDraw7 *iface,
> + DDSURFACEDESC2 *DDSD,
> + IDirectDrawSurface7 **Surf,
> + IUnknown *UnkOuter)
> +{
> + return IDirectDrawImpl_CreateSurface(iface, DDSD, Surf, UnkOuter, FALSE);
> +}
> +
> #define DDENUMSURFACES_SEARCHTYPE (DDENUMSURFACES_CANBECREATED|DDENUMSURFACES_DOESEXIST)
> #define DDENUMSURFACES_MATCHTYPE (DDENUMSURFACES_ALL|DDENUMSURFACES_MATCH|DDENUMSURFACES_NOMATCH)
>
> @@ -3105,7 +3122,7 @@ const IDirectDraw7Vtbl IDirectDraw7_Vtbl =
> IDirectDrawImpl_Compact,
> IDirectDrawImpl_CreateClipper,
> IDirectDrawImpl_CreatePalette,
> - IDirectDrawImpl_CreateSurface,
> + IDirectDraw7Impl_CreateSurface,
> IDirectDrawImpl_DuplicateSurface,
> IDirectDrawImpl_EnumDisplayModes,
> IDirectDrawImpl_EnumSurfaces,
> diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
> index 3de8668..9810c6f 100644
> --- a/dlls/ddraw/ddraw_private.h
> +++ b/dlls/ddraw/ddraw_private.h
> @@ -303,6 +303,9 @@ extern const IDirectDrawGammaControlVtbl IDirectDrawGammaControl_Vtbl DECLSPEC_H
> extern const IDirect3DTexture2Vtbl IDirect3DTexture2_Vtbl DECLSPEC_HIDDEN;
> extern const IDirect3DTextureVtbl IDirect3DTexture1_Vtbl DECLSPEC_HIDDEN;
>
> +HRESULT WINAPI IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *DDSD,
> + IDirectDrawSurface7 **Surf, IUnknown *UnkOuter, BOOL AllowBackBuffer) DECLSPEC_HIDDEN;
> +
> HRESULT WINAPI IDirectDrawSurfaceImpl_AddAttachedSurface(IDirectDrawSurfaceImpl *This,
> IDirectDrawSurfaceImpl *Surf) DECLSPEC_HIDDEN;
> void IDirectDrawSurfaceImpl_Destroy(IDirectDrawSurfaceImpl *This) DECLSPEC_HIDDEN;
> diff --git a/dlls/ddraw/ddraw_thunks.c b/dlls/ddraw/ddraw_thunks.c
> index 2c205e9..7d6396c 100644
> --- a/dlls/ddraw/ddraw_thunks.c
> +++ b/dlls/ddraw/ddraw_thunks.c
> @@ -331,9 +331,9 @@ static void set_surf_version(IDirectDrawSurfaceImpl *surf, int version)
> }
>
> static HRESULT WINAPI
> -IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
> - LPDIRECTDRAWSURFACE *ppSurface,
> - IUnknown *pUnkOuter)
> +IDirectDraw1Impl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
> + LPDIRECTDRAWSURFACE *ppSurface,
> + IUnknown *pUnkOuter)
> {
> LPDIRECTDRAWSURFACE7 pSurface7;
> IDirectDrawSurfaceImpl *impl;
> @@ -345,8 +345,8 @@ IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
> pSDesc->ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
> /* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok,
> * since the data layout is the same */
> - hr = IDirectDraw7_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw1(This),
> - (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
> + hr = IDirectDrawImpl_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw1(This),
> + (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter, TRUE);
> if (FAILED(hr))
> {
> *ppSurface = NULL;
> @@ -371,8 +371,8 @@ IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc,
> IDirectDrawSurfaceImpl *impl;
> HRESULT hr;
>
> - hr = IDirectDraw7_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw2(This),
> - (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
> + hr = IDirectDrawImpl_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw2(This),
> + (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter, TRUE);
> if (FAILED(hr))
> {
> *ppSurface = NULL;
> @@ -397,8 +397,8 @@ IDirectDraw3Impl_CreateSurface(LPDIRECTDRAW3 This, LPDDSURFACEDESC pSDesc,
> IDirectDrawSurfaceImpl *impl;
> HRESULT hr;
>
> - hr = IDirectDraw7_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw3(This),
> - (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter);
> + hr = IDirectDrawImpl_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw3(This),
> + (LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter, TRUE);
> if (FAILED(hr))
> {
> *ppSurface = NULL;
> @@ -423,8 +423,8 @@ IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc,
> HRESULT hr;
> IDirectDrawSurfaceImpl *impl;
>
> - hr = IDirectDraw7_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw4(This),
> - pSDesc, (LPDIRECTDRAWSURFACE7 *)ppSurface, pUnkOuter);
> + hr = IDirectDrawImpl_CreateSurface((IDirectDraw7 *)ddraw_from_ddraw4(This),
> + pSDesc, (LPDIRECTDRAWSURFACE7 *)ppSurface, pUnkOuter, TRUE);
> impl = (IDirectDrawSurfaceImpl *)*ppSurface;
> if(SUCCEEDED(hr) && impl)
> {
> @@ -1092,7 +1092,7 @@ const IDirectDrawVtbl IDirectDraw1_Vtbl =
> IDirectDrawImpl_Compact,
> IDirectDrawImpl_CreateClipper,
> IDirectDrawImpl_CreatePalette,
> - IDirectDrawImpl_CreateSurface,
> + IDirectDraw1Impl_CreateSurface,
> IDirectDrawImpl_DuplicateSurface,
> IDirectDrawImpl_EnumDisplayModes,
> IDirectDrawImpl_EnumSurfaces,
> --
> 1.7.1.1
>
>
>