Commit 9b643092 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11/tests: Add more tests for texture data initialization.

parent b3b4a943
......@@ -5262,13 +5262,13 @@ done:
ok(!refcount, "Device has %u references left.\n", refcount);
}
static void test_multisample_init(void)
static void test_texture_data_init(void)
{
static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
struct d3d11_test_context test_context;
ID3D11DeviceContext *context;
D3D11_TEXTURE2D_DESC desc;
ID3D11Texture2D *multi;
ID3D11Texture2D *texture;
ID3D11Device *device;
UINT count = 0;
HRESULT hr;
......@@ -5279,37 +5279,81 @@ static void test_multisample_init(void)
device = test_context.device;
context = test_context.immediate_context;
desc.Width = 640;
desc.Height = 480;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = 0;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
check_texture_color(texture, 0x00000000, 0);
ID3D11Texture2D_Release(texture);
desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
check_texture_color(texture, 0x00000000, 0);
ID3D11Texture2D_Release(texture);
desc.Format = DXGI_FORMAT_D32_FLOAT;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
check_texture_float(texture, 0.0f, 0);
ID3D11Texture2D_Release(texture);
desc.ArraySize = 4;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
check_texture_float(texture, 0.0f, 0);
ID3D11Texture2D_Release(texture);
desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
check_texture_color(texture, 0x00000000, 0);
ID3D11Texture2D_Release(texture);
desc.Format = DXGI_FORMAT_D32_FLOAT;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
check_texture_float(texture, 0.0f, 0);
ID3D11Texture2D_Release(texture);
hr = ID3D11Device_CheckMultisampleQualityLevels(device, DXGI_FORMAT_R8G8B8A8_UNORM, 2, &count);
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;
release_test_context(&test_context);
return;
}
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, 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 = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_RENDER_TARGET;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &multi);
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
ID3D11DeviceContext_ResolveSubresource(context, (ID3D11Resource *)test_context.backbuffer, 0,
(ID3D11Resource *)multi, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
(ID3D11Resource *)texture, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
todo_wine check_texture_color(test_context.backbuffer, 0x00000000, 0);
ID3D11Texture2D_Release(multi);
done:
ID3D11Texture2D_Release(texture);
release_test_context(&test_context);
}
......@@ -6232,7 +6276,7 @@ START_TEST(d3d11)
test_update_subresource();
test_copy_subresource_region();
test_resource_map();
test_multisample_init();
test_texture_data_init();
test_check_multisample_quality_levels();
test_swapchain_flip();
test_clear_render_target_view();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment