=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Use at least D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT for textures.

Alexandre Julliard julliard at winehq.org
Fri Nov 16 12:12:06 CST 2018


Module: vkd3d
Branch: master
Commit: a5646b3aff52b58dad7492a5d460cbed95103a48
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=a5646b3aff52b58dad7492a5d460cbed95103a48

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri Nov 16 13:28:24 2018 +0100

vkd3d: Use at least D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT for textures.

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>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 c854050..cf40e7a 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 7fb0b41..c827785 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;




More information about the wine-cvs mailing list