Conor McCarthy : vkd3d: Handle depth/stencil planes in GetCopyableFootprints().
Alexandre Julliard
julliard at winehq.org
Thu Jan 13 16:15:24 CST 2022
Module: vkd3d
Branch: master
Commit: 2566b8dd8cdd750df7558e37ed64dfe7cf12498f
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=2566b8dd8cdd750df7558e37ed64dfe7cf12498f
Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date: Tue Jan 11 00:01:34 2022 +1000
vkd3d: Handle depth/stencil planes in GetCopyableFootprints().
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d/device.c | 10 ++++++----
tests/d3d12.c | 6 ++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index 4ce3ed8..661ca1d 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -3660,7 +3660,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;
@@ -3694,9 +3694,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_DEPTH_BIT)
+ && (format->vk_aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT)) ? 2 : 1;
+ sub_resources_per_plane = d3d12_resource_desc_get_sub_resource_count(desc);
- if (!vkd3d_bound_range(first_sub_resource, sub_resource_count, desc->MipLevels * array_size))
+ if (!vkd3d_bound_range(first_sub_resource, sub_resource_count, sub_resources_per_plane * plane_count))
{
WARN("Invalid sub-resource range %u-%u for resource.\n", first_sub_resource, sub_resource_count);
return;
@@ -3706,7 +3708,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 13748f1..2507974 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -19550,11 +19550,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));
More information about the wine-cvs
mailing list