ddraw: Set dwBackBufferCount=0 in CreateSurface for backbuffer.

This commit is contained in:
Markus Stockhausen 2009-09-29 15:50:47 +02:00 committed by Alexandre Julliard
parent c0c6daeb5a
commit dbb29993db
2 changed files with 11 additions and 2 deletions

View File

@ -2492,6 +2492,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
extra_surfaces = DDSD->dwBackBufferCount; extra_surfaces = DDSD->dwBackBufferCount;
desc2.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER; /* It's not a front buffer */ desc2.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER; /* It's not a front buffer */
desc2.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; desc2.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
desc2.dwBackBufferCount = 0;
} }
hr = DD_OK; hr = DD_OK;

View File

@ -1154,9 +1154,9 @@ static void AttachmentTest7(void)
HRESULT hr; HRESULT hr;
IDirectDraw7 *dd7; IDirectDraw7 *dd7;
IDirectDrawSurface7 *surface1, *surface2, *surface3, *surface4; IDirectDrawSurface7 *surface1, *surface2, *surface3, *surface4;
DDSURFACEDESC2 ddsd; DDSURFACEDESC2 ddsd, ddsd2;
UINT num; UINT num;
DDSCAPS2 caps = {DDSCAPS_TEXTURE, 0, 0, 0}; DDSCAPS2 caps = {DDSCAPS_TEXTURE, 0, 0, 0}, caps2 = {DDSCAPS_BACKBUFFER,0,0,0};
HWND window = CreateWindow( "static", "ddraw_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL ); HWND window = CreateWindow( "static", "ddraw_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL );
hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (void **) &dd7); hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (void **) &dd7);
@ -1253,6 +1253,14 @@ static void AttachmentTest7(void)
hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface1, NULL); hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface1, NULL);
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
/* backbuffer surfaces must not have dwBackBufferCount set */
ddsd2.dwSize = sizeof(ddsd2);
hr = IDirectDrawSurface7_GetAttachedSurface(surface1, &caps2, &surface2);
ok(hr==DD_OK,"GetAttachedSurface returned: %x\n", hr);
hr = IDirectDrawSurface7_GetSurfaceDesc(surface2, &ddsd2);
ok(hr==DD_OK,"GetSurfaceDesc returned: %x\n", hr);
ok(ddsd2.dwBackBufferCount==0,"backbuffer surface has dwBackBufferCount==%u\n", ddsd2.dwBackBufferCount);
num = 0; num = 0;
IDirectDrawSurface7_EnumAttachedSurfaces(surface1, &num, SurfaceCounter); IDirectDrawSurface7_EnumAttachedSurfaces(surface1, &num, SurfaceCounter);
ok(num == 1, "Primary surface has %d surfaces attached, expected 1\n", num); ok(num == 1, "Primary surface has %d surfaces attached, expected 1\n", num);