From: Alex Henrie alexhenrie24@gmail.com
--- dlls/dxgi/adapter.c | 4 ++-- dlls/dxgi/device.c | 10 +++++----- dlls/dxgi/dxgi_main.c | 13 +++++-------- dlls/dxgi/dxgi_private.h | 1 - dlls/dxgi/factory.c | 6 +++--- dlls/dxgi/output.c | 4 ++-- dlls/dxgi/resource.c | 2 +- dlls/dxgi/swapchain.c | 26 +++++++++++++------------- 8 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index b178376341b..975481d40e1 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -80,7 +80,7 @@ static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IWineDXGIAdapter *iface) { wined3d_private_store_cleanup(&adapter->private_store); IWineDXGIFactory_Release(&adapter->factory->IWineDXGIFactory_iface); - heap_free(adapter); + free(adapter); }
return refcount; @@ -447,7 +447,7 @@ static void dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory
HRESULT dxgi_adapter_create(struct dxgi_factory *factory, UINT ordinal, struct dxgi_adapter **adapter) { - if (!(*adapter = heap_alloc(sizeof(**adapter)))) + if (!(*adapter = malloc(sizeof(**adapter)))) return E_OUTOFMEMORY;
dxgi_adapter_init(*adapter, factory, ordinal); diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c index 60febf4d8e1..2b8bb7f305f 100644 --- a/dlls/dxgi/device.c +++ b/dlls/dxgi/device.c @@ -100,7 +100,7 @@ static ULONG STDMETHODCALLTYPE dxgi_device_Release(IWineDXGIDevice *iface) wined3d_mutex_unlock(); IWineDXGIAdapter_Release(device->adapter); wined3d_private_store_cleanup(&device->private_store); - heap_free(device); + free(device); }
return refcount; @@ -341,7 +341,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_resource(IWineDXGIDevice *if "resource %p.\n", iface, wined3d_resource, usage, shared_resource, outer, needs_surface, resource);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) { ERR("Failed to allocate DXGI resource object memory.\n"); return E_OUTOFMEMORY; @@ -350,7 +350,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_resource(IWineDXGIDevice *if if (FAILED(hr = dxgi_resource_init(object, (IDXGIDevice *)iface, outer, needs_surface, wined3d_resource))) { WARN("Failed to initialize resource, hr %#lx.\n", hr); - heap_free(object); + free(object); return hr; }
@@ -455,7 +455,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_factory_create_swapchain(IWineDX if (FAILED(hr)) return hr;
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) { ERR("Failed to allocate swapchain memory.\n"); return E_OUTOFMEMORY; @@ -464,7 +464,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_factory_create_swapchain(IWineDX if (FAILED(hr = d3d11_swapchain_init(object, device, &wined3d_desc))) { WARN("Failed to initialise swapchain, hr %#lx.\n", hr); - heap_free(object); + free(object); return hr; }
diff --git a/dlls/dxgi/dxgi_main.c b/dlls/dxgi/dxgi_main.c index 5dd85a1b374..ca1fb525535 100644 --- a/dlls/dxgi/dxgi_main.c +++ b/dlls/dxgi/dxgi_main.c @@ -32,7 +32,7 @@ static struct dxgi_main dxgi_main;
static void dxgi_main_cleanup(void) { - heap_free(dxgi_main.device_layers); + free(dxgi_main.device_layers); FreeLibrary(dxgi_main.d3d10core); }
@@ -185,7 +185,7 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I device_size = d3d10_layer.get_size(d3d10_layer.id, &get_size_args, 0); device_size += sizeof(*dxgi_device);
- if (!(dxgi_device = heap_alloc_zero(device_size))) + if (!(dxgi_device = calloc(1, device_size))) { ERR("Failed to allocate device memory.\n"); return E_OUTOFMEMORY; @@ -195,7 +195,7 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I if (FAILED(hr)) { WARN("Failed to initialize device, hr %#lx.\n", hr); - heap_free(dxgi_device); + free(dxgi_device); *device = NULL; return hr; } @@ -215,11 +215,8 @@ HRESULT WINAPI DXGID3D10RegisterLayers(const struct dxgi_device_layer *layers, U
wined3d_mutex_lock();
- if (!dxgi_main.layer_count) - new_layers = heap_alloc(layer_count * sizeof(*new_layers)); - else - new_layers = heap_realloc(dxgi_main.device_layers, - (dxgi_main.layer_count + layer_count) * sizeof(*new_layers)); + new_layers = realloc(dxgi_main.device_layers, + (dxgi_main.layer_count + layer_count) * sizeof(*new_layers));
if (!new_layers) { diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index bae728abadb..6d09453df8d 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -20,7 +20,6 @@ #define __WINE_DXGI_PRIVATE_H
#include "wine/debug.h" -#include "wine/heap.h"
#include <assert.h>
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index 8de882b388d..32d54f033eb 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -79,7 +79,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface)
wined3d_decref(factory->wined3d); wined3d_private_store_cleanup(&factory->private_store); - heap_free(factory); + free(factory); }
return refcount; @@ -587,13 +587,13 @@ HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended) struct dxgi_factory *object; HRESULT hr;
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
if (FAILED(hr = dxgi_factory_init(object, extended))) { WARN("Failed to initialize factory, hr %#lx.\n", hr); - heap_free(object); + free(object); return hr; }
diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c index 067488399d2..e828ed0d9d8 100644 --- a/dlls/dxgi/output.c +++ b/dlls/dxgi/output.c @@ -236,7 +236,7 @@ static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput6 *iface) { wined3d_private_store_cleanup(&output->private_store); IWineDXGIAdapter_Release(&output->adapter->IWineDXGIAdapter_iface); - heap_free(output); + free(output); }
return refcount; @@ -725,7 +725,7 @@ static void dxgi_output_init(struct dxgi_output *output, unsigned int output_idx HRESULT dxgi_output_create(struct dxgi_adapter *adapter, unsigned int output_idx, struct dxgi_output **output) { - if (!(*output = heap_alloc_zero(sizeof(**output)))) + if (!(*output = calloc(1, sizeof(**output)))) return E_OUTOFMEMORY;
dxgi_output_init(*output, output_idx, adapter); diff --git a/dlls/dxgi/resource.c b/dlls/dxgi/resource.c index 9699b7672f9..0a2fa097456 100644 --- a/dlls/dxgi/resource.c +++ b/dlls/dxgi/resource.c @@ -77,7 +77,7 @@ static ULONG STDMETHODCALLTYPE dxgi_resource_inner_Release(IUnknown *iface) if (!refcount) { wined3d_private_store_cleanup(&resource->private_store); - heap_free(resource); + free(resource); }
return refcount; diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index 1bb99ef4233..6a26776d35d 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -803,7 +803,7 @@ static void STDMETHODCALLTYPE d3d11_swapchain_wined3d_object_released(void *pare struct d3d11_swapchain *swapchain = parent;
wined3d_private_store_cleanup(&swapchain->private_store); - heap_free(parent); + free(parent); }
static const struct wined3d_parent_ops d3d11_swapchain_wined3d_parent_ops = @@ -1126,7 +1126,7 @@ static void d3d12_swapchain_op_destroy(struct d3d12_swapchain *swapchain, struct vk_funcs->p_vkFreeMemory(swapchain->vk_device, op->resize_buffers.vk_memory, NULL); }
- heap_free(op); + free(op); }
static HRESULT d3d12_swapchain_op_present_execute(struct d3d12_swapchain *swapchain, struct d3d12_swapchain_op *op); @@ -1224,14 +1224,14 @@ static HRESULT select_vk_format(const struct dxgi_vk_funcs *vk_funcs, return DXGI_ERROR_INVALID_CALL; }
- if (!(formats = heap_calloc(format_count, sizeof(*formats)))) + if (!(formats = calloc(format_count, sizeof(*formats)))) return E_OUTOFMEMORY;
if ((vr = vk_funcs->p_vkGetPhysicalDeviceSurfaceFormatsKHR(vk_physical_device, vk_surface, &format_count, formats)) < 0) { WARN("Failed to enumerate supported surface formats, vr %d.\n", vr); - heap_free(formats); + free(formats); return hresult_from_vk_result(vr); }
@@ -1254,7 +1254,7 @@ static HRESULT select_vk_format(const struct dxgi_vk_funcs *vk_funcs, } } } - heap_free(formats); + free(formats); if (i == format_count) { FIXME("Failed to find Vulkan swapchain format for %s.\n", debug_dxgi_format(swapchain_desc->Format)); @@ -1313,7 +1313,7 @@ static BOOL d3d12_swapchain_is_present_mode_supported(struct d3d12_swapchain *sw
supported = FALSE;
- if (!(modes = heap_calloc(count, sizeof(*modes)))) + if (!(modes = calloc(count, sizeof(*modes)))) return FALSE; if ((vr = vk_funcs->p_vkGetPhysicalDeviceSurfacePresentModesKHR(vk_physical_device, swapchain->vk_surface, &count, modes)) >= 0) @@ -1331,7 +1331,7 @@ static BOOL d3d12_swapchain_is_present_mode_supported(struct d3d12_swapchain *sw { WARN("Failed to get available present modes, vr %d.\n", vr); } - heap_free(modes); + free(modes);
return supported; } @@ -1983,7 +1983,7 @@ static ULONG STDMETHODCALLTYPE d3d12_swapchain_Release(IDXGISwapChain4 *iface) if (!refcount) { d3d12_swapchain_destroy(swapchain); - heap_free(swapchain); + free(swapchain); }
return refcount; @@ -2216,7 +2216,7 @@ static HRESULT d3d12_swapchain_present(struct d3d12_swapchain *swapchain, return S_OK; }
- if (!(op = heap_alloc_zero(sizeof(*op)))) + if (!(op = calloc(1, sizeof(*op)))) { WARN("Cannot allocate memory.\n"); return E_OUTOFMEMORY; @@ -2499,7 +2499,7 @@ static HRESULT d3d12_swapchain_resize_buffers(struct d3d12_swapchain *swapchain, return S_OK; }
- if (!(op = heap_alloc_zero(sizeof(*op)))) + if (!(op = calloc(1, sizeof(*op)))) { WARN("Cannot allocate memory.\n"); return E_OUTOFMEMORY; @@ -3304,13 +3304,13 @@ HRESULT d3d12_swapchain_create(IWineDXGIFactory *factory, ID3D12CommandQueue *qu fullscreen_desc = &default_fullscreen_desc; }
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
if (FAILED(hr = ID3D12CommandQueue_GetDevice(queue, &IID_ID3D12Device, (void **)&device))) { ERR("Failed to get d3d12 device, hr %#lx.\n", hr); - heap_free(object); + free(object); return hr; }
@@ -3318,7 +3318,7 @@ HRESULT d3d12_swapchain_create(IWineDXGIFactory *factory, ID3D12CommandQueue *qu ID3D12Device_Release(device); if (FAILED(hr)) { - heap_free(object); + free(object); return hr; }