d3d11: Fix default shader resource views for cube textures.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1ca3a8b7cd
commit
5ac8be243d
|
@ -2578,6 +2578,8 @@ static void test_create_shader_resource_view(void)
|
|||
{{ 1, 12, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, 1}, {RGBA8_UNORM, TEX_3D, 0, 1}},
|
||||
{{ 1, 12, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, ~0u}, {RGBA8_UNORM, TEX_3D, 0, 1}},
|
||||
{{ 4, 12, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, ~0u}, {RGBA8_UNORM, TEX_3D, 0, 4}},
|
||||
{{ 1, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_CUBE, 0, 1}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_CUBE, 0, 2}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_CUBE, 0, ~0u}, {RGBA8_UNORM, TEX_CUBE, 0, 2}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_CUBE, 0, 1}, {RGBA8_UNORM, TEX_CUBE , 0, 1}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_CUBE, 1, 1}, {RGBA8_UNORM, TEX_CUBE , 1, 1}},
|
||||
|
@ -2715,7 +2717,7 @@ static void test_create_shader_resource_view(void)
|
|||
texture2d_desc.Format = tests[i].texture.format;
|
||||
texture2d_desc.MiscFlags = 0;
|
||||
|
||||
if (tests[i].srv_desc.dimension == D3D10_SRV_DIMENSION_TEXTURECUBE)
|
||||
if (tests[i].expected_srv_desc.dimension == D3D10_SRV_DIMENSION_TEXTURECUBE)
|
||||
texture2d_desc.MiscFlags |= D3D10_RESOURCE_MISC_TEXTURECUBE;
|
||||
|
||||
hr = ID3D10Device_CreateTexture2D(device, &texture2d_desc, NULL, &texture2d);
|
||||
|
|
|
@ -3244,15 +3244,23 @@ static void test_create_shader_resource_view(void)
|
|||
{{ 1, 12, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, 1}, {RGBA8_UNORM, TEX_3D, 0, 1}},
|
||||
{{ 1, 12, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, ~0u}, {RGBA8_UNORM, TEX_3D, 0, 1}},
|
||||
{{ 4, 12, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, ~0u}, {RGBA8_UNORM, TEX_3D, 0, 4}},
|
||||
{{ 1, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_CUBE, 0, 1}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_CUBE, 0, 2}},
|
||||
{{ 2, 9, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_CUBE, 0, 2}},
|
||||
{{ 2, 11, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_CUBE, 0, 2}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_CUBE, 0, ~0u}, {RGBA8_UNORM, TEX_CUBE, 0, 2}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_CUBE, 0, 1}, {RGBA8_UNORM, TEX_CUBE , 0, 1}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_CUBE, 1, 1}, {RGBA8_UNORM, TEX_CUBE , 1, 1}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, CUBE_ARRAY, 0, 1, 0, 1}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 1}},
|
||||
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, CUBE_ARRAY, 0, ~0u, 0, ~0u}, {RGBA8_UNORM, CUBE_ARRAY, 0, 2, 0, 1}},
|
||||
{{ 1, 8, RGBA8_UNORM}, {FMT_UNKNOWN, CUBE_ARRAY, 0, ~0u, 0, ~0u}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 1}},
|
||||
{{ 1, 12, RGBA8_UNORM}, {0}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 2}},
|
||||
{{ 1, 12, RGBA8_UNORM}, {FMT_UNKNOWN, CUBE_ARRAY, 0, ~0u, 0, ~0u}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 2}},
|
||||
{{ 1, 12, RGBA8_UNORM}, {FMT_UNKNOWN, CUBE_ARRAY, 0, ~0u, 0, 1}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 1}},
|
||||
{{ 1, 12, RGBA8_UNORM}, {FMT_UNKNOWN, CUBE_ARRAY, 0, ~0u, 0, 2}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 2}},
|
||||
{{ 1, 13, RGBA8_UNORM}, {0}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 2}},
|
||||
{{ 1, 14, RGBA8_UNORM}, {0}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 2}},
|
||||
{{ 1, 18, RGBA8_UNORM}, {0}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 3}},
|
||||
};
|
||||
static const struct
|
||||
{
|
||||
|
@ -3438,11 +3446,13 @@ static void test_create_shader_resource_view(void)
|
|||
texture2d_desc.Format = tests[i].texture.format;
|
||||
texture2d_desc.MiscFlags = 0;
|
||||
|
||||
if (tests[i].srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBE
|
||||
|| tests[i].srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY)
|
||||
if (tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBE
|
||||
|| tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY)
|
||||
texture2d_desc.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE;
|
||||
|
||||
if (tests[i].srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY
|
||||
if (texture2d_desc.MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE
|
||||
&& (texture2d_desc.ArraySize != 6
|
||||
|| tests[i].expected_srv_desc.dimension == D3D11_SRV_DIMENSION_TEXTURECUBEARRAY)
|
||||
&& feature_level < D3D_FEATURE_LEVEL_10_1)
|
||||
{
|
||||
skip("Test %u: Cube map array textures require feature level 10_1.\n", i);
|
||||
|
|
|
@ -520,7 +520,24 @@ static HRESULT set_srv_desc_from_resource(D3D11_SHADER_RESOURCE_VIEW_DESC *desc,
|
|||
ID3D11Texture2D_Release(texture);
|
||||
|
||||
desc->Format = texture_desc.Format;
|
||||
if (texture_desc.ArraySize == 1)
|
||||
if (texture_desc.MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE)
|
||||
{
|
||||
if (texture_desc.ArraySize >= 12)
|
||||
{
|
||||
desc->ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY;
|
||||
desc->u.TextureCubeArray.MostDetailedMip = 0;
|
||||
desc->u.TextureCubeArray.MipLevels = texture_desc.MipLevels;
|
||||
desc->u.TextureCubeArray.First2DArrayFace = 0;
|
||||
desc->u.TextureCubeArray.NumCubes = texture_desc.ArraySize / 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
desc->ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
|
||||
desc->u.TextureCube.MostDetailedMip = 0;
|
||||
desc->u.TextureCube.MipLevels = texture_desc.MipLevels;
|
||||
}
|
||||
}
|
||||
else if (texture_desc.ArraySize == 1)
|
||||
{
|
||||
if (texture_desc.SampleDesc.Count == 1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue