From: Stefan Dösinger <stefan@codeweavers.com> Visual Studio 2026 doesn't seem to like .ddpfPixelFormat.xxx initializers when initializing an outer structure. Some of the DDPF fields contained zero even though a different value was assigned during initialzation, in particular .ddpfPixelFormat.dwZBufferBitDepth. No compile error or warning is generated though. https://en.cppreference.com/w/cpp/language/aggregate_initialization.html suggests that the previous construct should be valid in C, but not C++. I guess that's where MSVC's bug comes from. --- dlls/ddraw/tests/ddraw1.c | 10 ++++++++-- dlls/ddraw/tests/ddraw2.c | 10 ++++++++-- dlls/ddraw/tests/ddraw4.c | 32 ++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw7.c | 32 ++++++++++++++++++++++---------- 4 files changed, 60 insertions(+), 24 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 80b3b60c716..dc5a09b671e 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -14409,7 +14409,10 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC), .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, .dwZBufferBitDepth = depth_caps[i].depth, .dwWidth = 64, .dwHeight = 64, @@ -14496,7 +14499,10 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC), .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, .dwZBufferBitDepth = depth_caps[i].depth, .dwWidth = 64, .dwHeight = 64, diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 6377ff51052..77db18c2795 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -15423,7 +15423,10 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC), .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, .dwZBufferBitDepth = depth_caps[i].depth, .dwWidth = 64, .dwHeight = 64, @@ -15516,7 +15519,10 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC), .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, .dwZBufferBitDepth = depth_caps[i].depth, .dwWidth = 64, .dwHeight = 64, diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1e9a964d86d..7ae3b9e53b0 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -18164,11 +18164,17 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC2), .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, - .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), - .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, - .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, - .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, + .ddpfPixelFormat = + { + .dwSize = sizeof(DDPIXELFORMAT), + .dwFlags = DDPF_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwZBitMask = depth_caps[i].mask, + }, .dwWidth = 64, .dwHeight = 64, }; @@ -18260,11 +18266,17 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC2), .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, - .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), - .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, - .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, - .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, + .ddpfPixelFormat = + { + .dwSize = sizeof(DDPIXELFORMAT), + .dwFlags = DDPF_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwZBitMask = depth_caps[i].mask, + }, .dwWidth = 64, .dwHeight = 64, }; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7a3c96fa315..7be07ced606 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -18307,11 +18307,17 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC2), .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, - .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), - .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, - .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, - .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, + .ddpfPixelFormat = + { + .dwSize = sizeof(DDPIXELFORMAT), + .dwFlags = DDPF_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwZBitMask = depth_caps[i].mask, + }, .dwWidth = 64, .dwHeight = 64, }; @@ -18394,11 +18400,17 @@ static void test_caps(void) { .dwSize = sizeof(DDSURFACEDESC2), .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, - .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, - .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), - .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, - .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, - .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .ddsCaps = + { + .dwCaps = DDSCAPS_ZBUFFER, + }, + .ddpfPixelFormat = + { + .dwSize = sizeof(DDPIXELFORMAT), + .dwFlags = DDPF_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwZBitMask = depth_caps[i].mask, + }, .dwWidth = 64, .dwHeight = 64, }; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10372