=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Allow D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT only when explicitly requested.

Alexandre Julliard julliard at winehq.org
Tue Jan 22 14:43:48 CST 2019


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri Jan 18 10:25:50 2019 +0100

vkd3d: Allow D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT only when explicitly requested.

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   | 12 ++++++------
 libs/vkd3d/resource.c |  2 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index 52e7410..93af06c 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -2077,6 +2077,7 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
     struct d3d12_device *device = impl_from_ID3D12Device(iface);
     const struct vkd3d_format *format;
     const D3D12_RESOURCE_DESC *desc;
+    UINT64 requested_alignment;
     UINT64 estimated_size;
 
     TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p.\n",
@@ -2101,6 +2102,9 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
         goto invalid;
     }
 
+    requested_alignment = desc->Alignment
+            ? desc->Alignment : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
+
     if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
     {
         info->SizeInBytes = desc->Width;
@@ -2114,6 +2118,8 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
             goto invalid;
         }
 
+        info->Alignment = max(info->Alignment, requested_alignment);
+
         if (info->Alignment < D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT)
         {
             if (!(format = vkd3d_format_from_d3d12_resource_desc(desc, 0)))
@@ -2124,13 +2130,7 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
 
             estimated_size = desc->Width * desc->Height * desc->DepthOrArraySize * format->byte_count;
             if (estimated_size > 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);
-            }
         }
     }
 
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 64d6e65..016d050 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -1085,6 +1085,8 @@ HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC *desc)
             return E_INVALIDARG;
     }
 
+    /* FIXME: Validate alignment for textures. */
+
     return S_OK;
 }
 




More information about the wine-cvs mailing list