d3d10core/tests: Multisampled render targets are zeroed on creation.
Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0f67df657d
commit
f37472ae21
|
@ -4637,6 +4637,92 @@ static void test_update_subresource(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_multisample_init(void)
|
||||
{
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
ID3D10Texture2D *backbuffer, *multi;
|
||||
ID3D10Device *device;
|
||||
ULONG refcount;
|
||||
DWORD color;
|
||||
HRESULT hr;
|
||||
unsigned int x, y;
|
||||
struct texture_readback rb;
|
||||
BOOL all_zero = TRUE;
|
||||
UINT count = 0;
|
||||
HWND window;
|
||||
IDXGISwapChain *swapchain;
|
||||
ID3D10RenderTargetView *rtview;
|
||||
static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
if (!(device = create_device()))
|
||||
{
|
||||
skip("Failed to create device, skipping tests.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = ID3D10Device_CheckMultisampleQualityLevels(device, DXGI_FORMAT_R8G8B8A8_UNORM, 2, &count);
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to get quality levels, hr %#x.\n", hr);
|
||||
if (!count)
|
||||
{
|
||||
skip("Multisampling not supported for DXGI_FORMAT_R8G8B8A8_UNORM, skipping tests.\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
window = CreateWindowA("static", "d3d10core_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||
swapchain = create_swapchain(device, window, TRUE);
|
||||
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_ID3D10Texture2D, (void **)&backbuffer);
|
||||
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
|
||||
hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)backbuffer, NULL, &rtview);
|
||||
ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr);
|
||||
ID3D10Device_ClearRenderTargetView(device, rtview, white);
|
||||
|
||||
desc.Width = 640;
|
||||
desc.Height = 480;
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
desc.SampleDesc.Count = 2;
|
||||
desc.SampleDesc.Quality = 0;
|
||||
desc.Usage = D3D10_USAGE_DEFAULT;
|
||||
desc.BindFlags = D3D10_BIND_RENDER_TARGET;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
hr = ID3D10Device_CreateTexture2D(device, &desc, NULL, &multi);
|
||||
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
|
||||
|
||||
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
|
||||
ID3D10Device_ResolveSubresource(device, (ID3D10Resource *)backbuffer, 0,
|
||||
(ID3D10Resource *)multi, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||
|
||||
get_texture_readback(backbuffer, &rb);
|
||||
for (y = 0; y < 480; ++y)
|
||||
{
|
||||
for (x = 0; x < 640; ++x)
|
||||
{
|
||||
color = get_readback_color(&rb, x, y);
|
||||
if (!compare_color(color, 0x00000000, 0))
|
||||
{
|
||||
all_zero = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!all_zero)
|
||||
break;
|
||||
}
|
||||
release_texture_readback(&rb);
|
||||
ok(all_zero, "Got unexpected color 0x%08x, position %ux%u.\n", color, x, y);
|
||||
|
||||
ID3D10RenderTargetView_Release(rtview);
|
||||
ID3D10Texture2D_Release(backbuffer);
|
||||
IDXGISwapChain_Release(swapchain);
|
||||
ID3D10Texture2D_Release(multi);
|
||||
DestroyWindow(window);
|
||||
done:
|
||||
refcount = ID3D10Device_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
|
||||
START_TEST(device)
|
||||
{
|
||||
test_feature_level();
|
||||
|
@ -4664,4 +4750,5 @@ START_TEST(device)
|
|||
test_il_append_aligned();
|
||||
test_fragment_coords();
|
||||
test_update_subresource();
|
||||
test_multisample_init();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue