From be23a8fc90bade6c1af4f2e317b0b0d8a34593b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 11 Jun 2019 10:13:32 +0200 Subject: [PATCH] vkd3d: Allocate device memory when heap offset is misaligned. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 15dac12a..6bbd5afa 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,