From: Józef Kucia jkucia@codeweavers.com
Initializes all fields of struct d3d12_resource in d3d12_resource_init().
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/resource.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 78101a5e1aad..be8bbed54072 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -1138,6 +1138,9 @@ static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12 resource->heap_flags = heap_flags; resource->initial_state = initial_state;
+ resource->heap = NULL; + resource->heap_offset = 0; + resource->device = device; ID3D12Device_AddRef(&device->ID3D12Device_iface);
@@ -1201,9 +1204,6 @@ HRESULT d3d12_committed_resource_create(struct d3d12_device *device, return hr; }
- object->heap = NULL; - object->heap_offset = 0; - TRACE("Created committed resource %p.\n", object);
*resource = object; @@ -1243,8 +1243,15 @@ static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device, else vr = VK_CALL(vkBindImageMemory(vk_device, resource->u.vk_image, heap->vk_memory, heap_offset));
- if (vr < 0) + if (vr == VK_SUCCESS) + { + resource->heap = heap; + resource->heap_offset = heap_offset; + } + else + { WARN("Failed to bind memory, vr %d.\n", vr); + }
return hresult_from_vk_result(vr); } @@ -1266,9 +1273,6 @@ HRESULT d3d12_placed_resource_create(struct d3d12_device *device, struct d3d12_h return hr; }
- object->heap = heap; - object->heap_offset = heap_offset; - TRACE("Created placed resource %p.\n", object);
*resource = object;