mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d: Return correctly aligned depth/stencil sizes from GetCopyableFootprints().
This commit is contained in:
parent
1a4dedbc8d
commit
e99906f05d
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
@ -4749,7 +4749,8 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device,
|
|||||||
depth = d3d12_resource_desc_get_depth(desc, miplevel_idx);
|
depth = d3d12_resource_desc_get_depth(desc, miplevel_idx);
|
||||||
row_count = height / format->block_height;
|
row_count = height / format->block_height;
|
||||||
row_size = (width / format->block_width) * format->byte_count * format->block_byte_count;
|
row_size = (width / format->block_width) * format->byte_count * format->block_byte_count;
|
||||||
row_pitch = align(row_size, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
|
/* Direct3D 12 requires double the alignment for dual planes. */
|
||||||
|
row_pitch = align(row_size, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT * plane_count);
|
||||||
|
|
||||||
if (layouts)
|
if (layouts)
|
||||||
{
|
{
|
||||||
@ -4766,7 +4767,7 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device,
|
|||||||
row_sizes[i] = row_size;
|
row_sizes[i] = row_size;
|
||||||
|
|
||||||
size = max(0, row_count - 1) * row_pitch + row_size;
|
size = max(0, row_count - 1) * row_pitch + row_size;
|
||||||
size = max(0, depth - 1) * align(size, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT) + size;
|
size = max(0, depth - 1) * align(size, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT * plane_count) + size;
|
||||||
|
|
||||||
total = offset + size;
|
total = offset + size;
|
||||||
offset = align(total, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
|
offset = align(total, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
|
||||||
|
@ -20263,12 +20263,10 @@ static void check_copyable_footprints_(const char *file, unsigned int line, cons
|
|||||||
unsigned int i, sub_resources_per_plane, plane_count, plane_idx;
|
unsigned int i, sub_resources_per_plane, plane_count, plane_idx;
|
||||||
DXGI_FORMAT expected_format = desc->Format;
|
DXGI_FORMAT expected_format = desc->Format;
|
||||||
uint64_t offset, size, total;
|
uint64_t offset, size, total;
|
||||||
bool format_is_ds;
|
|
||||||
|
|
||||||
sub_resources_per_plane = desc->MipLevels
|
sub_resources_per_plane = desc->MipLevels
|
||||||
* (desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? desc->DepthOrArraySize : 1);
|
* (desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? desc->DepthOrArraySize : 1);
|
||||||
plane_count = format_plane_count(desc->Format);
|
plane_count = format_plane_count(desc->Format);
|
||||||
format_is_ds = plane_count > 1;
|
|
||||||
|
|
||||||
offset = total = 0;
|
offset = total = 0;
|
||||||
for (i = 0; i < sub_resource_count; ++i)
|
for (i = 0; i < sub_resource_count; ++i)
|
||||||
@ -20291,7 +20289,6 @@ static void check_copyable_footprints_(const char *file, unsigned int line, cons
|
|||||||
const D3D12_PLACED_SUBRESOURCE_FOOTPRINT *l = &layouts[i];
|
const D3D12_PLACED_SUBRESOURCE_FOOTPRINT *l = &layouts[i];
|
||||||
const D3D12_SUBRESOURCE_FOOTPRINT *f = &l->Footprint;
|
const D3D12_SUBRESOURCE_FOOTPRINT *f = &l->Footprint;
|
||||||
|
|
||||||
todo_if(format_is_ds && l->Offset != base_offset + offset)
|
|
||||||
ok_(file, line)(l->Offset == base_offset + offset,
|
ok_(file, line)(l->Offset == base_offset + offset,
|
||||||
"Got offset %"PRIu64", expected %"PRIu64".\n", l->Offset, base_offset + offset);
|
"Got offset %"PRIu64", expected %"PRIu64".\n", l->Offset, base_offset + offset);
|
||||||
ok_(file, line)(f->Format == expected_format, "Got format %#x, expected %#x.\n",
|
ok_(file, line)(f->Format == expected_format, "Got format %#x, expected %#x.\n",
|
||||||
@ -20299,7 +20296,6 @@ static void check_copyable_footprints_(const char *file, unsigned int line, cons
|
|||||||
ok_(file, line)(f->Width == width, "Got width %u, expected %u.\n", f->Width, width);
|
ok_(file, line)(f->Width == width, "Got width %u, expected %u.\n", f->Width, width);
|
||||||
ok_(file, line)(f->Height == height, "Got height %u, expected %u.\n", f->Height, height);
|
ok_(file, line)(f->Height == height, "Got height %u, expected %u.\n", f->Height, height);
|
||||||
ok_(file, line)(f->Depth == depth, "Got depth %u, expected %u.\n", f->Depth, depth);
|
ok_(file, line)(f->Depth == depth, "Got depth %u, expected %u.\n", f->Depth, depth);
|
||||||
todo_if(format_is_ds)
|
|
||||||
ok_(file, line)(f->RowPitch == row_pitch, "Got row pitch %u, expected %u.\n", f->RowPitch, row_pitch);
|
ok_(file, line)(f->RowPitch == row_pitch, "Got row pitch %u, expected %u.\n", f->RowPitch, row_pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20318,10 +20314,7 @@ static void check_copyable_footprints_(const char *file, unsigned int line, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (total_size)
|
if (total_size)
|
||||||
{
|
|
||||||
todo_if(format_is_ds && *total_size != total)
|
|
||||||
ok_(file, line)(*total_size == total, "Got total size %"PRIu64", expected %"PRIu64".\n", *total_size, total);
|
ok_(file, line)(*total_size == total, "Got total size %"PRIu64", expected %"PRIu64".\n", *total_size, total);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_copyable_footprints(void)
|
static void test_get_copyable_footprints(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user