mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Allow D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT only for small textures.
Use a simple heuristic to decide if a resource is "small". The heuristic is based on theoretical constraints for the most detailed mip level of small resources. Those constraints are mentioned in D3D12 validation layer errors and in the DirectX 12 Graphics samples. 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
1561c8a9c2
commit
39eb9fe5d8
@ -2076,6 +2076,7 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
|
||||
{
|
||||
UINT64 default_alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
||||
struct d3d12_device *device = impl_from_ID3D12Device(iface);
|
||||
const struct vkd3d_format *format;
|
||||
const D3D12_RESOURCE_DESC *desc;
|
||||
bool valid = true;
|
||||
|
||||
@ -2118,7 +2119,26 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
|
||||
valid = false;
|
||||
}
|
||||
|
||||
info->Alignment = max(info->Alignment, D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT);
|
||||
if (valid && info->Alignment < D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT)
|
||||
{
|
||||
if ((format = vkd3d_format_from_d3d12_resource_desc(desc, 0)))
|
||||
{
|
||||
if (desc->Width * desc->Height * desc->DepthOrArraySize * format->byte_count
|
||||
> D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT)
|
||||
{
|
||||
info->Alignment = max(info->Alignment, D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
info->Alignment = max(info->Alignment, D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN("Invalid format %#x.\n", desc->Format);
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (valid && desc->Alignment % info->Alignment)
|
||||
|
Loading…
Reference in New Issue
Block a user