From e87d51fe5d6879a206f096bf58121221880f582a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 19 May 2016 10:49:40 +0200 Subject: [PATCH] d3d11/tests: Add tests for accessing unbound 2d array textures. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/tests/d3d11.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 72efa3bed82..04a369c6839 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -4339,6 +4339,8 @@ static void test_texture(void) {&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 3.0f, blue_colors}, {&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 3.1f, blue_colors}, {&ps_sample_2d_array, &array_2d_texture, POINT, 0.0f, 0.0f, MIP_MAX, 9.0f, blue_colors}, + {&ps_sample_2d_array, NULL, POINT, 0.0f, 0.0f, 0.0f, 0.0f, zero_colors}, + {&ps_sample_2d_array, NULL, POINT, 0.0f, 0.0f, MIP_MAX, 0.0f, zero_colors}, #undef POINT #undef POINT_LINEAR #undef MIP_MAX @@ -4415,17 +4417,25 @@ static void test_texture(void) current_texture = test->texture; - texture_desc.Width = current_texture->width; - texture_desc.Height = current_texture->height; - texture_desc.MipLevels = current_texture->miplevel_count; - texture_desc.ArraySize = current_texture->array_size; - texture_desc.Format = current_texture->format; + if (current_texture) + { + texture_desc.Width = current_texture->width; + texture_desc.Height = current_texture->height; + texture_desc.MipLevels = current_texture->miplevel_count; + texture_desc.ArraySize = current_texture->array_size; + texture_desc.Format = current_texture->format; - hr = ID3D11Device_CreateTexture2D(device, &texture_desc, current_texture->data, &texture); - ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr); + hr = ID3D11Device_CreateTexture2D(device, &texture_desc, current_texture->data, &texture); + ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr); - hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv); - ok(SUCCEEDED(hr), "Test %u: Failed to create shader resource view, hr %#x.\n", i, hr); + hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv); + ok(SUCCEEDED(hr), "Test %u: Failed to create shader resource view, hr %#x.\n", i, hr); + } + else + { + texture = NULL; + srv = NULL; + } ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &srv); } @@ -4468,9 +4478,11 @@ static void test_texture(void) } release_texture_readback(&rb); } - ID3D11ShaderResourceView_Release(srv); + if (srv) + ID3D11ShaderResourceView_Release(srv); ID3D11SamplerState_Release(sampler); - ID3D11Texture2D_Release(texture); + if (texture) + ID3D11Texture2D_Release(texture); ID3D11PixelShader_Release(ps); ID3D11Buffer_Release(cb);