From bf7df8516991cf4d544cbc22e66692e25be24b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ri=C4=8Dardas=20Barkauskas?= Date: Mon, 22 Aug 2011 15:46:41 +0300 Subject: [PATCH] ddraw: Do not create implicit depth buffer. --- dlls/ddraw/ddraw.c | 50 ++++-------------------------------------- dlls/ddraw/tests/d3d.c | 12 ++++++++++ 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index fc0dd93002a..d1754ec1152 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2939,8 +2939,8 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw, IDirectDrawSurfac localParameters.SwapEffect = WINED3DSWAPEFFECT_COPY; localParameters.hDeviceWindow = window; localParameters.Windowed = !(ddraw->cooperative_level & DDSCL_FULLSCREEN); - localParameters.EnableAutoDepthStencil = TRUE; - localParameters.AutoDepthStencilFormat = WINED3DFMT_D16_UNORM; + localParameters.EnableAutoDepthStencil = FALSE; + localParameters.AutoDepthStencilFormat = WINED3DFMT_UNKNOWN; localParameters.Flags = 0; localParameters.FullScreen_RefreshRateInHz = WINED3DPRESENT_RATE_DEFAULT; localParameters.PresentationInterval = WINED3DPRESENT_INTERVAL_DEFAULT; @@ -5923,50 +5923,8 @@ static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_pa UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface) { - struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent); - IDirectDrawSurface7 *ddraw7; - IDirectDrawSurfaceImpl *ddraw_surface; - DDSURFACEDESC2 ddsd; - HRESULT hr; - - TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" - "\tmultisample_quality %u, discard %u, surface %p.\n", - device_parent, width, height, format, multisample_type, multisample_quality, discard, surface); - - *surface = NULL; - - /* Create a DirectDraw surface */ - memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwHeight = height; - ddsd.dwWidth = width; - if (format) - { - PixelFormat_WineD3DtoDD(&ddsd.u4.ddpfPixelFormat, format); - } - else - { - ddsd.dwFlags ^= DDSD_PIXELFORMAT; - } - - ddraw->depthstencil = TRUE; - hr = IDirectDraw7_CreateSurface(&ddraw->IDirectDraw7_iface, &ddsd, &ddraw7, NULL); - ddraw->depthstencil = FALSE; - if (FAILED(hr)) - { - WARN("Failed to create depth/stencil surface, hr %#x.\n", hr); - return hr; - } - - ddraw_surface = impl_from_IDirectDrawSurface7(ddraw7); - *surface = ddraw_surface->wined3d_surface; - wined3d_surface_incref(*surface); - IDirectDrawSurface7_Release(&ddraw_surface->IDirectDrawSurface7_iface); - - return D3D_OK; + ERR("DirectDraw doesn't have and shoudn't try creating implicit depth buffers.\n"); + return E_NOTIMPL; } static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent, diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 685ed45afac..8946d485563 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -100,11 +100,19 @@ static ULONG getRefcount(IUnknown *iface) return IUnknown_Release(iface); } +static HRESULT WINAPI SurfaceCounter(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) +{ + UINT *num = context; + (*num)++; + IDirectDrawSurface_Release(surface); + return DDENUMRET_OK; +} static BOOL CreateDirect3D(void) { HRESULT rc; DDSURFACEDESC2 ddsd; + UINT num; rc = pDirectDrawCreateEx(NULL, (void**)&lpDD, &IID_IDirectDraw7, NULL); @@ -131,6 +139,10 @@ static BOOL CreateDirect3D(void) if (FAILED(rc)) return FALSE; + num = 0; + IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, NULL, &num, SurfaceCounter); + ok(num == 1, "Has %d surfaces, expected 1\n", num); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;