Commit 23696573 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

dxgi: Use CRT allocation functions.

parent 1b7b948a
......@@ -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);
......
......@@ -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;
}
......
......@@ -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)
{
......
......@@ -20,7 +20,6 @@
#define __WINE_DXGI_PRIVATE_H
#include "wine/debug.h"
#include "wine/heap.h"
#include <assert.h>
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment