[PATCH vkd3d] vkd3d: Use at least D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT for textures.
Józef Kucia
joseph.kucia at gmail.com
Fri Nov 16 06:28:24 CST 2018
From: Józef Kucia <jkucia at codeweavers.com>
It's the smallest alignment for textures supported by D3D12. Vulkan
implementations may return lower values.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
libs/vkd3d/device.c | 3 +++
tests/d3d12.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index c85405024e75..cf40e7a1f064 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -2062,6 +2062,7 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
}
else
{
+ /* FIXME: Should we support D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT for small MSSA resources? */
if (desc->SampleDesc.Count != 1)
default_alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT;
@@ -2070,6 +2071,8 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
WARN("Failed to get allocation info for texture.\n");
valid = false;
}
+
+ info->Alignment = max(info->Alignment, D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT);
}
if (valid && desc->Alignment % info->Alignment)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 7fb0b4108023..c82778594129 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -21218,6 +21218,8 @@ static void test_suballocate_small_textures(void)
check_alignment(info.SizeInBytes, info.Alignment);
}
+ ok(info.Alignment >= D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT, "Got alignment %"PRIu64".\n", info.Alignment);
+
heap_desc.SizeInBytes = ARRAY_SIZE(textures) * info.SizeInBytes;
memset(&heap_desc.Properties, 0, sizeof(heap_desc.Properties));
heap_desc.Properties.Type = D3D12_HEAP_TYPE_DEFAULT;
--
2.18.1
More information about the wine-devel
mailing list