/* DirectDraw Base Functions * * Copyright 1997-1999 Marcus Meissner * Copyright 1998 Lionel Ulmer (most of Direct3D stuff) */ #include "config.h" #include #include #include #include #include #include #include "winerror.h" #include "heap.h" #include "wine/exception.h" #include "ddraw.h" #include "d3d.h" #include "debugtools.h" #include "options.h" DEFAULT_DEBUG_CHANNEL(ddraw); /****************************************************************************** * debug output functions */ void _dump_DDBLTFX(DWORD flagmask) { int i; const struct { DWORD mask; char *name; } flags[] = { #define FE(x) { x, #x}, FE(DDBLTFX_ARITHSTRETCHY) FE(DDBLTFX_MIRRORLEFTRIGHT) FE(DDBLTFX_MIRRORUPDOWN) FE(DDBLTFX_NOTEARING) FE(DDBLTFX_ROTATE180) FE(DDBLTFX_ROTATE270) FE(DDBLTFX_ROTATE90) FE(DDBLTFX_ZBUFFERRANGE) FE(DDBLTFX_ZBUFFERBASEDEST) #undef FE }; for (i=0;idwFlags); if (pf->dwFlags & DDPF_FOURCC) { DPRINTF(", dwFourCC (%08lx) : %c%c%c%c", pf->dwFourCC, (unsigned char)( pf->dwFourCC &0xff), (unsigned char)((pf->dwFourCC>> 8)&0xff), (unsigned char)((pf->dwFourCC>>16)&0xff), (unsigned char)((pf->dwFourCC>>24)&0xff) ); } if (pf->dwFlags & DDPF_RGB) { char *cmd; DPRINTF(", RGB bits: %ld, ", pf->u.dwRGBBitCount); switch (pf->u.dwRGBBitCount) { case 4: cmd = "%1lx"; break; case 8: cmd = "%02lx"; break; case 16: cmd = "%04lx"; break; case 24: cmd = "%06lx"; break; case 32: cmd = "%08lx"; break; default: ERR("Unexpected bit depth !\n"); cmd = "%d"; break; } DPRINTF(" R "); DPRINTF(cmd, pf->u1.dwRBitMask); DPRINTF(" G "); DPRINTF(cmd, pf->u2.dwGBitMask); DPRINTF(" B "); DPRINTF(cmd, pf->u3.dwBBitMask); if (pf->dwFlags & DDPF_ALPHAPIXELS) { DPRINTF(" A "); DPRINTF(cmd, pf->u4.dwRGBAlphaBitMask); } if (pf->dwFlags & DDPF_ZPIXELS) { DPRINTF(" Z "); DPRINTF(cmd, pf->u4.dwRGBZBitMask); } } if (pf->dwFlags & DDPF_ZBUFFER) { DPRINTF(", Z bits : %ld", pf->u.dwZBufferBitDepth); } if (pf->dwFlags & DDPF_ALPHA) { DPRINTF(", Alpha bits : %ld", pf->u.dwAlphaBitDepth); } DPRINTF(")"); } void _dump_colorkeyflag(DWORD ck) { int i; const struct { DWORD mask; char *name; } flags[] = { #define FE(x) { x, #x}, FE(DDCKEY_COLORSPACE) FE(DDCKEY_DESTBLT) FE(DDCKEY_DESTOVERLAY) FE(DDCKEY_SRCBLT) FE(DDCKEY_SRCOVERLAY) #undef FE }; for (i=0;idwColorSpaceLowValue, ddck->dwColorSpaceHighValue); } void _dump_surface_desc(DDSURFACEDESC *lpddsd) { int i; struct { DWORD mask; char *name; void (*func)(void *); void *elt; } flags[16], *fe = flags; #define FE(x,f,e) do { fe->mask = x; fe->name = #x; fe->func = f; fe->elt = (void *) &(lpddsd->e); fe++; } while(0) FE(DDSD_CAPS, _dump_DDSCAPS, ddsCaps); FE(DDSD_HEIGHT, _dump_DWORD, dwHeight); FE(DDSD_WIDTH, _dump_DWORD, dwWidth); FE(DDSD_PITCH, _dump_DWORD, lPitch); FE(DDSD_BACKBUFFERCOUNT, _dump_DWORD, dwBackBufferCount); FE(DDSD_ZBUFFERBITDEPTH, _dump_DWORD, u.dwZBufferBitDepth); FE(DDSD_ALPHABITDEPTH, _dump_DWORD, dwAlphaBitDepth); FE(DDSD_PIXELFORMAT, _dump_pixelformat, ddpfPixelFormat); FE(DDSD_CKDESTOVERLAY, _dump_DDCOLORKEY, ddckCKDestOverlay); FE(DDSD_CKDESTBLT, _dump_DDCOLORKEY, ddckCKDestBlt); FE(DDSD_CKSRCOVERLAY, _dump_DDCOLORKEY, ddckCKSrcOverlay); FE(DDSD_CKSRCBLT, _dump_DDCOLORKEY, ddckCKSrcBlt); FE(DDSD_MIPMAPCOUNT, _dump_DWORD, u.dwMipMapCount); FE(DDSD_REFRESHRATE, _dump_DWORD, u.dwRefreshRate); FE(DDSD_LINEARSIZE, _dump_DWORD, u1.dwLinearSize); FE(DDSD_LPSURFACE, _dump_PTR, u1.lpSurface); #undef FE for (i=0;idwFlags) { DPRINTF(" - %s : ",flags[i].name); flags[i].func(flags[i].elt); DPRINTF("\n"); } } void _dump_cooperativelevel(DWORD cooplevel) { int i; const struct { int mask; char *name; } flags[] = { #define FE(x) { x, #x}, FE(DDSCL_FULLSCREEN) FE(DDSCL_ALLOWREBOOT) FE(DDSCL_NOWINDOWCHANGES) FE(DDSCL_NORMAL) FE(DDSCL_ALLOWMODEX) FE(DDSCL_EXCLUSIVE) FE(DDSCL_SETFOCUSWINDOW) FE(DDSCL_SETDEVICEWINDOW) FE(DDSCL_CREATEDEVICEWINDOW) #undef FE }; if (TRACE_ON(ddraw)) { DPRINTF(" - "); for (i=0;i