diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index baa3219ae47..da803a3a5f7 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1156,7 +1156,7 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW surface_desc->dwWidth, surface_desc->dwHeight, mode.format_id, WINED3D_MULTISAMPLE_NONE, 0))) ERR("Failed to resize buffers, hr %#lx.\n", hr); else - ddrawformat_from_wined3dformat(&ddraw->primary->surface_desc.u4.ddpfPixelFormat, mode.format_id); + ddrawformat_from_wined3dformat(&ddraw->primary->surface_desc.ddpfPixelFormat, mode.format_id); } ddraw->flags |= DDRAW_RESTORE_MODE; @@ -1675,10 +1675,10 @@ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2 DDSD->dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_PITCH | DDSD_REFRESHRATE; DDSD->dwWidth = mode.width; DDSD->dwHeight = mode.height; - DDSD->u2.dwRefreshRate = mode.refresh_rate; - DDSD->u4.ddpfPixelFormat.dwSize = sizeof(DDSD->u4.ddpfPixelFormat); - ddrawformat_from_wined3dformat(&DDSD->u4.ddpfPixelFormat, mode.format_id); - DDSD->u1.lPitch = mode.width * DDSD->u4.ddpfPixelFormat.u1.dwRGBBitCount / 8; + DDSD->dwRefreshRate = mode.refresh_rate; + DDSD->ddpfPixelFormat.dwSize = sizeof(DDSD->ddpfPixelFormat); + ddrawformat_from_wined3dformat(&DDSD->ddpfPixelFormat, mode.format_id); + DDSD->lPitch = mode.width * DDSD->ddpfPixelFormat.dwRGBBitCount / 8; if(TRACE_ON(ddraw)) { @@ -2463,10 +2463,10 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, continue; if (DDSD->dwFlags & DDSD_HEIGHT && mode.height != DDSD->dwHeight) continue; - if (DDSD->dwFlags & DDSD_REFRESHRATE && mode.refresh_rate != DDSD->u2.dwRefreshRate) + if (DDSD->dwFlags & DDSD_REFRESHRATE && mode.refresh_rate != DDSD->dwRefreshRate) continue; if (DDSD->dwFlags & DDSD_PIXELFORMAT - && pixelformat.u1.dwRGBBitCount != DDSD->u4.ddpfPixelFormat.u1.dwRGBBitCount) + && pixelformat.dwRGBBitCount != DDSD->ddpfPixelFormat.dwRGBBitCount) continue; } @@ -2485,23 +2485,23 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, memset(&callback_sd, 0, sizeof(callback_sd)); callback_sd.dwSize = sizeof(callback_sd); - callback_sd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + callback_sd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); callback_sd.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH|DDSD_REFRESHRATE; if (Flags & DDEDM_REFRESHRATES) - callback_sd.u2.dwRefreshRate = mode.refresh_rate; + callback_sd.dwRefreshRate = mode.refresh_rate; callback_sd.dwWidth = mode.width; callback_sd.dwHeight = mode.height; - callback_sd.u4.ddpfPixelFormat=pixelformat; + callback_sd.ddpfPixelFormat=pixelformat; /* Calc pitch and DWORD align like MSDN says */ - callback_sd.u1.lPitch = (callback_sd.u4.ddpfPixelFormat.u1.dwRGBBitCount / 8) * mode.width; - callback_sd.u1.lPitch = (callback_sd.u1.lPitch + 3) & ~3; + callback_sd.lPitch = (callback_sd.ddpfPixelFormat.dwRGBBitCount / 8) * mode.width; + callback_sd.lPitch = (callback_sd.lPitch + 3) & ~3; - TRACE("Enumerating %lux%lux%lu @%lu\n", callback_sd.dwWidth, callback_sd.dwHeight, callback_sd.u4.ddpfPixelFormat.u1.dwRGBBitCount, - callback_sd.u2.dwRefreshRate); + TRACE("Enumerating %lux%lux%lu @%lu\n", callback_sd.dwWidth, callback_sd.dwHeight, callback_sd.ddpfPixelFormat.dwRGBBitCount, + callback_sd.dwRefreshRate); if(cb(&callback_sd, Context) == DDENUMRET_CANCEL) { @@ -3096,26 +3096,26 @@ Main_DirectDraw_DDPIXELFORMAT_Match(const DDPIXELFORMAT *requested, if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_ZBUFFER|DDPF_ALPHA |DDPF_LUMINANCE|DDPF_BUMPDUDV)) - if (requested->u1.dwRGBBitCount != provided->u1.dwRGBBitCount) + if (requested->dwRGBBitCount != provided->dwRGBBitCount) return FALSE; if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_STENCILBUFFER |DDPF_LUMINANCE|DDPF_BUMPDUDV)) - if (requested->u2.dwRBitMask != provided->u2.dwRBitMask) + if (requested->dwRBitMask != provided->dwRBitMask) return FALSE; if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_ZBUFFER|DDPF_BUMPDUDV)) - if (requested->u3.dwGBitMask != provided->u3.dwGBitMask) + if (requested->dwGBitMask != provided->dwGBitMask) return FALSE; /* I could be wrong about the bumpmapping. MSDN docs are vague. */ if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_STENCILBUFFER |DDPF_BUMPDUDV)) - if (requested->u4.dwBBitMask != provided->u4.dwBBitMask) + if (requested->dwBBitMask != provided->dwBBitMask) return FALSE; if (requested->dwFlags & (DDPF_ALPHAPIXELS|DDPF_ZPIXELS)) - if (requested->u5.dwRGBAlphaBitMask != provided->u5.dwRGBAlphaBitMask) + if (requested->dwRGBAlphaBitMask != provided->dwRGBAlphaBitMask) return FALSE; return TRUE; @@ -3137,19 +3137,19 @@ static BOOL ddraw_match_surface_desc(const DDSURFACEDESC2 *requested, const DDSU static const struct compare_info compare[] = { CMP(ALPHABITDEPTH, dwAlphaBitDepth), - CMP(BACKBUFFERCOUNT, u5.dwBackBufferCount), + CMP(BACKBUFFERCOUNT, dwBackBufferCount), CMP(CAPS, ddsCaps), CMP(CKDESTBLT, ddckCKDestBlt), - CMP(CKDESTOVERLAY, u3 /* ddckCKDestOverlay */), + CMP(CKDESTOVERLAY, ddckCKDestOverlay), CMP(CKSRCBLT, ddckCKSrcBlt), CMP(CKSRCOVERLAY, ddckCKSrcOverlay), CMP(HEIGHT, dwHeight), - CMP(LINEARSIZE, u1 /* dwLinearSize */), + CMP(LINEARSIZE, dwLinearSize), CMP(LPSURFACE, lpSurface), - CMP(MIPMAPCOUNT, u2 /* dwMipMapCount */), - CMP(PITCH, u1 /* lPitch */), + CMP(MIPMAPCOUNT, dwMipMapCount), + CMP(PITCH, lPitch), /* PIXELFORMAT: manual */ - CMP(REFRESHRATE, u2 /* dwRefreshRate */), + CMP(REFRESHRATE, dwRefreshRate), CMP(TEXTURESTAGE, dwTextureStage), CMP(WIDTH, dwWidth), /* ZBUFFERBITDEPTH: "obsolete" */ @@ -3173,8 +3173,8 @@ static BOOL ddraw_match_surface_desc(const DDSURFACEDESC2 *requested, const DDSU if (requested->dwFlags & DDSD_PIXELFORMAT) { - if (!Main_DirectDraw_DDPIXELFORMAT_Match(&requested->u4.ddpfPixelFormat, - &provided->u4.ddpfPixelFormat)) + if (!Main_DirectDraw_DDPIXELFORMAT_Match(&requested->ddpfPixelFormat, + &provided->ddpfPixelFormat)) return FALSE; } @@ -3242,8 +3242,8 @@ static HRESULT CALLBACK enum_surface_mode_callback(DDSURFACEDESC2 *surface_desc, desc.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT; desc.dwWidth = surface_desc->dwWidth; desc.dwHeight = surface_desc->dwHeight; - desc.u1.lPitch = surface_desc->u1.lPitch; - desc.u4.ddpfPixelFormat = surface_desc->u4.ddpfPixelFormat; + desc.lPitch = surface_desc->lPitch; + desc.ddpfPixelFormat = surface_desc->ddpfPixelFormat; if (SUCCEEDED(ddraw7_CreateSurface(params->ddraw, &desc, &surface, NULL))) { @@ -3308,7 +3308,7 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD flags, { .dwSize = sizeof(desc), .dwFlags = DDSD_PIXELFORMAT, - .u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), }; struct enum_surface_mode_params params = { @@ -3326,7 +3326,7 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD flags, return hr_ddraw_from_wined3d(hr); } - ddrawformat_from_wined3dformat(&desc.u4.ddpfPixelFormat, mode.format_id); + ddrawformat_from_wined3dformat(&desc.ddpfPixelFormat, mode.format_id); hr = ddraw7_EnumDisplayModes(iface, 0, &desc, ¶ms, enum_surface_mode_callback); } diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index a3f309f89f0..e7681fa9b11 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -24,8 +24,6 @@ #include #include #define COBJMACROS -#define NONAMELESSSTRUCT -#define NONAMELESSUNION #include "wine/debug.h" #include "wine/heap.h" diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 1cfef5007d5..80556e96787 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -1840,7 +1840,7 @@ static HRESULT WINAPI d3d_device2_GetCurrentViewport(IDirect3DDevice2 *iface, ID static BOOL validate_surface_palette(struct ddraw_surface *surface) { - return !format_is_paletteindexed(&surface->surface_desc.u4.ddpfPixelFormat) + return !format_is_paletteindexed(&surface->surface_desc.ddpfPixelFormat) || surface->palette; } @@ -2712,7 +2712,7 @@ static void fixup_texture_alpha_op(struct d3d_device *device) wined3d_resource_get_desc(wined3d_texture_get_resource(tex), &desc); ddfmt.dwSize = sizeof(ddfmt); ddrawformat_from_wined3dformat(&ddfmt, desc.format); - if (!ddfmt.u5.dwRGBAlphaBitMask) + if (!ddfmt.dwRGBAlphaBitMask) tex_alpha = FALSE; } @@ -4375,7 +4375,7 @@ static DWORD in_plane(UINT idx, struct wined3d_vec4 p, D3DVECTOR center, D3DVALU float distance, norm; norm = sqrtf(p.x * p.x + p.y * p.y + p.z * p.z); - distance = (p.x * center.u1.x + p.y * center.u2.y + p.z * center.u3.z + p.w) / norm; + distance = (p.x * center.x + p.y * center.y + p.z * center.z + p.w) / norm; if (equality) { diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c index 2f4c121789d..13e639eda3f 100644 --- a/dlls/ddraw/executebuffer.c +++ b/dlls/ddraw/executebuffer.c @@ -147,7 +147,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d for (i = 0; i < count; ++i) { D3DTRIANGLE *ci = (D3DTRIANGLE *)instr; - TRACE(" v1: %d v2: %d v3: %d\n",ci->u1.v1, ci->u2.v2, ci->u3.v3); + TRACE(" v1: %d v2: %d v3: %d\n",ci->v1, ci->v2, ci->v3); TRACE(" Flags : "); if (TRACE_ON(ddraw)) { @@ -173,11 +173,11 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d switch (primitive_size) { case 3: - indices[(i * primitive_size) + 2] = ci->u3.v3; + indices[(i * primitive_size) + 2] = ci->v3; /* Drop through. */ case 2: - indices[(i * primitive_size) + 1] = ci->u2.v2; - indices[(i * primitive_size) ] = ci->u1.v1; + indices[(i * primitive_size) + 1] = ci->v2; + indices[(i * primitive_size) ] = ci->v1; } instr += size; } @@ -235,21 +235,21 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d D3DSTATE *ci = (D3DSTATE *)instr; D3DMATRIX *m; - m = ddraw_get_object(&device->handle_table, ci->u2.dwArg[0] - 1, DDRAW_HANDLE_MATRIX); + m = ddraw_get_object(&device->handle_table, ci->dwArg[0] - 1, DDRAW_HANDLE_MATRIX); if (!m) { - ERR("Invalid matrix handle %#lx.\n", ci->u2.dwArg[0]); + ERR("Invalid matrix handle %#lx.\n", ci->dwArg[0]); } else { - if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_WORLD) - device->world = ci->u2.dwArg[0]; - if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_VIEW) - device->view = ci->u2.dwArg[0]; - if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_PROJECTION) - device->proj = ci->u2.dwArg[0]; + if (ci->dtstTransformStateType == D3DTRANSFORMSTATE_WORLD) + device->world = ci->dwArg[0]; + if (ci->dtstTransformStateType == D3DTRANSFORMSTATE_VIEW) + device->view = ci->dwArg[0]; + if (ci->dtstTransformStateType == D3DTRANSFORMSTATE_PROJECTION) + device->proj = ci->dwArg[0]; IDirect3DDevice3_SetTransform(&device->IDirect3DDevice3_iface, - ci->u1.dtstTransformStateType, m); + ci->dtstTransformStateType, m); } instr += size; @@ -263,7 +263,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d D3DSTATE *ci = (D3DSTATE *)instr; if (FAILED(IDirect3DDevice3_SetLightState(&device->IDirect3DDevice3_iface, - ci->u1.dlstLightStateType, ci->u2.dwArg[0]))) + ci->dlstLightStateType, ci->dwArg[0]))) WARN("Failed to set light state.\n"); instr += size; @@ -277,7 +277,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d D3DSTATE *ci = (D3DSTATE *)instr; if (FAILED(IDirect3DDevice3_SetRenderState(&device->IDirect3DDevice3_iface, - ci->u1.drstRenderStateType, ci->u2.dwArg[0]))) + ci->drstRenderStateType, ci->dwArg[0]))) WARN("Failed to set render state.\n"); instr += size; diff --git a/dlls/ddraw/material.c b/dlls/ddraw/material.c index 5bf2fcc7f9b..15eb46f9869 100644 --- a/dlls/ddraw/material.c +++ b/dlls/ddraw/material.c @@ -447,11 +447,11 @@ void material_activate(struct d3d_material *material) TRACE("Activating material %p.\n", material); - d3d7mat.u.diffuse = material->mat.u.diffuse; - d3d7mat.u1.ambient = material->mat.u1.ambient; - d3d7mat.u2.specular = material->mat.u2.specular; - d3d7mat.u3.emissive = material->mat.u3.emissive; - d3d7mat.u4.power = material->mat.u4.power; + d3d7mat.diffuse = material->mat.diffuse; + d3d7mat.ambient = material->mat.ambient; + d3d7mat.specular = material->mat.specular; + d3d7mat.emissive = material->mat.emissive; + d3d7mat.power = material->mat.power; IDirect3DDevice7_SetMaterial(&material->active_device->IDirect3DDevice7_iface, &d3d7mat); } diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 437f97f7491..33f38949c15 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -534,7 +534,7 @@ static HRESULT ddraw_surface_set_palette(struct ddraw_surface *surface, IDirectD return DDERR_INVALIDSURFACETYPE; } - if (!format_is_paletteindexed(&surface->surface_desc.u4.ddpfPixelFormat)) + if (!format_is_paletteindexed(&surface->surface_desc.ddpfPixelFormat)) return DDERR_INVALIDPIXELFORMAT; wined3d_mutex_lock(); @@ -842,7 +842,7 @@ static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *ifa our_caps.dwCaps = caps->dwCaps; our_caps.dwCaps2 = 0; our_caps.dwCaps3 = 0; - our_caps.u1.dwCaps4 = 0; + our_caps.dwCaps4 = 0; } else { @@ -850,7 +850,7 @@ static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *ifa } TRACE("head_surface %p, looking for caps %#lx, %#lx, %#lx, %#lx.\n", head_surface, our_caps.dwCaps, - our_caps.dwCaps2, our_caps.dwCaps3, our_caps.u1.dwCaps4); /* FIXME: Better debugging */ + our_caps.dwCaps2, our_caps.dwCaps3, our_caps.dwCaps4); /* FIXME: Better debugging */ for(i = 0; i < MAX_COMPLEX_ATTACHED; i++) { @@ -861,7 +861,7 @@ static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *ifa surf->surface_desc.ddsCaps.dwCaps, surf->surface_desc.ddsCaps.dwCaps2, surf->surface_desc.ddsCaps.dwCaps3, - surf->surface_desc.ddsCaps.u1.dwCaps4); + surf->surface_desc.ddsCaps.dwCaps4); if (((surf->surface_desc.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) && ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) { @@ -890,7 +890,7 @@ static HRESULT WINAPI ddraw_surface7_GetAttachedSurface(IDirectDrawSurface7 *ifa surf->surface_desc.ddsCaps.dwCaps, surf->surface_desc.ddsCaps.dwCaps2, surf->surface_desc.ddsCaps.dwCaps3, - surf->surface_desc.ddsCaps.u1.dwCaps4); + surf->surface_desc.ddsCaps.dwCaps4); if (((surf->surface_desc.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) && ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2)) { @@ -950,7 +950,7 @@ static HRESULT WINAPI ddraw_surface3_GetAttachedSurface(IDirectDrawSurface3 *ifa caps2.dwCaps = caps->dwCaps; caps2.dwCaps2 = 0; caps2.dwCaps3 = 0; - caps2.u1.dwCaps4 = 0; + caps2.dwCaps4 = 0; hr = ddraw_surface7_GetAttachedSurface(&surface->IDirectDrawSurface7_iface, &caps2, &attachment7); @@ -981,7 +981,7 @@ static HRESULT WINAPI ddraw_surface2_GetAttachedSurface(IDirectDrawSurface2 *ifa caps2.dwCaps = caps->dwCaps; caps2.dwCaps2 = 0; caps2.dwCaps3 = 0; - caps2.u1.dwCaps4 = 0; + caps2.dwCaps4 = 0; hr = ddraw_surface7_GetAttachedSurface(&surface->IDirectDrawSurface7_iface, &caps2, &attachment7); @@ -1012,7 +1012,7 @@ static HRESULT WINAPI ddraw_surface1_GetAttachedSurface(IDirectDrawSurface *ifac caps2.dwCaps = caps->dwCaps; caps2.dwCaps2 = 0; caps2.dwCaps3 = 0; - caps2.u1.dwCaps4 = 0; + caps2.dwCaps4 = 0; hr = ddraw_surface7_GetAttachedSurface(&surface->IDirectDrawSurface7_iface, &caps2, &attachment7); @@ -1546,7 +1546,7 @@ static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT * if (!(flags & DDBLT_ASYNC)) wined3d_flags |= WINED3DCLEAR_SYNCHRONOUS; - if (!wined3d_colour_from_ddraw_colour(&dst_surface->surface_desc.u4.ddpfPixelFormat, + if (!wined3d_colour_from_ddraw_colour(&dst_surface->surface_desc.ddpfPixelFormat, dst_surface->palette, fill_colour, &colour)) return DDERR_INVALIDPARAMS; @@ -1563,7 +1563,7 @@ static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT * if (!(flags & DDBLT_ASYNC)) wined3d_flags |= WINED3DCLEAR_SYNCHRONOUS; - if (!wined3d_colour_from_ddraw_colour(&dst_surface->surface_desc.u4.ddpfPixelFormat, + if (!wined3d_colour_from_ddraw_colour(&dst_surface->surface_desc.ddpfPixelFormat, dst_surface->palette, fill_colour, &colour)) return DDERR_INVALIDPARAMS; @@ -1755,7 +1755,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Blt(IDirectDrawSurface *i { FIXME("DDBLT_DDROPS not implemented.\n"); if (fx) - FIXME(" rop %#lx, pattern %p.\n", fx->dwDDROP, fx->u5.lpDDSPattern); + FIXME(" rop %#lx, pattern %p.\n", fx->dwDDROP, fx->lpDDSPattern); return DDERR_NORASTEROPHW; } @@ -1828,9 +1828,9 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Blt(IDirectDrawSurface *i rop_fx = *fx; if (fx->dwROP == WHITENESS) - rop_fx.u5.dwFillColor = 0xffffffff; + rop_fx.dwFillColor = 0xffffffff; else - rop_fx.u5.dwFillColor = 0; + rop_fx.dwFillColor = 0; if (dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) flags |= DDBLT_DEPTHFILL; @@ -1870,7 +1870,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Blt(IDirectDrawSurface *i if (fx) { wined3d_fx.fx = fx->dwDDFX; - fill_colour = fx->u5.dwFillColor; + fill_colour = fx->dwFillColor; wined3d_fx.dst_color_key.color_space_low_value = fx->ddckDestColorkey.dwColorSpaceLowValue; wined3d_fx.dst_color_key.color_space_high_value = fx->ddckDestColorkey.dwColorSpaceHighValue; wined3d_fx.src_color_key.color_space_low_value = fx->ddckSrcColorkey.dwColorSpaceLowValue; @@ -2364,7 +2364,7 @@ static HRESULT WINAPI ddraw_surface7_GetDC(IDirectDrawSurface7 *iface, HDC *dc) { surface->dc = *dc; - if (format_is_paletteindexed(&surface->surface_desc.u4.ddpfPixelFormat)) + if (format_is_paletteindexed(&surface->surface_desc.ddpfPixelFormat)) { const struct ddraw_palette *palette; @@ -3296,7 +3296,7 @@ static HRESULT WINAPI ddraw_surface7_GetColorKey(IDirectDrawSurface7 *iface, DWO wined3d_mutex_unlock(); return DDERR_NOCOLORKEY; } - *CKey = This->surface_desc.u3.ddckCKDestOverlay; + *CKey = This->surface_desc.ddckCKDestOverlay; break; case DDCKEY_SRCBLT: @@ -3513,7 +3513,7 @@ static HRESULT WINAPI ddraw_surface7_GetPixelFormat(IDirectDrawSurface7 *iface, return DDERR_INVALIDPARAMS; wined3d_mutex_lock(); - DD_STRUCT_COPY_BYSIZE(PixelFormat, &surface->surface_desc.u4.ddpfPixelFormat); + DD_STRUCT_COPY_BYSIZE(PixelFormat, &surface->surface_desc.ddpfPixelFormat); wined3d_mutex_unlock(); return DD_OK; @@ -4684,7 +4684,7 @@ static void ddraw_surface_sync_color_keys(struct ddraw_surface *surface) if (desc->dwFlags & DDSD_CKDESTOVERLAY) ddraw_surface_set_wined3d_textures_colour_key(surface, DDCKEY_DESTOVERLAY, - (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay); + (struct wined3d_color_key *)&desc->ddckCKDestOverlay); if (desc->dwFlags & DDSD_CKDESTBLT) ddraw_surface_set_wined3d_textures_colour_key(surface, DDCKEY_DESTBLT, (struct wined3d_color_key *)&desc->ddckCKDestBlt); @@ -4747,17 +4747,17 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, WARN("DDSD_WIDTH is set, but DDSD_PITCH is not, returning DDERR_INVALIDPARAMS.\n"); return DDERR_INVALIDPARAMS; } - if (!DDSD->dwWidth || DDSD->u1.lPitch <= 0 || DDSD->u1.lPitch & 0x3) + if (!DDSD->dwWidth || DDSD->lPitch <= 0 || DDSD->lPitch & 0x3) { WARN("Pitch is %ld, width is %lu, returning DDERR_INVALIDPARAMS.\n", - DDSD->u1.lPitch, DDSD->dwWidth); + DDSD->lPitch, DDSD->dwWidth); return DDERR_INVALIDPARAMS; } if (DDSD->dwWidth != surface->surface_desc.dwWidth) TRACE("Surface width changed from %lu to %lu.\n", surface->surface_desc.dwWidth, DDSD->dwWidth); - if (DDSD->u1.lPitch != surface->surface_desc.u1.lPitch) - TRACE("Surface pitch changed from %lu to %lu.\n", surface->surface_desc.u1.lPitch, DDSD->u1.lPitch); - pitch = DDSD->u1.lPitch; + if (DDSD->lPitch != surface->surface_desc.lPitch) + TRACE("Surface pitch changed from %lu to %lu.\n", surface->surface_desc.lPitch, DDSD->lPitch); + pitch = DDSD->lPitch; width = DDSD->dwWidth; } else if (DDSD->dwFlags & DDSD_PITCH) @@ -4767,7 +4767,7 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, } else { - pitch = surface->surface_desc.u1.lPitch; + pitch = surface->surface_desc.lPitch; width = surface->surface_desc.dwWidth; } @@ -4790,7 +4790,7 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, wined3d_mutex_lock(); if (DDSD->dwFlags & DDSD_PIXELFORMAT) { - format_id = wined3dformat_from_ddrawformat(&DDSD->u4.ddpfPixelFormat); + format_id = wined3dformat_from_ddrawformat(&DDSD->ddpfPixelFormat); if (format_id == WINED3DFMT_UNKNOWN) { @@ -4798,13 +4798,13 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, wined3d_mutex_unlock(); return DDERR_INVALIDPARAMS; } - current_format_id = wined3dformat_from_ddrawformat(&surface->surface_desc.u4.ddpfPixelFormat); + current_format_id = wined3dformat_from_ddrawformat(&surface->surface_desc.ddpfPixelFormat); if (format_id != current_format_id) TRACE("Surface format changed from %#x to %#x.\n", current_format_id, format_id); } else { - current_format_id = format_id = wined3dformat_from_ddrawformat(&surface->surface_desc.u4.ddpfPixelFormat); + current_format_id = format_id = wined3dformat_from_ddrawformat(&surface->surface_desc.ddpfPixelFormat); } if (width == surface->surface_desc.dwWidth && height == surface->surface_desc.dwHeight @@ -4953,11 +4953,11 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, if (DDSD->dwFlags & DDSD_WIDTH) surface->surface_desc.dwWidth = width; if (DDSD->dwFlags & DDSD_PITCH) - surface->surface_desc.u1.lPitch = DDSD->u1.lPitch; + surface->surface_desc.lPitch = DDSD->lPitch; if (DDSD->dwFlags & DDSD_HEIGHT) surface->surface_desc.dwHeight = height; if (DDSD->dwFlags & DDSD_PIXELFORMAT) - surface->surface_desc.u4.ddpfPixelFormat = DDSD->u4.ddpfPixelFormat; + surface->surface_desc.ddpfPixelFormat = DDSD->ddpfPixelFormat; wined3d_mutex_unlock(); @@ -5084,7 +5084,7 @@ static HRESULT ddraw_surface_set_color_key(struct ddraw_surface *surface, DWORD break; case DDCKEY_DESTOVERLAY: - surface->surface_desc.u3.ddckCKDestOverlay = fixed_color_key; + surface->surface_desc.ddckCKDestOverlay = fixed_color_key; surface->surface_desc.dwFlags |= DDSD_CKDESTOVERLAY; break; @@ -5512,7 +5512,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu if (((src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) != (dst_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP)) - || (src_surface->surface_desc.u2.dwMipMapCount != dst_surface->surface_desc.u2.dwMipMapCount)) + || (src_surface->surface_desc.dwMipMapCount != dst_surface->surface_desc.dwMipMapCount)) { ERR("Trying to load surfaces with different mip-map counts.\n"); } @@ -5550,7 +5550,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu if ((src_desc->dwWidth != dst_desc->dwWidth) || (src_desc->dwHeight != dst_desc->dwHeight)) { - /* Should also check for same pixel format, u1.lPitch, ... */ + /* Should also check for same pixel format, lPitch, ... */ ERR("Error in surface sizes.\n"); wined3d_mutex_unlock(); return D3DERR_TEXTURE_LOAD_FAILED; @@ -5584,8 +5584,8 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu return D3DERR_TEXTURE_LOAD_FAILED; } - if (dst_surface->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) - memcpy(dst_map_desc.data, src_map_desc.data, src_surface->surface_desc.u1.dwLinearSize); + if (dst_surface->surface_desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC) + memcpy(dst_map_desc.data, src_map_desc.data, src_surface->surface_desc.dwLinearSize); else memcpy(dst_map_desc.data, src_map_desc.data, src_map_desc.row_pitch * src_desc->dwHeight); @@ -6171,7 +6171,7 @@ static void wined3d_resource_desc_from_ddraw(struct ddraw *ddraw, const DWORD caps2 = desc->ddsCaps.dwCaps2; wined3d_desc->resource_type = WINED3D_RTYPE_TEXTURE_2D; - wined3d_desc->format = wined3dformat_from_ddrawformat(&desc->u4.ddpfPixelFormat); + wined3d_desc->format = wined3dformat_from_ddrawformat(&desc->ddpfPixelFormat); wined3d_desc->multisample_type = WINED3D_MULTISAMPLE_NONE; wined3d_desc->multisample_quality = 0; wined3d_desc->usage = WINED3DUSAGE_VIDMEM_ACCOUNTING; @@ -6261,26 +6261,26 @@ static HRESULT ddraw_texture_init(struct ddraw_texture *texture, struct ddraw *d /* Validate the pitch. */ if (desc->dwFlags & DDSD_LPSURFACE) { - if (format_is_compressed(&desc->u4.ddpfPixelFormat)) + if (format_is_compressed(&desc->ddpfPixelFormat)) { if ((desc->dwFlags & DDSD_LINEARSIZE) - && desc->u1.dwLinearSize < wined3d_calculate_format_pitch(ddraw->wined3d_adapter, + && desc->dwLinearSize < wined3d_calculate_format_pitch(ddraw->wined3d_adapter, wined3d_desc.format, wined3d_desc.width) * ((wined3d_desc.height + 3) / 4)) { - WARN("Invalid linear size %lu specified.\n", desc->u1.dwLinearSize); + WARN("Invalid linear size %lu specified.\n", desc->dwLinearSize); return DDERR_INVALIDPARAMS; } } else { - if (desc->u1.lPitch < wined3d_calculate_format_pitch(ddraw->wined3d_adapter, - wined3d_desc.format, wined3d_desc.width) || desc->u1.lPitch & 3) + if (desc->lPitch < wined3d_calculate_format_pitch(ddraw->wined3d_adapter, + wined3d_desc.format, wined3d_desc.width) || desc->lPitch & 3) { - WARN("Invalid pitch %lu specified.\n", desc->u1.lPitch); + WARN("Invalid pitch %lu specified.\n", desc->lPitch); return DDERR_INVALIDPARAMS; } - pitch = desc->u1.lPitch; + pitch = desc->lPitch; } } @@ -6380,19 +6380,19 @@ static HRESULT ddraw_texture_init(struct ddraw_texture *texture, struct ddraw *d *mip_desc = *desc; wined3d_texture_get_pitch(wined3d_texture, j, &row_pitch, &slice_pitch); - if (format_is_compressed(&desc->u4.ddpfPixelFormat)) + if (format_is_compressed(&desc->ddpfPixelFormat)) { if (desc->dwFlags & DDSD_LPSURFACE) - mip_desc->u1.dwLinearSize = ~0u; + mip_desc->dwLinearSize = ~0u; else - mip_desc->u1.dwLinearSize = slice_pitch; + mip_desc->dwLinearSize = slice_pitch; mip_desc->dwFlags |= DDSD_LINEARSIZE; mip_desc->dwFlags &= ~DDSD_PITCH; } else { if (!(desc->dwFlags & DDSD_LPSURFACE)) - mip_desc->u1.lPitch = row_pitch; + mip_desc->lPitch = row_pitch; mip_desc->dwFlags |= DDSD_PITCH; mip_desc->dwFlags &= ~DDSD_LINEARSIZE; } @@ -6401,7 +6401,7 @@ static HRESULT ddraw_texture_init(struct ddraw_texture *texture, struct ddraw *d mip_desc->lpSurface = NULL; if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP) - mip_desc->u2.dwMipMapCount = levels - j; + mip_desc->dwMipMapCount = levels - j; if (j) { @@ -6559,7 +6559,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP) { - if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount) + if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->dwBackBufferCount) { WARN("Tried to create a flippable surface without any back buffers.\n"); heap_free(texture); @@ -6698,7 +6698,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (!(desc->dwFlags & DDSD_PIXELFORMAT)) { desc->dwFlags |= DDSD_PIXELFORMAT; - desc->u4.ddpfPixelFormat = wined3d_display_mode_format; + desc->ddpfPixelFormat = wined3d_display_mode_format; } /* No width or no height? Use the screen size. */ @@ -6775,7 +6775,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (desc->dwFlags & DDSD_MIPMAPCOUNT) { /* Mipmap count is given, should not be 0. */ - if (!desc->u2.dwMipMapCount) + if (!desc->dwMipMapCount) { heap_free(texture); return DDERR_INVALIDPARAMS; @@ -6786,18 +6786,18 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ /* Undocumented feature: Create sublevels until either the * width or the height is 1. */ if (version == 7) - desc->u2.dwMipMapCount = wined3d_log2i(max(desc->dwWidth, desc->dwHeight)) + 1; + desc->dwMipMapCount = wined3d_log2i(max(desc->dwWidth, desc->dwHeight)) + 1; else - desc->u2.dwMipMapCount = wined3d_log2i(min(desc->dwWidth, desc->dwHeight)) + 1; + desc->dwMipMapCount = wined3d_log2i(min(desc->dwWidth, desc->dwHeight)) + 1; } } else { - desc->u2.dwMipMapCount = 1; + desc->dwMipMapCount = 1; } desc->dwFlags |= DDSD_MIPMAPCOUNT; - levels = desc->u2.dwMipMapCount; + levels = desc->dwMipMapCount; } else { @@ -6828,7 +6828,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (!(ddraw->flags & DDRAW_NO3D) && SUCCEEDED(hr = wined3d_check_device_format(ddraw->wined3d, ddraw->wined3d_adapter, WINED3D_DEVICE_TYPE_HAL, mode.format_id, - usage, bind_flags, WINED3D_RTYPE_TEXTURE_2D, wined3dformat_from_ddrawformat(&desc->u4.ddpfPixelFormat)))) + usage, bind_flags, WINED3D_RTYPE_TEXTURE_2D, wined3dformat_from_ddrawformat(&desc->ddpfPixelFormat)))) { desc->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; } @@ -6883,7 +6883,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ return DDERR_INVALIDPARAMS; } - if (format_is_compressed(&desc->u4.ddpfPixelFormat)) + if (format_is_compressed(&desc->ddpfPixelFormat)) { if (version != 4 && (desc->dwFlags & DDSD_PITCH)) { @@ -6911,7 +6911,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ } if (((desc->dwFlags & DDSD_CKDESTOVERLAY) - && desc->u3.ddckCKDestOverlay.dwColorSpaceLowValue != desc->u3.ddckCKDestOverlay.dwColorSpaceHighValue) + && desc->ddckCKDestOverlay.dwColorSpaceLowValue != desc->ddckCKDestOverlay.dwColorSpaceHighValue) || ((desc->dwFlags & DDSD_CKDESTBLT) && desc->ddckCKDestBlt.dwColorSpaceLowValue != desc->ddckCKDestBlt.dwColorSpaceHighValue) || ((desc->dwFlags & DDSD_CKSRCOVERLAY) @@ -6936,7 +6936,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ reserve_memory = !(desc->dwFlags & DDSD_LPSURFACE) && desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY - && wined3d_display_mode_format.u1.dwRGBBitCount <= 16; + && wined3d_display_mode_format.dwRGBBitCount <= 16; if (FAILED(hr = ddraw_texture_init(texture, ddraw, layers, levels, sysmem_fallback, reserve_memory))) { @@ -6950,7 +6950,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (desc->dwFlags & DDSD_BACKBUFFERCOUNT) { - unsigned int count = desc->u5.dwBackBufferCount; + unsigned int count = desc->dwBackBufferCount; struct ddraw_surface *last = root; attach = &last->complex_array[0]; @@ -6973,7 +6973,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ | DDSCAPS_BACKBUFFER); if (!i) desc->ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; - desc->u5.dwBackBufferCount = 0; + desc->dwBackBufferCount = 0; if (FAILED(hr = ddraw_texture_init(texture, ddraw, 1, 1, sysmem_fallback, reserve_memory))) { diff --git a/dlls/ddraw/utils.c b/dlls/ddraw/utils.c index c2794824e9e..1915f9dd7f0 100644 --- a/dlls/ddraw/utils.c +++ b/dlls/ddraw/utils.c @@ -40,130 +40,130 @@ void ddrawformat_from_wined3dformat(DDPIXELFORMAT *DDPixelFormat, enum wined3d_f case WINED3DFMT_B8G8R8_UNORM: DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 24; - DDPixelFormat->u2.dwRBitMask = 0x00ff0000; - DDPixelFormat->u3.dwGBitMask = 0x0000ff00; - DDPixelFormat->u4.dwBBitMask = 0x000000ff; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwRGBBitCount = 24; + DDPixelFormat->dwRBitMask = 0x00ff0000; + DDPixelFormat->dwGBitMask = 0x0000ff00; + DDPixelFormat->dwBBitMask = 0x000000ff; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_B8G8R8A8_UNORM: DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 32; - DDPixelFormat->u2.dwRBitMask = 0x00ff0000; - DDPixelFormat->u3.dwGBitMask = 0x0000ff00; - DDPixelFormat->u4.dwBBitMask = 0x000000ff; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0xff000000; + DDPixelFormat->dwRGBBitCount = 32; + DDPixelFormat->dwRBitMask = 0x00ff0000; + DDPixelFormat->dwGBitMask = 0x0000ff00; + DDPixelFormat->dwBBitMask = 0x000000ff; + DDPixelFormat->dwRGBAlphaBitMask = 0xff000000; break; case WINED3DFMT_B8G8R8X8_UNORM: DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 32; - DDPixelFormat->u2.dwRBitMask = 0x00ff0000; - DDPixelFormat->u3.dwGBitMask = 0x0000ff00; - DDPixelFormat->u4.dwBBitMask = 0x000000ff; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwRGBBitCount = 32; + DDPixelFormat->dwRBitMask = 0x00ff0000; + DDPixelFormat->dwGBitMask = 0x0000ff00; + DDPixelFormat->dwBBitMask = 0x000000ff; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_R8G8B8X8_UNORM: DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 32; - DDPixelFormat->u2.dwRBitMask = 0x000000ff; - DDPixelFormat->u3.dwGBitMask = 0x0000ff00; - DDPixelFormat->u4.dwBBitMask = 0x00ff0000; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwRGBBitCount = 32; + DDPixelFormat->dwRBitMask = 0x000000ff; + DDPixelFormat->dwGBitMask = 0x0000ff00; + DDPixelFormat->dwBBitMask = 0x00ff0000; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_B5G6R5_UNORM: DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 16; - DDPixelFormat->u2.dwRBitMask = 0xF800; - DDPixelFormat->u3.dwGBitMask = 0x07E0; - DDPixelFormat->u4.dwBBitMask = 0x001F; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwRGBBitCount = 16; + DDPixelFormat->dwRBitMask = 0xF800; + DDPixelFormat->dwGBitMask = 0x07E0; + DDPixelFormat->dwBBitMask = 0x001F; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_B5G5R5X1_UNORM: DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 16; - DDPixelFormat->u2.dwRBitMask = 0x7C00; - DDPixelFormat->u3.dwGBitMask = 0x03E0; - DDPixelFormat->u4.dwBBitMask = 0x001F; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwRGBBitCount = 16; + DDPixelFormat->dwRBitMask = 0x7C00; + DDPixelFormat->dwGBitMask = 0x03E0; + DDPixelFormat->dwBBitMask = 0x001F; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_B5G5R5A1_UNORM: DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 16; - DDPixelFormat->u2.dwRBitMask = 0x7C00; - DDPixelFormat->u3.dwGBitMask = 0x03E0; - DDPixelFormat->u4.dwBBitMask = 0x001F; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x8000; + DDPixelFormat->dwRGBBitCount = 16; + DDPixelFormat->dwRBitMask = 0x7C00; + DDPixelFormat->dwGBitMask = 0x03E0; + DDPixelFormat->dwBBitMask = 0x001F; + DDPixelFormat->dwRGBAlphaBitMask = 0x8000; break; case WINED3DFMT_B4G4R4A4_UNORM: DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 16; - DDPixelFormat->u2.dwRBitMask = 0x0F00; - DDPixelFormat->u3.dwGBitMask = 0x00F0; - DDPixelFormat->u4.dwBBitMask = 0x000F; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0xF000; + DDPixelFormat->dwRGBBitCount = 16; + DDPixelFormat->dwRBitMask = 0x0F00; + DDPixelFormat->dwGBitMask = 0x00F0; + DDPixelFormat->dwBBitMask = 0x000F; + DDPixelFormat->dwRGBAlphaBitMask = 0xF000; break; case WINED3DFMT_B2G3R3_UNORM: DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 8; - DDPixelFormat->u2.dwRBitMask = 0xE0; - DDPixelFormat->u3.dwGBitMask = 0x1C; - DDPixelFormat->u4.dwBBitMask = 0x03; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0; + DDPixelFormat->dwRGBBitCount = 8; + DDPixelFormat->dwRBitMask = 0xE0; + DDPixelFormat->dwGBitMask = 0x1C; + DDPixelFormat->dwBBitMask = 0x03; + DDPixelFormat->dwLuminanceAlphaBitMask = 0x0; break; case WINED3DFMT_P8_UINT: DDPixelFormat->dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 8; - DDPixelFormat->u2.dwRBitMask = 0x00; - DDPixelFormat->u3.dwGBitMask = 0x00; - DDPixelFormat->u4.dwBBitMask = 0x00; + DDPixelFormat->dwRGBBitCount = 8; + DDPixelFormat->dwRBitMask = 0x00; + DDPixelFormat->dwGBitMask = 0x00; + DDPixelFormat->dwBBitMask = 0x00; break; case WINED3DFMT_A8_UNORM: DDPixelFormat->dwFlags = DDPF_ALPHA; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwAlphaBitDepth = 8; - DDPixelFormat->u2.dwRBitMask = 0x0; - DDPixelFormat->u3.dwZBitMask = 0x0; - DDPixelFormat->u4.dwStencilBitMask = 0x0; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0; + DDPixelFormat->dwAlphaBitDepth = 8; + DDPixelFormat->dwRBitMask = 0x0; + DDPixelFormat->dwZBitMask = 0x0; + DDPixelFormat->dwStencilBitMask = 0x0; + DDPixelFormat->dwLuminanceAlphaBitMask = 0x0; break; case WINED3DFMT_B2G3R3A8_UNORM: DDPixelFormat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 16; - DDPixelFormat->u2.dwRBitMask = 0x00E0; - DDPixelFormat->u3.dwGBitMask = 0x001C; - DDPixelFormat->u4.dwBBitMask = 0x0003; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0xFF00; + DDPixelFormat->dwRGBBitCount = 16; + DDPixelFormat->dwRBitMask = 0x00E0; + DDPixelFormat->dwGBitMask = 0x001C; + DDPixelFormat->dwBBitMask = 0x0003; + DDPixelFormat->dwRGBAlphaBitMask = 0xFF00; break; case WINED3DFMT_B4G4R4X4_UNORM: DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwRGBBitCount = 16; - DDPixelFormat->u2.dwRBitMask = 0x0F00; - DDPixelFormat->u3.dwGBitMask = 0x00F0; - DDPixelFormat->u4.dwBBitMask = 0x000F; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwRGBBitCount = 16; + DDPixelFormat->dwRBitMask = 0x0F00; + DDPixelFormat->dwGBitMask = 0x00F0; + DDPixelFormat->dwBBitMask = 0x000F; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; /* How are Z buffer bit depth and Stencil buffer bit depth related? @@ -171,73 +171,73 @@ void ddrawformat_from_wined3dformat(DDPIXELFORMAT *DDPixelFormat, enum wined3d_f case WINED3DFMT_D16_UNORM: DDPixelFormat->dwFlags = DDPF_ZBUFFER; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwZBufferBitDepth = 16; - DDPixelFormat->u2.dwStencilBitDepth = 0; - DDPixelFormat->u3.dwZBitMask = 0x0000FFFF; - DDPixelFormat->u4.dwStencilBitMask = 0x0; - DDPixelFormat->u5.dwRGBZBitMask = 0x00000000; + DDPixelFormat->dwZBufferBitDepth = 16; + DDPixelFormat->dwStencilBitDepth = 0; + DDPixelFormat->dwZBitMask = 0x0000FFFF; + DDPixelFormat->dwStencilBitMask = 0x0; + DDPixelFormat->dwRGBZBitMask = 0x00000000; break; case WINED3DFMT_D32_UNORM: DDPixelFormat->dwFlags = DDPF_ZBUFFER; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwZBufferBitDepth = 32; - DDPixelFormat->u2.dwStencilBitDepth = 0; - DDPixelFormat->u3.dwZBitMask = 0xFFFFFFFF; - DDPixelFormat->u4.dwStencilBitMask = 0x0; - DDPixelFormat->u5.dwRGBZBitMask = 0x00000000; + DDPixelFormat->dwZBufferBitDepth = 32; + DDPixelFormat->dwStencilBitDepth = 0; + DDPixelFormat->dwZBitMask = 0xFFFFFFFF; + DDPixelFormat->dwStencilBitMask = 0x0; + DDPixelFormat->dwRGBZBitMask = 0x00000000; break; case WINED3DFMT_S4X4_UINT_D24_UNORM: DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER; DDPixelFormat->dwFourCC = 0; /* Should I set dwZBufferBitDepth to 32 here? */ - DDPixelFormat->u1.dwZBufferBitDepth = 32; - DDPixelFormat->u2.dwStencilBitDepth = 4; - DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF; - DDPixelFormat->u4.dwStencilBitMask = 0x0F000000; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwZBufferBitDepth = 32; + DDPixelFormat->dwStencilBitDepth = 4; + DDPixelFormat->dwZBitMask = 0x00FFFFFF; + DDPixelFormat->dwStencilBitMask = 0x0F000000; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_D24_UNORM_S8_UINT: DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwZBufferBitDepth = 32; - DDPixelFormat->u2.dwStencilBitDepth = 8; - DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF; - DDPixelFormat->u4.dwStencilBitMask = 0xFF000000; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwZBufferBitDepth = 32; + DDPixelFormat->dwStencilBitDepth = 8; + DDPixelFormat->dwZBitMask = 0x00FFFFFF; + DDPixelFormat->dwStencilBitMask = 0xFF000000; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_X8D24_UNORM: DDPixelFormat->dwFlags = DDPF_ZBUFFER; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwZBufferBitDepth = 32; - DDPixelFormat->u2.dwStencilBitDepth = 0; - DDPixelFormat->u3.dwZBitMask = 0x00FFFFFF; - DDPixelFormat->u4.dwStencilBitMask = 0x00000000; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwZBufferBitDepth = 32; + DDPixelFormat->dwStencilBitDepth = 0; + DDPixelFormat->dwZBitMask = 0x00FFFFFF; + DDPixelFormat->dwStencilBitMask = 0x00000000; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_S1_UINT_D15_UNORM: DDPixelFormat->dwFlags = DDPF_ZBUFFER | DDPF_STENCILBUFFER; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwZBufferBitDepth = 16; - DDPixelFormat->u2.dwStencilBitDepth = 1; - DDPixelFormat->u3.dwZBitMask = 0x7fff; - DDPixelFormat->u4.dwStencilBitMask = 0x8000; - DDPixelFormat->u5.dwRGBAlphaBitMask = 0x0; + DDPixelFormat->dwZBufferBitDepth = 16; + DDPixelFormat->dwStencilBitDepth = 1; + DDPixelFormat->dwZBitMask = 0x7fff; + DDPixelFormat->dwStencilBitMask = 0x8000; + DDPixelFormat->dwRGBAlphaBitMask = 0x0; break; case WINED3DFMT_UYVY: case WINED3DFMT_YUY2: - DDPixelFormat->u1.dwYUVBitCount = 16; + DDPixelFormat->dwYUVBitCount = 16; DDPixelFormat->dwFlags = DDPF_FOURCC; DDPixelFormat->dwFourCC = wined3d_format; break; case WINED3DFMT_YV12: - DDPixelFormat->u1.dwYUVBitCount = 12; + DDPixelFormat->dwYUVBitCount = 12; DDPixelFormat->dwFlags = DDPF_FOURCC; DDPixelFormat->dwFourCC = wined3d_format; break; @@ -258,62 +258,62 @@ void ddrawformat_from_wined3dformat(DDPIXELFORMAT *DDPixelFormat, enum wined3d_f case WINED3DFMT_L8_UNORM: DDPixelFormat->dwFlags = DDPF_LUMINANCE; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwLuminanceBitCount = 8; - DDPixelFormat->u2.dwLuminanceBitMask = 0xff; - DDPixelFormat->u3.dwBumpDvBitMask = 0x0; - DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x0; + DDPixelFormat->dwLuminanceBitCount = 8; + DDPixelFormat->dwLuminanceBitMask = 0xff; + DDPixelFormat->dwBumpDvBitMask = 0x0; + DDPixelFormat->dwBumpLuminanceBitMask = 0x0; + DDPixelFormat->dwLuminanceAlphaBitMask = 0x0; break; case WINED3DFMT_L4A4_UNORM: DDPixelFormat->dwFlags = DDPF_ALPHAPIXELS | DDPF_LUMINANCE; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwLuminanceBitCount = 4; - DDPixelFormat->u2.dwLuminanceBitMask = 0x0f; - DDPixelFormat->u3.dwBumpDvBitMask = 0x0; - DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0xf0; + DDPixelFormat->dwLuminanceBitCount = 4; + DDPixelFormat->dwLuminanceBitMask = 0x0f; + DDPixelFormat->dwBumpDvBitMask = 0x0; + DDPixelFormat->dwBumpLuminanceBitMask = 0x0; + DDPixelFormat->dwLuminanceAlphaBitMask = 0xf0; break; case WINED3DFMT_L8A8_UNORM: DDPixelFormat->dwFlags = DDPF_ALPHAPIXELS | DDPF_LUMINANCE; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwLuminanceBitCount = 16; - DDPixelFormat->u2.dwLuminanceBitMask = 0x00ff; - DDPixelFormat->u3.dwBumpDvBitMask = 0x0; - DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0xff00; + DDPixelFormat->dwLuminanceBitCount = 16; + DDPixelFormat->dwLuminanceBitMask = 0x00ff; + DDPixelFormat->dwBumpDvBitMask = 0x0; + DDPixelFormat->dwBumpLuminanceBitMask = 0x0; + DDPixelFormat->dwLuminanceAlphaBitMask = 0xff00; break; /* Bump mapping */ case WINED3DFMT_R8G8_SNORM: DDPixelFormat->dwFlags = DDPF_BUMPDUDV; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwBumpBitCount = 16; - DDPixelFormat->u2.dwBumpDuBitMask = 0x000000ff; - DDPixelFormat->u3.dwBumpDvBitMask = 0x0000ff00; - DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x00000000; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000; + DDPixelFormat->dwBumpBitCount = 16; + DDPixelFormat->dwBumpDuBitMask = 0x000000ff; + DDPixelFormat->dwBumpDvBitMask = 0x0000ff00; + DDPixelFormat->dwBumpLuminanceBitMask = 0x00000000; + DDPixelFormat->dwLuminanceAlphaBitMask = 0x00000000; break; case WINED3DFMT_R5G5_SNORM_L6_UNORM: DDPixelFormat->dwFlags = DDPF_BUMPDUDV | DDPF_BUMPLUMINANCE; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwBumpBitCount = 16; - DDPixelFormat->u2.dwBumpDuBitMask = 0x0000001f; - DDPixelFormat->u3.dwBumpDvBitMask = 0x000003e0; - DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x0000fc00; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000; + DDPixelFormat->dwBumpBitCount = 16; + DDPixelFormat->dwBumpDuBitMask = 0x0000001f; + DDPixelFormat->dwBumpDvBitMask = 0x000003e0; + DDPixelFormat->dwBumpLuminanceBitMask = 0x0000fc00; + DDPixelFormat->dwLuminanceAlphaBitMask = 0x00000000; break; case WINED3DFMT_R8G8_SNORM_L8X8_UNORM: DDPixelFormat->dwFlags = DDPF_BUMPDUDV | DDPF_BUMPLUMINANCE; DDPixelFormat->dwFourCC = 0; - DDPixelFormat->u1.dwBumpBitCount = 32; - DDPixelFormat->u2.dwBumpDuBitMask = 0x000000ff; - DDPixelFormat->u3.dwBumpDvBitMask = 0x0000ff00; - DDPixelFormat->u4.dwBumpLuminanceBitMask = 0x00ff0000; - DDPixelFormat->u5.dwLuminanceAlphaBitMask = 0x00000000; + DDPixelFormat->dwBumpBitCount = 32; + DDPixelFormat->dwBumpDuBitMask = 0x000000ff; + DDPixelFormat->dwBumpDvBitMask = 0x0000ff00; + DDPixelFormat->dwBumpLuminanceBitMask = 0x00ff0000; + DDPixelFormat->dwLuminanceAlphaBitMask = 0x00000000; break; default: @@ -346,7 +346,7 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix } else if(DDPixelFormat->dwFlags & DDPF_RGB) { - switch(DDPixelFormat->u1.dwRGBBitCount) + switch(DDPixelFormat->dwRGBBitCount) { case 8: /* This is the only format that can match here */ @@ -354,40 +354,40 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix case 16: /* Read the Color masks */ - if( (DDPixelFormat->u2.dwRBitMask == 0xF800) && - (DDPixelFormat->u3.dwGBitMask == 0x07E0) && - (DDPixelFormat->u4.dwBBitMask == 0x001F) ) + if( (DDPixelFormat->dwRBitMask == 0xF800) && + (DDPixelFormat->dwGBitMask == 0x07E0) && + (DDPixelFormat->dwBBitMask == 0x001F) ) { return WINED3DFMT_B5G6R5_UNORM; } - if( (DDPixelFormat->u2.dwRBitMask == 0x7C00) && - (DDPixelFormat->u3.dwGBitMask == 0x03E0) && - (DDPixelFormat->u4.dwBBitMask == 0x001F) ) + if( (DDPixelFormat->dwRBitMask == 0x7C00) && + (DDPixelFormat->dwGBitMask == 0x03E0) && + (DDPixelFormat->dwBBitMask == 0x001F) ) { if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) && - (DDPixelFormat->u5.dwRGBAlphaBitMask == 0x8000)) + (DDPixelFormat->dwRGBAlphaBitMask == 0x8000)) return WINED3DFMT_B5G5R5A1_UNORM; else return WINED3DFMT_B5G5R5X1_UNORM; } - if( (DDPixelFormat->u2.dwRBitMask == 0x0F00) && - (DDPixelFormat->u3.dwGBitMask == 0x00F0) && - (DDPixelFormat->u4.dwBBitMask == 0x000F) ) + if( (DDPixelFormat->dwRBitMask == 0x0F00) && + (DDPixelFormat->dwGBitMask == 0x00F0) && + (DDPixelFormat->dwBBitMask == 0x000F) ) { if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) && - (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xF000)) + (DDPixelFormat->dwRGBAlphaBitMask == 0xF000)) return WINED3DFMT_B4G4R4A4_UNORM; else return WINED3DFMT_B4G4R4X4_UNORM; } if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) && - (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xFF00) && - (DDPixelFormat->u2.dwRBitMask == 0x00E0) && - (DDPixelFormat->u3.dwGBitMask == 0x001C) && - (DDPixelFormat->u4.dwBBitMask == 0x0003) ) + (DDPixelFormat->dwRGBAlphaBitMask == 0xFF00) && + (DDPixelFormat->dwRBitMask == 0x00E0) && + (DDPixelFormat->dwGBitMask == 0x001C) && + (DDPixelFormat->dwBBitMask == 0x0003) ) { return WINED3DFMT_B2G3R3A8_UNORM; } @@ -399,12 +399,12 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix case 32: /* Read the Color masks */ - if( (DDPixelFormat->u2.dwRBitMask == 0x00FF0000) && - (DDPixelFormat->u3.dwGBitMask == 0x0000FF00) && - (DDPixelFormat->u4.dwBBitMask == 0x000000FF) ) + if( (DDPixelFormat->dwRBitMask == 0x00FF0000) && + (DDPixelFormat->dwGBitMask == 0x0000FF00) && + (DDPixelFormat->dwBBitMask == 0x000000FF) ) { if( (DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) && - (DDPixelFormat->u5.dwRGBAlphaBitMask == 0xFF000000)) + (DDPixelFormat->dwRGBAlphaBitMask == 0xFF000000)) return WINED3DFMT_B8G8R8A8_UNORM; else return WINED3DFMT_B8G8R8X8_UNORM; @@ -421,7 +421,7 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix else if( (DDPixelFormat->dwFlags & DDPF_ALPHA) ) { /* Alpha only Pixelformat */ - switch(DDPixelFormat->u1.dwAlphaBitDepth) + switch(DDPixelFormat->dwAlphaBitDepth) { case 8: return WINED3DFMT_A8_UNORM; @@ -437,10 +437,10 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix if(DDPixelFormat->dwFlags & DDPF_ALPHAPIXELS) { /* Luminance with Alpha */ - switch(DDPixelFormat->u1.dwLuminanceBitCount) + switch(DDPixelFormat->dwLuminanceBitCount) { case 4: - if(DDPixelFormat->u1.dwAlphaBitDepth == 4) + if(DDPixelFormat->dwAlphaBitDepth == 4) return WINED3DFMT_L4A4_UNORM; WARN("Unknown Alpha / Luminance bit depth combination.\n"); return WINED3DFMT_UNKNOWN; @@ -450,7 +450,7 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix return WINED3DFMT_R5G5_SNORM_L6_UNORM; case 8: - if(DDPixelFormat->u1.dwAlphaBitDepth == 8) + if(DDPixelFormat->dwAlphaBitDepth == 8) return WINED3DFMT_L8A8_UNORM; WARN("Unknown Alpha / Lumincase bit depth combination.\n"); return WINED3DFMT_UNKNOWN; @@ -459,7 +459,7 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix else { /* Luminance-only */ - switch(DDPixelFormat->u1.dwLuminanceBitCount) + switch(DDPixelFormat->dwLuminanceBitCount) { case 6: FIXME("A luminance Pixelformat shouldn't have 6 luminance bits. Returning D3DFMT_L6V5U5 for now.\n"); @@ -469,7 +469,7 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix return WINED3DFMT_L8_UNORM; default: - WARN("Unknown luminance-only bit depth %lu.\n", DDPixelFormat->u1.dwLuminanceBitCount); + WARN("Unknown luminance-only bit depth %lu.\n", DDPixelFormat->dwLuminanceBitCount); return WINED3DFMT_UNKNOWN; } } @@ -479,30 +479,30 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix /* Z buffer */ if(DDPixelFormat->dwFlags & DDPF_STENCILBUFFER) { - switch(DDPixelFormat->u1.dwZBufferBitDepth) + switch(DDPixelFormat->dwZBufferBitDepth) { case 16: - if (DDPixelFormat->u2.dwStencilBitDepth == 1) return WINED3DFMT_S1_UINT_D15_UNORM; + if (DDPixelFormat->dwStencilBitDepth == 1) return WINED3DFMT_S1_UINT_D15_UNORM; WARN("Unknown depth stencil format: 16 z bits, %lu stencil bits.\n", - DDPixelFormat->u2.dwStencilBitDepth); + DDPixelFormat->dwStencilBitDepth); return WINED3DFMT_UNKNOWN; case 32: - if (DDPixelFormat->u2.dwStencilBitDepth == 8) return WINED3DFMT_D24_UNORM_S8_UINT; - else if (DDPixelFormat->u2.dwStencilBitDepth == 4) return WINED3DFMT_S4X4_UINT_D24_UNORM; + if (DDPixelFormat->dwStencilBitDepth == 8) return WINED3DFMT_D24_UNORM_S8_UINT; + else if (DDPixelFormat->dwStencilBitDepth == 4) return WINED3DFMT_S4X4_UINT_D24_UNORM; WARN("Unknown depth stencil format: 32 z bits, %lu stencil bits.\n", - DDPixelFormat->u2.dwStencilBitDepth); + DDPixelFormat->dwStencilBitDepth); return WINED3DFMT_UNKNOWN; default: WARN("Unknown depth stencil format: %lu z bits, %lu stencil bits.\n", - DDPixelFormat->u1.dwZBufferBitDepth, DDPixelFormat->u2.dwStencilBitDepth); + DDPixelFormat->dwZBufferBitDepth, DDPixelFormat->dwStencilBitDepth); return WINED3DFMT_UNKNOWN; } } else { - switch(DDPixelFormat->u1.dwZBufferBitDepth) + switch(DDPixelFormat->dwZBufferBitDepth) { case 16: return WINED3DFMT_D16_UNORM; @@ -511,16 +511,16 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix return WINED3DFMT_X8D24_UNORM; case 32: - if (DDPixelFormat->u3.dwZBitMask == 0x00FFFFFF) return WINED3DFMT_X8D24_UNORM; - else if (DDPixelFormat->u3.dwZBitMask == 0xFFFFFF00) return WINED3DFMT_X8D24_UNORM; - else if (DDPixelFormat->u3.dwZBitMask == 0xFFFFFFFF) return WINED3DFMT_D32_UNORM; + if (DDPixelFormat->dwZBitMask == 0x00FFFFFF) return WINED3DFMT_X8D24_UNORM; + else if (DDPixelFormat->dwZBitMask == 0xFFFFFF00) return WINED3DFMT_X8D24_UNORM; + else if (DDPixelFormat->dwZBitMask == 0xFFFFFFFF) return WINED3DFMT_D32_UNORM; WARN("Unknown depth-only format: 32 z bits, mask 0x%08lx\n", - DDPixelFormat->u3.dwZBitMask); + DDPixelFormat->dwZBitMask); return WINED3DFMT_UNKNOWN; default: WARN("Unknown depth-only format: %lu z bits, mask 0x%08lx\n", - DDPixelFormat->u1.dwZBufferBitDepth, DDPixelFormat->u3.dwZBitMask); + DDPixelFormat->dwZBufferBitDepth, DDPixelFormat->dwZBitMask); return WINED3DFMT_UNKNOWN; } } @@ -531,24 +531,24 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix } else if(DDPixelFormat->dwFlags & DDPF_BUMPDUDV) { - if( (DDPixelFormat->u1.dwBumpBitCount == 16 ) && - (DDPixelFormat->u2.dwBumpDuBitMask == 0x000000ff) && - (DDPixelFormat->u3.dwBumpDvBitMask == 0x0000ff00) && - (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x00000000) ) + if( (DDPixelFormat->dwBumpBitCount == 16 ) && + (DDPixelFormat->dwBumpDuBitMask == 0x000000ff) && + (DDPixelFormat->dwBumpDvBitMask == 0x0000ff00) && + (DDPixelFormat->dwBumpLuminanceBitMask == 0x00000000) ) { return WINED3DFMT_R8G8_SNORM; } - else if ( (DDPixelFormat->u1.dwBumpBitCount == 16 ) && - (DDPixelFormat->u2.dwBumpDuBitMask == 0x0000001f) && - (DDPixelFormat->u3.dwBumpDvBitMask == 0x000003e0) && - (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x0000fc00) ) + else if ( (DDPixelFormat->dwBumpBitCount == 16 ) && + (DDPixelFormat->dwBumpDuBitMask == 0x0000001f) && + (DDPixelFormat->dwBumpDvBitMask == 0x000003e0) && + (DDPixelFormat->dwBumpLuminanceBitMask == 0x0000fc00) ) { return WINED3DFMT_R5G5_SNORM_L6_UNORM; } - else if ( (DDPixelFormat->u1.dwBumpBitCount == 32 ) && - (DDPixelFormat->u2.dwBumpDuBitMask == 0x000000ff) && - (DDPixelFormat->u3.dwBumpDvBitMask == 0x0000ff00) && - (DDPixelFormat->u4.dwBumpLuminanceBitMask == 0x00ff0000) ) + else if ( (DDPixelFormat->dwBumpBitCount == 32 ) && + (DDPixelFormat->dwBumpDuBitMask == 0x000000ff) && + (DDPixelFormat->dwBumpDvBitMask == 0x0000ff00) && + (DDPixelFormat->dwBumpLuminanceBitMask == 0x00ff0000) ) { return WINED3DFMT_R8G8_SNORM_L8X8_UNORM; } @@ -597,7 +597,7 @@ BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddra { DWORD size, mask; - size = pf->u1.dwAlphaBitDepth; + size = pf->dwAlphaBitDepth; mask = size < 32 ? (1u << size) - 1 : ~0u; wined3d_colour->r = 0.0f; wined3d_colour->g = 0.0f; @@ -635,11 +635,11 @@ BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddra if (pf->dwFlags & DDPF_RGB) { - wined3d_colour->r = colour_to_float(colour, pf->u2.dwRBitMask); - wined3d_colour->g = colour_to_float(colour, pf->u3.dwGBitMask); - wined3d_colour->b = colour_to_float(colour, pf->u4.dwBBitMask); + wined3d_colour->r = colour_to_float(colour, pf->dwRBitMask); + wined3d_colour->g = colour_to_float(colour, pf->dwGBitMask); + wined3d_colour->b = colour_to_float(colour, pf->dwBBitMask); if (pf->dwFlags & DDPF_ALPHAPIXELS) - wined3d_colour->a = colour_to_float(colour, pf->u5.dwRGBAlphaBitMask); + wined3d_colour->a = colour_to_float(colour, pf->dwRGBAlphaBitMask); else wined3d_colour->a = 0.0f; return TRUE; @@ -647,9 +647,9 @@ BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddra if (pf->dwFlags & DDPF_ZBUFFER) { - wined3d_colour->r = colour_to_float(colour, pf->u3.dwZBitMask); + wined3d_colour->r = colour_to_float(colour, pf->dwZBitMask); if (pf->dwFlags & DDPF_STENCILBUFFER) - wined3d_colour->g = colour_to_float(colour, pf->u4.dwStencilBitMask); + wined3d_colour->g = colour_to_float(colour, pf->dwStencilBitMask); else wined3d_colour->g = 0.0f; wined3d_colour->b = 0.0f; @@ -777,7 +777,7 @@ DDRAW_dump_DDSCAPS(const DDSCAPS *in) in_bis.dwCaps = in->dwCaps; in_bis.dwCaps2 = 0; in_bis.dwCaps3 = 0; - in_bis.u1.dwCaps4 = 0; + in_bis.dwCaps4 = 0; DDRAW_dump_DDSCAPS2(&in_bis); } @@ -832,29 +832,29 @@ DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf) (unsigned char)((pf->dwFourCC>>16)&0xff), (unsigned char)((pf->dwFourCC>>24)&0xff), pf->dwFourCC, - pf->u1.dwYUVBitCount); + pf->dwYUVBitCount); if (pf->dwFlags & DDPF_RGB) { TRACE(", RGB bits: %lu, R 0x%08lx G 0x%08lx B 0x%08lx", - pf->u1.dwRGBBitCount, - pf->u2.dwRBitMask, - pf->u3.dwGBitMask, - pf->u4.dwBBitMask); + pf->dwRGBBitCount, + pf->dwRBitMask, + pf->dwGBitMask, + pf->dwBBitMask); if (pf->dwFlags & DDPF_ALPHAPIXELS) - TRACE(" A 0x%08lx", pf->u5.dwRGBAlphaBitMask); + TRACE(" A 0x%08lx", pf->dwRGBAlphaBitMask); if (pf->dwFlags & DDPF_ZPIXELS) - TRACE(" Z 0x%08lx", pf->u5.dwRGBZBitMask); + TRACE(" Z 0x%08lx", pf->dwRGBZBitMask); } if (pf->dwFlags & DDPF_ZBUFFER) - TRACE(", Z bits: %lu", pf->u1.dwZBufferBitDepth); + TRACE(", Z bits: %lu", pf->dwZBufferBitDepth); if (pf->dwFlags & DDPF_ALPHA) - TRACE(", Alpha bits: %lu", pf->u1.dwAlphaBitDepth); + TRACE(", Alpha bits: %lu", pf->dwAlphaBitDepth); if (pf->dwFlags & DDPF_BUMPDUDV) TRACE(", Bump bits: %lu, U 0x%08lx V 0x%08lx L 0x%08lx", - pf->u1.dwBumpBitCount, - pf->u2.dwBumpDuBitMask, - pf->u3.dwBumpDvBitMask, - pf->u4.dwBumpLuminanceBitMask); + pf->dwBumpBitCount, + pf->dwBumpDuBitMask, + pf->dwBumpDvBitMask, + pf->dwBumpLuminanceBitMask); TRACE(")\n"); } @@ -865,19 +865,18 @@ void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) { ME(DDSD_HEIGHT, DDRAW_dump_DWORD, dwHeight), ME(DDSD_WIDTH, DDRAW_dump_DWORD, dwWidth), - ME(DDSD_PITCH, DDRAW_dump_DWORD, u1 /* lPitch */), - ME(DDSD_LINEARSIZE, DDRAW_dump_DWORD, u1 /* dwLinearSize */), - ME(DDSD_BACKBUFFERCOUNT, DDRAW_dump_DWORD, u5.dwBackBufferCount), - ME(DDSD_MIPMAPCOUNT, DDRAW_dump_DWORD, u2 /* dwMipMapCount */), - ME(DDSD_ZBUFFERBITDEPTH, DDRAW_dump_DWORD, u2 /* dwZBufferBitDepth */), /* This is for 'old-style' D3D */ - ME(DDSD_REFRESHRATE, DDRAW_dump_DWORD, u2 /* dwRefreshRate */), + ME(DDSD_PITCH, DDRAW_dump_DWORD, lPitch), + ME(DDSD_LINEARSIZE, DDRAW_dump_DWORD, dwLinearSize), + ME(DDSD_BACKBUFFERCOUNT, DDRAW_dump_DWORD, dwBackBufferCount), + ME(DDSD_MIPMAPCOUNT, DDRAW_dump_DWORD, dwMipMapCount), + ME(DDSD_REFRESHRATE, DDRAW_dump_DWORD, dwRefreshRate), ME(DDSD_ALPHABITDEPTH, DDRAW_dump_DWORD, dwAlphaBitDepth), ME(DDSD_LPSURFACE, DDRAW_dump_PTR, lpSurface), - ME(DDSD_CKDESTOVERLAY, DDRAW_dump_DDCOLORKEY, u3 /* ddckCKDestOverlay */), + ME(DDSD_CKDESTOVERLAY, DDRAW_dump_DDCOLORKEY, ddckCKDestOverlay), ME(DDSD_CKDESTBLT, DDRAW_dump_DDCOLORKEY, ddckCKDestBlt), ME(DDSD_CKSRCOVERLAY, DDRAW_dump_DDCOLORKEY, ddckCKSrcOverlay), ME(DDSD_CKSRCBLT, DDRAW_dump_DDCOLORKEY, ddckCKSrcBlt), - ME(DDSD_PIXELFORMAT, DDRAW_dump_pixelformat, u4 /* ddpfPixelFormat */) + ME(DDSD_PIXELFORMAT, DDRAW_dump_pixelformat, ddpfPixelFormat) }; static const struct member_info members_caps[] = { @@ -952,7 +951,7 @@ void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS* pIn, DDSCAPS2* pOut) pOut->dwCaps = pIn->dwCaps; pOut->dwCaps2 = 0; pOut->dwCaps3 = 0; - pOut->u1.dwCaps4 = 0; + pOut->dwCaps4 = 0; } void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2* pIn, DDDEVICEIDENTIFIER* pOut) @@ -1210,32 +1209,32 @@ void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out) out->dwFlags = in->dwFlags & ~DDSD_ZBUFFERBITDEPTH; if (in->dwFlags & DDSD_WIDTH) out->dwWidth = in->dwWidth; if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight; - if (in->dwFlags & DDSD_PIXELFORMAT) out->u4.ddpfPixelFormat = in->ddpfPixelFormat; + if (in->dwFlags & DDSD_PIXELFORMAT) out->ddpfPixelFormat = in->ddpfPixelFormat; else if(in->dwFlags & DDSD_ZBUFFERBITDEPTH) { out->dwFlags |= DDSD_PIXELFORMAT; - memset(&out->u4.ddpfPixelFormat, 0, sizeof(out->u4.ddpfPixelFormat)); - out->u4.ddpfPixelFormat.dwSize = sizeof(out->u4.ddpfPixelFormat); - out->u4.ddpfPixelFormat.dwFlags = DDPF_ZBUFFER; - out->u4.ddpfPixelFormat.u1.dwZBufferBitDepth = in->u2.dwZBufferBitDepth; + memset(&out->ddpfPixelFormat, 0, sizeof(out->ddpfPixelFormat)); + out->ddpfPixelFormat.dwSize = sizeof(out->ddpfPixelFormat); + out->ddpfPixelFormat.dwFlags = DDPF_ZBUFFER; + out->ddpfPixelFormat.dwZBufferBitDepth = in->dwZBufferBitDepth; /* 0 is not a valid DDSURFACEDESC / DDPIXELFORMAT on either side of the * conversion */ - out->u4.ddpfPixelFormat.u3.dwZBitMask = ~0U >> (32 - in->u2.dwZBufferBitDepth); + out->ddpfPixelFormat.dwZBitMask = ~0U >> (32 - in->dwZBufferBitDepth); } /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */ out->ddsCaps.dwCaps = in->ddsCaps.dwCaps; - if (in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch; - if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->u5.dwBackBufferCount = in->dwBackBufferCount; + if (in->dwFlags & DDSD_PITCH) out->lPitch = in->lPitch; + if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->dwBackBufferCount; if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth; /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */ out->lpSurface = in->lpSurface; - if (in->dwFlags & DDSD_CKDESTOVERLAY) out->u3.ddckCKDestOverlay = in->ddckCKDestOverlay; + if (in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->ddckCKDestOverlay; if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt; if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay; if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt; - if (in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount; - if (in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate; - if (in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize; + if (in->dwFlags & DDSD_MIPMAPCOUNT) out->dwMipMapCount = in->dwMipMapCount; + if (in->dwFlags & DDSD_REFRESHRATE) out->dwRefreshRate = in->dwRefreshRate; + if (in->dwFlags & DDSD_LINEARSIZE) out->dwLinearSize = in->dwLinearSize; /* Does not exist in DDSURFACEDESC: * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE, */ @@ -1253,31 +1252,31 @@ void DDSD2_to_DDSD(const DDSURFACEDESC2 *in, DDSURFACEDESC *out) if (in->dwFlags & DDSD_HEIGHT) out->dwHeight = in->dwHeight; if (in->dwFlags & DDSD_PIXELFORMAT) { - out->ddpfPixelFormat = in->u4.ddpfPixelFormat; + out->ddpfPixelFormat = in->ddpfPixelFormat; if ((in->dwFlags & DDSD_CAPS) && (in->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)) { /* Z buffers have DDSD_ZBUFFERBITDEPTH set, but not DDSD_PIXELFORMAT. They do * have valid data in ddpfPixelFormat though */ out->dwFlags &= ~DDSD_PIXELFORMAT; out->dwFlags |= DDSD_ZBUFFERBITDEPTH; - out->u2.dwZBufferBitDepth = in->u4.ddpfPixelFormat.u1.dwZBufferBitDepth; + out->dwZBufferBitDepth = in->ddpfPixelFormat.dwZBufferBitDepth; } } /* ddsCaps is read even without DDSD_CAPS set. See dsurface:no_ddsd_caps_test */ out->ddsCaps.dwCaps = in->ddsCaps.dwCaps; - if (in->dwFlags & DDSD_PITCH) out->u1.lPitch = in->u1.lPitch; - if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->u5.dwBackBufferCount; - if (in->dwFlags & DDSD_ZBUFFERBITDEPTH) out->u2.dwZBufferBitDepth = in->u2.dwMipMapCount; /* same union */ + if (in->dwFlags & DDSD_PITCH) out->lPitch = in->lPitch; + if (in->dwFlags & DDSD_BACKBUFFERCOUNT) out->dwBackBufferCount = in->dwBackBufferCount; + if (in->dwFlags & DDSD_ZBUFFERBITDEPTH) out->dwZBufferBitDepth = in->dwMipMapCount; /* same union */ if (in->dwFlags & DDSD_ALPHABITDEPTH) out->dwAlphaBitDepth = in->dwAlphaBitDepth; /* DDraw(native, and wine) does not set the DDSD_LPSURFACE, so always copy */ out->lpSurface = in->lpSurface; - if (in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->u3.ddckCKDestOverlay; + if (in->dwFlags & DDSD_CKDESTOVERLAY) out->ddckCKDestOverlay = in->ddckCKDestOverlay; if (in->dwFlags & DDSD_CKDESTBLT) out->ddckCKDestBlt = in->ddckCKDestBlt; if (in->dwFlags & DDSD_CKSRCOVERLAY) out->ddckCKSrcOverlay = in->ddckCKSrcOverlay; if (in->dwFlags & DDSD_CKSRCBLT) out->ddckCKSrcBlt = in->ddckCKSrcBlt; - if (in->dwFlags & DDSD_MIPMAPCOUNT) out->u2.dwMipMapCount = in->u2.dwMipMapCount; - if (in->dwFlags & DDSD_REFRESHRATE) out->u2.dwRefreshRate = in->u2.dwRefreshRate; - if (in->dwFlags & DDSD_LINEARSIZE) out->u1.dwLinearSize = in->u1.dwLinearSize; + if (in->dwFlags & DDSD_MIPMAPCOUNT) out->dwMipMapCount = in->dwMipMapCount; + if (in->dwFlags & DDSD_REFRESHRATE) out->dwRefreshRate = in->dwRefreshRate; + if (in->dwFlags & DDSD_LINEARSIZE) out->dwLinearSize = in->dwLinearSize; /* Does not exist in DDSURFACEDESC: * DDSD_TEXTURESTAGE, DDSD_FVF, DDSD_SRCVBHANDLE, */ diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c index 83c88f48691..75e07c016ae 100644 --- a/dlls/ddraw/viewport.c +++ b/dlls/ddraw/viewport.c @@ -544,9 +544,9 @@ static HRESULT WINAPI d3d_viewport_TransformVertices(IDirect3DViewport3 *iface, { /* If clipping is enabled, Windows assumes that outH is * a valid pointer. */ - outH[i].u1.hx = (x - device->legacy_clipspace._41 * w) / device->legacy_clipspace._11; - outH[i].u2.hy = (y - device->legacy_clipspace._42 * w) / device->legacy_clipspace._22; - outH[i].u3.hz = (z - device->legacy_clipspace._43 * w) / device->legacy_clipspace._33; + outH[i].hx = (x - device->legacy_clipspace._41 * w) / device->legacy_clipspace._11; + outH[i].hy = (y - device->legacy_clipspace._42 * w) / device->legacy_clipspace._22; + outH[i].hz = (z - device->legacy_clipspace._43 * w) / device->legacy_clipspace._33; outH[i].dwFlags = 0; if (x > w) @@ -635,8 +635,8 @@ static HRESULT WINAPI d3d_viewport_SetBackground(IDirect3DViewport3 *iface, D3DM } TRACE("Setting background color : %.8e %.8e %.8e %.8e.\n", - m->mat.u.diffuse.u1.r, m->mat.u.diffuse.u2.g, - m->mat.u.diffuse.u3.b, m->mat.u.diffuse.u4.a); + m->mat.diffuse.r, m->mat.diffuse.g, + m->mat.diffuse.b, m->mat.diffuse.a); viewport->background = m; wined3d_mutex_unlock(); @@ -762,10 +762,10 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface, if (!This->background) WARN("No background material set.\n"); else - color = D3DRGBA(This->background->mat.u.diffuse.u1.r, - This->background->mat.u.diffuse.u2.g, - This->background->mat.u.diffuse.u3.b, - This->background->mat.u.diffuse.u4.a); + color = D3DRGBA(This->background->mat.diffuse.r, + This->background->mat.diffuse.g, + This->background->mat.diffuse.b, + This->background->mat.diffuse.a); } /* Need to temporarily activate the viewport to clear it. The previously