ReactOS 0.4.15-dev-5666-gc548b97
utils.c File Reference
#include "config.h"
#include "wine/port.h"
#include "ddraw_private.h"
Include dependency graph for utils.c:

Go to the source code of this file.

Macros

#define STRUCT   DDSURFACEDESC2
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ddraw)
 
static void DDRAW_dump_pixelformat (const DDPIXELFORMAT *pf)
 
void ddrawformat_from_wined3dformat (DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_id wined3d_format)
 
enum wined3d_format_id wined3dformat_from_ddrawformat (const DDPIXELFORMAT *DDPixelFormat)
 
unsigned int wined3dmapflags_from_ddrawmapflags (unsigned int flags)
 
static float colour_to_float (DWORD colour, DWORD mask)
 
BOOL wined3d_colour_from_ddraw_colour (const DDPIXELFORMAT *pf, const struct ddraw_palette *palette, DWORD colour, struct wined3d_color *wined3d_colour)
 
static void DDRAW_dump_DWORD (const void *in)
 
static void DDRAW_dump_PTR (const void *in)
 
static void DDRAW_dump_DDCOLORKEY (const DDCOLORKEY *ddck)
 
static void DDRAW_dump_flags_nolf (DWORD flags, const struct flag_info *names, size_t num_names)
 
static void DDRAW_dump_flags (DWORD flags, const struct flag_info *names, size_t num_names)
 
void DDRAW_dump_DDSCAPS2 (const DDSCAPS2 *in)
 
static void DDRAW_dump_DDSCAPS (const DDSCAPS *in)
 
static void DDRAW_dump_pixelformat_flag (DWORD flagmask)
 
static void DDRAW_dump_members (DWORD flags, const void *data, const struct member_info *mems, size_t num_mems)
 
void DDRAW_dump_surface_desc (const DDSURFACEDESC2 *lpddsd)
 
void dump_D3DMATRIX (const D3DMATRIX *mat)
 
DWORD get_flexible_vertex_size (DWORD d3dvtVertexType)
 
void DDRAW_Convert_DDSCAPS_1_To_2 (const DDSCAPS *pIn, DDSCAPS2 *pOut)
 
void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1 (const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut)
 
void DDRAW_dump_cooperativelevel (DWORD cooplevel)
 
void DDRAW_dump_DDCAPS (const DDCAPS *lpcaps)
 
void multiply_matrix (D3DMATRIX *dest, const D3DMATRIX *src1, const D3DMATRIX *src2)
 
HRESULT hr_ddraw_from_wined3d (HRESULT hr)
 
void DDSD_to_DDSD2 (const DDSURFACEDESC *in, DDSURFACEDESC2 *out)
 
void DDSD2_to_DDSD (const DDSURFACEDESC2 *in, DDSURFACEDESC *out)
 

Macro Definition Documentation

◆ STRUCT

#define STRUCT   DDSURFACEDESC2

Function Documentation

◆ colour_to_float()

static float colour_to_float ( DWORD  colour,
DWORD  mask 
)
static

Definition at line 589 of file utils.c.

590{
591 if (!mask)
592 return 0.0f;
593 return (float)(colour & mask) / (float)mask;
594}
GLenum GLint GLuint mask
Definition: glext.h:6028

Referenced by wined3d_colour_from_ddraw_colour().

◆ DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1()

void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1 ( const DDDEVICEIDENTIFIER2 pIn,
DDDEVICEIDENTIFIER pOut 
)

Definition at line 961 of file utils.c.

962{
963 /* 2 adds a dwWHQLLevel field to the end. Both structures are
964 * unversioned. */
965 memcpy(pOut, pIn, sizeof(*pOut));
966}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by ddraw4_GetDeviceIdentifier().

◆ DDRAW_Convert_DDSCAPS_1_To_2()

void DDRAW_Convert_DDSCAPS_1_To_2 ( const DDSCAPS pIn,
DDSCAPS2 pOut 
)

Definition at line 951 of file utils.c.

952{
953 /* 2 adds three additional caps fields to the end. Both versions
954 * are unversioned. */
955 pOut->dwCaps = pIn->dwCaps;
956 pOut->dwCaps2 = 0;
957 pOut->dwCaps3 = 0;
958 pOut->u1.dwCaps4 = 0;
959}
DWORD dwCaps4
Definition: ddraw.h:737
DWORD dwCaps3
Definition: ddraw.h:734
DWORD dwCaps2
Definition: ddraw.h:733
DWORD dwCaps
Definition: ddraw.h:732
DWORD dwCaps
Definition: ddraw.h:727

Referenced by ddraw2_GetAvailableVidMem().

◆ DDRAW_dump_cooperativelevel()

void DDRAW_dump_cooperativelevel ( DWORD  cooplevel)

Definition at line 968 of file utils.c.

