mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d: Return the correct depth/stencil plane format from GetCopyableFootprints().
This commit is contained in:
committed by
Henri Verbeet
parent
17adde7f73
commit
1a4dedbc8d
Notes:
Henri Verbeet
2025-01-20 16:18:31 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/899
@@ -4693,10 +4693,11 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device,
|
||||
uint64_t base_offset, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *layouts, UINT *row_counts,
|
||||
UINT64 *row_sizes, UINT64 *total_bytes)
|
||||
{
|
||||
unsigned int i, sub_resource_idx, miplevel_idx, row_count, row_size, row_pitch;
|
||||
unsigned int i, sub_resource_idx, plane_idx, miplevel_idx, row_count, row_size, row_pitch;
|
||||
unsigned int width, height, depth, plane_count, sub_resources_per_plane;
|
||||
const struct vkd3d_format *format;
|
||||
uint64_t offset, size, total;
|
||||
DXGI_FORMAT plane_format;
|
||||
|
||||
if (layouts)
|
||||
memset(layouts, 0xff, sizeof(*layouts) * sub_resource_count);
|
||||
@@ -4719,8 +4720,7 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device,
|
||||
return;
|
||||
}
|
||||
|
||||
plane_count = ((format->vk_aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT)
|
||||
&& (format->vk_aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT)) ? 2 : 1;
|
||||
plane_count = format->plane_count;
|
||||
sub_resources_per_plane = d3d12_resource_desc_get_sub_resource_count(desc);
|
||||
|
||||
if (!vkd3d_bound_range(first_sub_resource, sub_resource_count, sub_resources_per_plane * plane_count))
|
||||
@@ -4731,10 +4731,19 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device,
|
||||
|
||||
offset = 0;
|
||||
total = 0;
|
||||
plane_format = desc->Format;
|
||||
for (i = 0; i < sub_resource_count; ++i)
|
||||
{
|
||||
sub_resource_idx = (first_sub_resource + i) % sub_resources_per_plane;
|
||||
plane_idx = (first_sub_resource + i) / sub_resources_per_plane;
|
||||
miplevel_idx = sub_resource_idx % desc->MipLevels;
|
||||
|
||||
if (plane_count > 1)
|
||||
{
|
||||
plane_format = !plane_idx ? DXGI_FORMAT_R32_TYPELESS : DXGI_FORMAT_R8_TYPELESS;
|
||||
format = vkd3d_get_format(device, plane_format, true);
|
||||
}
|
||||
|
||||
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);
|
||||
depth = d3d12_resource_desc_get_depth(desc, miplevel_idx);
|
||||
@@ -4745,7 +4754,7 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device,
|
||||
if (layouts)
|
||||
{
|
||||
layouts[i].Offset = base_offset + offset;
|
||||
layouts[i].Footprint.Format = desc->Format;
|
||||
layouts[i].Footprint.Format = plane_format;
|
||||
layouts[i].Footprint.Width = width;
|
||||
layouts[i].Footprint.Height = height;
|
||||
layouts[i].Footprint.Depth = depth;
|
||||
|
Reference in New Issue
Block a user