From: Stefan Dösinger <stefandoesinger@gmx.at>
To: wine-devel@winehq.org; Ralph Little <littlesincanada@yahoo.co.uk>
Sent: Wednesday, February 1, 2012 11:52:15 AM
Subject: Re: Profiing
windows apps
Hi,
Am Dienstag, 31. Januar 2012, 21:51:01 schrieb Ralph Little:
> IDirectDraw * pDD = NULL;
> IDirectDrawSurface * pDDSPrimary = NULL;
> DDSURFACEDESC ddsd;
Take a look at dlls/ddraw/tests/ddraw*.c
> ...<initialisation etc>...
Make sure you use the version of the interface the game uses. There are some
behavioral differences between them. E.g. with zbuffers
DDSURFACEDESC(IDirectDraw, IDirectDraw2) has dwZBufferBitDepth(and
DDSD_ZBUFFERBITDEPTH), while DDSURFACEDESC2(IDirectDraw4, IDirectDraw7) always
uses a pixel format.
As far as I can see from the bug report the game is using IDirectDraw4.
> memset(&ddsd, 0, sizeof(ddsd));
> ddsd.dwSize = sizeof(ddsd);
> ddsd.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_HEIGHT | DDSD_WIDTH;
> ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER;
Is it really
trying to create a system memory z buffer? (Ok, I just saw this
in the logs attached to the bug report - that's really odd).
> ddsd.dwHeight = 600;
> ddsd.dwWidth = 800;
> ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
Try to set ddsd.ddpfPixelFormat.dwZBufferBitDepth to e.g. 16 and
ddsd.ddpfPixelFormat.dwZBitMask to 0x0000ffff. Keep dwFlags set to 0. Als try
to keep dwSize at 0.
> I assume that if the caller specifies DDSCAPS_ZBUFFER, the you must also
> specify some PIXEL format information. DDSD_PIXELFORMAT is present, but
> there are no format flags.
Basically that, or dwZBufferBitDepth. See zbufferbitdepth_test in
dlls/ddraw/tests/dsurface.c for some tests on this. (Don't add any new tests
there btw - use tests/ddraw*.c).
> I have to admit that I am a bit of a novice when it comes to DirectX so any
> guidance here would be helpful. I see that the
lpSurface is NULL, which I
> thought was an error. However, I see that this is optional if the caller
> wishes the system to manage the surface memory.
Correct.
> Any error returned by this function the Sims at this point to causes it to
> crash. Therefore, it seems to me that if it succeeds in Windows, it must
> have passed something different. If only we could see the source :D
If the testing doesn't reveal anything, look out for IDirectDraw::GetCaps
calls in the logs or IDirect3Dx::EnumZBufferFormats. IDirectDraw::GetCaps
returns a DDCAPS structure which has dwZBufferBitDepths containing some flags
for z buffer bit depths. EnumZBufferFormats calls a callback multiple times
with available DDPIXELFORMAT structures. The application may not like some
flags we set there.
Also please attach a full +ddraw log to the bug report. If it is too big
compress it. bzip2 should do a pretty
decent job, if all fails try lrzip.