969{
970 static const struct flag_info flags[] =
971 {
981 };
982
983 if (TRACE_ON(ddraw))
984 {
985 TRACE(" - ");
987 }
988}
#define ARRAY_SIZE(a)
Definition: main.h:24
#define FE(x)
static void DDRAW_dump_flags(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:707
#define TRACE_ON(x)
Definition: compat.h:75
GLbitfield flags
Definition: glext.h:7161
#define DDSCL_SETDEVICEWINDOW
Definition: ddraw.h:539
#define DDSCL_SETFOCUSWINDOW
Definition: ddraw.h:538
#define DDSCL_NORMAL
Definition: ddraw.h:535
#define DDSCL_EXCLUSIVE
Definition: ddraw.h:536
#define DDSCL_ALLOWREBOOT
Definition: ddraw.h:533
#define DDSCL_CREATEDEVICEWINDOW
Definition: ddraw.h:540
#define DDSCL_NOWINDOWCHANGES
Definition: ddraw.h:534
#define DDSCL_ALLOWMODEX
Definition: ddraw.h:537
#define DDSCL_FULLSCREEN
Definition: ddraw.h:532
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by ddraw_set_cooperative_level().

◆ DDRAW_dump_DDCAPS()

void DDRAW_dump_DDCAPS ( const DDCAPS lpcaps)

Definition at line 990 of file utils.c.

991{
992 static const struct flag_info flags1[] =
993 {
994 FE(DDCAPS_3D),
1000 FE(DDCAPS_BLT),
1004 FE(DDCAPS_GDI),
1013 FE(DDCAPS_VBI),
1026 };
1027 static const struct flag_info flags2[] =
1028 {
1054 };
1055 static const struct flag_info flags3[] =
1056 {
1076 };
1077 static const struct flag_info flags4[] =
1078 {
1107 };
1108 static const struct flag_info flags5[] =
1109 {
1120 };
1121 static const struct flag_info flags6[] =
1122 {
1134 };
1135 static const struct flag_info flags7[] =
1136 {
1142 };
1143
1144 TRACE(" - dwSize : %d\n", lpcaps->dwSize);
1145 TRACE(" - dwCaps : "); DDRAW_dump_flags(lpcaps->dwCaps, flags1, ARRAY_SIZE(flags1));
1146 TRACE(" - dwCaps2 : "); DDRAW_dump_flags(lpcaps->dwCaps2, flags2, ARRAY_SIZE(flags2));
1147 TRACE(" - dwCKeyCaps : "); DDRAW_dump_flags(lpcaps->dwCKeyCaps, flags3, ARRAY_SIZE(flags3));
1148 TRACE(" - dwFXCaps : "); DDRAW_dump_flags(lpcaps->dwFXCaps, flags4, ARRAY_SIZE(flags4));
1149 TRACE(" - dwFXAlphaCaps : "); DDRAW_dump_flags(lpcaps->dwFXAlphaCaps, flags5, ARRAY_SIZE(flags5));
1150 TRACE(" - dwPalCaps : "); DDRAW_dump_flags(lpcaps->dwPalCaps, flags6, ARRAY_SIZE(flags6));
1151 TRACE(" - dwSVCaps : "); DDRAW_dump_flags(lpcaps->dwSVCaps, flags7, ARRAY_SIZE(flags7));
1152 TRACE("...\n");
1153 TRACE(" - dwNumFourCCCodes : %d\n", lpcaps->dwNumFourCCCodes);
1154 TRACE(" - dwCurrVisibleOverlays : %d\n", lpcaps->dwCurrVisibleOverlays);
1155 TRACE(" - dwMinOverlayStretch : %d\n", lpcaps->dwMinOverlayStretch);
1156 TRACE(" - dwMaxOverlayStretch : %d\n", lpcaps->dwMaxOverlayStretch);
1157 TRACE("...\n");
1158 TRACE(" - ddsCaps : "); DDRAW_dump_DDSCAPS2(&lpcaps->ddsCaps);
1159}
void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
Definition: utils.c:713
#define DDSVCAPS_RESERVED4
Definition: ddraw.h:440
#define DDFXCAPS_OVERLAYSHRINKXN
Definition: ddraw.h:423
#define DDCKEYCAPS_DESTBLTCLRSPACEYUV
Definition: ddraw.h:483
#define DDPCAPS_PRIMARYSURFACE
Definition: ddraw.h:456
#define DDCKEYCAPS_SRCBLTCLRSPACEYUV
Definition: ddraw.h:492
#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL
Definition: ddraw.h:386
#define DDCAPS_OVERLAYSTRETCH
Definition: ddraw.h:343
#define DDFXALPHACAPS_BLTALPHASURFACES
Definition: ddraw.h:395
#define DDCAPS_3D
Definition: ddraw.h:329
#define DDFXALPHACAPS_BLTALPHAPIXELS
Definition: ddraw.h:393
#define DDFXCAPS_BLTSHRINKYN
Definition: ddraw.h:416
#define DDCAPS_BLT
Definition: ddraw.h:335
#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG
Definition: ddraw.h:401
#define DDCAPS_ALIGNBOUNDARYSRC
Definition: ddraw.h:332
#define DDCAPS2_CANDROPZ16BIT
Definition: ddraw.h:370
#define DDCAPS_BLTDEPTHFILL
Definition: ddraw.h:357
#define DDCAPS2_FLIPINTERVAL
Definition: ddraw.h:381
#define DDCKEYCAPS_DESTBLT
Definition: ddraw.h:481
#define DDCKEYCAPS_SRCOVERLAYYUV
Definition: ddraw.h:498
#define DDCKEYCAPS_SRCBLTYUV
Definition: ddraw.h:493
#define DDSVCAPS_RESERVED3
Definition: ddraw.h:439
#define DDFXCAPS_BLTSHRINKX
Definition: ddraw.h:413
#define DDCAPS_ALIGNBOUNDARYDEST
Definition: ddraw.h:330
#define DDCAPS2_FLIPNOVSYNC
Definition: ddraw.h:382
#define DDCAPS_PALETTE
Definition: ddraw.h:344
#define DDPCAPS_VSYNC
Definition: ddraw.h:459
#define DDCAPS_OVERLAY
Definition: ddraw.h:340
#define DDFXALPHACAPS_OVERLAYALPHAPIXELS
Definition: ddraw.h:398
#define DDCAPS2_PRIMARYGAMMA
Definition: ddraw.h:378
#define DDCKEYCAPS_DESTOVERLAY
Definition: ddraw.h:485
#define DDCAPS_BLTQUEUE
Definition: ddraw.h:336
#define DDCAPS2_COLORCONTROLOVERLAY
Definition: ddraw.h:368
#define DDFXCAPS_OVERLAYARITHSTRETCHY
Definition: ddraw.h:421
#define DDPCAPS_ALLOW256
Definition: ddraw.h:458
#define DDCAPS2_CANRENDERWINDOWED
Definition: ddraw.h:379
#define DDCAPS_STEREOVIEW
Definition: ddraw.h:63
#define DDSVCAPS_RESERVED1
Definition: ddraw.h:437
#define DDCKEYCAPS_DESTBLTCLRSPACE
Definition: ddraw.h:482
#define DDCAPS2_NONLOCALVIDMEM
Definition: ddraw.h:371
#define DDCKEYCAPS_SRCOVERLAY
Definition: ddraw.h:494
#define DDPCAPS_8BITENTRIES
Definition: ddraw.h:454
#define DDFXCAPS_BLTSTRETCHYN
Definition: ddraw.h:420
#define DDFXCAPS_BLTMIRRORLEFTRIGHT
Definition: ddraw.h:409
#define DDFXCAPS_OVERLAYARITHSTRETCHYN
Definition: ddraw.h:406
#define DDCAPS_ALPHA
Definition: ddraw.h:352
#define DDCAPS_CANBLTSYSMEM
Definition: ddraw.h:360
#define DDCAPS_READSCANLINE
Definition: ddraw.h:346
#define DDFXCAPS_BLTMIRRORUPDOWN
Definition: ddraw.h:410
#define DDFXCAPS_OVERLAYSTRETCHXN
Definition: ddraw.h:427
#define DDCAPS2_CERTIFIED
Definition: ddraw.h:362
#define DDSVCAPS_STEREOSEQUENTIAL
Definition: ddraw.h:450
#define DDCAPS_OVERLAYFOURCC
Definition: ddraw.h:342
#define DDCAPS2_COLORCONTROLPRIMARY
Definition: ddraw.h:369
#define DDCKEYCAPS_DESTOVERLAYCLRSPACE
Definition: ddraw.h:486
#define DDCAPS2_NONLOCALVIDMEMCAPS
Definition: ddraw.h:372
#define DDCAPS_BLTSTRETCH
Definition: ddraw.h:338
#define DDFXCAPS_OVERLAYSHRINKX
Definition: ddraw.h:422
#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV
Definition: ddraw.h:496
#define DDFXCAPS_BLTSTRETCHXN
Definition: ddraw.h:418
#define DDFXALPHACAPS_OVERLAYALPHASURFACES
Definition: ddraw.h:400
#define DDCAPS_ALIGNSIZESRC
Definition: ddraw.h:333
#define DDCKEYCAPS_SRCBLT
Definition: ddraw.h:490
#define DDFXCAPS_BLTSTRETCHY
Definition: ddraw.h:419
#define DDCKEYCAPS_SRCOVERLAYONEACTIVE
Definition: ddraw.h:497
#define DDCAPS_OVERLAYCANTCLIP
Definition: ddraw.h:341
#define DDCAPS_CANCLIPSTRETCHED
Definition: ddraw.h:359
#define DDCAPS_ZBLTS
Definition: ddraw.h:349
#define DDFXCAPS_BLTARITHSTRETCHY
Definition: ddraw.h:407
#define DDCAPS2_CANBOBINTERLEAVED
Definition: ddraw.h:366
#define DDFXCAPS_BLTARITHSTRETCHYN
Definition: ddraw.h:408
#define DDCAPS_BANKSWITCHED
Definition: ddraw.h:356
#define DDPCAPS_1BIT
Definition: ddraw.h:460
#define DDCAPS2_CANBOBNONINTERLEAVED
Definition: ddraw.h:367
#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND
Definition: ddraw.h:397
#define DDCAPS_GDI
Definition: ddraw.h:339
#define DDFXCAPS_BLTSHRINKXN
Definition: ddraw.h:414
#define DDCAPS_VBI
Definition: ddraw.h:348
#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG
Definition: ddraw.h:399
#define DDCAPS2_CANCALIBRATEGAMMA
Definition: ddraw.h:380
#define DDCKEYCAPS_DESTOVERLAYONEACTIVE
Definition: ddraw.h:488
#define DDCAPS_CANCLIP
Definition: ddraw.h:358
#define DDPCAPS_2BIT
Definition: ddraw.h:461
#define DDCAPS_BLTCOLORFILL
Definition: ddraw.h:355
#define DDSVCAPS_RESERVED2
Definition: ddraw.h:438
#define DDFXCAPS_OVERLAYMIRRORUPDOWN
Definition: ddraw.h:431
#define DDCAPS2_WIDESURFACES
Definition: ddraw.h:374
#define DDCAPS2_COPYFOURCC
Definition: ddraw.h:377
#define DDFXCAPS_BLTSTRETCHX
Definition: ddraw.h:417
#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT
Definition: ddraw.h:430
#define DDCAPS_ALIGNSTRIDE
Definition: ddraw.h:334
#define DDPCAPS_8BIT
Definition: ddraw.h:455
#define DDFXALPHACAPS_BLTALPHAEDGEBLEND
Definition: ddraw.h:392
#define DDCKEYCAPS_DESTBLTYUV
Definition: ddraw.h:484
#define DDCAPS2_AUTOFLIPOVERLAY
Definition: ddraw.h:365
#define DDFXCAPS_OVERLAYSTRETCHY
Definition: ddraw.h:428
#define DDFXCAPS_BLTROTATION90
Definition: ddraw.h:412
#define DDFXCAPS_OVERLAYALPHA
Definition: ddraw.h:405
#define DDCAPS_COLORKEY
Definition: ddraw.h:351
#define DDFXCAPS_OVERLAYSTRETCHX
Definition: ddraw.h:426
#define DDCAPS2_CANFLIPODDEVEN
Definition: ddraw.h:375
#define DDCAPS_NOHARDWARE
Definition: ddraw.h:354
#define DDCAPS_BLTFOURCC
Definition: ddraw.h:337
#define DDPCAPS_PRIMARYSURFACELEFT
Definition: ddraw.h:457
#define DDCKEYCAPS_DESTOVERLAYYUV
Definition: ddraw.h:489
#define DDPCAPS_ALPHA
Definition: ddraw.h:462
#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV
Definition: ddraw.h:487
#define DDCAPS2_STEREO
Definition: ddraw.h:385
#define DDFXCAPS_OVERLAYSTRETCHYN
Definition: ddraw.h:429
#define DDCKEYCAPS_SRCOVERLAYCLRSPACE
Definition: ddraw.h:495
#define DDCAPS_ALIGNSIZEDEST
Definition: ddraw.h:331
#define DDFXALPHACAPS_BLTALPHAPIXELSNEG
Definition: ddraw.h:394
#define DDFXCAPS_BLTROTATION
Definition: ddraw.h:411
#define DDFXALPHACAPS_BLTALPHASURFACESNEG
Definition: ddraw.h:396
#define DDCKEYCAPS_SRCBLTCLRSPACE
Definition: ddraw.h:491
#define DDCAPS2_TEXMANINNONLOCALVIDMEM
Definition: ddraw.h:384
#define DDCAPS2_NOPAGELOCKREQUIRED
Definition: ddraw.h:373
#define DDFXCAPS_OVERLAYSHRINKYN
Definition: ddraw.h:425
#define DDCAPS2_CANBOBHARDWARE
Definition: ddraw.h:376
#define DDCAPS2_CANMANAGETEXTURE
Definition: ddraw.h:383
#define DDFXCAPS_BLTSHRINKY
Definition: ddraw.h:415
#define DDPCAPS_INITIALIZE
Definition: ddraw.h:452
#define DDCKEYCAPS_NOCOSTOVERLAY
Definition: ddraw.h:499
#define DDFXCAPS_OVERLAYSHRINKY
Definition: ddraw.h:424
#define DDCAPS_ZOVERLAYS
Definition: ddraw.h:350
#define DDCAPS_COLORKEYHWASSIST
Definition: ddraw.h:353
#define DDCAPS2_VIDEOPORT
Definition: ddraw.h:364
#define DDCAPS2_NO2DDURING3DSCENE
Definition: ddraw.h:363
#define DDCAPS_PALETTEVSYNC
Definition: ddraw.h:345
#define DDPCAPS_4BIT
Definition: ddraw.h:453
#define DDFXCAPS_BLTALPHA
Definition: ddraw.h:404

Referenced by ddraw7_GetCaps().

◆ DDRAW_dump_DDCOLORKEY()

static void DDRAW_dump_DDCOLORKEY ( const DDCOLORKEY ddck)
static

Definition at line 692 of file utils.c.

693{
694 TRACE("Low : 0x%08x - High : 0x%08x\n", ddck->dwColorSpaceLowValue, ddck->dwColorSpaceHighValue);
695}

Referenced by DDRAW_dump_surface_desc().

◆ DDRAW_dump_DDSCAPS()

static void DDRAW_dump_DDSCAPS ( const DDSCAPS in)
static

Definition at line 776 of file utils.c.

777{
778 DDSCAPS2 in_bis;
779
780 in_bis.dwCaps = in->dwCaps;
781 in_bis.dwCaps2 = 0;
782 in_bis.dwCaps3 = 0;
783 in_bis.u1.dwCaps4 = 0;
784
785 DDRAW_dump_DDSCAPS2(&in_bis);
786}
GLuint in
Definition: glext.h:9616

Referenced by DDRAW_dump_surface_desc().

◆ DDRAW_dump_DDSCAPS2()

void DDRAW_dump_DDSCAPS2 ( const DDSCAPS2 in)

Definition at line 713 of file utils.c.

714{
715 static const struct flag_info flags[] =
716 {
747 };
748 static const struct flag_info flags2[] =
749 {
769 };
770
772 DDRAW_dump_flags(in->dwCaps2, flags2, ARRAY_SIZE(flags2));
773}
static void DDRAW_dump_flags_nolf(DWORD flags, const struct flag_info *names, size_t num_names)
Definition: utils.c:697
#define DDSCAPS_ALPHA
Definition: surface.c:310
#define DDSCAPS_MODEX
Definition: ddraw.h:271
#define DDSCAPS2_CUBEMAP_NEGATIVEZ
Definition: ddraw.h:296
#define DDSCAPS_FRONTBUFFER
Definition: ddraw.h:254
#define DDSCAPS_ALLOCONLOAD
Definition: ddraw.h:274
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
#define DDSCAPS2_OPAQUE
Definition: ddraw.h:288
#define DDSCAPS_OVERLAY
Definition: ddraw.h:256
#define DDSCAPS_VISIBLE
Definition: ddraw.h:265
#define DDSCAPS2_HARDWAREDEINTERLACE
Definition: ddraw.h:281
#define DDSCAPS2_RESERVED1
Definition: ddraw.h:286
#define DDSCAPS_HWCODEC
Definition: ddraw.h:270
#define DDSCAPS_RESERVED2
Definition: ddraw.h:273
#define DDSCAPS2_CUBEMAP_POSITIVEX
Definition: ddraw.h:291
#define DDSCAPS_MIPMAP
Definition: ddraw.h:272
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:258
#define DDSCAPS_WRITEONLY
Definition: ddraw.h:266
#define DDSCAPS_OPTIMIZED
Definition: ddraw.h:279
#define DDSCAPS_NONLOCALVIDMEM
Definition: ddraw.h:277
#define DDSCAPS_RESERVED1
Definition: ddraw.h:249
#define DDSCAPS2_MIPMAPSUBLEVEL
Definition: ddraw.h:304
#define DDSCAPS_LIVEVIDEO
Definition: ddraw.h:269
#define DDSCAPS_PALETTE
Definition: ddraw.h:257
#define DDSCAPS2_D3DTEXTUREMANAGE
Definition: ddraw.h:305
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:255
#define DDSCAPS2_RESERVED2
Definition: ddraw.h:287
#define DDSCAPS2_CUBEMAP
Definition: ddraw.h:290
#define DDSCAPS_PRIMARYSURFACELEFT
Definition: ddraw.h:260
#define DDSCAPS_FLIP
Definition: ddraw.h:253
#define DDSCAPS2_HINTDYNAMIC
Definition: ddraw.h:283
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:251
#define DDSCAPS2_CUBEMAP_NEGATIVEY
Definition: ddraw.h:294
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:263
#define DDSCAPS2_CUBEMAP_POSITIVEY
Definition: ddraw.h:293
#define DDSCAPS2_CUBEMAP_NEGATIVEX
Definition: ddraw.h:292
#define DDSCAPS2_TEXTUREMANAGE
Definition: ddraw.h:285
#define DDSCAPS2_HINTANTIALIASING
Definition: ddraw.h:289
#define DDSCAPS2_CUBEMAP_POSITIVEZ
Definition: ddraw.h:295
#define DDSCAPS_TEXTURE
Definition: ddraw.h:262
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:264
#define DDSCAPS_LOCALVIDMEM
Definition: ddraw.h:276
#define DDSCAPS_OWNDC
Definition: ddraw.h:268
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:261
#define DDSCAPS2_HINTSTATIC
Definition: ddraw.h:284
#define DDSCAPS_VIDEOPORT
Definition: ddraw.h:275
#define DDSCAPS_STANDARDVGAMODE
Definition: ddraw.h:278
#define DDSCAPS2_STEREOSURFACELEFT
Definition: ddraw.h:307
#define DDSCAPS2_DONOTPERSIST
Definition: ddraw.h:306
#define DDSCAPS_COMPLEX
Definition: ddraw.h:252

Referenced by ddraw7_GetAvailableVidMem(), DDRAW_dump_DDCAPS(), DDRAW_dump_DDSCAPS(), and DDRAW_dump_surface_desc().

◆ DDRAW_dump_DWORD()

static void DDRAW_dump_DWORD ( const void in)
static

Definition at line 682 of file utils.c.

683{
684 TRACE("%d\n", *((const DWORD *) in));
685}
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by DDRAW_dump_surface_desc().

◆ DDRAW_dump_flags()

static void DDRAW_dump_flags ( DWORD  flags,
const struct flag_info names,
size_t  num_names 
)
static

Definition at line 707 of file utils.c.

708{
710 TRACE("\n");
711}
static int num_names
Definition: apinames.c:56
GLuint GLuint * names
Definition: glext.h:11545

Referenced by DDRAW_dump_cooperativelevel(), DDRAW_dump_DDCAPS(), and DDRAW_dump_DDSCAPS2().

◆ DDRAW_dump_flags_nolf()

static void DDRAW_dump_flags_nolf ( DWORD  flags,
const struct flag_info names,
size_t  num_names 
)
static

Definition at line 697 of file utils.c.

698{
699 unsigned int i;
700
701 for (i=0; i < num_names; i++)
702 if ((flags & names[i].val) || /* standard flag value */
703 ((!flags) && (!names[i].val))) /* zero value only */
704 TRACE("%s ", names[i].name);
705}
GLuint GLfloat * val
Definition: glext.h:7180
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: name.c:39

Referenced by DDRAW_dump_DDSCAPS2(), DDRAW_dump_flags(), and DDRAW_dump_pixelformat_flag().

◆ DDRAW_dump_members()

static void DDRAW_dump_members ( DWORD  flags,
const void data,
const struct member_info mems,
size_t  num_mems 
)
static

Definition at line 812 of file utils.c.

813{
814 unsigned int i;
815
816 for (i=0; i < num_mems; i++)
817 {
818 if (mems[i].val & flags)
819 {
820 TRACE(" - %s : ", mems[i].name);
821 mems[i].func((const char *)data + mems[i].offset);
822 }
823 }
824}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLintptr offset
Definition: glext.h:5920
void(* func)(const void *)

Referenced by DDRAW_dump_surface_desc().

◆ DDRAW_dump_pixelformat()

static void DDRAW_dump_pixelformat ( const DDPIXELFORMAT pf)
static

Definition at line 827 of file utils.c.

828{
829 TRACE("( ");
831 if (pf->dwFlags & DDPF_FOURCC)
832 TRACE(", dwFourCC code '%c%c%c%c' (0x%08x) - %u bits per pixel",
833 (unsigned char)( pf->dwFourCC &0xff),
834 (unsigned char)((pf->dwFourCC>> 8)&0xff),
835 (unsigned char)((pf->dwFourCC>>16)&0xff),
836 (unsigned char)((pf->dwFourCC>>24)&0xff),
837 pf->dwFourCC,
838 pf->u1.dwYUVBitCount);
839 if (pf->dwFlags & DDPF_RGB)
840 {
841 TRACE(", RGB bits: %u, R 0x%08x G 0x%08x B 0x%08x",
842 pf->u1.dwRGBBitCount,
843 pf->u2.dwRBitMask,
844 pf->u3.dwGBitMask,
845 pf->u4.dwBBitMask);
846 if (pf->dwFlags & DDPF_ALPHAPIXELS)
847 TRACE(" A 0x%08x", pf->u5.dwRGBAlphaBitMask);
848 if (pf->dwFlags & DDPF_ZPIXELS)
849 TRACE(" Z 0x%08x", pf->u5.dwRGBZBitMask);
850 }
851 if (pf->dwFlags & DDPF_ZBUFFER)
852 TRACE(", Z bits: %u", pf->u1.dwZBufferBitDepth);
853 if (pf->dwFlags & DDPF_ALPHA)
854 TRACE(", Alpha bits: %u", pf->u1.dwAlphaBitDepth);
855 if (pf->dwFlags & DDPF_BUMPDUDV)
856 TRACE(", Bump bits: %u, U 0x%08x V 0x%08x L 0x%08x",
857 pf->u1.dwBumpBitCount,
858 pf->u2.dwBumpDuBitMask,
859 pf->u3.dwBumpDvBitMask,
861 TRACE(")\n");
862}
static void DDRAW_dump_pixelformat_flag(DWORD flagmask)
Definition: utils.c:789
#define DDPF_ZBUFFER
Definition: ddraw.h:511
#define DDPF_ALPHA
Definition: ddraw.h:502
#define DDPF_FOURCC
Definition: ddraw.h:503
#define DDPF_RGB
Definition: ddraw.h:507
#define DDPF_ZPIXELS
Definition: ddraw.h:514
#define DDPF_ALPHAPIXELS
Definition: ddraw.h:501
#define DDPF_BUMPDUDV
Definition: ddraw.h:519
DWORD dwRGBZBitMask
Definition: ddraw.h:1116
DWORD dwBBitMask
Definition: ddraw.h:1106
DWORD dwBumpDuBitMask
Definition: ddraw.h:1089
DWORD dwBumpBitCount
Definition: ddraw.h:1080
DWORD dwBumpDvBitMask
Definition: ddraw.h:1097
DWORD dwZBufferBitDepth
Definition: ddraw.h:1077
DWORD dwAlphaBitDepth
Definition: ddraw.h:1078
DWORD dwFourCC
Definition: ddraw.h:1072
DWORD dwBumpLuminanceBitMask
Definition: ddraw.h:1109
DWORD dwRGBBitCount
Definition: ddraw.h:1075
DWORD dwYUVBitCount
Definition: ddraw.h:1076
DWORD dwRBitMask
Definition: ddraw.h:1085
DWORD dwGBitMask
Definition: ddraw.h:1094
DWORD dwFlags
Definition: ddraw.h:1071
DWORD dwRGBAlphaBitMask
Definition: ddraw.h:1113

Referenced by DDRAW_dump_surface_desc(), ddrawformat_from_wined3dformat(), wined3d_colour_from_ddraw_colour(), and wined3dformat_from_ddrawformat().

◆ DDRAW_dump_pixelformat_flag()

static void DDRAW_dump_pixelformat_flag ( DWORD  flagmask)
static

Definition at line 789 of file utils.c.

790{
791 static const struct flag_info flags[] =
792 {
794 FE(DDPF_ALPHA),
799 FE(DDPF_RGB),
802 FE(DDPF_YUV),
807 };
808
810}
#define DDPF_PALETTEINDEXEDTO8
Definition: ddraw.h:505
#define DDPF_PALETTEINDEXED4
Definition: ddraw.h:504
#define DDPF_PALETTEINDEXED2
Definition: ddraw.h:513
#define DDPF_COMPRESSED
Definition: ddraw.h:508
#define DDPF_YUV
Definition: ddraw.h:510
#define DDPF_PALETTEINDEXED1
Definition: ddraw.h:512
#define DDPF_PALETTEINDEXED8
Definition: ddraw.h:506
#define DDPF_RGBTOYUV
Definition: ddraw.h:509

Referenced by DDRAW_dump_pixelformat().

◆ DDRAW_dump_PTR()

static void DDRAW_dump_PTR ( const void in)
static

Definition at line 687 of file utils.c.

688{
689 TRACE("%p\n", *((const void * const*) in));
690}

Referenced by DDRAW_dump_surface_desc().

◆ DDRAW_dump_surface_desc()

void DDRAW_dump_surface_desc ( const DDSURFACEDESC2 lpddsd)

Definition at line 864 of file utils.c.

865{
866#define STRUCT DDSURFACEDESC2
867 static const struct member_info members[] =
868 {
871 ME(DDSD_PITCH, DDRAW_dump_DWORD, u1 /* lPitch */),
872 ME(DDSD_LINEARSIZE, DDRAW_dump_DWORD, u1 /* dwLinearSize */),
873 ME(DDSD_BACKBUFFERCOUNT, DDRAW_dump_DWORD, u5.dwBackBufferCount),
874 ME(DDSD_MIPMAPCOUNT, DDRAW_dump_DWORD, u2 /* dwMipMapCount */),
875 ME(DDSD_ZBUFFERBITDEPTH, DDRAW_dump_DWORD, u2 /* dwZBufferBitDepth */), /* This is for 'old-style' D3D */
876 ME(DDSD_REFRESHRATE, DDRAW_dump_DWORD, u2 /* dwRefreshRate */),
878 ME(DDSD_LPSURFACE, DDRAW_dump_PTR, lpSurface),
879 ME(DDSD_CKDESTOVERLAY, DDRAW_dump_DDCOLORKEY, u3 /* ddckCKDestOverlay */),
880 ME(DDSD_CKDESTBLT, DDRAW_dump_DDCOLORKEY, ddckCKDestBlt),
881 ME(DDSD_CKSRCOVERLAY, DDRAW_dump_DDCOLORKEY, ddckCKSrcOverlay),
882 ME(DDSD_CKSRCBLT, DDRAW_dump_DDCOLORKEY, ddckCKSrcBlt),
883 ME(DDSD_PIXELFORMAT, DDRAW_dump_pixelformat, u4 /* ddpfPixelFormat */)
884 };
885 static const struct member_info members_caps[] =
886 {
888 };
889 static const struct member_info members_caps2[] =
890 {
892 };
893#undef STRUCT
894
895 if (NULL == lpddsd)
896 {
897 TRACE("(null)\n");
898 }
899 else
900 {
901 if (lpddsd->dwSize >= sizeof(DDSURFACEDESC2))
902 {
903 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps2, 1);
904 }
905 else
906 {
907 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps, 1);
908 }
909 DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members, ARRAY_SIZE(members));
910 }
911}
#define ME(x, f, e)
#define DDSD_LPSURFACE
Definition: ddrawex.h:22
#define NULL
Definition: types.h:112
static void DDRAW_dump_members(DWORD flags, const void *data, const struct member_info *mems, size_t num_mems)
Definition: utils.c:812
static void DDRAW_dump_PTR(const void *in)
Definition: utils.c:687
static void DDRAW_dump_DDSCAPS(const DDSCAPS *in)
Definition: utils.c:776
static void DDRAW_dump_DDCOLORKEY(const DDCOLORKEY *ddck)
Definition: utils.c:692
static void DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf)
Definition: utils.c:827
static void DDRAW_dump_DWORD(const void *in)
Definition: utils.c:682
static const WCHAR dwWidth[]
Definition: provider.c:62
static const WCHAR dwHeight[]
Definition: provider.c:63
GLdouble GLdouble u2
Definition: glext.h:8308
GLdouble u1
Definition: glext.h:8308
static BYTE u3[]
Definition: msg.c:580
static BYTE u5[]
Definition: msg.c:590
static BYTE u4[]
Definition: msg.c:588
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSD_PIXELFORMAT
Definition: ddraw.h:216
DWORD dwAlphaBitDepth
Definition: ddraw.h:3
#define DDSD_PITCH
Definition: ddraw.h:211
#define DDSD_REFRESHRATE
Definition: ddraw.h:222
#define DDSD_MIPMAPCOUNT
Definition: ddraw.h:221
#define DDSD_ALPHABITDEPTH
Definition: ddraw.h:214
#define DDSD_HEIGHT
Definition: ddraw.h:209
#define DDSD_ZBUFFERBITDEPTH
Definition: ddraw.h:213
#define DDSD_CKDESTOVERLAY
Definition: ddraw.h:217
#define DDSD_CKSRCBLT
Definition: ddraw.h:220
#define DDSD_LINEARSIZE
Definition: ddraw.h:223
#define DDSD_CAPS
Definition: ddraw.h:208
#define DDSD_CKDESTBLT
Definition: ddraw.h:218
#define DDSD_BACKBUFFERCOUNT
Definition: ddraw.h:212
#define DDSD_CKSRCOVERLAY
Definition: ddraw.h:219
DWORD dwFlags
Definition: ddraw.h:1153
DWORD dwSize
Definition: ddraw.h:1152

