From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/d3d8/device.c | 19 +++++++++++++++++++ dlls/d3d8/tests/device.c | 8 +++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 036c60edc37..3ff36fc65fb 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -937,6 +937,20 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) return D3DERR_DEVICELOST; } +static BOOL d3d_format_check_multisampled_support(D3DFORMAT format) +{ + switch (format) + { + /* 16-bit format support was patchy as far back as Windows XP, but is nonexistent now. */ + case D3DFMT_R5G6B5: + case D3DFMT_X1R5G5B5: + case D3DFMT_A1R5G5B5: + return FALSE; + default: + return TRUE; + } +} + static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, D3DPRESENT_PARAMETERS *present_parameters) { @@ -953,6 +967,11 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, WARN("App not active, returning D3DERR_DEVICELOST.\n"); return D3DERR_DEVICELOST; } + + if (present_parameters->MultiSampleType + && !d3d_format_check_multisampled_support(present_parameters->BackBufferFormat)) + return D3DERR_INVALIDCALL; + output_idx = device->adapter_ordinal; if (!wined3d_swapchain_desc_from_d3d8(&swapchain_desc, device->d3d_parent->wined3d_outputs[output_idx], present_parameters)) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 019340b191e..250c04c7f51 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -9521,13 +9521,12 @@ static void test_swapchain_multisample_reset(void) const char *name; D3DFORMAT format; HRESULT expected_hr; - BOOL todo; } formats[] = { - {"D3DFMT_R5G6B5", D3DFMT_R5G6B5, D3DERR_INVALIDCALL, TRUE}, - {"D3DFMT_X1R5G5B5", D3DFMT_X1R5G5B5, D3DERR_INVALIDCALL, TRUE}, - {"D3DFMT_A1R5G5B5", D3DFMT_A1R5G5B5, D3DERR_INVALIDCALL, TRUE}, + {"D3DFMT_R5G6B5", D3DFMT_R5G6B5, D3DERR_INVALIDCALL}, + {"D3DFMT_X1R5G5B5", D3DFMT_X1R5G5B5, D3DERR_INVALIDCALL}, + {"D3DFMT_A1R5G5B5", D3DFMT_A1R5G5B5, D3DERR_INVALIDCALL}, {"D3DFMT_X8R8G8B8", D3DFMT_X8R8G8B8}, {"D3DFMT_A8R8G8B8", D3DFMT_A8R8G8B8}, }; @@ -9572,7 +9571,6 @@ static void test_swapchain_multisample_reset(void) present_parameters.Windowed = windowed; present_parameters.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES; hr = IDirect3DDevice8_Reset(device, &present_parameters); - todo_wine_if(formats[i].todo) ok(hr == formats[i].expected_hr, "Unexpected hr %#lx.\n", hr); if (FAILED(hr)) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10874