[PATCH 6/6] d3d10core/tests: Test the creation of textures with invalid multisample settings.

Józef Kucia joseph.kucia at gmail.com
Fri Jan 29 04:15:48 CST 2016


On Fri, Jan 29, 2016 at 12:51 AM, Matteo Bruni <mbruni at codeweavers.com> wrote:
> Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
> ---
>  dlls/d3d10core/tests/device.c | 48 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
> index ae755d3..de3b551 100644
> --- a/dlls/d3d10core/tests/device.c
> +++ b/dlls/d3d10core/tests/device.c
> @@ -5138,6 +5138,53 @@ done:
>      ok(!refcount, "Device has %u references left.\n", refcount);
>  }
>
> +static void test_invalid_multisample(void)
> +{
> +    D3D10_TEXTURE2D_DESC desc;
> +    ID3D10Texture2D *texture;
> +    UINT quality_level_count;
> +    ID3D10Device *device;
> +    ULONG refcount;
> +    HRESULT hr;
> +
> +    if (!(device = create_device()))
> +    {
> +        skip("Failed to create device.\n");
> +        return;
> +    }
> +
> +    ID3D10Device_CheckMultisampleQualityLevels(device, DXGI_FORMAT_R8G8B8A8_UNORM, 2, &quality_level_count);
> +    desc.Width = 128;
> +    desc.Height = 128;
> +    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, &texture);
> +    if (quality_level_count)
> +    {
> +        ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
> +        ID3D10Texture2D_Release(texture);
> +        desc.SampleDesc.Quality = quality_level_count;
> +        hr = ID3D10Device_CreateTexture2D(device, &desc, NULL, &texture);
> +    }
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +
> +    /* We assume 15 samples multisampling is never supported in practice. */
> +    desc.SampleDesc.Count = 15;
> +    desc.SampleDesc.Quality = 0;
> +    hr = ID3D10Device_CreateTexture2D(device, &desc, NULL, &texture);
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +
> +    refcount = ID3D10Device_Release(device);
> +    ok(!refcount, "Device has %u references left.\n", refcount);
> +}
> +
>  START_TEST(device)
>  {
>      test_feature_level();
> @@ -5168,4 +5215,5 @@ START_TEST(device)
>      test_copy_subresource_region();
>      test_multisample_init();
>      test_checkmultisamplequalitylevels();
> +    test_invalid_multisample();
>  }
> --
> 2.4.10
>
>
>

This is fine by me but it could be considered to be merged into
test_create_texture2d().



More information about the wine-devel mailing list