Referenced by ddraw2_CreateSurface(), ddraw4_CreateSurface(), ddraw7_CreateSurface(), ddraw7_GetDisplayMode(), ddraw_surface3_GetSurfaceDesc(), ddraw_surface7_GetSurfaceDesc(), ddraw_surface_create(), and surface_lock().

◆ ddrawformat_from_wined3dformat()

void ddrawformat_from_wined3dformat ( DDPIXELFORMAT DDPixelFormat,
enum wined3d_format_id  wined3d_format 
)

Definition at line 33 of file utils.c.

34{
35 DWORD Size = DDPixelFormat->dwSize;
36
37 if(Size==0) return;
38
39 memset(DDPixelFormat, 0x00, Size);
40 DDPixelFormat->dwSize = Size;
41 switch (wined3d_format)
42 {
44 DDPixelFormat->dwFlags = DDPF_RGB;
45 DDPixelFormat->dwFourCC = 0;
46 DDPixelFormat->u1.dwRGBBitCount = 24;
47 DDPixelFormat->u2.dwRBitMask = 0x00ff0000;
48 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
49 DDPixelFormat->u4.dwBBitMask = 0x000000ff;
50 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
51 break;
52
54 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
55 DDPixelFormat->dwFourCC = 0;
56 DDPixelFormat->u1.dwRGBBitCount = 32;
57 DDPixelFormat->u2.dwRBitMask = 0x00ff0000;
58 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
59 DDPixelFormat->u4.dwBBitMask = 0x000000ff;
60 DDPixelFormat->u5.dwRGBAlphaBitMask = 0xff000000;
61 break;
62
64 DDPixelFormat->dwFlags = DDPF_RGB;
65 DDPixelFormat->dwFourCC = 0;
66 DDPixelFormat->u1.dwRGBBitCount = 32;
67 DDPixelFormat->u2.dwRBitMask = 0x00ff0000;
68 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
69 DDPixelFormat->u4.dwBBitMask = 0x000000ff;
70 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
71 break;
72
74 DDPixelFormat->dwFlags = DDPF_RGB;
75 DDPixelFormat->dwFourCC = 0;
76 DDPixelFormat->u1.dwRGBBitCount = 32;
77 DDPixelFormat->u2.dwRBitMask = 0x000000ff;
78 DDPixelFormat->u3.dwGBitMask = 0x0000ff00;
79 DDPixelFormat->u4.dwBBitMask = 0x00ff0000;
80 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
81 break;
82
84 DDPixelFormat->dwFlags = DDPF_RGB;
85 DDPixelFormat->dwFourCC = 0;
86 DDPixelFormat->u1.dwRGBBitCount = 16;
87 DDPixelFormat->u2.dwRBitMask = 0xF800;
88 DDPixelFormat->u3.dwGBitMask = 0x07E0;
89 DDPixelFormat->u4.dwBBitMask = 0x001F;
90 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
91 break;
92
94 DDPixelFormat->dwFlags = DDPF_RGB;
95 DDPixelFormat->dwFourCC = 0;
96 DDPixelFormat->u1.dwRGBBitCount = 16;
97 DDPixelFormat->u2.dwRBitMask = 0x7C00;
98 DDPixelFormat->u3.dwGBitMask = 0x03E0;
99 DDPixelFormat->u4.dwBBitMask = 0x001F;
100 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
101 break;
102
104 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
105 DDPixelFormat->dwFourCC = 0;
106 DDPixelFormat->u1.dwRGBBitCount = 16;
107 DDPixelFormat->u2.dwRBitMask = 0x7C00;
108 DDPixelFormat->u3.dwGBitMask = 0x03E0;
109 DDPixelFormat->u4.dwBBitMask = 0x001F;
110 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x8000;
111 break;
112
114 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
115 DDPixelFormat->dwFourCC = 0;
116 DDPixelFormat->u1.dwRGBBitCount = 16;
117 DDPixelFormat->u2.dwRBitMask = 0x0F00;
118 DDPixelFormat->u3.dwGBitMask = 0x00F0;
119 DDPixelFormat->u4.dwBBitMask = 0x000F;
120 DDPixelFormat->u5.dwRGBAlphaBitMask = 0xF000;
121 break;
122
124 DDPixelFormat->dwFlags = DDPF_RGB;
125 DDPixelFormat->dwFourCC = 0;
126 DDPixelFormat->u1.dwRGBBitCount = 8;
127 DDPixelFormat->u2.dwRBitMask = 0xE0;
128 DDPixelFormat->u3.dwGBitMask = 0x1C;
129 DDPixelFormat->u4.dwBBitMask = 0x03;
130 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0;
131 break;
132
134 DDPixelFormat->dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
135 DDPixelFormat->dwFourCC = 0;
136 DDPixelFormat->u1.dwRGBBitCount = 8;
137 DDPixelFormat->u2.dwRBitMask = 0x00;
138 DDPixelFormat->u3.dwGBitMask = 0x00;
139 DDPixelFormat->u4.dwBBitMask = 0x00;
140 break;
141
143 DDPixelFormat->dwFlags = DDPF_ALPHA;
144 DDPixelFormat->dwFourCC = 0;
145 DDPixelFormat->u1.dwAlphaBitDepth = 8;
146 DDPixelFormat->u2.dwRBitMask = 0x0;
147 DDPixelFormat->u3.dwZBitMask = 0x0;
148 DDPixelFormat->u4.dwStencilBitMask = 0x0;
149 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0;
150 break;
151
153 DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
154 DDPixelFormat->dwFourCC = 0;
155 DDPixelFormat->u1.dwRGBBitCount = 16;
156 DDPixelFormat->u2.dwRBitMask = 0x00E0;
157 DDPixelFormat->u3.dwGBitMask = 0x001C;
158 DDPixelFormat->u4.dwBBitMask = 0x0003;
159 DDPixelFormat->u5.dwRGBAlphaBitMask = 0xFF00;
160 break;
161
163 DDPixelFormat->dwFlags = DDPF_RGB;
164 DDPixelFormat->dwFourCC = 0;
165 DDPixelFormat->u1.dwRGBBitCount = 16;
166 DDPixelFormat->u2.dwRBitMask = 0x0F00;
167 DDPixelFormat->u3.dwGBitMask = 0x00F0;
168 DDPixelFormat->u4.dwBBitMask = 0x000F;
169 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
170 break;
171
172 /* How are Z buffer bit depth and Stencil buffer bit depth related?
173 */
175 DDPixelFormat->dwFlags = DDPF_ZBUFFER;
176 DDPixelFormat->dwFourCC = 0;
177 DDPixelFormat->u1.dwZBufferBitDepth = 16;
178 DDPixelFormat->u2.dwStencilBitDepth = 0;
179 DDPixelFormat->u3.dwZBitMask = 0x0000FFFF;
180 DDPixelFormat->u4.dwStencilBitMask = 0x0;
181 DDPixelFormat->u5.dwRGBZBitMask = 0x00000000;
182 break;
183
185 DDPixelFormat->dwFlags = DDPF_ZBUFFER;
186 DDPixelFormat->dwFourCC = 0;
187 DDPixelFormat->u1.dwZBufferBitDepth = 32;
188 DDPixelFormat->u2.dwStencilBitDepth = 0;
189 DDPixelFormat->u3.dwZBitMask = 0xFFFFFFFF;
190 DDPixelFormat->u4.dwStencilBitMask = 0x0;
191 DDPixelFormat->u5.dwRGBZBitMask = 0x00000000;
192 break;
193
195 DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER;
196 DDPixelFormat->dwFourCC = 0;
197 /* Should I set dwZBufferBitDepth to 32 here? */
198 DDPixelFormat->u1.dwZBufferBitDepth = 32;
199 DDPixelFormat->u2.dwStencilBitDepth = 4;
200 DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF;
201 DDPixelFormat->u4.dwStencilBitMask = 0x0F000000;
202 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
203 break;
204
206 DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER;
207 DDPixelFormat->dwFourCC = 0;
208 DDPixelFormat->u1.dwZBufferBitDepth = 32;
209 DDPixelFormat->u2.dwStencilBitDepth = 8;
210 DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF;
211 DDPixelFormat->u4.dwStencilBitMask = 0xFF000000;
212 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
213 break;
214
216 DDPixelFormat->dwFlags = DDPF_ZBUFFER;
217 DDPixelFormat->dwFourCC = 0;
218 DDPixelFormat->u1.dwZBufferBitDepth = 32;
219 DDPixelFormat->u2.dwStencilBitDepth = 0;
220 DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF;
221 DDPixelFormat->u4.dwStencilBitMask = 0x00000000;
222 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
223 break;
224
226 DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER;
227 DDPixelFormat->dwFourCC = 0;
228 DDPixelFormat->u1.dwZBufferBitDepth = 16;
229 DDPixelFormat->u2.dwStencilBitDepth = 1;
230 DDPixelFormat->u3.dwZBitMask = 0x7fff;
231 DDPixelFormat->u4.dwStencilBitMask = 0x8000;
232 DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0;
233 break;
234
235 case WINED3DFMT_UYVY:
236 case WINED3DFMT_YUY2:
237 DDPixelFormat->u1.dwYUVBitCount = 16;
238 DDPixelFormat->dwFlags = DDPF_FOURCC;
239 DDPixelFormat->dwFourCC = wined3d_format;
240 break;
241
242 case WINED3DFMT_YV12:
243 DDPixelFormat->u1.dwYUVBitCount = 12;
244 DDPixelFormat->dwFlags = DDPF_FOURCC;
245 DDPixelFormat->dwFourCC = wined3d_format;
246 break;
247
248 case WINED3DFMT_DXT1:
249 case WINED3DFMT_DXT2:
250 case WINED3DFMT_DXT3:
251 case WINED3DFMT_DXT4:
252 case WINED3DFMT_DXT5:
256 DDPixelFormat->dwFlags = DDPF_FOURCC;
257 DDPixelFormat->dwFourCC = wined3d_format;
258 break;
259
260 /* Luminance */
262 DDPixelFormat->dwFlags = DDPF_LUMINANCE;
263 DDPixelFormat->dwFourCC = 0;
264 DDPixelFormat->u1.dwLuminanceBitCount = 8;
265 DDPixelFormat->u2.dwLuminanceBitMask = 0xff;
266 DDPixelFormat->u3.dwBumpDvBitMask = 0x0;
267 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0;
268 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0;
269 break;
270
272 DDPixelFormat->dwFlags = DDPF_ALPHAPIXELS | DDPF_LUMINANCE;
273 DDPixelFormat->dwFourCC = 0;
274 DDPixelFormat->u1.dwLuminanceBitCount = 4;
275 DDPixelFormat->u2.dwLuminanceBitMask = 0x0f;
276 DDPixelFormat->u3.dwBumpDvBitMask = 0x0;
277 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0;
278 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0xf0;
279 break;
280
282 DDPixelFormat->dwFlags = DDPF_ALPHAPIXELS | DDPF_LUMINANCE;
283 DDPixelFormat->dwFourCC = 0;
284 DDPixelFormat->u1.dwLuminanceBitCount = 16;
285 DDPixelFormat->u2.dwLuminanceBitMask = 0x00ff;
286 DDPixelFormat->u3.dwBumpDvBitMask = 0x0;
287 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0;
288 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0xff00;
289 break;
290
291 /* Bump mapping */
293 DDPixelFormat->dwFlags = DDPF_BUMPDUDV;
294 DDPixelFormat->dwFourCC = 0;
295 DDPixelFormat->u1.dwBumpBitCount = 16;
296 DDPixelFormat->u2.dwBumpDuBitMask = 0x000000ff;
297 DDPixelFormat->u3.dwBumpDvBitMask = 0x0000ff00;
298 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x00000000;
299 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000;
300 break;
301
303 DDPixelFormat->dwFlags = DDPF_BUMPDUDV | DDPF_BUMPLUMINANCE;
304 DDPixelFormat->dwFourCC = 0;
305 DDPixelFormat->u1.dwBumpBitCount = 16;
306 DDPixelFormat->u2.dwBumpDuBitMask = 0x0000001f;
307 DDPixelFormat->u3.dwBumpDvBitMask = 0x000003e0;
308 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0000fc00;
309 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000;
310 break;
311
313 DDPixelFormat->dwFlags = DDPF_BUMPDUDV | DDPF_BUMPLUMINANCE;
314 DDPixelFormat->dwFourCC = 0;
315 DDPixelFormat->u1.dwBumpBitCount = 32;
316 DDPixelFormat->u2.dwBumpDuBitMask = 0x000000ff;
317 DDPixelFormat->u3.dwBumpDvBitMask = 0x0000ff00;
318 DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x00ff0000;
319 DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000;
320 break;
321
322 default:
323 FIXME("Unhandled wined3d format %#x.\n", wined3d_format);
324 break;
325 }
326
327 if(TRACE_ON(ddraw)) {
328 TRACE("Returning: ");
329 DDRAW_dump_pixelformat(DDPixelFormat);
330 }
331}
#define FIXME(fmt,...)
Definition: debug.h:111
#define DDPF_LUMINANCE
Definition: ddraw.h:517
#define DDPF_STENCILBUFFER
Definition: ddraw.h:515
#define DDPF_BUMPLUMINANCE
Definition: ddraw.h:518
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwLuminanceAlphaBitMask
Definition: ddraw.h:1115
DWORD dwSize
Definition: ddraw.h:1070
DWORD dwLuminanceBitMask
Definition: ddraw.h:1088
DWORD dwStencilBitDepth
Definition: ddraw.h:1087
DWORD dwLuminanceBitCount
Definition: ddraw.h:1079
DWORD dwZBitMask
Definition: ddraw.h:1096
DWORD dwStencilBitMask
Definition: ddraw.h:1108
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:111
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:110
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_DXT2
Definition: wined3d.h:240
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:223
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:112
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:119
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:120
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:224
@ WINED3DFMT_R8G8B8X8_UNORM
Definition: wined3d.h:114
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:109
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:191
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:118
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:187
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:121
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:108
@ WINED3DFMT_DXT1
Definition: wined3d.h:239
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_DXT3
Definition: wined3d.h:241
@ WINED3DFMT_DXT4
Definition: wined3d.h:242
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:122
@ WINED3DFMT_YV12
Definition: wined3d.h:238
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:221
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_DXT5
Definition: wined3d.h:243
@ WINED3DFMT_YUY2
Definition: wined3d.h:237
@ WINED3DFMT_G8R8_G8B8
Definition: wined3d.h:245
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:117
@ WINED3DFMT_UYVY
Definition: wined3d.h:236
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:201
@ WINED3DFMT_R8G8_B8G8
Definition: wined3d.h:246
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:113
@ WINED3DFMT_MULTI2_ARGB8
Definition: wined3d.h:244
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:181

Referenced by d3d7_EnumZBufferFormats(), d3d_device2_EnumTextureFormats(), d3d_device3_GetRenderState(), d3d_device3_SetRenderState(), d3d_device3_SetTexture(), d3d_device7_EnumTextureFormats(), ddraw7_EnumDisplayModes(), ddraw7_GetDisplayMode(), ddraw7_SetDisplayMode(), and ddraw_surface_create().

◆ DDSD2_to_DDSD()

void DDSD2_to_DDSD ( const DDSURFACEDESC2 in,
DDSURFACEDESC out 
)

Definition at line 1262 of file utils.c.

1263{
1264 memset(out, 0, sizeof(*out));
1265 out->dwSize = sizeof(*out);
1266 out->dwFlags = in->dwFlags;
1267 if (in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
1268 if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
1269 if (in->dwFlags & DDSD_PIXELFORMAT)
1270 {
1271 out->ddpfPixelFormat = in->u4.ddpfPixelFormat;
1272 if ((in->dwFlags & DDSD_CAPS) && (in->ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
1273 {
1274 /* Z buffers have DDSD_ZBUFFERBITDEPTH set, but not DDSD_PIXELFORMAT. They do
1275 * have valid data in ddpfPixelFormat though */
1276 out->dwFlags &= ~DDSD_PIXELFORMAT;
1277 out->dwFlags |= DDSD_ZBUFFERBITDEPTH;
1278 out->u2.dwZBufferBitDepth = in->u4.ddpfPixelFormat.u1.dwZBufferBitDepth;
1279 }
1280 }
1281 /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */
1282 out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
1283 if (in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch;
1284 if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->u5.dwBackBufferCount;
1285 if (in->dwFlags & DDSD_ZBUFFERBITDEPTH) out->u2.dwZBufferBitDepth = in->u2.dwMipMapCount; /* same union */
1286 if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
1287 /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
1288 out->lpSurface = in->lpSurface;
1289 if (in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->u3.ddckCKDestOverlay;
1290 if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
1291 if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
1292 if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
1293 if (in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount;
1294 if (in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate;
1295 if (in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize;
1296 /* Does not exist in DDSURFACEDESC:
1297 * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
1298 */
1299 if (in->dwFlags & DDSD_TEXTURESTAGE) WARN("Does not exist in DDSURFACEDESC: DDSD_TEXTURESTAGE\n");
1300 if (in->dwFlags & DDSD_FVF) WARN("Does not exist in DDSURFACEDESC: DDSD_FVF\n");
1301 if (in->dwFlags & DDSD_SRCVBHANDLE) WARN("Does not exist in DDSURFACEDESC: DDSD_SRCVBHANDLE\n");
1303}
#define WARN(fmt,...)
Definition: debug.h:112
static FILE * out
Definition: regtests2xml.c:44
#define DDSD_TEXTURESTAGE
Definition: ddraw.h:224
#define DDSD_SRCVBHANDLE
Definition: ddraw.h:226
#define DDSD_FVF
Definition: ddraw.h:225

Referenced by ddraw_surface1_Lock(), ddraw_surface2_Lock(), ddraw_surface3_GetSurfaceDesc(), ddraw_surface3_Lock(), and EnumDisplayModesCallbackThunk().

◆ DDSD_to_DDSD2()

void DDSD_to_DDSD2 ( const DDSURFACEDESC in,
DDSURFACEDESC2 out 
)

Definition at line 1218 of file utils.c.

1219{
1220 /* The output of this function is never passed to the application directly, so
1221 * the memset is not strictly needed. CreateSurface still has problems with this
1222 * though. Don't forget to set ddsCaps.dwCaps2/3/4 to 0 when removing this */
1223 memset(out, 0x00, sizeof(*out));
1224 out->dwSize = sizeof(*out);
1225 out->dwFlags = in->dwFlags & ~DDSD_ZBUFFERBITDEPTH;
1226 if (in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth;
1227 if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight;
1228 if (in->dwFlags & DDSD_PIXELFORMAT) out->u4.ddpfPixelFormat = in->ddpfPixelFormat;
1229 else if(in->dwFlags & DDSD_ZBUFFERBITDEPTH)
1230 {
1231 out->dwFlags |= DDSD_PIXELFORMAT;
1232 memset(&out->u4.ddpfPixelFormat, 0, sizeof(out->u4.ddpfPixelFormat));
1233 out->u4.ddpfPixelFormat.dwSize = sizeof(out->u4.ddpfPixelFormat);
1234 out->u4.ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
1235 out->u4.ddpfPixelFormat.u1.dwZBufferBitDepth = in->u2.dwZBufferBitDepth;
1236 /* 0 is not a valid DDSURFACEDESC / DDPIXELFORMAT on either side of the
1237 * conversion */
1238 out->u4.ddpfPixelFormat.u3.dwZBitMask = ~0U >> (32 - in->u2.dwZBufferBitDepth);
1239 }
1240 /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */
1241 out->ddsCaps.dwCaps = in->ddsCaps.dwCaps;
1242 if (in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch;
1243 if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->u5.dwBackBufferCount = in->dwBackBufferCount;
1244 if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth;
1245 /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */
1246 out->lpSurface = in->lpSurface;
1247 if (in->dwFlags & DDSD_CKDESTOVERLAY) out->u3.ddckCKDestOverlay = in->ddckCKDestOverlay;
1248 if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt;
1249 if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay;
1250 if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt;
1251 if (in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount;
1252 if (in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate;
1253 if (in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize;
1254 /* Does not exist in DDSURFACEDESC:
1255 * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE,
1256 */
1257}
#define U(x)
Definition: wordpad.c:45

Referenced by ddraw1_CreateSurface(), ddraw1_EnumDisplayModes(), ddraw1_EnumSurfaces(), ddraw2_CreateSurface(), ddraw2_EnumDisplayModes(), ddraw2_EnumSurfaces(), ddraw_surface1_Initialize(), ddraw_surface2_Initialize(), ddraw_surface3_Initialize(), and ddraw_surface3_SetSurfaceDesc().

◆ dump_D3DMATRIX()

void dump_D3DMATRIX ( const D3DMATRIX mat)

Definition at line 914 of file utils.c.

915{
916 TRACE(" %f %f %f %f\n", mat->_11, mat->_12, mat->_13, mat->_14);
917 TRACE(" %f %f %f %f\n", mat->_21, mat->_22, mat->_23, mat->_24);
918 TRACE(" %f %f %f %f\n", mat->_31, mat->_32, mat->_33, mat->_34);
919 TRACE(" %f %f %f %f\n", mat->_41, mat->_42, mat->_43, mat->_44);
920}
static const MAT2 mat
Definition: font.c:66

Referenced by d3d_device1_SetMatrix().

◆ get_flexible_vertex_size()

DWORD get_flexible_vertex_size ( DWORD  d3dvtVertexType)

Definition at line 923 of file utils.c.

924{
925 DWORD size = 0;
926 DWORD i;
927
928 if (d3dvtVertexType & D3DFVF_NORMAL) size += 3 * sizeof(D3DVALUE);
929 if (d3dvtVertexType & D3DFVF_DIFFUSE) size += sizeof(DWORD);
930 if (d3dvtVertexType & D3DFVF_SPECULAR) size += sizeof(DWORD);
931 if (d3dvtVertexType & D3DFVF_RESERVED1) size += sizeof(DWORD);
932 switch (d3dvtVertexType & D3DFVF_POSITION_MASK)
933 {
934 case D3DFVF_XYZ: size += 3 * sizeof(D3DVALUE); break;
935 case D3DFVF_XYZRHW: size += 4 * sizeof(D3DVALUE); break;
936 case D3DFVF_XYZB1: size += 4 * sizeof(D3DVALUE); break;
937 case D3DFVF_XYZB2: size += 5 * sizeof(D3DVALUE); break;
938 case D3DFVF_XYZB3: size += 6 * sizeof(D3DVALUE); break;
939 case D3DFVF_XYZB4: size += 7 * sizeof(D3DVALUE); break;
940 case D3DFVF_XYZB5: size += 8 * sizeof(D3DVALUE); break;
941 default: ERR("Unexpected position mask\n");
942 }
943 for (i = 0; i < GET_TEXCOUNT_FROM_FVF(d3dvtVertexType); i++)
944 {
945 size += GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, i) * sizeof(D3DVALUE);
946 }
947
948 return size;
949}
#define ERR(fmt,...)
Definition: debug.h:110
#define D3DFVF_DIFFUSE
Definition: d3d8types.h:122
#define D3DFVF_XYZ
Definition: d3d8types.h:113
#define D3DFVF_XYZB1
Definition: d3d8types.h:115
#define D3DFVF_XYZB5
Definition: d3d8types.h:119
#define D3DFVF_XYZRHW
Definition: d3d8types.h:114
#define D3DFVF_XYZB4
Definition: d3d8types.h:118
#define D3DFVF_NORMAL
Definition: d3d8types.h:120
#define D3DFVF_XYZB3
Definition: d3d8types.h:117
#define D3DFVF_XYZB2
Definition: d3d8types.h:116
#define D3DFVF_SPECULAR
Definition: d3d8types.h:123
#define D3DFVF_POSITION_MASK
Definition: d3d8types.h:112
float D3DVALUE
Definition: d3dtypes.h:89
#define D3DFVF_RESERVED1
Definition: d3dtypes.h:1309
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num)
#define GET_TEXCOUNT_FROM_FVF(d3dvtVertexType)
GLsizeiptr size
Definition: glext.h:5919
#define DWORD
Definition: nt_native.h:44

◆ hr_ddraw_from_wined3d()

◆ multiply_matrix()

void multiply_matrix ( D3DMATRIX dest,
const D3DMATRIX src1,
const D3DMATRIX src2 
)

Definition at line 1173 of file utils.c.

1176{
1178
1179 /* Now do the multiplication 'by hand'.
1180 I know that all this could be optimised, but this will be done later :-) */
1181 temp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
1182 temp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
1183 temp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
1184 temp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
1185
1186 temp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
1187 temp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
1188 temp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
1189 temp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
1190
1191 temp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
1192 temp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
1193 temp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
1194 temp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
1195
1196 temp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
1197 temp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
1198 temp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
1199 temp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
1200
1201 /* And copy the new matrix in the good storage.. */
1202 memcpy(dest, &temp, 16 * sizeof(D3DVALUE));
1203}
static char * dest
Definition: rtl.c:135
static calc_node_t temp
Definition: rpn_ieee.c:38
float _32
Definition: d3d8types.h:1113
float _42
Definition: d3d8types.h:1114
float _13
Definition: d3d8types.h:1111
float _44
Definition: d3d8types.h:1114
float _14
Definition: d3d8types.h:1111
float _11
Definition: d3d8types.h:1111
float _33
Definition: d3d8types.h:1113
float _24
Definition: d3d8types.h:1112
float _31
Definition: d3d8types.h:1113
float _34
Definition: d3d8types.h:1113
float _12
Definition: d3d8types.h:1111
float _21
Definition: d3d8types.h:1112
float _41
Definition: d3d8types.h:1114
float _23
Definition: d3d8types.h:1112
float _43
Definition: d3d8types.h:1114
float _22
Definition: d3d8types.h:1112

Referenced by d3d_device3_MultiplyTransform(), d3d_device3_SetTransform(), d3d_viewport_TransformVertices(), get_modelview_matrix(), get_projection_matrix(), get_texture_matrix(), prepare_clip_space_planes(), process_vertices_strided(), update_clip_space(), and wined3d_device_multiply_transform().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ddraw  )

◆ wined3d_colour_from_ddraw_colour()

BOOL wined3d_colour_from_ddraw_colour ( const DDPIXELFORMAT pf,
const struct ddraw_palette palette,
DWORD  colour,
struct wined3d_color wined3d_colour 
)

Definition at line 596 of file utils.c.

598{
599 if (pf->dwFlags & DDPF_ALPHA)
600 {
601 DWORD size, mask;
602
603 size = pf->u1.dwAlphaBitDepth;
604 mask = size < 32 ? (1u << size) - 1 : ~0u;
605 wined3d_colour->r = 0.0f;
606 wined3d_colour->g = 0.0f;
607 wined3d_colour->b = 0.0f;
608 wined3d_colour->a = colour_to_float(colour, mask);
609 return TRUE;
610 }
611
612 if (pf->dwFlags & DDPF_FOURCC)
613 {
614 WARN("FourCC formats not supported.\n");
615 goto fail;
616 }
617
619 {
621
622 colour &= 0xff;
623 if (!palette || FAILED(wined3d_palette_get_entries(palette->wined3d_palette, 0, colour, 1, &entry)))
624 {
625 wined3d_colour->r = 0.0f;
626 wined3d_colour->g = 0.0f;
627 wined3d_colour->b = 0.0f;
628 }
629 else
630 {
631 wined3d_colour->r = entry.peRed / 255.0f;
632 wined3d_colour->g = entry.peGreen / 255.0f;
633 wined3d_colour->b = entry.peBlue / 255.0f;
634 }
635 wined3d_colour->a = colour / 255.0f;
636 return TRUE;
637 }
638
639 if (pf->dwFlags & DDPF_RGB)
640 {
641 wined3d_colour->r = colour_to_float(colour, pf->u2.dwRBitMask);
642 wined3d_colour->g = colour_to_float(colour, pf->u3.dwGBitMask);
643 wined3d_colour->b = colour_to_float(colour, pf->u4.dwBBitMask);
644 if (pf->dwFlags & DDPF_ALPHAPIXELS)
645 wined3d_colour->a = colour_to_float(colour, pf->u5.dwRGBAlphaBitMask);
646 else
647 wined3d_colour->a = 0.0f;
648 return TRUE;
649 }
650
651 if (pf->dwFlags & DDPF_ZBUFFER)
652 {
653 wined3d_colour->r = colour_to_float(colour, pf->u3.dwZBitMask);
654 if (pf->dwFlags & DDPF_STENCILBUFFER)
655 wined3d_colour->g = colour_to_float(colour, pf->u4.dwStencilBitMask);
656 else
657 wined3d_colour->g = 0.0f;
658 wined3d_colour->b = 0.0f;
659 wined3d_colour->a = 0.0f;
660 return TRUE;
661 }
662
663 FIXME("Unhandled pixel format.\n");
665
666fail:
667 wined3d_colour->r = 0.0f;
668 wined3d_colour->g = 0.0f;
669 wined3d_colour->b = 0.0f;
670 wined3d_colour->a = 0.0f;
671
672 return FALSE;
673}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static float colour_to_float(DWORD colour, DWORD mask)
Definition: utils.c:589
HRESULT CDECL wined3d_palette_get_entries(const struct wined3d_palette *palette, DWORD flags, DWORD start, DWORD count, PALETTEENTRY *entries)
Definition: palette.c:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
static HPALETTE palette
Definition: clipboard.c:1345

Referenced by ddraw_surface_blt().

◆ wined3dformat_from_ddrawformat()

enum wined3d_format_id wined3dformat_from_ddrawformat ( const DDPIXELFORMAT DDPixelFormat)

Definition at line 333 of file utils.c.

334{
335 TRACE("Convert a DirectDraw Pixelformat to a WineD3D Pixelformat\n");
336 if(TRACE_ON(ddraw))
337 {
338 DDRAW_dump_pixelformat(DDPixelFormat);
339 }
340
341 if(DDPixelFormat->dwFlags & DDPF_PALETTEINDEXED8)
342 {
343 return WINED3DFMT_P8_UINT;
344 }
346 {
347 FIXME("DDPF_PALETTEINDEXED1 to DDPF_PALETTEINDEXED4 are not supported by WineD3D (yet). Returning WINED3DFMT_P8\n");
348 return WINED3DFMT_P8_UINT;
349 }
350 else if(DDPixelFormat->dwFlags & DDPF_RGB)
351 {
352 switch(DDPixelFormat->u1.dwRGBBitCount)
353 {
354 case 8:
355 /* This is the only format that can match here */
357
358 case 16:
359 /* Read the Color masks */
360 if( (DDPixelFormat->u2.dwRBitMask == 0xF800) &&
361 (DDPixelFormat->u3.dwGBitMask == 0x07E0) &&
362 (DDPixelFormat->u4.dwBBitMask == 0x001F) )
363 {
365 }
366
367 if( (DDPixelFormat->u2.dwRBitMask == 0x7C00) &&
368 (DDPixelFormat->u3.dwGBitMask == 0x03E0) &&
369 (DDPixelFormat->u4.dwBBitMask == 0x001F) )
370 {
371 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
372 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0x8000))
374 else
376 }
377
378 if( (DDPixelFormat->u2.dwRBitMask == 0x0F00) &&
379 (DDPixelFormat->u3.dwGBitMask == 0x00F0) &&
380 (DDPixelFormat->u4.dwBBitMask == 0x000F) )
381 {
382 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
383 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xF000))
385 else
387 }
388
389 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
390 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xFF00) &&
391 (DDPixelFormat->u2.dwRBitMask == 0x00E0) &&
392 (DDPixelFormat->u3.dwGBitMask == 0x001C) &&
393 (DDPixelFormat->u4.dwBBitMask == 0x0003) )
394 {
396 }
397 WARN("16 bit RGB Pixel format does not match.\n");
398 return WINED3DFMT_UNKNOWN;
399
400 case 24:
402
403 case 32:
404 /* Read the Color masks */
405 if( (DDPixelFormat->u2.dwRBitMask == 0x00FF0000) &&
406 (DDPixelFormat->u3.dwGBitMask == 0x0000FF00) &&
407 (DDPixelFormat->u4.dwBBitMask == 0x000000FF) )
408 {
409 if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) &&
410 (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xFF000000))
412 else
414
415 }
416 WARN("32 bit RGB pixel format does not match.\n");
417 return WINED3DFMT_UNKNOWN;
418
419 default:
420 WARN("Invalid dwRGBBitCount in Pixelformat structure.\n");
421 return WINED3DFMT_UNKNOWN;
422 }
423 }
424 else if( (DDPixelFormat->dwFlags & DDPF_ALPHA) )
425 {
426 /* Alpha only Pixelformat */
427 switch(DDPixelFormat->u1.dwAlphaBitDepth)
428 {
429 case 8:
430 return WINED3DFMT_A8_UNORM;
431
432 default:
433 WARN("Invalid AlphaBitDepth in Alpha-Only Pixelformat.\n");
434 return WINED3DFMT_UNKNOWN;
435 }
436 }
437 else if(DDPixelFormat->dwFlags & DDPF_LUMINANCE)
438 {
439 /* Luminance-only or luminance-alpha */
440 if(DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS)
441 {
442 /* Luminance with Alpha */
443 switch(DDPixelFormat->u1.dwLuminanceBitCount)
444 {
445 case 4:
446 if(DDPixelFormat->u1.dwAlphaBitDepth == 4)
448 WARN("Unknown Alpha / Luminance bit depth combination.\n");
449 return WINED3DFMT_UNKNOWN;
450
451 case 6:
452 FIXME("A luminance Pixelformat shouldn't have 6 luminance bits. Returning D3DFMT_L6V5U5 for now.\n");
454
455 case 8:
456 if(DDPixelFormat->u1.dwAlphaBitDepth == 8)
458 WARN("Unknown Alpha / Lumincase bit depth combination.\n");
459 return WINED3DFMT_UNKNOWN;
460 }
461 }
462 else
463 {
464 /* Luminance-only */
465 switch(DDPixelFormat->u1.dwLuminanceBitCount)
466 {
467 case 6:
468 FIXME("A luminance Pixelformat shouldn't have 6 luminance bits. Returning D3DFMT_L6V5U5 for now.\n");
470
471 case 8:
472 return WINED3DFMT_L8_UNORM;
473
474 default:
475 WARN("Unknown luminance-only bit depth 0x%x.\n", DDPixelFormat->u1.dwLuminanceBitCount);
476 return WINED3DFMT_UNKNOWN;
477 }
478 }
479 }
480 else if(DDPixelFormat->dwFlags & DDPF_ZBUFFER)
481 {
482 /* Z buffer */
483 if(DDPixelFormat->dwFlags & DDPF_STENCILBUFFER)
484 {
485 switch(DDPixelFormat->u1.dwZBufferBitDepth)
486 {
487 case 16:
488 if (DDPixelFormat->u2.dwStencilBitDepth == 1) return WINED3DFMT_S1_UINT_D15_UNORM;
489 WARN("Unknown depth stencil format: 16 z bits, %u stencil bits.\n",
490 DDPixelFormat->u2.dwStencilBitDepth);
491 return WINED3DFMT_UNKNOWN;
492
493 case 32:
494 if (DDPixelFormat->u2.dwStencilBitDepth == 8) return WINED3DFMT_D24_UNORM_S8_UINT;
495 else if (DDPixelFormat->u2.dwStencilBitDepth == 4) return WINED3DFMT_S4X4_UINT_D24_UNORM;
496 WARN("Unknown depth stencil format: 32 z bits, %u stencil bits.\n",
497 DDPixelFormat->u2.dwStencilBitDepth);
498 return WINED3DFMT_UNKNOWN;
499
500 default:
501 WARN("Unknown depth stencil format: %u z bits, %u stencil bits.\n",
502 DDPixelFormat->u1.dwZBufferBitDepth, DDPixelFormat->u2.dwStencilBitDepth);
503 return WINED3DFMT_UNKNOWN;
504 }
505 }
506 else
507 {
508 switch(DDPixelFormat->u1.dwZBufferBitDepth)
509 {
510 case 16:
512
513 case 24:
515
516 case 32:
517 if (DDPixelFormat->u3.dwZBitMask == 0x00FFFFFF) return WINED3DFMT_X8D24_UNORM;
518 else if (DDPixelFormat->u3.dwZBitMask == 0xFFFFFF00) return WINED3DFMT_X8D24_UNORM;
519 else if (DDPixelFormat->u3.dwZBitMask == 0xFFFFFFFF) return WINED3DFMT_D32_UNORM;
520 WARN("Unknown depth-only format: 32 z bits, mask 0x%08x\n",
521 DDPixelFormat->u3.dwZBitMask);
522 return WINED3DFMT_UNKNOWN;
523
524 default:
525 WARN("Unknown depth-only format: %u z bits, mask 0x%08x\n",
526 DDPixelFormat->u1.dwZBufferBitDepth, DDPixelFormat->u3.dwZBitMask);
527 return WINED3DFMT_UNKNOWN;
528 }
529 }
530 }
531 else if(DDPixelFormat->dwFlags & DDPF_FOURCC)
532 {
533 return DDPixelFormat->dwFourCC;
534 }
535 else if(DDPixelFormat->dwFlags & DDPF_BUMPDUDV)
536 {
537 if( (DDPixelFormat->u1.dwBumpBitCount == 16 ) &&
538 (DDPixelFormat->u2.dwBumpDuBitMask == 0x000000ff) &&
539 (DDPixelFormat->u3.dwBumpDvBitMask == 0x0000ff00) &&
540 (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x00000000) )
541 {
543 }
544 else if ( (DDPixelFormat->u1.dwBumpBitCount == 16 ) &&
545 (DDPixelFormat->u2.dwBumpDuBitMask == 0x0000001f) &&
546 (DDPixelFormat->u3.dwBumpDvBitMask == 0x000003e0) &&
547 (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x0000fc00) )
548 {
550 }
551 else if ( (DDPixelFormat->u1.dwBumpBitCount == 32 ) &&
552 (DDPixelFormat->u2.dwBumpDuBitMask == 0x000000ff) &&
553 (DDPixelFormat->u3.dwBumpDvBitMask == 0x0000ff00) &&
554 (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x00ff0000) )
555 {
557 }
558 }
559
560 WARN("Unknown Pixelformat.\n");
561 return WINED3DFMT_UNKNOWN;
562}
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:107

Referenced by ddraw_surface7_SetSurfaceDesc(), and ddraw_surface_create().

◆ wined3dmapflags_from_ddrawmapflags()

unsigned int wined3dmapflags_from_ddrawmapflags ( unsigned int  flags)

Definition at line 564 of file utils.c.

565{
566 static const unsigned int handled = DDLOCK_NOSYSLOCK
570 unsigned int wined3d_flags;
571
572 wined3d_flags = flags & handled;
574 wined3d_flags |= WINED3D_MAP_READ;
575 if (!(flags & DDLOCK_READONLY))
576 wined3d_flags |= WINED3D_MAP_WRITE;
577 if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
578 wined3d_flags |= WINED3D_MAP_READ | WINED3D_MAP_WRITE;
580 wined3d_flags |= WINED3D_MAP_NO_DIRTY_UPDATE;
582
583 if (flags)
584 FIXME("Unhandled flags %#x.\n", flags);
585
586 return wined3d_flags;
587}
#define DDLOCK_READONLY
Definition: ddraw.h:624
#define DDLOCK_WRITEONLY
Definition: ddraw.h:625
#define DDLOCK_NODIRTYUPDATE
Definition: ddraw.h:632
#define DDLOCK_DONOTWAIT
Definition: ddraw.h:630
#define DDLOCK_DISCARDCONTENTS
Definition: ddraw.h:628
#define DDLOCK_NOOVERWRITE
Definition: ddraw.h:627
#define DDLOCK_NOSYSLOCK
Definition: ddraw.h:626
#define DDLOCK_WAIT
Definition: ddraw.h:622
#define WINED3D_MAP_NO_DIRTY_UPDATE
Definition: wined3d.h:937
#define WINED3D_MAP_READ
Definition: wined3d.h:939
#define WINED3D_MAP_WRITE
Definition: wined3d.h:938

Referenced by d3d_vertex_buffer7_Lock(), and surface_lock().