From 0fb8cdfad5e55e814f6cb7c61935dc5e25cfd132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 25 Aug 2016 19:54:13 +0200 Subject: d3d11/tests: Test the creation of 1d shader resource views in test_create_shader_resource_view. --- dlls/d3d11/tests/d3d11.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index ec5c296..0dd286d 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -3536,6 +3536,7 @@ static void test_create_shader_resource_view(void) D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc; D3D11_TEXTURE3D_DESC texture3d_desc; D3D11_TEXTURE2D_DESC texture2d_desc; + D3D11_TEXTURE1D_DESC texture1d_desc; ULONG refcount, expected_refcount; ID3D11ShaderResourceView *srview; D3D_FEATURE_LEVEL feature_level; @@ -3543,6 +3544,7 @@ static void test_create_shader_resource_view(void) ID3D11Device *device, *tmp; ID3D11Texture3D *texture3d; ID3D11Texture2D *texture2d; + ID3D11Texture1D *texture1d; ID3D11Resource *texture; ID3D11Buffer *buffer; IUnknown *iface; @@ -3575,6 +3577,21 @@ static void test_create_shader_resource_view(void) } tests[] = { + {{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D, 0, 10}}, + {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 10}}, + {{10, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 10}}, + {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D, 0, 10}, {RGBA8_UNORM, TEX_1D, 0, 10}}, + {{ 1, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 1}}, + {{10, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_1D, 0, ~0u}, {RGBA8_UNORM, TEX_1D, 0, 10}}, + {{10, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 0, 4}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 0, 4}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 1, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 1, 9, 0, 4}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 3, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 3, 7, 0, 4}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 5, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 5, 5, 0, 4}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 9, ~0u, 0, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 9, 1, 0, 4}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 1, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 1, 3}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 2, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 2, 2}}, + {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_1D_ARRAY, 0, ~0u, 3, ~0u}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 10, 3, 1}}, {{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0, 10}}, {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 0, ~0u}, {RGBA8_UNORM, TEX_2D, 0, 10}}, {{10, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0, ~0u}, {RGBA8_UNORM, TEX_2D, 0, 10}}, @@ -3769,6 +3786,12 @@ static void test_create_shader_resource_view(void) skip("Structured buffers require feature level 11_0.\n"); } + texture1d_desc.Width = 512; + texture1d_desc.Usage = D3D11_USAGE_DEFAULT; + texture1d_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + texture1d_desc.CPUAccessFlags = 0; + texture1d_desc.MiscFlags = 0; + texture2d_desc.Width = 512; texture2d_desc.Height = 512; texture2d_desc.SampleDesc.Count = 1; @@ -3788,7 +3811,23 @@ static void test_create_shader_resource_view(void) { D3D11_SHADER_RESOURCE_VIEW_DESC *current_desc; - if (tests[i].expected_srv_desc.dimension != D3D11_SRV_DIMENSION_TEXTURE3D) + if (tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE1D || + tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE1DARRAY) + { + texture1d_desc.MipLevels = tests[i].texture.miplevel_count; + texture1d_desc.ArraySize = tests[i].texture.depth_or_array_size; + texture1d_desc.Format = tests[i].texture.format; + + hr = ID3D11Device_CreateTexture1D(device, &texture1d_desc, NULL, &texture1d); + ok(SUCCEEDED(hr), "Test %u: Failed to create 1d texture, hr %#x.\n", i, hr); + texture = (ID3D11Resource *)texture1d; + } + else if (tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2D || + tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2DARRAY || + tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2DMS || + tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY || + tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBE || + tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY) { texture2d_desc.MipLevels = tests[i].texture.miplevel_count; texture2d_desc.ArraySize = tests[i].texture.depth_or_array_size; -- 2.8.1