Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- tests/d3d12.c | 19 +++++++++++++++++++ tests/d3d12_test_utils.h | 1 + 2 files changed, 20 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 323ef23..1e0e25f 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -18810,6 +18810,8 @@ static void test_get_copyable_footprints(void) {DXGI_FORMAT_BC6H_UF16, true}, {DXGI_FORMAT_BC6H_SF16, true}, {DXGI_FORMAT_BC7_UNORM, true}, + {DXGI_FORMAT_D32_FLOAT, false}, + {DXGI_FORMAT_D24_UNORM_S8_UINT, false}, }; static const uint64_t base_offsets[] = { @@ -18855,6 +18857,14 @@ static void test_get_copyable_footprints(void) {D3D12_RESOURCE_DIMENSION_TEXTURE3D, 3, 2, 2, 2, 2, DXGI_FORMAT_BC1_UNORM, {1, 0}, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_NONE}, 0, 1, }, + { + {D3D12_RESOURCE_DIMENSION_TEXTURE2D, 0, 4, 4, 1, 1, DXGI_FORMAT_D32_FLOAT, + {1, 0}, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL}, 0, 2, + }, + { + {D3D12_RESOURCE_DIMENSION_TEXTURE2D, 0, 4, 4, 1, 1, DXGI_FORMAT_D24_UNORM_S8_UINT, + {1, 0}, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL}, 0, 3, + }, };
if (!(device = create_device())) @@ -18894,6 +18904,15 @@ static void test_get_copyable_footprints(void) sub_resource_count = resource_desc.MipLevels; if (resources[i].dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D) sub_resource_count *= resource_desc.DepthOrArraySize; + if (resource_desc.Format == DXGI_FORMAT_D24_UNORM_S8_UINT) + { + if (!vkd3d_test_platform_is_windows()) + { + skip("Depth/stencil planes are not supported.\n"); + continue; + } + sub_resource_count *= 2; + } assert(sub_resource_count <= ARRAY_SIZE(layouts));
for (k = 0; k < ARRAY_SIZE(base_offsets); ++k) diff --git a/tests/d3d12_test_utils.h b/tests/d3d12_test_utils.h index 5092183..f9d49de 100644 --- a/tests/d3d12_test_utils.h +++ b/tests/d3d12_test_utils.h @@ -308,6 +308,7 @@ static unsigned int format_size(DXGI_FORMAT format) case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: case DXGI_FORMAT_R8G8B8A8_UINT: case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_D24_UNORM_S8_UINT: return 4; case DXGI_FORMAT_R16_FLOAT: case DXGI_FORMAT_R16_UNORM:
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/device.c | 11 ++++++----- tests/d3d12.c | 6 ++---- 2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 757d4ac..51c4553 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -3175,7 +3175,7 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device *i = {DXGI_FORMAT_UNKNOWN, VK_FORMAT_UNDEFINED, 1, 1, 1, 1, 0};
unsigned int i, sub_resource_idx, miplevel_idx, row_count, row_size, row_pitch; - unsigned int width, height, depth, array_size; + unsigned int width, height, depth, plane_count, sub_resources_per_plane; const struct vkd3d_format *format; uint64_t offset, size, total;
@@ -3209,10 +3209,11 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device *i return; }
- array_size = d3d12_resource_desc_get_layer_count(desc); + plane_count = (format->vk_aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT) ? 2 : 1; + sub_resources_per_plane = d3d12_resource_desc_get_sub_resource_count(desc);
- if (first_sub_resource >= desc->MipLevels * array_size - || sub_resource_count > desc->MipLevels * array_size - first_sub_resource) + if (first_sub_resource >= sub_resources_per_plane * plane_count + || sub_resource_count > sub_resources_per_plane * plane_count - first_sub_resource) { WARN("Invalid sub-resource range %u-%u for resource.\n", first_sub_resource, sub_resource_count); return; @@ -3222,7 +3223,7 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device *i total = 0; for (i = 0; i < sub_resource_count; ++i) { - sub_resource_idx = first_sub_resource + i; + sub_resource_idx = (first_sub_resource + i) % sub_resources_per_plane; miplevel_idx = sub_resource_idx % desc->MipLevels; width = align(d3d12_resource_desc_get_width(desc, miplevel_idx), format->block_width); height = align(d3d12_resource_desc_get_height(desc, miplevel_idx), format->block_height); diff --git a/tests/d3d12.c b/tests/d3d12.c index 1e0e25f..c3521b7 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -18906,11 +18906,9 @@ static void test_get_copyable_footprints(void) sub_resource_count *= resource_desc.DepthOrArraySize; if (resource_desc.Format == DXGI_FORMAT_D24_UNORM_S8_UINT) { + /* FIXME: we require D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL here for DS formats but windows doesn't. */ if (!vkd3d_test_platform_is_windows()) - { - skip("Depth/stencil planes are not supported.\n"); - continue; - } + resource_desc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; sub_resource_count *= 2; } assert(sub_resource_count <= ARRAY_SIZE(layouts));