Commit a537fb0a authored by Nick Burns's avatar Nick Burns Committed by Alexandre Julliard

ddraw: Fix surface version setting.

parent 9dea6f7d
...@@ -2084,6 +2084,7 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This, ...@@ -2084,6 +2084,7 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
ICOM_INIT_INTERFACE(*ppSurf, IDirect3DTexture, IDirect3DTexture1_Vtbl); ICOM_INIT_INTERFACE(*ppSurf, IDirect3DTexture, IDirect3DTexture1_Vtbl);
(*ppSurf)->ref = 1; (*ppSurf)->ref = 1;
(*ppSurf)->version = 7; (*ppSurf)->version = 7;
TRACE("%p->version = %d\n", (*ppSurf), (*ppSurf)->version);
(*ppSurf)->ddraw = This; (*ppSurf)->ddraw = This;
(*ppSurf)->surface_desc.dwSize = sizeof(DDSURFACEDESC2); (*ppSurf)->surface_desc.dwSize = sizeof(DDSURFACEDESC2);
(*ppSurf)->surface_desc.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); (*ppSurf)->surface_desc.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
......
...@@ -377,6 +377,23 @@ IDirectDraw4Impl_CreatePalette(LPDIRECTDRAW4 This, DWORD dwFlags, ...@@ -377,6 +377,23 @@ IDirectDraw4Impl_CreatePalette(LPDIRECTDRAW4 This, DWORD dwFlags,
return hr; return hr;
} }
/* Must set all attached surfaces (e.g. mipmaps) versions as well */
static void set_surf_version(IDirectDrawSurfaceImpl *surf, int version)
{
int i;
TRACE("%p->version(%d) = %d\n", surf, surf->version, version);
surf->version = version;
for(i = 0; i < MAX_COMPLEX_ATTACHED; i++)
{
if(!surf->complex_array[i]) break;
set_surf_version(surf->complex_array[i], version);
}
while( (surf = surf->next_attached) )
{
set_surf_version(surf, version);
}
}
static HRESULT WINAPI static HRESULT WINAPI
IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc, IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
LPDIRECTDRAWSURFACE *ppSurface, LPDIRECTDRAWSURFACE *ppSurface,
...@@ -407,7 +424,7 @@ IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc, ...@@ -407,7 +424,7 @@ IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7); impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
if(SUCCEEDED(hr) && impl) if(SUCCEEDED(hr) && impl)
{ {
impl->version = 1; set_surf_version(impl, 1);
IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
IDirectDraw, IDirectDraw,
IDirectDraw7, IDirectDraw7,
...@@ -442,7 +459,7 @@ IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc, ...@@ -442,7 +459,7 @@ IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc,
impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7); impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
if(SUCCEEDED(hr) && impl) if(SUCCEEDED(hr) && impl)
{ {
impl->version = 2; set_surf_version(impl, 2);
IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
IDirectDraw2, IDirectDraw2,
IDirectDraw7, IDirectDraw7,
...@@ -477,7 +494,7 @@ IDirectDraw3Impl_CreateSurface(LPDIRECTDRAW3 This, LPDDSURFACEDESC pSDesc, ...@@ -477,7 +494,7 @@ IDirectDraw3Impl_CreateSurface(LPDIRECTDRAW3 This, LPDDSURFACEDESC pSDesc,
impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7); impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, pSurface7);
if(SUCCEEDED(hr) && impl) if(SUCCEEDED(hr) && impl)
{ {
impl->version = 3; set_surf_version(impl, 3);
IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
IDirectDraw3, IDirectDraw3,
IDirectDraw7, IDirectDraw7,
...@@ -507,7 +524,7 @@ IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc, ...@@ -507,7 +524,7 @@ IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc,
impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurface); impl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurface);
if(SUCCEEDED(hr) && impl) if(SUCCEEDED(hr) && impl)
{ {
impl->version = 4; set_surf_version(impl, 4);
IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl,
IDirectDraw4, IDirectDraw4,
IDirectDraw7, IDirectDraw7,
......
...@@ -475,15 +475,18 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface, ...@@ -475,15 +475,18 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface,
TRACE("(%p)->(%p,%p)\n", This, Caps, Surface); TRACE("(%p)->(%p,%p)\n", This, Caps, Surface);
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
our_caps = *Caps;
if(This->version < 7) if(This->version < 7)
{ {
/* Earlier dx apps put garbage into these members, clear them */ /* Earlier dx apps put garbage into these members, clear them */
our_caps.dwCaps = Caps->dwCaps;
our_caps.dwCaps2 = 0; our_caps.dwCaps2 = 0;
our_caps.dwCaps3 = 0; our_caps.dwCaps3 = 0;
our_caps.dwCaps4 = 0; our_caps.dwCaps4 = 0;
} }
else
{
our_caps = *Caps;
}
TRACE("(%p): Looking for caps: %x,%x,%x,%x\n", This, our_caps.dwCaps, our_caps.dwCaps2, our_caps.dwCaps3, our_caps.dwCaps4); /* FIXME: Better debugging */ TRACE("(%p): Looking for caps: %x,%x,%x,%x\n", This, our_caps.dwCaps, our_caps.dwCaps2, our_caps.dwCaps3, our_caps.dwCaps4); /* FIXME: Better debugging */
......
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