d3d8: Reject FBs with mismatching multisample settings.
This commit is contained in:
parent
4d8bfe190c
commit
e09f980c83
|
@ -1185,6 +1185,14 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
|
|||
wined3d_mutex_unlock();
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
if (ds_desc.multisample_type != rt_desc.multisample_type
|
||||
|| ds_desc.multisample_quality != rt_desc.multisample_quality)
|
||||
{
|
||||
WARN("Multisample settings do not match, returing D3DERR_INVALIDCALL\n");
|
||||
wined3d_mutex_unlock();
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device);
|
||||
|
|
|
@ -6855,6 +6855,52 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_multisample_mismatch(void)
|
||||
{
|
||||
IDirect3DDevice8 *device;
|
||||
IDirect3D8 *d3d;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
ULONG refcount;
|
||||
IDirect3DSurface8 *rt_multi, *ds;
|
||||
|
||||
window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||
d3d = Direct3DCreate8(D3D_SDK_VERSION);
|
||||
ok(!!d3d, "Failed to create a D3D object.\n");
|
||||
if (FAILED(IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
||||
D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES)))
|
||||
{
|
||||
skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisample mismatch test.\n");
|
||||
IDirect3D8_Release(d3d);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(device = create_device(d3d, window, window, TRUE)))
|
||||
{
|
||||
skip("Failed to create a D3D device, skipping tests.\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice8_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8,
|
||||
D3DMULTISAMPLE_2_SAMPLES, FALSE, &rt_multi);
|
||||
ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice8_GetDepthStencilSurface(device, &ds);
|
||||
ok(SUCCEEDED(hr), "Failed to get original depth/stencil, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice8_SetRenderTarget(device, rt_multi, ds);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
IDirect3DSurface8_Release(ds);
|
||||
IDirect3DSurface8_Release(rt_multi);
|
||||
|
||||
refcount = IDirect3DDevice8_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
done:
|
||||
IDirect3D8_Release(d3d);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(visual)
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER8 identifier;
|
||||
|
@ -6911,4 +6957,5 @@ START_TEST(visual)
|
|||
test_table_fog_zw();
|
||||
test_signed_formats();
|
||||
test_pointsize();
|
||||
test_multisample_mismatch();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue