=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Allocate device memory when heap offset is misaligned.

Alexandre Julliard julliard at winehq.org
Tue Jun 11 16:49:24 CDT 2019


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Jun 11 10:13:32 2019 +0200

vkd3d: Allocate device memory when heap offset is misaligned.

On radv with AMD Polaris GPUs, the alignment may be as high as 0x20000
or 0x40000. World of Warcraft seems to ignore the alignment returned
from GetResourceAllocationInfo(), and simply aligns to 0x10000
(D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT).

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/resource.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 15dac12..6bbd5af 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -1492,7 +1492,7 @@ HRESULT d3d12_committed_resource_create(struct d3d12_device *device,
 }
 
 static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device,
-        struct d3d12_resource *resource, struct d3d12_heap *heap, UINT64 heap_offset)
+        struct d3d12_resource *resource, struct d3d12_heap *heap, uint64_t heap_offset)
 {
     const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
     VkDevice vk_device = device->vk_device;
@@ -1506,16 +1506,16 @@ static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device,
 
     if (heap_offset % requirements.alignment)
     {
-        FIXME("Invalid heap offset %#"PRIx64".\n", heap_offset);
-        return E_INVALIDARG;
+        FIXME("Invalid heap offset %#"PRIx64" (alignment %#"PRIx64").\n",
+                heap_offset, requirements.alignment);
+        goto allocate_memory;
     }
 
     if (!(requirements.memoryTypeBits & (1u << heap->vk_memory_type)))
     {
-        FIXME("Memory type %u cannot be bound to resource %p (allowed types %#x), "
-                "allocating device memory.\n",
+        FIXME("Memory type %u cannot be bound to resource %p (allowed types %#x).\n",
                 heap->vk_memory_type, resource, requirements.memoryTypeBits);
-        return vkd3d_allocate_resource_memory(device, resource, &heap->desc.Properties, heap->desc.Flags);
+        goto allocate_memory;
     }
 
     if (d3d12_resource_is_buffer(resource))
@@ -1534,6 +1534,10 @@ static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device,
     }
 
     return hresult_from_vk_result(vr);
+
+allocate_memory:
+    FIXME("Allocating device memory.\n");
+    return vkd3d_allocate_resource_memory(device, resource, &heap->desc.Properties, heap->desc.Flags);
 }
 
 HRESULT d3d12_placed_resource_create(struct d3d12_device *device, struct d3d12_heap *heap, UINT64 heap_offset,




More information about the wine-cvs mailing list