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),
if (FAILED(hr)) { *ppSurface = NULL;(LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter, TRUE);
@@ -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),
if (FAILED(hr)) { *ppSurface = NULL;(LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter, TRUE);
@@ -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),
if (FAILED(hr)) { *ppSurface = NULL;(LPDDSURFACEDESC2)pSDesc, &pSurface7, pUnkOuter, TRUE);
@@ -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),
impl = (IDirectDrawSurfaceImpl *)*ppSurface; if(SUCCEEDED(hr) && impl) {pSDesc, (LPDIRECTDRAWSURFACE7 *)ppSurface, pUnkOuter, TRUE);
@@ -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
Hi Stefan,
On Monday 19 July 2010 20:56:35 Stefan Dösinger wrote:
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.
There is at least one game verified to work with CreateSurface method that allows creation of back buffers - Bulanci (Combat Pillows, bug #9008). But I have to admit that I don't know the internals of WineD3D, nor DirectX.
Oldrich.
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,
Am 19.07.2010 um 21:24 schrieb Oldřich Jedlička:
Hi Stefan,
On Monday 19 July 2010 20:56:35 Stefan Dösinger wrote:
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.
There is at least one game verified to work with CreateSurface method that allows creation of back buffers - Bulanci (Combat Pillows, bug #9008). But I have to admit that I don't know the internals of WineD3D, nor DirectX.
You probably get away with not dealing with AddAttachedSurface by luck. With the GDI 2D renderer ddraw passes the attached backbuffer explicitly to wined3d. With the GL renderer you may not be so lucky because it may render to an offscreen texture instead of the backbuffer.
Hi Stefan,
On Tuesday 20 July 2010 00:01:13 Stefan Dösinger wrote:
Am 19.07.2010 um 21:24 schrieb Oldřich Jedlička:
Hi Stefan,
On Monday 19 July 2010 20:56:35 Stefan Dösinger wrote:
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.
There is at least one game verified to work with CreateSurface method that allows creation of back buffers - Bulanci (Combat Pillows, bug #9008). But I have to admit that I don't know the internals of WineD3D, nor DirectX.
You probably get away with not dealing with AddAttachedSurface by luck. With the GDI 2D renderer ddraw passes the attached backbuffer explicitly to wined3d. With the GL renderer you may not be so lucky because it may render to an offscreen texture instead of the backbuffer.
This is unfortunately out of my scope (I've never done DirectX/OpenGL programming). I will need help in this area. I can have a look at the code to understand the difference (from the code perspective) between backbuffer and offscreen texture.
Hi Stefan,
On Tuesday 20 July 2010 00:01:13 Stefan Dösinger wrote:
Am 19.07.2010 um 21:24 schrieb Oldřich Jedlička:
Hi Stefan,
On Monday 19 July 2010 20:56:35 Stefan Dösinger wrote:
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.
There is at least one game verified to work with CreateSurface method that allows creation of back buffers - Bulanci (Combat Pillows, bug #9008). But I have to admit that I don't know the internals of WineD3D, nor DirectX.
You probably get away with not dealing with AddAttachedSurface by luck. With the GDI 2D renderer ddraw passes the attached backbuffer explicitly to wined3d. With the GL renderer you may not be so lucky because it may render to an offscreen texture instead of the backbuffer.
I've analysed the usage by the game and read something about AddAttachedSurface.
MSDN says that AddAttachedSurface might work, but should not be used on the flipping chain (i.e. to attach back buffers to front buffers). Thus I think there is no change necessary at the moment.
I've downloaded the "bulanci" game (Combat Pillows) and analysed how it is used. The created BACKBUFFER is always Blt'ed onto the FRONTBUFFER (see attachment), there is no call to AddAttachedSurface. I don't know if there is any additional action (=coding) needed.
@all: Can anybody please have look at the attached log snippet if there is something wrong? It looks to me that everything works. I've used wine with original patch removing the backbuffer check.
Regards, Oldrich.
2010/7/20 Oldřich Jedlička oldium.pro@seznam.cz:
Hi Stefan,
On Tuesday 20 July 2010 00:01:13 Stefan Dösinger wrote:
Am 19.07.2010 um 21:24 schrieb Oldřich Jedlička:
Hi Stefan,
On Monday 19 July 2010 20:56:35 Stefan Dösinger wrote:
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.
There is at least one game verified to work with CreateSurface method that allows creation of back buffers - Bulanci (Combat Pillows, bug #9008). But I have to admit that I don't know the internals of WineD3D, nor DirectX.
You probably get away with not dealing with AddAttachedSurface by luck. With the GDI 2D renderer ddraw passes the attached backbuffer explicitly to wined3d. With the GL renderer you may not be so lucky because it may render to an offscreen texture instead of the backbuffer.
I've analysed the usage by the game and read something about AddAttachedSurface.
MSDN says that AddAttachedSurface might work, but should not be used on the flipping chain (i.e. to attach back buffers to front buffers). Thus I think there is no change necessary at the moment.
Sounds like a test is needed there since MSDN is not the most reliable source of information. I found a comment on MSDN which says AddAttachedSurface can work on a swapchain but it is an unsupported feature.
I've downloaded the "bulanci" game (Combat Pillows) and analysed how it is used. The created BACKBUFFER is always Blt'ed onto the FRONTBUFFER (see attachment), there is no call to AddAttachedSurface. I don't know if there is any additional action (=coding) needed.
@all: Can anybody please have look at the attached log snippet if there is something wrong? It looks to me that everything works. I've used wine with original patch removing the backbuffer check.
If it is really true that AddAttachedSurface won't work then a patch like this might be fine (wait for Stefan's confirmation though). I wonder can you perform any 3D rendering to this type of extra backbuffer (it would need FBOs then) or is it just a 'helper' buffer? Might require testing too...
Roderick
2010/7/20 Roderick Colenbrander thunderbird2k@gmail.com:
2010/7/20 Oldřich Jedlička oldium.pro@seznam.cz:
Hi Stefan,
On Tuesday 20 July 2010 00:01:13 Stefan Dösinger wrote:
Am 19.07.2010 um 21:24 schrieb Oldřich Jedlička:
Hi Stefan,
On Monday 19 July 2010 20:56:35 Stefan Dösinger wrote:
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.
There is at least one game verified to work with CreateSurface method that allows creation of back buffers - Bulanci (Combat Pillows, bug #9008). But I have to admit that I don't know the internals of WineD3D, nor DirectX.
You probably get away with not dealing with AddAttachedSurface by luck. With the GDI 2D renderer ddraw passes the attached backbuffer explicitly to wined3d. With the GL renderer you may not be so lucky because it may render to an offscreen texture instead of the backbuffer.
I've analysed the usage by the game and read something about AddAttachedSurface.
MSDN says that AddAttachedSurface might work, but should not be used on the flipping chain (i.e. to attach back buffers to front buffers). Thus I think there is no change necessary at the moment.
Sounds like a test is needed there since MSDN is not the most reliable source of information. I found a comment on MSDN which says AddAttachedSurface can work on a swapchain but it is an unsupported feature.
I've downloaded the "bulanci" game (Combat Pillows) and analysed how it is used. The created BACKBUFFER is always Blt'ed onto the FRONTBUFFER (see attachment), there is no call to AddAttachedSurface. I don't know if there is any additional action (=coding) needed.
@all: Can anybody please have look at the attached log snippet if there is something wrong? It looks to me that everything works. I've used wine with original patch removing the backbuffer check.
If it is really true that AddAttachedSurface won't work then a patch like this might be fine (wait for Stefan's confirmation though). I wonder can you perform any 3D rendering to this type of extra backbuffer (it would need FBOs then) or is it just a 'helper' buffer? Might require testing too...
Roderick
Just something else I thought about before going to bed, the game only requests that the surface is a 'back buffer'. CreateNewSurface in DirectDraw sets video memory related flags. It might be useful to add some tests what type of memory, Windows selects for a standalone backbuffer. Who knows it might select system memory.
Roderick