wined3d: Use CRT allocation functions.

This commit is contained in:
Alex Henrie 2024-02-19 18:40:27 -07:00 committed by Alexandre Julliard
parent 6ec9f446eb
commit 340a4b05b5
27 changed files with 548 additions and 554 deletions

View file

@ -4133,7 +4133,7 @@ static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter_gl *adapter_gl,
attribute = WGL_NUMBER_PIXEL_FORMATS_ARB;
GL_EXTCALL(wglGetPixelFormatAttribivARB(dc, 0, 0, 1, &attribute, &cfg_count));
adapter_gl->pixel_formats = heap_calloc(cfg_count, sizeof(*adapter_gl->pixel_formats));
adapter_gl->pixel_formats = calloc(cfg_count, sizeof(*adapter_gl->pixel_formats));
attribs[attrib_count++] = WGL_RED_BITS_ARB;
attribs[attrib_count++] = WGL_GREEN_BITS_ARB;
attribs[attrib_count++] = WGL_BLUE_BITS_ARB;
@ -4200,7 +4200,7 @@ static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter_gl *adapter_gl,
int cfg_count;
cfg_count = DescribePixelFormat(dc, 0, 0, 0);
adapter_gl->pixel_formats = heap_calloc(cfg_count, sizeof(*adapter_gl->pixel_formats));
adapter_gl->pixel_formats = calloc(cfg_count, sizeof(*adapter_gl->pixel_formats));
for (i = 0, adapter_gl->pixel_format_count = 0; i < cfg_count; ++i)
{
@ -4251,9 +4251,9 @@ static void adapter_gl_destroy(struct wined3d_adapter *adapter)
{
struct wined3d_adapter_gl *adapter_gl = wined3d_adapter_gl(adapter);
heap_free(adapter_gl->pixel_formats);
free(adapter_gl->pixel_formats);
wined3d_adapter_cleanup(adapter);
heap_free(adapter_gl);
free(adapter_gl);
}
static HRESULT adapter_gl_create_device(struct wined3d *wined3d, const struct wined3d_adapter *adapter,
@ -4264,7 +4264,7 @@ static HRESULT adapter_gl_create_device(struct wined3d *wined3d, const struct wi
struct wined3d_device_gl *device_gl;
HRESULT hr;
if (!(device_gl = heap_alloc_zero(sizeof(*device_gl))))
if (!(device_gl = calloc(1, sizeof(*device_gl))))
return E_OUTOFMEMORY;
device_gl->current_fence_id = 1;
@ -4274,7 +4274,7 @@ static HRESULT adapter_gl_create_device(struct wined3d *wined3d, const struct wi
wined3d_adapter_gl_const(adapter)->gl_info.supported, device_parent)))
{
WARN("Failed to initialize device, hr %#lx.\n", hr);
heap_free(device_gl);
free(device_gl);
return hr;
}
@ -4291,8 +4291,8 @@ static void adapter_gl_destroy_device(struct wined3d_device *device)
wined3d_device_cleanup(&device_gl->d);
wined3d_lock_cleanup(&device_gl->allocator_cs);
heap_free(device_gl->retired_blocks);
heap_free(device_gl);
free(device_gl->retired_blocks);
free(device_gl);
}
static struct wined3d_context *adapter_gl_acquire_context(struct wined3d_device *device,
@ -4653,12 +4653,12 @@ static bool adapter_gl_alloc_bo(struct wined3d_device *device, struct wined3d_re
flags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_CLIENT_STORAGE_BIT;
}
if (!(bo_gl = heap_alloc(sizeof(*bo_gl))))
if (!(bo_gl = malloc(sizeof(*bo_gl))))
return false;
if (!(wined3d_device_gl_create_bo(device_gl, NULL, size, binding, usage, coherent, flags, bo_gl)))
{
heap_free(bo_gl);
free(bo_gl);
return false;
}
@ -4702,13 +4702,13 @@ static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device,
TRACE("device %p, desc %p, state_parent %p, parent %p, parent_ops %p, swapchain %p.\n",
device, desc, state_parent, parent, parent_ops, swapchain);
if (!(swapchain_gl = heap_alloc_zero(sizeof(*swapchain_gl))))
if (!(swapchain_gl = calloc(1, sizeof(*swapchain_gl))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_swapchain_gl_init(swapchain_gl, device, desc, state_parent, parent, parent_ops)))
{
WARN("Failed to initialise swapchain, hr %#lx.\n", hr);
heap_free(swapchain_gl);
free(swapchain_gl);
return hr;
}
@ -4723,7 +4723,7 @@ static void adapter_gl_destroy_swapchain(struct wined3d_swapchain *swapchain)
struct wined3d_swapchain_gl *swapchain_gl = wined3d_swapchain_gl(swapchain);
wined3d_swapchain_gl_cleanup(swapchain_gl);
heap_free(swapchain_gl);
free(swapchain_gl);
}
static HRESULT adapter_gl_create_buffer(struct wined3d_device *device,
@ -4736,13 +4736,13 @@ static HRESULT adapter_gl_create_buffer(struct wined3d_device *device,
TRACE("device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.\n",
device, desc, data, parent, parent_ops, buffer);
if (!(buffer_gl = heap_alloc_zero(sizeof(*buffer_gl))))
if (!(buffer_gl = calloc(1, sizeof(*buffer_gl))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_buffer_gl_init(buffer_gl, device, desc, data, parent, parent_ops)))
{
WARN("Failed to initialise buffer, hr %#lx.\n", hr);
heap_free(buffer_gl);
free(buffer_gl);
return hr;
}
@ -4767,7 +4767,7 @@ static void adapter_gl_destroy_buffer(struct wined3d_buffer *buffer)
if (swapchain_count)
wined3d_device_incref(device);
wined3d_buffer_cleanup(&buffer_gl->b);
wined3d_cs_destroy_object(device->cs, heap_free, buffer_gl);
wined3d_cs_destroy_object(device->cs, free, buffer_gl);
if (swapchain_count)
wined3d_device_decref(device);
}
@ -4789,7 +4789,7 @@ static HRESULT adapter_gl_create_texture(struct wined3d_device *device,
layer_count, level_count, flags, parent, parent_ops)))
{
WARN("Failed to initialise texture, hr %#lx.\n", hr);
heap_free(texture_gl);
free(texture_gl);
return hr;
}
@ -4818,7 +4818,7 @@ static void adapter_gl_destroy_texture(struct wined3d_texture *texture)
texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent);
wined3d_texture_cleanup(&texture_gl->t);
wined3d_cs_destroy_object(device->cs, heap_free, texture_gl);
wined3d_cs_destroy_object(device->cs, free, texture_gl);
if (swapchain_count)
wined3d_device_decref(device);
@ -4834,13 +4834,13 @@ static HRESULT adapter_gl_create_rendertarget_view(const struct wined3d_view_des
TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
wined3d_debug_view_desc(desc, resource), resource, parent, parent_ops, view);
if (!(view_gl = heap_alloc_zero(sizeof(*view_gl))))
if (!(view_gl = calloc(1, sizeof(*view_gl))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_rendertarget_view_gl_init(view_gl, desc, resource, parent, parent_ops)))
{
WARN("Failed to initialise view, hr %#lx.\n", hr);
heap_free(view_gl);
free(view_gl);
return hr;
}
@ -4890,8 +4890,8 @@ static void wined3d_view_gl_destroy_object(void *object)
if (ctx->bo_user && ctx->bo_user->valid)
list_remove(&ctx->bo_user->entry);
heap_free(ctx->object);
heap_free(ctx->free);
free(ctx->object);
free(ctx->free);
}
static void wined3d_view_gl_destroy(struct wined3d_device *device, const struct wined3d_gl_view *gl_view,
@ -4899,7 +4899,7 @@ static void wined3d_view_gl_destroy(struct wined3d_device *device, const struct
{
struct wined3d_view_gl_destroy_ctx *ctx, c;
if (!(ctx = heap_alloc(sizeof(*ctx))))
if (!(ctx = malloc(sizeof(*ctx))))
ctx = &c;
ctx->device = device;
ctx->gl_view = gl_view;
@ -4934,13 +4934,13 @@ static HRESULT adapter_gl_create_shader_resource_view(const struct wined3d_view_
TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
wined3d_debug_view_desc(desc, resource), resource, parent, parent_ops, view);
if (!(view_gl = heap_alloc_zero(sizeof(*view_gl))))
if (!(view_gl = calloc(1, sizeof(*view_gl))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_shader_resource_view_gl_init(view_gl, desc, resource, parent, parent_ops)))
{
WARN("Failed to initialise view, hr %#lx.\n", hr);
heap_free(view_gl);
free(view_gl);
return hr;
}
@ -4971,13 +4971,13 @@ static HRESULT adapter_gl_create_unordered_access_view(const struct wined3d_view
TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
wined3d_debug_view_desc(desc, resource), resource, parent, parent_ops, view);
if (!(view_gl = heap_alloc_zero(sizeof(*view_gl))))
if (!(view_gl = calloc(1, sizeof(*view_gl))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_unordered_access_view_gl_init(view_gl, desc, resource, parent, parent_ops)))
{
WARN("Failed to initialise view, hr %#lx.\n", hr);
heap_free(view_gl);
free(view_gl);
return hr;
}
@ -5006,7 +5006,7 @@ static HRESULT adapter_gl_create_sampler(struct wined3d_device *device, const st
TRACE("device %p, desc %p, parent %p, parent_ops %p, sampler %p.\n",
device, desc, parent, parent_ops, sampler);
if (!(sampler_gl = heap_alloc_zero(sizeof(*sampler_gl))))
if (!(sampler_gl = calloc(1, sizeof(*sampler_gl))))
return E_OUTOFMEMORY;
wined3d_sampler_gl_init(sampler_gl, device, desc, parent, parent_ops);
@ -5033,7 +5033,7 @@ static void wined3d_sampler_gl_destroy_object(void *object)
context_release(context);
}
heap_free(sampler_gl);
free(sampler_gl);
}
static void adapter_gl_destroy_sampler(struct wined3d_sampler *sampler)
@ -5374,7 +5374,7 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl,
{
WARN("No suitable pixel formats found.\n");
wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
heap_free(adapter_gl->pixel_formats);
free(adapter_gl->pixel_formats);
return FALSE;
}
@ -5382,7 +5382,7 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl,
{
ERR("Failed to initialize GL format info.\n");
wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
heap_free(adapter_gl->pixel_formats);
free(adapter_gl->pixel_formats);
return FALSE;
}
@ -5397,12 +5397,12 @@ struct wined3d_adapter *wined3d_adapter_gl_create(unsigned int ordinal, unsigned
{
struct wined3d_adapter_gl *adapter;
if (!(adapter = heap_alloc_zero(sizeof(*adapter))))
if (!(adapter = calloc(1, sizeof(*adapter))))
return NULL;
if (!wined3d_adapter_gl_init(adapter, ordinal, wined3d_creation_flags))
{
heap_free(adapter);
free(adapter);
return NULL;
}

View file

@ -204,8 +204,8 @@ static void adapter_vk_destroy(struct wined3d_adapter *adapter)
VK_CALL(vkDestroyInstance(vk_info->instance, NULL));
wined3d_unload_vulkan(vk_info);
wined3d_adapter_cleanup(&adapter_vk->a);
heap_free(adapter_vk->device_extensions);
heap_free(adapter_vk);
free(adapter_vk->device_extensions);
free(adapter_vk);
}
static HRESULT wined3d_select_vulkan_queue_family(const struct wined3d_adapter_vk *adapter_vk,
@ -218,7 +218,7 @@ static HRESULT wined3d_select_vulkan_queue_family(const struct wined3d_adapter_v
VK_CALL(vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &count, NULL));
if (!(queue_properties = heap_calloc(count, sizeof(*queue_properties))))
if (!(queue_properties = calloc(count, sizeof(*queue_properties))))
return E_OUTOFMEMORY;
VK_CALL(vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &count, queue_properties));
@ -229,11 +229,11 @@ static HRESULT wined3d_select_vulkan_queue_family(const struct wined3d_adapter_v
{
*queue_family_index = i;
*timestamp_bits = queue_properties[i].timestampValidBits;
heap_free(queue_properties);
free(queue_properties);
return WINED3D_OK;
}
}
heap_free(queue_properties);
free(queue_properties);
WARN("Failed to find graphics queue.\n");
return E_FAIL;
@ -287,19 +287,19 @@ static struct wined3d_allocator_chunk *wined3d_allocator_vk_create_chunk(struct
struct wined3d_context_vk *context_vk = wined3d_context_vk(context);
struct wined3d_allocator_chunk_vk *chunk_vk;
if (!(chunk_vk = heap_alloc(sizeof(*chunk_vk))))
if (!(chunk_vk = malloc(sizeof(*chunk_vk))))
return NULL;
if (!wined3d_allocator_chunk_init(&chunk_vk->c, allocator))
{
heap_free(chunk_vk);
free(chunk_vk);
return NULL;
}
if (!(chunk_vk->vk_memory = wined3d_context_vk_allocate_vram_chunk_memory(context_vk, memory_type, chunk_size)))
{
wined3d_allocator_chunk_cleanup(&chunk_vk->c);
heap_free(chunk_vk);
free(chunk_vk);
return NULL;
}
list_add_head(&allocator->pools[memory_type].chunks, &chunk_vk->c.entry);
@ -326,7 +326,7 @@ static void wined3d_allocator_vk_destroy_chunk(struct wined3d_allocator_chunk *c
VK_CALL(vkFreeMemory(device_vk->vk_device, chunk_vk->vk_memory, NULL));
TRACE("Freed memory 0x%s.\n", wine_dbgstr_longlong(chunk_vk->vk_memory));
wined3d_allocator_chunk_cleanup(&chunk_vk->c);
heap_free(chunk_vk);
free(chunk_vk);
}
static const struct wined3d_allocator_ops wined3d_allocator_vk_ops =
@ -394,7 +394,7 @@ static HRESULT adapter_vk_create_device(struct wined3d *wined3d, const struct wi
VkResult vr;
HRESULT hr;
if (!(device_vk = heap_alloc_zero(sizeof(*device_vk))))
if (!(device_vk = calloc(1, sizeof(*device_vk))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_select_vulkan_queue_family(adapter_vk, &queue_family_index, &timestamp_bits)))
@ -474,7 +474,7 @@ static HRESULT adapter_vk_create_device(struct wined3d *wined3d, const struct wi
fail:
VK_CALL(vkDestroyDevice(vk_device, NULL));
heap_free(device_vk);
free(device_vk);
return hr;
}
@ -489,7 +489,7 @@ static void adapter_vk_destroy_device(struct wined3d_device *device)
wined3d_lock_cleanup(&device_vk->allocator_cs);
VK_CALL(vkDestroyDevice(device_vk->vk_device, NULL));
heap_free(device_vk);
free(device_vk);
}
static struct wined3d_context *adapter_vk_acquire_context(struct wined3d_device *device,
@ -1218,13 +1218,13 @@ static bool adapter_vk_alloc_bo(struct wined3d_device *device, struct wined3d_re
size = texture->sub_resources[sub_resource_idx].size;
}
if (!(bo_vk = heap_alloc(sizeof(*bo_vk))))
if (!(bo_vk = malloc(sizeof(*bo_vk))))
return false;
if (!(wined3d_context_vk_create_bo(context_vk, size, buffer_usage, memory_type, bo_vk)))
{
WARN("Failed to create Vulkan buffer.\n");
heap_free(bo_vk);
free(bo_vk);
return false;
}
@ -1254,14 +1254,14 @@ static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device,
TRACE("device %p, desc %p, state_parent %p, parent %p, parent_ops %p, swapchain %p.\n",
device, desc, state_parent, parent, parent_ops, swapchain);
if (!(swapchain_vk = heap_alloc_zero(sizeof(*swapchain_vk))))
if (!(swapchain_vk = calloc(1, sizeof(*swapchain_vk))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_swapchain_vk_init(swapchain_vk, device, desc, state_parent, parent,
parent_ops)))
{
WARN("Failed to initialise swapchain, hr %#lx.\n", hr);
heap_free(swapchain_vk);
free(swapchain_vk);
return hr;
}
@ -1276,7 +1276,7 @@ static void adapter_vk_destroy_swapchain(struct wined3d_swapchain *swapchain)
struct wined3d_swapchain_vk *swapchain_vk = wined3d_swapchain_vk(swapchain);
wined3d_swapchain_vk_cleanup(swapchain_vk);
heap_free(swapchain_vk);
free(swapchain_vk);
}
unsigned int wined3d_adapter_vk_get_memory_type_index(const struct wined3d_adapter_vk *adapter_vk,
@ -1306,13 +1306,13 @@ static HRESULT adapter_vk_create_buffer(struct wined3d_device *device,
TRACE("device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.\n",
device, desc, data, parent, parent_ops, buffer);
if (!(buffer_vk = heap_alloc_zero(sizeof(*buffer_vk))))
if (!(buffer_vk = calloc(1, sizeof(*buffer_vk))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_buffer_vk_init(buffer_vk, device, desc, data, parent, parent_ops)))
{
WARN("Failed to initialise buffer, hr %#lx.\n", hr);
heap_free(buffer_vk);
free(buffer_vk);
return hr;
}
@ -1337,7 +1337,7 @@ static void adapter_vk_destroy_buffer(struct wined3d_buffer *buffer)
if (swapchain_count)
wined3d_device_incref(device);
wined3d_buffer_cleanup(&buffer_vk->b);
wined3d_cs_destroy_object(device->cs, heap_free, buffer_vk);
wined3d_cs_destroy_object(device->cs, free, buffer_vk);
if (swapchain_count)
wined3d_device_decref(device);
}
@ -1359,7 +1359,7 @@ static HRESULT adapter_vk_create_texture(struct wined3d_device *device,
layer_count, level_count, flags, parent, parent_ops)))
{
WARN("Failed to initialise texture, hr %#lx.\n", hr);
heap_free(texture_vk);
free(texture_vk);
return hr;
}
@ -1388,7 +1388,7 @@ static void adapter_vk_destroy_texture(struct wined3d_texture *texture)
texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent);
wined3d_texture_cleanup(&texture_vk->t);
wined3d_cs_destroy_object(device->cs, heap_free, texture_vk);
wined3d_cs_destroy_object(device->cs, free, texture_vk);
if (swapchain_count)
wined3d_device_decref(device);
@ -1404,13 +1404,13 @@ static HRESULT adapter_vk_create_rendertarget_view(const struct wined3d_view_des
TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
wined3d_debug_view_desc(desc, resource), resource, parent, parent_ops, view);
if (!(view_vk = heap_alloc_zero(sizeof(*view_vk))))
if (!(view_vk = calloc(1, sizeof(*view_vk))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_rendertarget_view_vk_init(view_vk, desc, resource, parent, parent_ops)))
{
WARN("Failed to initialise view, hr %#lx.\n", hr);
heap_free(view_vk);
free(view_vk);
return hr;
}
@ -1493,8 +1493,8 @@ static void wined3d_view_vk_destroy_object(void *object)
if (context)
context_release(context);
heap_free(ctx->object);
heap_free(ctx->free);
free(ctx->object);
free(ctx->free);
}
static void wined3d_view_vk_destroy(struct wined3d_device *device, VkBufferView *vk_buffer_view,
@ -1503,7 +1503,7 @@ static void wined3d_view_vk_destroy(struct wined3d_device *device, VkBufferView
{
struct wined3d_view_vk_destroy_ctx *ctx, c;
if (!(ctx = heap_alloc(sizeof(*ctx))))
if (!(ctx = malloc(sizeof(*ctx))))
ctx = &c;
ctx->device_vk = wined3d_device_vk(device);
ctx->vk_buffer_view = vk_buffer_view;
@ -1542,13 +1542,13 @@ static HRESULT adapter_vk_create_shader_resource_view(const struct wined3d_view_
TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
wined3d_debug_view_desc(desc, resource), resource, parent, parent_ops, view);
if (!(view_vk = heap_alloc_zero(sizeof(*view_vk))))
if (!(view_vk = calloc(1, sizeof(*view_vk))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_shader_resource_view_vk_init(view_vk, desc, resource, parent, parent_ops)))
{
WARN("Failed to initialise view, hr %#lx.\n", hr);
heap_free(view_vk);
free(view_vk);
return hr;
}
@ -1587,13 +1587,13 @@ static HRESULT adapter_vk_create_unordered_access_view(const struct wined3d_view
TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
wined3d_debug_view_desc(desc, resource), resource, parent, parent_ops, view);
if (!(view_vk = heap_alloc_zero(sizeof(*view_vk))))
if (!(view_vk = calloc(1, sizeof(*view_vk))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_unordered_access_view_vk_init(view_vk, desc, resource, parent, parent_ops)))
{
WARN("Failed to initialise view, hr %#lx.\n", hr);
heap_free(view_vk);
free(view_vk);
return hr;
}
@ -1630,7 +1630,7 @@ static HRESULT adapter_vk_create_sampler(struct wined3d_device *device, const st
TRACE("device %p, desc %p, parent %p, parent_ops %p, sampler %p.\n",
device, desc, parent, parent_ops, sampler);
if (!(sampler_vk = heap_alloc_zero(sizeof(*sampler_vk))))
if (!(sampler_vk = calloc(1, sizeof(*sampler_vk))))
return E_OUTOFMEMORY;
wined3d_sampler_vk_init(sampler_vk, device, desc, parent, parent_ops);
@ -1651,7 +1651,7 @@ static void wined3d_sampler_vk_destroy_object(void *object)
context_vk = wined3d_context_vk(context_acquire(sampler_vk->s.device, NULL, 0));
wined3d_context_vk_destroy_vk_sampler(context_vk, sampler_vk->vk_image_info.sampler, sampler_vk->command_buffer_id);
heap_free(sampler_vk);
free(sampler_vk);
context_release(&context_vk->c);
}
@ -1934,7 +1934,7 @@ static BOOL enable_vulkan_instance_extensions(uint32_t *extension_count,
WARN("Failed to count instance extensions, vr %s.\n", wined3d_debug_vkresult(vr));
goto done;
}
if (!(extensions = heap_calloc(count, sizeof(*extensions))))
if (!(extensions = calloc(count, sizeof(*extensions))))
{
WARN("Out of memory.\n");
goto done;
@ -1978,7 +1978,7 @@ static BOOL enable_vulkan_instance_extensions(uint32_t *extension_count,
success = TRUE;
done:
heap_free(extensions);
free(extensions);
return success;
}
@ -2399,7 +2399,7 @@ static bool wined3d_adapter_vk_init_device_extensions(struct wined3d_adapter_vk
return false;
}
if (!(extensions = heap_calloc(count, sizeof(*extensions))))
if (!(extensions = calloc(count, sizeof(*extensions))))
{
ERR("Failed to allocate extension properties array.\n");
return false;
@ -2470,9 +2470,9 @@ done:
}
else
{
heap_free(enabled_extensions);
free(enabled_extensions);
}
heap_free(extensions);
free(extensions);
return success;
}
@ -2520,7 +2520,7 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
if (!wined3d_adapter_init(adapter, ordinal, luid, &wined3d_adapter_vk_ops))
{
heap_free(adapter_vk->device_extensions);
free(adapter_vk->device_extensions);
goto fail_vulkan;
}
@ -2548,7 +2548,7 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
fail:
wined3d_adapter_cleanup(adapter);
heap_free(adapter_vk->device_extensions);
free(adapter_vk->device_extensions);
fail_vulkan:
VK_CALL(vkDestroyInstance(vk_info->instance, NULL));
wined3d_unload_vulkan(vk_info);
@ -2560,12 +2560,12 @@ struct wined3d_adapter *wined3d_adapter_vk_create(unsigned int ordinal,
{
struct wined3d_adapter_vk *adapter_vk;
if (!(adapter_vk = heap_alloc_zero(sizeof(*adapter_vk))))
if (!(adapter_vk = calloc(1, sizeof(*adapter_vk))))
return NULL;
if (!wined3d_adapter_vk_init(adapter_vk, ordinal, wined3d_creation_flags))
{
heap_free(adapter_vk);
free(adapter_vk);
return NULL;
}

View file

@ -3915,7 +3915,7 @@ static void clone_sig(struct wined3d_shader_signature *new, const struct wined3d
char *name;
new->element_count = sig->element_count;
new->elements = heap_calloc(new->element_count, sizeof(*new->elements));
new->elements = calloc(new->element_count, sizeof(*new->elements));
for (i = 0; i < sig->element_count; ++i)
{
new->elements[i] = sig->elements[i];
@ -3924,7 +3924,7 @@ static void clone_sig(struct wined3d_shader_signature *new, const struct wined3d
continue;
/* Clone the semantic string */
name = heap_alloc(strlen(sig->elements[i].semantic_name) + 1);
name = malloc(strlen(sig->elements[i].semantic_name) + 1);
strcpy(name, sig->elements[i].semantic_name);
new->elements[i].semantic_name = name;
}
@ -3941,7 +3941,7 @@ static unsigned int find_input_signature(struct shader_arb_priv *priv, const str
TRACE("Found existing signature %u\n", found_sig->idx);
return found_sig->idx;
}
found_sig = heap_alloc_zero(sizeof(*found_sig));
found_sig = calloc(1, sizeof(*found_sig));
clone_sig(&found_sig->sig, sig);
found_sig->idx = priv->ps_sig_number++;
TRACE("New signature stored and assigned number %u\n", found_sig->idx);
@ -4282,7 +4282,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_context_gl
{
struct shader_arb_priv *priv = device->shader_priv;
shader->backend_data = heap_alloc_zero(sizeof(*shader_data));
shader->backend_data = calloc(1, sizeof(*shader_data));
shader_data = shader->backend_data;
shader_data->clamp_consts = shader->reg_maps.shader_version.major == 1;
@ -4316,12 +4316,11 @@ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_context_gl
if (shader_data->num_gl_shaders)
{
new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2);
new_array = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, shader_data->gl_shaders,
new_size * sizeof(*shader_data->gl_shaders));
new_array = _recalloc(shader_data->gl_shaders, new_size, sizeof(*shader_data->gl_shaders));
}
else
{
new_array = heap_alloc_zero(sizeof(*shader_data->gl_shaders));
new_array = calloc(1, sizeof(*shader_data->gl_shaders));
new_size = 1;
}
@ -4377,7 +4376,7 @@ static struct arb_vs_compiled_shader *find_arb_vshader(struct wined3d_shader *sh
{
const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
shader->backend_data = heap_alloc_zero(sizeof(*shader_data));
shader->backend_data = calloc(1, sizeof(*shader_data));
shader_data = shader->backend_data;
if ((gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT)
@ -4415,12 +4414,11 @@ static struct arb_vs_compiled_shader *find_arb_vshader(struct wined3d_shader *sh
if (shader_data->num_gl_shaders)
{
new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2);
new_array = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, shader_data->gl_shaders,
new_size * sizeof(*shader_data->gl_shaders));
new_array = _recalloc(shader_data->gl_shaders, new_size, sizeof(*shader_data->gl_shaders));
}
else
{
new_array = heap_alloc_zero(sizeof(*shader_data->gl_shaders));
new_array = calloc(1, sizeof(*shader_data->gl_shaders));
new_size = 1;
}
@ -4818,7 +4816,7 @@ static void shader_arb_destroy(struct wined3d_shader *shader)
for (i = 0; i < shader_data->num_gl_shaders; ++i)
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
heap_free(shader_data->gl_shaders);
free(shader_data->gl_shaders);
}
else
{
@ -4827,14 +4825,14 @@ static void shader_arb_destroy(struct wined3d_shader *shader)
for (i = 0; i < shader_data->num_gl_shaders; ++i)
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
heap_free(shader_data->gl_shaders);
free(shader_data->gl_shaders);
}
checkGLcall("delete programs");
context_release(context);
heap_free(shader->backend_data);
free(shader->backend_data);
shader->backend_data = NULL;
}
@ -4851,13 +4849,13 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
void *vertex_priv, *fragment_priv;
struct shader_arb_priv *priv;
if (!(priv = heap_alloc_zero(sizeof(*priv))))
if (!(priv = calloc(1, sizeof(*priv))))
return E_OUTOFMEMORY;
if (!(vertex_priv = vertex_pipe->vp_alloc(&arb_program_shader_backend, priv)))
{
ERR("Failed to initialize vertex pipe.\n");
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -4865,7 +4863,7 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
{
ERR("Failed to initialize fragment pipe.\n");
vertex_pipe->vp_free(device, NULL);
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -4893,10 +4891,10 @@ static void release_signature(struct wine_rb_entry *entry, void *context)
for (i = 0; i < sig->sig.element_count; ++i)
{
heap_free((char *)sig->sig.elements[i].semantic_name);
free((char *)sig->sig.elements[i].semantic_name);
}
heap_free(sig->sig.elements);
heap_free(sig);
free(sig->sig.elements);
free(sig);
}
/* Context activation is done by the caller. */
@ -4907,7 +4905,7 @@ static void shader_arb_free(struct wined3d_device *device, struct wined3d_contex
wine_rb_destroy(&priv->signature_tree, release_signature, NULL);
priv->fragment_pipe->free_private(device, context);
priv->vertex_pipe->vp_free(device, context);
heap_free(device->shader_priv);
free(device->shader_priv);
}
static BOOL shader_arb_allocate_context_data(struct wined3d_context *context)
@ -5383,33 +5381,33 @@ static void record_instruction(struct list *list, const struct wined3d_shader_in
struct recorded_instruction *rec;
unsigned int i;
if (!(rec = heap_alloc_zero(sizeof(*rec))))
if (!(rec = calloc(1, sizeof(*rec))))
{
ERR("Out of memory\n");
return;
}
rec->ins = *ins;
if (!(dst_param = heap_alloc(sizeof(*dst_param))))
if (!(dst_param = malloc(sizeof(*dst_param))))
goto free;
*dst_param = *ins->dst;
if (ins->dst->reg.idx[0].rel_addr)
{
if (!(rel_addr = heap_alloc(sizeof(*rel_addr))))
if (!(rel_addr = malloc(sizeof(*rel_addr))))
goto free;
*rel_addr = *ins->dst->reg.idx[0].rel_addr;
dst_param->reg.idx[0].rel_addr = rel_addr;
}
rec->ins.dst = dst_param;
if (!(src_param = heap_calloc(ins->src_count, sizeof(*src_param))))
if (!(src_param = calloc(ins->src_count, sizeof(*src_param))))
goto free;
for (i = 0; i < ins->src_count; ++i)
{
src_param[i] = ins->src[i];
if (ins->src[i].reg.idx[0].rel_addr)
{
if (!(rel_addr = heap_alloc(sizeof(*rel_addr))))
if (!(rel_addr = malloc(sizeof(*rel_addr))))
goto free;
*rel_addr = *ins->src[i].reg.idx[0].rel_addr;
src_param[i].reg.idx[0].rel_addr = rel_addr;
@ -5423,18 +5421,18 @@ free:
ERR("Out of memory\n");
if (dst_param)
{
heap_free((void *)dst_param->reg.idx[0].rel_addr);
heap_free(dst_param);
free((void *)dst_param->reg.idx[0].rel_addr);
free(dst_param);
}
if (src_param)
{
for (i = 0; i < ins->src_count; ++i)
{
heap_free((void *)src_param[i].reg.idx[0].rel_addr);
free((void *)src_param[i].reg.idx[0].rel_addr);
}
heap_free(src_param);
free(src_param);
}
heap_free(rec);
free(rec);
}
static void free_recorded_instruction(struct list *list)
@ -5447,18 +5445,18 @@ static void free_recorded_instruction(struct list *list)
list_remove(&rec_ins->entry);
if (rec_ins->ins.dst)
{
heap_free((void *)rec_ins->ins.dst->reg.idx[0].rel_addr);
heap_free((void *)rec_ins->ins.dst);
free((void *)rec_ins->ins.dst->reg.idx[0].rel_addr);
free((void *)rec_ins->ins.dst);
}
if (rec_ins->ins.src)
{
for (i = 0; i < rec_ins->ins.src_count; ++i)
{
heap_free((void *)rec_ins->ins.src[i].reg.idx[0].rel_addr);
free((void *)rec_ins->ins.src[i].reg.idx[0].rel_addr);
}
heap_free((void *)rec_ins->ins.src);
free((void *)rec_ins->ins.src);
}
heap_free(rec_ins);
free(rec_ins);
}
}
@ -5472,7 +5470,7 @@ static void pop_control_frame(const struct wined3d_shader_instruction *ins)
struct list *e = list_head(&priv->control_frames);
control_frame = LIST_ENTRY(e, struct control_frame, entry);
list_remove(&control_frame->entry);
heap_free(control_frame);
free(control_frame);
priv->loop_depth--;
}
else if (ins->handler_idx == WINED3DSIH_ENDIF)
@ -5481,7 +5479,7 @@ static void pop_control_frame(const struct wined3d_shader_instruction *ins)
struct list *e = list_head(&priv->control_frames);
control_frame = LIST_ENTRY(e, struct control_frame, entry);
list_remove(&control_frame->entry);
heap_free(control_frame);
free(control_frame);
}
}
@ -5495,7 +5493,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
if(ins->handler_idx == WINED3DSIH_LOOP || ins->handler_idx == WINED3DSIH_REP)
{
control_frame = heap_alloc_zero(sizeof(*control_frame));
control_frame = calloc(1, sizeof(*control_frame));
list_add_head(&priv->control_frames, &control_frame->entry);
if(ins->handler_idx == WINED3DSIH_LOOP) control_frame->type = LOOP;
@ -5592,13 +5590,13 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
shader_addline(buffer, "#end loop/rep\n");
free_recorded_instruction(&copy);
heap_free(control_frame);
free(control_frame);
return; /* Instruction is handled */
}
else
{
/* This is a nested loop. Proceed to the normal recording function */
heap_free(control_frame);
free(control_frame);
}
}
}
@ -5612,7 +5610,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
/* boolean if */
if(ins->handler_idx == WINED3DSIH_IF)
{
control_frame = heap_alloc_zero(sizeof(*control_frame));
control_frame = calloc(1, sizeof(*control_frame));
list_add_head(&priv->control_frames, &control_frame->entry);
control_frame->type = IF;
@ -5632,7 +5630,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
else if(ins->handler_idx == WINED3DSIH_IFC)
{
/* IF(bool) and if_cond(a, b) use the same ELSE and ENDIF tokens */
control_frame = heap_alloc_zero(sizeof(*control_frame));
control_frame = calloc(1, sizeof(*control_frame));
control_frame->type = IFC;
control_frame->no.ifc = priv->num_ifcs++;
list_add_head(&priv->control_frames, &control_frame->entry);
@ -5667,7 +5665,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
shader_addline(buffer, "#} endif\n");
if(control_frame->muting) priv->muted = FALSE;
list_remove(&control_frame->entry);
heap_free(control_frame);
free(control_frame);
return; /* Instruction is handled */
}
/* In case of an ifc, generate a HW shader instruction */
@ -5758,7 +5756,7 @@ static void *arbfp_alloc(const struct wined3d_shader_backend_ops *shader_backend
* invalidate some data when switching between FFP and fragment shaders. */
if (shader_backend == &arb_program_shader_backend)
priv = shader_priv;
else if (!(priv = heap_alloc_zero(sizeof(*priv))))
else if (!(priv = calloc(1, sizeof(*priv))))
return NULL;
wine_rb_init(&priv->fragment_shaders, wined3d_ffp_frag_program_key_compare);
@ -5776,7 +5774,7 @@ static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *param)
gl_info = context_gl->gl_info;
GL_EXTCALL(glDeleteProgramsARB(1, &entry_arb->shader));
checkGLcall("delete ffp program");
heap_free(entry_arb);
free(entry_arb);
}
/* Context activation is done by the caller. */
@ -5788,7 +5786,7 @@ static void arbfp_free(struct wined3d_device *device, struct wined3d_context *co
wine_rb_destroy(&priv->fragment_shaders, arbfp_free_ffpshader, context_gl);
if (device->shader_backend != &arb_program_shader_backend)
heap_free(device->fragment_priv);
free(device->fragment_priv);
}
static void arbfp_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps)
@ -6552,7 +6550,7 @@ static void arbfp_update_shader(struct wined3d_context *context, const struct wi
{
struct arbfp_ffp_desc *new_desc;
if (!(new_desc = heap_alloc(sizeof(*new_desc))))
if (!(new_desc = malloc(sizeof(*new_desc))))
{
ERR("Out of memory\n");
return;
@ -6845,7 +6843,7 @@ static void arbfp_free_blit_shader(struct wine_rb_entry *entry, void *ctx)
GL_EXTCALL(glDeleteProgramsARB(1, &entry_arb->shader));
checkGLcall("glDeleteProgramsARB(1, &entry_arb->shader)");
heap_free(entry_arb);
free(entry_arb);
}
/* Context activation is done by the caller. */
@ -6867,7 +6865,7 @@ static void arbfp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3
if (arbfp_blitter->palette_texture)
gl_info->gl_ops.gl.p_glDeleteTextures(1, &arbfp_blitter->palette_texture);
heap_free(arbfp_blitter);
free(arbfp_blitter);
}
static void gen_packed_yuv_read(struct wined3d_string_buffer *buffer,
@ -7580,7 +7578,7 @@ static HRESULT arbfp_blit_set(struct wined3d_arbfp_blitter *blitter, struct wine
return E_NOTIMPL;
}
if (!(desc = heap_alloc(sizeof(*desc))))
if (!(desc = malloc(sizeof(*desc))))
goto err_out;
desc->type = type;
@ -7593,7 +7591,7 @@ err_out:
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader))");
GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0));
checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0)");
heap_free(desc);
free(desc);
return E_OUTOFMEMORY;
}
}
@ -7894,7 +7892,7 @@ void wined3d_arbfp_blitter_create(struct wined3d_blitter **next, const struct wi
if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
return;
if (!(blitter = heap_alloc(sizeof(*blitter))))
if (!(blitter = malloc(sizeof(*blitter))))
{
ERR("Failed to allocate blitter.\n");
return;

View file

@ -1028,7 +1028,7 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined
{
struct atifs_ffp_desc *new_desc;
if (!(new_desc = heap_alloc_zero(sizeof(*new_desc))))
if (!(new_desc = calloc(1, sizeof(*new_desc))))
{
ERR("Out of memory\n");
return;
@ -1334,7 +1334,7 @@ static void *atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend
{
struct atifs_private_data *priv;
if (!(priv = heap_alloc_zero(sizeof(*priv))))
if (!(priv = calloc(1, sizeof(*priv))))
return NULL;
wine_rb_init(&priv->fragment_shaders, wined3d_ffp_frag_program_key_compare);
@ -1351,7 +1351,7 @@ static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *param)
gl_info = context_gl->gl_info;
GL_EXTCALL(glDeleteFragmentShaderATI(entry_ati->shader));
checkGLcall("glDeleteFragmentShaderATI(entry->shader)");
heap_free(entry_ati);
free(entry_ati);
}
/* Context activation is done by the caller. */
@ -1362,7 +1362,7 @@ static void atifs_free(struct wined3d_device *device, struct wined3d_context *co
wine_rb_destroy(&priv->fragment_shaders, atifs_free_ffpshader, context_gl);
heap_free(priv);
free(priv);
device->fragment_priv = NULL;
}
@ -1377,7 +1377,7 @@ static BOOL atifs_alloc_context_data(struct wined3d_context *context)
{
struct atifs_context_private_data *priv;
if (!(priv = heap_alloc_zero(sizeof(*priv))))
if (!(priv = calloc(1, sizeof(*priv))))
return FALSE;
context->fragment_pipe_data = priv;
return TRUE;
@ -1385,7 +1385,7 @@ static BOOL atifs_alloc_context_data(struct wined3d_context *context)
static void atifs_free_context_data(struct wined3d_context *context)
{
heap_free(context->fragment_pipe_data);
free(context->fragment_pipe_data);
}
const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline =

View file

@ -203,7 +203,7 @@ static void wined3d_buffer_gl_destroy_buffer_object(struct wined3d_buffer_gl *bu
if (!--bo_gl->b.refcount)
{
wined3d_context_gl_destroy_bo(context_gl, bo_gl);
heap_free(bo_gl);
free(bo_gl);
}
buffer_gl->b.buffer_object = NULL;
}
@ -224,7 +224,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
TRACE("Creating an OpenGL buffer object for wined3d buffer %p with usage %s.\n",
buffer_gl, debug_d3dusage(buffer_gl->b.resource.usage));
if (!(bo = heap_alloc(sizeof(*bo))))
if (!(bo = malloc(sizeof(*bo))))
return FALSE;
size = buffer_gl->b.resource.size;
@ -240,7 +240,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
ERR("Failed to create OpenGL buffer object.\n");
buffer_gl->b.flags &= ~WINED3D_BUFFER_USE_BO;
buffer_clear_dirty_areas(&buffer_gl->b);
heap_free(bo);
free(bo);
return FALSE;
}
@ -283,8 +283,8 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *buffer,
*/
TRACE("Reconverting because converted attributes occur, and the stride changed.\n");
buffer->stride = *stride_this_run;
heap_free(buffer->conversion_map);
buffer->conversion_map = heap_calloc(buffer->stride, sizeof(*buffer->conversion_map));
free(buffer->conversion_map);
buffer->conversion_map = calloc(buffer->stride, sizeof(*buffer->conversion_map));
ret = TRUE;
}
}
@ -366,7 +366,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_s
TRACE("No fixup required.\n");
if(This->conversion_map)
{
heap_free(This->conversion_map);
free(This->conversion_map);
This->conversion_map = NULL;
This->stride = 0;
return TRUE;
@ -457,7 +457,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_s
/* Sanity test */
if (!ret)
ERR("no converted attributes found, old conversion map exists, and no declaration change?\n");
heap_free(This->conversion_map);
free(This->conversion_map);
This->conversion_map = NULL;
This->stride = 0;
}
@ -528,7 +528,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
/* Now for each vertex in the buffer that needs conversion. */
vertex_count = buffer->resource.size / buffer->stride;
if (!(data = heap_alloc(buffer->resource.size)))
if (!(data = malloc(buffer->resource.size)))
{
ERR("Out of memory.\n");
return;
@ -571,7 +571,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
wined3d_context_copy_bo_address(context, &dst, &src,
buffer->dirty_range_count, buffer->dirty_ranges, WINED3D_MAP_WRITE);
heap_free(data);
free(data);
}
BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer,
@ -747,7 +747,7 @@ static void buffer_resource_unload(struct wined3d_resource *resource)
context_release(context);
heap_free(buffer->conversion_map);
free(buffer->conversion_map);
buffer->conversion_map = NULL;
buffer->stride = 0;
buffer->conversion_stride = 0;
@ -776,8 +776,8 @@ static void wined3d_buffer_destroy_object(void *object)
wined3d_buffer_unload_location(buffer, context, WINED3D_LOCATION_BUFFER);
context_release(context);
}
heap_free(buffer->conversion_map);
heap_free(buffer->dirty_ranges);
free(buffer->conversion_map);
free(buffer->dirty_ranges);
}
void wined3d_buffer_cleanup(struct wined3d_buffer *buffer)
@ -1144,7 +1144,7 @@ static void wined3d_buffer_set_bo(struct wined3d_buffer *buffer, struct wined3d_
if (!--prev_bo->refcount)
{
wined3d_context_destroy_bo(context, prev_bo);
heap_free(prev_bo);
free(prev_bo);
}
}
@ -1570,7 +1570,7 @@ static BOOL wined3d_buffer_vk_create_buffer_object(struct wined3d_buffer_vk *buf
struct wined3d_resource *resource = &buffer_vk->b.resource;
struct wined3d_bo_vk *bo_vk;
if (!(bo_vk = heap_alloc(sizeof(*bo_vk))))
if (!(bo_vk = malloc(sizeof(*bo_vk))))
return FALSE;
if (!(wined3d_context_vk_create_bo(context_vk, resource->size,
@ -1578,7 +1578,7 @@ static BOOL wined3d_buffer_vk_create_buffer_object(struct wined3d_buffer_vk *buf
vk_memory_type_from_access_flags(resource->access, resource->usage), bo_vk)))
{
WARN("Failed to create Vulkan buffer.\n");
heap_free(bo_vk);
free(bo_vk);
return FALSE;
}
@ -1642,7 +1642,7 @@ static void wined3d_buffer_vk_unload_location(struct wined3d_buffer *buffer,
if (!--bo_vk->b.refcount)
{
wined3d_context_vk_destroy_bo(context_vk, bo_vk);
heap_free(bo_vk);
free(bo_vk);
}
buffer->buffer_object = NULL;
break;

View file

@ -578,7 +578,7 @@ static struct fbo_entry *wined3d_context_gl_create_fbo_entry(const struct wined3
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
struct fbo_entry *entry;
entry = heap_alloc(sizeof(*entry));
entry = malloc(sizeof(*entry));
wined3d_context_gl_generate_fbo_key(context_gl, &entry->key,
render_targets, depth_stencil, color_location, ds_location);
entry->flags = 0;
@ -629,7 +629,7 @@ static void wined3d_context_gl_destroy_fbo_entry(struct wined3d_context_gl *cont
}
--context_gl->fbo_entry_count;
list_remove(&entry->entry);
heap_free(entry);
free(entry);
}
/* Context activation is done by the caller. */
@ -1462,12 +1462,12 @@ static void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
checkGLcall("context cleanup");
}
heap_free(context_gl->submitted.fences);
heap_free(context_gl->free_pipeline_statistics_queries);
heap_free(context_gl->free_so_statistics_queries);
heap_free(context_gl->free_timestamp_queries);
heap_free(context_gl->free_fences);
heap_free(context_gl->free_occlusion_queries);
free(context_gl->submitted.fences);
free(context_gl->free_pipeline_statistics_queries);
free(context_gl->free_so_statistics_queries);
free(context_gl->free_timestamp_queries);
free(context_gl->free_fences);
free(context_gl->free_occlusion_queries);
LIST_FOR_EACH_ENTRY(pipeline_statistics_query, &context_gl->pipeline_statistics_queries,
struct wined3d_pipeline_statistics_query, entry)
@ -1534,7 +1534,7 @@ static void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
wined3d_context_gl_destroy_fbo_entry(context_gl, entry);
}
heap_free(context_gl->texture_type);
free(context_gl->texture_type);
wined3d_context_gl_restore_pixel_format(context_gl);
if (restore_ctx)
@ -1584,8 +1584,8 @@ BOOL wined3d_context_gl_set_current(struct wined3d_context_gl *context_gl)
{
TRACE("Switching away from destroyed context %p.\n", old);
wined3d_context_gl_cleanup(old);
heap_free((void *)old->gl_info);
heap_free(old);
free((void *)old->gl_info);
free(old);
}
else
{
@ -2169,7 +2169,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
}
}
if (!(context_gl->texture_type = heap_calloc(gl_info->limits.combined_samplers,
if (!(context_gl->texture_type = calloc(gl_info->limits.combined_samplers,
sizeof(*context_gl->texture_type))))
goto fail;
@ -2341,7 +2341,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
return WINED3D_OK;
fail:
heap_free(context_gl->texture_type);
free(context_gl->texture_type);
wined3d_release_dc(context_gl->window, context_gl->dc);
return E_FAIL;
}
@ -2375,7 +2375,7 @@ void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl)
/* Make a copy of gl_info for wined3d_context_gl_cleanup() use, the
* one in wined3d_adapter may go away in the meantime. */
gl_info = heap_alloc(sizeof(*gl_info));
gl_info = malloc(sizeof(*gl_info));
*gl_info = *context_gl->gl_info;
context_gl->gl_info = gl_info;
context_gl->c.destroyed = 1;
@ -2385,7 +2385,7 @@ void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl)
wined3d_context_gl_cleanup(context_gl);
TlsSetValue(context_get_tls_idx(), NULL);
heap_free(context_gl);
free(context_gl);
}
const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl *context_gl,

View file

@ -430,7 +430,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
}
else
{
if (!(slab = heap_alloc_zero(sizeof(*slab))))
if (!(slab = calloc(1, sizeof(*slab))))
{
wined3d_device_vk_allocator_unlock(device_vk);
ERR("Failed to allocate bo slab.\n");
@ -441,7 +441,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
{
wined3d_device_vk_allocator_unlock(device_vk);
ERR("Failed to add slab to available tree.\n");
heap_free(slab);
free(slab);
return false;
}
@ -451,7 +451,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
wined3d_device_vk_allocator_unlock(device_vk);
ERR("Failed to create slab bo.\n");
wine_rb_remove(&context_vk->bo_slab_available, &slab->entry);
heap_free(slab);
free(slab);
return false;
}
slab->map = ~0u;
@ -1277,7 +1277,7 @@ static void wined3d_context_vk_destroy_bo_slab(struct wine_rb_entry *entry, void
{
next = slab->next;
wined3d_context_vk_destroy_bo(context_vk, &slab->bo);
heap_free(slab);
free(slab);
slab = next;
}
}
@ -1294,7 +1294,7 @@ static void wined3d_context_vk_destroy_graphics_pipeline(struct wine_rb_entry *e
device_vk = wined3d_device_vk(context_vk->c.device);
VK_CALL(vkDestroyPipeline(device_vk->vk_device, pipeline_vk->vk_pipeline, NULL));
heap_free(pipeline_vk);
free(pipeline_vk);
}
static void wined3d_context_vk_destroy_pipeline_layout(struct wine_rb_entry *entry, void *ctx)
@ -1310,8 +1310,8 @@ static void wined3d_context_vk_destroy_pipeline_layout(struct wine_rb_entry *ent
VK_CALL(vkDestroyPipelineLayout(device_vk->vk_device, layout->vk_pipeline_layout, NULL));
VK_CALL(vkDestroyDescriptorSetLayout(device_vk->vk_device, layout->vk_set_layout, NULL));
heap_free(layout->key.bindings);
heap_free(layout);
free(layout->key.bindings);
free(layout);
}
static void wined3d_render_pass_key_vk_init(struct wined3d_render_pass_key_vk *key,
@ -1511,12 +1511,12 @@ VkRenderPass wined3d_context_vk_get_render_pass(struct wined3d_context_vk *conte
if ((entry = wine_rb_get(&context_vk->render_passes, &key)))
return WINE_RB_ENTRY_VALUE(entry, struct wined3d_render_pass_vk, entry)->vk_render_pass;
if (!(pass = heap_alloc(sizeof(*pass))))
if (!(pass = malloc(sizeof(*pass))))
return VK_NULL_HANDLE;
if (!wined3d_render_pass_vk_init(pass, context_vk, &key))
{
heap_free(pass);
free(pass);
return VK_NULL_HANDLE;
}
@ -1524,7 +1524,7 @@ VkRenderPass wined3d_context_vk_get_render_pass(struct wined3d_context_vk *conte
{
ERR("Failed to insert render pass.\n");
wined3d_render_pass_vk_cleanup(pass, context_vk);
heap_free(pass);
free(pass);
return VK_NULL_HANDLE;
}
@ -1571,12 +1571,12 @@ static void wined3d_context_vk_destroy_render_pass(struct wine_rb_entry *entry,
struct wined3d_render_pass_vk, entry);
wined3d_render_pass_vk_cleanup(pass, ctx);
heap_free(pass);
free(pass);
}
static void wined3d_shader_descriptor_writes_vk_cleanup(struct wined3d_shader_descriptor_writes_vk *writes)
{
heap_free(writes->writes);
free(writes->writes);
}
static void wined3d_context_vk_destroy_query_pools(struct wined3d_context_vk *context_vk, struct list *free_pools)
@ -1586,7 +1586,7 @@ static void wined3d_context_vk_destroy_query_pools(struct wined3d_context_vk *co
LIST_FOR_EACH_ENTRY_SAFE(pool_vk, entry, free_pools, struct wined3d_query_pool_vk, entry)
{
wined3d_query_pool_vk_cleanup(pool_vk, context_vk);
heap_free(pool_vk);
free(pool_vk);
}
}
@ -1635,11 +1635,11 @@ bool wined3d_context_vk_allocate_query(struct wined3d_context_vk *context_vk,
list_init(&pool_vk->entry);
}
if (!(pool_vk = heap_alloc_zero(sizeof(*pool_vk))))
if (!(pool_vk = calloc(1, sizeof(*pool_vk))))
return false;
if (!wined3d_query_pool_vk_init(pool_vk, context_vk, type, free_pools))
{
heap_free(pool_vk);
free(pool_vk);
return false;
}
@ -1681,7 +1681,7 @@ bool wined3d_context_vk_allocate_query(struct wined3d_context_vk *context_vk,
if (!wined3d_query_pool_vk_allocate_query(pool_vk, &idx))
{
wined3d_query_pool_vk_cleanup(pool_vk, context_vk);
heap_free(pool_vk);
free(pool_vk);
return false;
}
@ -1710,11 +1710,11 @@ void wined3d_context_vk_cleanup(struct wined3d_context_vk *context_vk)
for (i = 0; i < context_vk->completed.buffer_count; ++i)
free_command_buffer(context_vk, &context_vk->completed.buffers[i]);
heap_free(context_vk->compute.bindings.bindings);
heap_free(context_vk->graphics.bindings.bindings);
free(context_vk->compute.bindings.bindings);
free(context_vk->graphics.bindings.bindings);
for (i = 0; i < context_vk->vk_descriptor_pool_count; ++i)
VK_CALL(vkDestroyDescriptorPool(device_vk->vk_device, context_vk->vk_descriptor_pools[i], NULL));
heap_free(context_vk->vk_descriptor_pools);
free(context_vk->vk_descriptor_pools);
if (context_vk->vk_framebuffer)
VK_CALL(vkDestroyFramebuffer(device_vk->vk_device, context_vk->vk_framebuffer, NULL));
if (context_vk->vk_so_counter_bo.vk_buffer)
@ -1729,9 +1729,9 @@ void wined3d_context_vk_cleanup(struct wined3d_context_vk *context_vk)
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_pipeline_statistics_query_pools);
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_stream_output_statistics_query_pools);
wine_rb_destroy(&context_vk->bo_slab_available, wined3d_context_vk_destroy_bo_slab, context_vk);
heap_free(context_vk->submitted.buffers);
heap_free(context_vk->completed.buffers);
heap_free(context_vk->retired.objects);
free(context_vk->submitted.buffers);
free(context_vk->completed.buffers);
free(context_vk->retired.objects);
wined3d_shader_descriptor_writes_vk_cleanup(&context_vk->descriptor_writes);
wine_rb_destroy(&context_vk->graphics_pipelines, wined3d_context_vk_destroy_graphics_pipeline, context_vk);
@ -3271,12 +3271,12 @@ struct wined3d_pipeline_layout_vk *wined3d_context_vk_get_pipeline_layout(
if ((entry = wine_rb_get(&context_vk->pipeline_layouts, &key)))
return WINE_RB_ENTRY_VALUE(entry, struct wined3d_pipeline_layout_vk, entry);
if (!(layout = heap_alloc(sizeof(*layout))))
if (!(layout = malloc(sizeof(*layout))))
return NULL;
if (!(layout->key.bindings = heap_alloc(sizeof(*layout->key.bindings) * key.binding_count)))
if (!(layout->key.bindings = malloc(sizeof(*layout->key.bindings) * key.binding_count)))
{
heap_free(layout);
free(layout);
return NULL;
}
memcpy(layout->key.bindings, key.bindings, sizeof(*layout->key.bindings) * key.binding_count);
@ -3315,8 +3315,8 @@ struct wined3d_pipeline_layout_vk *wined3d_context_vk_get_pipeline_layout(
return layout;
fail:
heap_free(layout->key.bindings);
heap_free(layout);
free(layout->key.bindings);
free(layout);
return NULL;
}
@ -3333,7 +3333,7 @@ static VkPipeline wined3d_context_vk_get_graphics_pipeline(struct wined3d_contex
if ((entry = wine_rb_get(&context_vk->graphics_pipelines, key)))
return WINE_RB_ENTRY_VALUE(entry, struct wined3d_graphics_pipeline_vk, entry)->vk_pipeline;
if (!(pipeline_vk = heap_alloc(sizeof(*pipeline_vk))))
if (!(pipeline_vk = malloc(sizeof(*pipeline_vk))))
return VK_NULL_HANDLE;
pipeline_vk->key = *key;
@ -3341,7 +3341,7 @@ static VkPipeline wined3d_context_vk_get_graphics_pipeline(struct wined3d_contex
VK_NULL_HANDLE, 1, &key->pipeline_desc, NULL, &pipeline_vk->vk_pipeline))) < 0)
{
WARN("Failed to create graphics pipeline, vr %s.\n", wined3d_debug_vkresult(vr));
heap_free(pipeline_vk);
free(pipeline_vk);
return VK_NULL_HANDLE;
}

View file

@ -2050,7 +2050,7 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
if (!(light_info = wined3d_light_state_get_light(&cs->state.light_state, light_idx)))
{
TRACE("Adding new light.\n");
if (!(light_info = heap_alloc_zero(sizeof(*light_info))))
if (!(light_info = calloc(1, sizeof(*light_info))))
{
ERR("Failed to allocate light info.\n");
return;
@ -2758,7 +2758,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
if (op->bo.addr.buffer_object)
FIXME("Free BO address %s.\n", debug_const_bo_address(&op->bo.addr));
else
heap_free((void *)op->bo.addr.addr);
free((void *)op->bo.addr.addr);
}
}
@ -3021,9 +3021,9 @@ static void *wined3d_cs_st_require_space(struct wined3d_device_context *context,
new_size = max(size, cs->data_size * 2);
if (!cs->end)
new_data = heap_realloc(cs->data, new_size);
new_data = realloc(cs->data, new_size);
else
new_data = heap_alloc(new_size);
new_data = malloc(new_size);
if (!new_data)
return NULL;
@ -3057,7 +3057,7 @@ static void wined3d_cs_st_submit(struct wined3d_device_context *context, enum wi
if (cs->data == data)
cs->start = cs->end = start;
else if (!start)
heap_free(data);
free(data);
}
static void wined3d_cs_st_finish(struct wined3d_device_context *context, enum wined3d_cs_queue_id queue_id)
@ -3170,7 +3170,7 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str
+ ((box->bottom - box->top - 1) / format->block_height) * map_desc->row_pitch
+ ((box->right - box->left + format->block_width - 1) / format->block_width) * format->block_byte_count;
if (!(map_desc->data = heap_alloc(size)))
if (!(map_desc->data = malloc(size)))
{
WARN_(d3d_perf)("Failed to allocate a heap memory buffer.\n");
return false;
@ -3563,12 +3563,12 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
struct wined3d_cs *cs;
if (!(cs = heap_alloc_zero(sizeof(*cs))))
if (!(cs = calloc(1, sizeof(*cs))))
return NULL;
if (FAILED(wined3d_state_create(device, levels, level_count, &cs->c.state)))
{
heap_free(cs);
free(cs);
return NULL;
}
@ -3582,7 +3582,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
state_init(&cs->state, d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT, cs->c.state->feature_level);
cs->data_size = WINED3D_INITIAL_CS_SIZE;
if (!(cs->data = heap_alloc(cs->data_size)))
if (!(cs->data = malloc(cs->data_size)))
goto fail;
if (wined3d_settings.cs_multithreaded & WINED3D_CSMT_ENABLE)
@ -3610,13 +3610,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
if (!pNtAlertThreadByThreadId && !(cs->event = CreateEventW(NULL, FALSE, FALSE, NULL)))
{
ERR("Failed to create command stream event.\n");
heap_free(cs->data);
free(cs->data);
goto fail;
}
if (!(cs->present_event = CreateEventW(NULL, FALSE, FALSE, NULL)))
{
ERR("Failed to create command stream present event.\n");
heap_free(cs->data);
free(cs->data);
goto fail;
}
@ -3627,7 +3627,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
CloseHandle(cs->present_event);
if (cs->event)
CloseHandle(cs->event);
heap_free(cs->data);
free(cs->data);
goto fail;
}
@ -3638,7 +3638,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
CloseHandle(cs->present_event);
if (cs->event)
CloseHandle(cs->event);
heap_free(cs->data);
free(cs->data);
goto fail;
}
}
@ -3649,7 +3649,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
fail:
wined3d_state_destroy(cs->c.state);
state_cleanup(&cs->state);
heap_free(cs);
free(cs);
return NULL;
}
@ -3667,8 +3667,8 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
wined3d_state_destroy(cs->c.state);
state_cleanup(&cs->state);
heap_free(cs->data);
heap_free(cs);
free(cs->data);
free(cs);
}
static void wined3d_cs_packet_decref_objects(const struct wined3d_cs_packet *packet)
@ -4310,7 +4310,7 @@ static bool wined3d_deferred_context_map_upload_bo(struct wined3d_device_context
return false;
}
if (!(deferred->upload_heap_refcount = heap_alloc(sizeof(*deferred->upload_heap_refcount))))
if (!(deferred->upload_heap_refcount = malloc(sizeof(*deferred->upload_heap_refcount))))
{
HeapDestroy(deferred->upload_heap);
deferred->upload_heap = 0;
@ -4435,12 +4435,12 @@ HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, str
TRACE("device %p, context %p.\n", device, context);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_state_create(device, &device->cs->c.state->feature_level, 1, &object->c.state)))
{
heap_free(object);
free(object);
return hr;
}
@ -4467,7 +4467,7 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte
for (i = 0; i < deferred->resource_count; ++i)
wined3d_resource_decref(deferred->resources[i]);
heap_free(deferred->resources);
free(deferred->resources);
for (i = 0; i < deferred->upload_count; ++i)
{
@ -4480,19 +4480,19 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte
if (!InterlockedDecrement(deferred->upload_heap_refcount))
{
HeapDestroy(deferred->upload_heap);
heap_free(deferred->upload_heap_refcount);
free(deferred->upload_heap_refcount);
}
}
heap_free(deferred->uploads);
free(deferred->uploads);
for (i = 0; i < deferred->command_list_count; ++i)
wined3d_command_list_decref(deferred->command_lists[i]);
heap_free(deferred->command_lists);
free(deferred->command_lists);
for (i = 0; i < deferred->query_count; ++i)
wined3d_query_decref(deferred->queries[i].query);
heap_free(deferred->queries);
free(deferred->queries);
while (offset < deferred->data_size)
{
@ -4501,8 +4501,8 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte
}
wined3d_state_destroy(deferred->c.state);
heap_free(deferred->data);
heap_free(deferred);
free(deferred->data);
free(deferred);
}
HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device_context *context,
@ -4515,7 +4515,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
TRACE("context %p, list %p.\n", context, list);
wined3d_device_context_lock(context);
memory = heap_alloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources)
memory = malloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources)
+ deferred->upload_count * sizeof(*object->uploads)
+ deferred->command_list_count * sizeof(*object->command_lists)
+ deferred->query_count * sizeof(*object->queries)
@ -4604,7 +4604,7 @@ static void wined3d_command_list_destroy_object(void *object)
if (!--bo->refcount)
{
wined3d_context_destroy_bo(context, bo);
heap_free(bo);
free(bo);
}
}
else
@ -4620,11 +4620,11 @@ static void wined3d_command_list_destroy_object(void *object)
if (!InterlockedDecrement(list->upload_heap_refcount))
{
HeapDestroy(list->upload_heap);
heap_free(list->upload_heap_refcount);
free(list->upload_heap_refcount);
}
}
heap_free(list);
free(list);
}
ULONG CDECL wined3d_command_list_incref(struct wined3d_command_list *list)

View file

@ -108,7 +108,7 @@ BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *c
return FALSE;
}
if (!(new_array = heap_realloc(device->contexts, sizeof(*new_array) * (device->context_count + 1))))
if (!(new_array = realloc(device->contexts, sizeof(*new_array) * (device->context_count + 1))))
{
ERR("Failed to grow the context array.\n");
device->adapter->fragment_pipe->free_context_data(context);
@ -150,13 +150,13 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context
if (!--device->context_count)
{
heap_free(device->contexts);
free(device->contexts);
device->contexts = NULL;
return;
}
memmove(&device->contexts[i], &device->contexts[i + 1], (device->context_count - i) * sizeof(*device->contexts));
if (!(new_array = heap_realloc(device->contexts, device->context_count * sizeof(*device->contexts))))
if (!(new_array = realloc(device->contexts, device->context_count * sizeof(*device->contexts))))
{
ERR("Failed to shrink context array. Oh well.\n");
return;
@ -178,7 +178,7 @@ static void device_free_so_desc(struct wine_rb_entry *entry, void *context)
{
struct wined3d_so_desc_entry *s = WINE_RB_ENTRY_VALUE(entry, struct wined3d_so_desc_entry, entry);
heap_free(s);
free(s);
}
static void device_leftover_sampler(struct wine_rb_entry *entry, void *context)
@ -220,7 +220,7 @@ void wined3d_device_cleanup(struct wined3d_device *device)
for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i)
{
heap_free(device->multistate_funcs[i]);
free(device->multistate_funcs[i]);
device->multistate_funcs[i] = NULL;
}
@ -285,7 +285,7 @@ static void wined3d_blend_state_destroy_object(void *object)
{
TRACE("object %p.\n", object);
heap_free(object);
free(object);
}
ULONG CDECL wined3d_blend_state_decref(struct wined3d_blend_state *state)
@ -326,7 +326,7 @@ HRESULT CDECL wined3d_blend_state_create(struct wined3d_device *device,
TRACE("device %p, desc %p, parent %p, parent_ops %p, state %p.\n",
device, desc, parent, parent_ops, state);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->refcount = 1;
@ -360,7 +360,7 @@ static void wined3d_depth_stencil_state_destroy_object(void *object)
{
TRACE("object %p.\n", object);
heap_free(object);
free(object);
}
ULONG CDECL wined3d_depth_stencil_state_decref(struct wined3d_depth_stencil_state *state)
@ -417,7 +417,7 @@ HRESULT CDECL wined3d_depth_stencil_state_create(struct wined3d_device *device,
TRACE("device %p, desc %p, parent %p, parent_ops %p, state %p.\n",
device, desc, parent, parent_ops, state);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->refcount = 1;
@ -447,7 +447,7 @@ static void wined3d_rasterizer_state_destroy_object(void *object)
{
TRACE("object %p.\n", object);
heap_free(object);
free(object);
}
ULONG CDECL wined3d_rasterizer_state_decref(struct wined3d_rasterizer_state *state)
@ -483,7 +483,7 @@ HRESULT CDECL wined3d_rasterizer_state_create(struct wined3d_device *device,
TRACE("device %p, desc %p, parent %p, parent_ops %p, state %p.\n",
device, desc, parent, parent_ops, state);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->refcount = 1;
@ -1209,12 +1209,12 @@ static struct wined3d_allocator_chunk *wined3d_allocator_gl_create_chunk(struct
return NULL;
context_gl = wined3d_context_gl(context);
if (!(chunk_gl = heap_alloc(sizeof(*chunk_gl))))
if (!(chunk_gl = malloc(sizeof(*chunk_gl))))
return NULL;
if (!wined3d_allocator_chunk_init(&chunk_gl->c, allocator))
{
heap_free(chunk_gl);
free(chunk_gl);
return NULL;
}
@ -1222,7 +1222,7 @@ static struct wined3d_allocator_chunk *wined3d_allocator_gl_create_chunk(struct
if (!(chunk_gl->gl_buffer = wined3d_context_gl_allocate_vram_chunk_buffer(context_gl, memory_type, chunk_size)))
{
wined3d_allocator_chunk_cleanup(&chunk_gl->c);
heap_free(chunk_gl);
free(chunk_gl);
return NULL;
}
list_add_head(&allocator->pools[memory_type].chunks, &chunk_gl->c.entry);
@ -1248,7 +1248,7 @@ static void wined3d_allocator_gl_destroy_chunk(struct wined3d_allocator_chunk *c
GL_EXTCALL(glDeleteBuffers(1, &chunk_gl->gl_buffer));
TRACE("Freed buffer %u.\n", chunk_gl->gl_buffer);
wined3d_allocator_chunk_cleanup(&chunk_gl->c);
heap_free(chunk_gl);
free(chunk_gl);
context_release(&context_gl->c);
}
@ -1569,7 +1569,7 @@ HRESULT wined3d_device_set_implicit_swapchain(struct wined3d_device *device, str
return WINED3DERR_INVALIDCALL;
device->swapchain_count = 1;
if (!(device->swapchains = heap_calloc(device->swapchain_count, sizeof(*device->swapchains))))
if (!(device->swapchains = calloc(device->swapchain_count, sizeof(*device->swapchains))))
{
ERR("Failed to allocate swapchain array.\n");
hr = E_OUTOFMEMORY;
@ -1628,7 +1628,7 @@ HRESULT wined3d_device_set_implicit_swapchain(struct wined3d_device *device, str
return WINED3D_OK;
err_out:
heap_free(device->swapchains);
free(device->swapchains);
device->swapchains = NULL;
device->swapchain_count = 0;
@ -1733,7 +1733,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
wined3d_rendertarget_view_decref(view);
}
heap_free(device->swapchains);
free(device->swapchains);
device->swapchains = NULL;
wined3d_state_reset(state, &device->adapter->d3d_info);
@ -4806,7 +4806,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
/* 32-bit user32 cursors ignore the alpha channel if it's all
* zeroes, and use the mask instead. Fill the mask with all ones
* to ensure we still get a fully transparent cursor. */
if (!(mask_bits = heap_alloc(mask_size)))
if (!(mask_bits = malloc(mask_size)))
return E_OUTOFMEMORY;
memset(mask_bits, 0xff, mask_size);
@ -4831,7 +4831,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
if (device->bCursorVisible)
SetCursor(cursor);
heap_free(mask_bits);
free(mask_bits);
}
TRACE("New cursor dimensions are %ux%u.\n", cursor_width, cursor_height);
@ -5538,7 +5538,7 @@ HRESULT wined3d_device_init(struct wined3d_device *device, struct wined3d *wined
err:
for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i)
{
heap_free(device->multistate_funcs[i]);
free(device->multistate_funcs[i]);
}
wine_rb_destroy(&device->samplers, NULL, NULL);
wine_rb_destroy(&device->rasterizer_states, NULL, NULL);

View file

@ -180,8 +180,8 @@ void wined3d_adapter_cleanup(struct wined3d_adapter *adapter)
for (output_idx = 0; output_idx < adapter->output_count; ++output_idx)
wined3d_output_cleanup(&adapter->outputs[output_idx]);
heap_free(adapter->outputs);
heap_free(adapter->formats);
free(adapter->outputs);
free(adapter->formats);
close_adapter_desc.hAdapter = adapter->kmt_adapter;
D3DKMTCloseAdapter(&close_adapter_desc);
}
@ -212,7 +212,7 @@ ULONG CDECL wined3d_decref(struct wined3d *wined3d)
adapter->adapter_ops->adapter_destroy(adapter);
}
heap_free(wined3d);
free(wined3d);
wined3d_mutex_unlock();
}
@ -1122,7 +1122,7 @@ HRESULT CDECL wined3d_adapter_register_budget_change_notification(const struct w
struct wined3d_adapter_budget_change_notification *notification, *new_notification;
BOOL found = FALSE;
new_notification = heap_alloc_zero(sizeof(*new_notification));
new_notification = calloc(1, sizeof(*new_notification));
if (!new_notification)
return E_OUTOFMEMORY;
@ -1178,7 +1178,7 @@ HRESULT CDECL wined3d_adapter_unregister_budget_change_notification(DWORD cookie
if (notification->cookie == cookie)
{
list_remove(&notification->entry);
heap_free(notification);
free(notification);
break;
}
}
@ -1396,11 +1396,11 @@ HRESULT CDECL wined3d_output_find_closest_matching_mode(struct wined3d_output *o
return E_FAIL;
}
if (!(modes = heap_calloc(mode_count, sizeof(*modes))))
if (!(modes = calloc(mode_count, sizeof(*modes))))
return E_OUTOFMEMORY;
if (!(matching_modes = heap_calloc(mode_count, sizeof(*matching_modes))))
if (!(matching_modes = calloc(mode_count, sizeof(*matching_modes))))
{
heap_free(modes);
free(modes);
return E_OUTOFMEMORY;
}
@ -1409,8 +1409,8 @@ HRESULT CDECL wined3d_output_find_closest_matching_mode(struct wined3d_output *o
if (FAILED(hr = wined3d_output_get_mode(output, mode->format_id,
WINED3D_SCANLINE_ORDERING_UNKNOWN, i, &modes[i], true)))
{
heap_free(matching_modes);
heap_free(modes);
free(matching_modes);
free(modes);
return hr;
}
matching_modes[i] = &modes[i];
@ -1445,8 +1445,8 @@ HRESULT CDECL wined3d_output_find_closest_matching_mode(struct wined3d_output *o
struct wined3d_display_mode current_mode;
if (FAILED(hr = wined3d_output_get_display_mode(output, &current_mode, NULL)))
{
heap_free(matching_modes);
heap_free(modes);
free(matching_modes);
free(modes);
return hr;
}
mode->width = current_mode.width;
@ -1468,8 +1468,8 @@ HRESULT CDECL wined3d_output_find_closest_matching_mode(struct wined3d_output *o
*mode = *matching_modes[j];
heap_free(matching_modes);
heap_free(modes);
free(matching_modes);
free(modes);
TRACE("Returning %ux%u@%u %s %#x.\n", mode->width, mode->height,
mode->refresh_rate, debug_d3dformat(mode->format_id),
@ -2858,7 +2858,7 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] =
static void adapter_no3d_destroy(struct wined3d_adapter *adapter)
{
wined3d_adapter_cleanup(adapter);
heap_free(adapter);
free(adapter);
}
static HRESULT adapter_no3d_create_device(struct wined3d *wined3d, const struct wined3d_adapter *adapter,
@ -2871,14 +2871,14 @@ static HRESULT adapter_no3d_create_device(struct wined3d *wined3d, const struct
struct wined3d_device_no3d *device_no3d;
HRESULT hr;
if (!(device_no3d = heap_alloc_zero(sizeof(*device_no3d))))
if (!(device_no3d = calloc(1, sizeof(*device_no3d))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_device_init(&device_no3d->d, wined3d, adapter->ordinal, device_type, focus_window,
flags, surface_alignment, levels, level_count, supported_extensions, device_parent)))
{
WARN("Failed to initialize device, hr %#lx.\n", hr);
heap_free(device_no3d);
free(device_no3d);
return hr;
}
@ -2890,7 +2890,7 @@ static HRESULT adapter_no3d_create_device(struct wined3d *wined3d, const struct
static void adapter_no3d_destroy_device(struct wined3d_device *device)
{
wined3d_device_cleanup(device);
heap_free(device);
free(device);
}
static struct wined3d_context *adapter_no3d_acquire_context(struct wined3d_device *device,
@ -3031,14 +3031,14 @@ static HRESULT adapter_no3d_create_swapchain(struct wined3d_device *device,
TRACE("device %p, desc %p, state_parent %p, parent %p, parent_ops %p, swapchain %p.\n",
device, desc, state_parent, parent, parent_ops, swapchain);
if (!(swapchain_no3d = heap_alloc_zero(sizeof(*swapchain_no3d))))
if (!(swapchain_no3d = calloc(1, sizeof(*swapchain_no3d))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_swapchain_no3d_init(swapchain_no3d, device, desc, state_parent, parent,
parent_ops)))
{
WARN("Failed to initialise swapchain, hr %#lx.\n", hr);
heap_free(swapchain_no3d);
free(swapchain_no3d);
return hr;
}
@ -3051,7 +3051,7 @@ static HRESULT adapter_no3d_create_swapchain(struct wined3d_device *device,
static void adapter_no3d_destroy_swapchain(struct wined3d_swapchain *swapchain)
{
wined3d_swapchain_cleanup(swapchain);
heap_free(swapchain);
free(swapchain);
}
static HRESULT adapter_no3d_create_buffer(struct wined3d_device *device,
@ -3064,13 +3064,13 @@ static HRESULT adapter_no3d_create_buffer(struct wined3d_device *device,
TRACE("device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.\n",
device, desc, data, parent, parent_ops, buffer);
if (!(buffer_no3d = heap_alloc_zero(sizeof(*buffer_no3d))))
if (!(buffer_no3d = calloc(1, sizeof(*buffer_no3d))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_buffer_no3d_init(buffer_no3d, device, desc, data, parent, parent_ops)))
{
WARN("Failed to initialise buffer, hr %#lx.\n", hr);
heap_free(buffer_no3d);
free(buffer_no3d);
return hr;
}
@ -3094,7 +3094,7 @@ static void adapter_no3d_destroy_buffer(struct wined3d_buffer *buffer)
if (swapchain_count)
wined3d_device_incref(device);
wined3d_buffer_cleanup(buffer);
wined3d_cs_destroy_object(device->cs, heap_free, buffer);
wined3d_cs_destroy_object(device->cs, free, buffer);
if (swapchain_count)
wined3d_device_decref(device);
}
@ -3116,7 +3116,7 @@ static HRESULT adapter_no3d_create_texture(struct wined3d_device *device,
layer_count, level_count, flags, parent, parent_ops)))
{
WARN("Failed to initialise texture, hr %#lx.\n", hr);
heap_free(texture_no3d);
free(texture_no3d);
return hr;
}
@ -3144,7 +3144,7 @@ static void adapter_no3d_destroy_texture(struct wined3d_texture *texture)
texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent);
wined3d_texture_cleanup(texture);
wined3d_cs_destroy_object(device->cs, heap_free, texture);
wined3d_cs_destroy_object(device->cs, free, texture);
if (swapchain_count)
wined3d_device_decref(device);
@ -3160,13 +3160,13 @@ static HRESULT adapter_no3d_create_rendertarget_view(const struct wined3d_view_d
TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
wined3d_debug_view_desc(desc, resource), resource, parent, parent_ops, view);
if (!(view_no3d = heap_alloc_zero(sizeof(*view_no3d))))
if (!(view_no3d = calloc(1, sizeof(*view_no3d))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_rendertarget_view_no3d_init(view_no3d, desc, resource, parent, parent_ops)))
{
WARN("Failed to initialise view, hr %#lx.\n", hr);
heap_free(view_no3d);
free(view_no3d);
return hr;
}
@ -3190,7 +3190,7 @@ static void adapter_no3d_destroy_rendertarget_view(struct wined3d_rendertarget_v
if (swapchain_count)
wined3d_device_incref(device);
wined3d_rendertarget_view_cleanup(view);
wined3d_cs_destroy_object(device->cs, heap_free, view);
wined3d_cs_destroy_object(device->cs, free, view);
if (swapchain_count)
wined3d_device_decref(device);
}
@ -3336,7 +3336,7 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal,
TRACE("ordinal %u, wined3d_creation_flags %#x.\n", ordinal, wined3d_creation_flags);
if (!(adapter = heap_alloc_zero(sizeof(*adapter))))
if (!(adapter = calloc(1, sizeof(*adapter))))
return NULL;
if (ordinal == 0 && wined3d_get_primary_adapter_luid(&primary_luid))
@ -3344,21 +3344,21 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal,
if (!wined3d_adapter_init(adapter, ordinal, luid, &wined3d_adapter_no3d_ops))
{
heap_free(adapter);
free(adapter);
return NULL;
}
if (!wined3d_adapter_no3d_init_format_info(adapter))
{
wined3d_adapter_cleanup(adapter);
heap_free(adapter);
free(adapter);
return NULL;
}
if (!wined3d_driver_info_init(&adapter->driver_info, &gpu_description, WINED3D_FEATURE_LEVEL_NONE, 0, 0))
{
wined3d_adapter_cleanup(adapter);
heap_free(adapter);
free(adapter);
return NULL;
}
adapter->vram_bytes_used = 0;
@ -3465,7 +3465,7 @@ done:
{
for (output_idx = 0; output_idx < adapter->output_count; ++output_idx)
wined3d_output_cleanup(&adapter->outputs[output_idx]);
heap_free(adapter->outputs);
free(adapter->outputs);
close_adapter_desc.hAdapter = adapter->kmt_adapter;
D3DKMTCloseAdapter(&close_adapter_desc);
}

View file

@ -5254,7 +5254,7 @@ HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEF
break;
case 1:
state_table[cur[i].state].apply = multistate_apply_2;
if (!(dev_multistate_funcs[cur[i].state] = heap_calloc(2, sizeof(**dev_multistate_funcs))))
if (!(dev_multistate_funcs[cur[i].state] = calloc(2, sizeof(**dev_multistate_funcs))))
goto out_of_mem;
dev_multistate_funcs[cur[i].state][0] = multistate_funcs[cur[i].state][0];
@ -5262,7 +5262,7 @@ HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEF
break;
case 2:
state_table[cur[i].state].apply = multistate_apply_3;
if (!(funcs_array = heap_realloc(dev_multistate_funcs[cur[i].state],
if (!(funcs_array = realloc(dev_multistate_funcs[cur[i].state],
sizeof(**dev_multistate_funcs) * 3)))
goto out_of_mem;
@ -5292,7 +5292,7 @@ HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEF
out_of_mem:
for (i = 0; i <= STATE_HIGHEST; ++i)
{
heap_free(dev_multistate_funcs[i]);
free(dev_multistate_funcs[i]);
}
memset(dev_multistate_funcs, 0, (STATE_HIGHEST + 1) * sizeof(*dev_multistate_funcs));

View file

@ -504,7 +504,7 @@ void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id, BOOL
{
const char *ptr, *end, *line;
log = heap_alloc(length);
log = malloc(length);
if (program)
GL_EXTCALL(glGetProgramInfoLog(id, length, NULL, log));
else
@ -532,7 +532,7 @@ void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id, BOOL
FIXME(" %.*s", (int)(ptr - line), line);
}
}
heap_free(log);
free(log);
}
}
@ -568,7 +568,7 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf
char *source = NULL;
GL_EXTCALL(glGetProgramiv(program, GL_ATTACHED_SHADERS, &shader_count));
if (!(shaders = heap_calloc(shader_count, sizeof(*shaders))))
if (!(shaders = calloc(shader_count, sizeof(*shaders))))
{
ERR("Failed to allocate shader array memory.\n");
return;
@ -584,12 +584,12 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf
if (source_size < tmp)
{
heap_free(source);
free(source);
if (!(source = heap_alloc(tmp)))
if (!(source = malloc(tmp)))
{
ERR("Failed to allocate %d bytes for shader source.\n", tmp);
heap_free(shaders);
free(shaders);
return;
}
source_size = tmp;
@ -612,8 +612,8 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf
FIXME("\n");
}
heap_free(source);
heap_free(shaders);
free(source);
free(shaders);
}
/* Context activation is done by the caller. */
@ -1005,16 +1005,16 @@ static void shader_glsl_init_transform_feedback(const struct wined3d_context_gl
return;
}
if (!(varyings = heap_calloc(count, sizeof(*varyings))))
if (!(varyings = calloc(count, sizeof(*varyings))))
{
ERR("Out of memory.\n");
string_buffer_release(&priv->string_buffers, buffer);
return;
}
if (!(strings = heap_calloc(length, sizeof(*strings))))
if (!(strings = calloc(length, sizeof(*strings))))
{
ERR("Out of memory.\n");
heap_free(varyings);
free(varyings);
string_buffer_release(&priv->string_buffers, buffer);
return;
}
@ -1023,8 +1023,8 @@ static void shader_glsl_init_transform_feedback(const struct wined3d_context_gl
GL_EXTCALL(glTransformFeedbackVaryings(program_id, count, varyings, mode));
checkGLcall("glTransformFeedbackVaryings");
heap_free(varyings);
heap_free(strings);
free(varyings);
free(strings);
string_buffer_release(&priv->string_buffers, buffer);
}
@ -6906,7 +6906,7 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc
list_remove(&entry->ps.shader_entry);
if (entry->cs.id)
list_remove(&entry->cs.shader_entry);
heap_free(entry);
free(entry);
}
static void shader_glsl_setup_vs3_output(struct shader_glsl_priv *priv,
@ -6926,7 +6926,7 @@ static void shader_glsl_setup_vs3_output(struct shader_glsl_priv *priv,
unsigned int i, j;
char reg_mask[6];
set = heap_calloc(max_varyings, sizeof(*set));
set = calloc(max_varyings, sizeof(*set));
for (i = 0; i < input_signature->element_count; ++i)
{
@ -7010,7 +7010,7 @@ static void shader_glsl_setup_vs3_output(struct shader_glsl_priv *priv,
shader_addline(buffer, "%s.%s = vec%u(0.0);\n", destination->buffer, reg_mask, size);
}
heap_free(set);
free(set);
string_buffer_release(&priv->string_buffers, destination);
}
@ -8546,7 +8546,7 @@ static GLuint find_glsl_fragment_shader(const struct wined3d_context_gl *context
if (!shader->backend_data)
{
if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
if (!(shader->backend_data = calloc(1, sizeof(*shader_data))))
{
ERR("Failed to allocate backend data.\n");
return 0;
@ -8575,11 +8575,11 @@ static GLuint find_glsl_fragment_shader(const struct wined3d_context_gl *context
if (shader_data->num_gl_shaders)
{
new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2);
new_array = heap_realloc(shader_data->gl_shaders.ps, new_size * sizeof(*gl_shaders));
new_array = realloc(shader_data->gl_shaders.ps, new_size * sizeof(*gl_shaders));
}
else
{
new_array = heap_alloc(sizeof(*gl_shaders));
new_array = malloc(sizeof(*gl_shaders));
new_size = 1;
}
@ -8638,7 +8638,7 @@ static GLuint find_glsl_vertex_shader(const struct wined3d_context_gl *context_g
if (!shader->backend_data)
{
if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
if (!(shader->backend_data = calloc(1, sizeof(*shader_data))))
{
ERR("Failed to allocate backend data.\n");
return 0;
@ -8664,11 +8664,11 @@ static GLuint find_glsl_vertex_shader(const struct wined3d_context_gl *context_g
if (shader_data->num_gl_shaders)
{
new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2);
new_array = heap_realloc(shader_data->gl_shaders.vs, new_size * sizeof(*gl_shaders));
new_array = realloc(shader_data->gl_shaders.vs, new_size * sizeof(*gl_shaders));
}
else
{
new_array = heap_alloc(sizeof(*gl_shaders));
new_array = malloc(sizeof(*gl_shaders));
new_size = 1;
}
@ -8700,7 +8700,7 @@ static GLuint find_glsl_hull_shader(const struct wined3d_context_gl *context_gl,
if (!shader->backend_data)
{
if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
if (!(shader->backend_data = calloc(1, sizeof(*shader_data))))
{
ERR("Failed to allocate backend data.\n");
return 0;
@ -8719,7 +8719,7 @@ static GLuint find_glsl_hull_shader(const struct wined3d_context_gl *context_gl,
assert(!shader_data->gl_shaders.hs);
new_size = 1;
if (!(new_array = heap_alloc(sizeof(*new_array))))
if (!(new_array = malloc(sizeof(*new_array))))
{
ERR("Failed to allocate GL shaders array.\n");
return 0;
@ -8745,7 +8745,7 @@ static GLuint find_glsl_domain_shader(const struct wined3d_context_gl *context_g
if (!shader->backend_data)
{
if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
if (!(shader->backend_data = calloc(1, sizeof(*shader_data))))
{
ERR("Failed to allocate backend data.\n");
return 0;
@ -8765,11 +8765,11 @@ static GLuint find_glsl_domain_shader(const struct wined3d_context_gl *context_g
if (shader_data->num_gl_shaders)
{
new_size = shader_data->shader_array_size + 1;
new_array = heap_realloc(shader_data->gl_shaders.ds, new_size * sizeof(*new_array));
new_array = realloc(shader_data->gl_shaders.ds, new_size * sizeof(*new_array));
}
else
{
new_array = heap_alloc(sizeof(*new_array));
new_array = malloc(sizeof(*new_array));
new_size = 1;
}
@ -8800,7 +8800,7 @@ static GLuint find_glsl_geometry_shader(const struct wined3d_context_gl *context
if (!shader->backend_data)
{
if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
if (!(shader->backend_data = calloc(1, sizeof(*shader_data))))
{
ERR("Failed to allocate backend data.\n");
return 0;
@ -8820,11 +8820,11 @@ static GLuint find_glsl_geometry_shader(const struct wined3d_context_gl *context
if (shader_data->num_gl_shaders)
{
new_size = shader_data->shader_array_size + 1;
new_array = heap_realloc(shader_data->gl_shaders.gs, new_size * sizeof(*new_array));
new_array = realloc(shader_data->gl_shaders.gs, new_size * sizeof(*new_array));
}
else
{
new_array = heap_alloc(sizeof(*new_array));
new_array = malloc(sizeof(*new_array));
new_size = 1;
}
@ -9950,7 +9950,7 @@ static struct glsl_ffp_vertex_shader *shader_glsl_find_ffp_vertex_shader(struct
if ((entry = wine_rb_get(&priv->ffp_vertex_shaders, settings)))
return WINE_RB_ENTRY_VALUE(entry, struct glsl_ffp_vertex_shader, desc.entry);
if (!(shader = heap_alloc(sizeof(*shader))))
if (!(shader = malloc(sizeof(*shader))))
return NULL;
shader->desc.settings = *settings;
@ -9971,7 +9971,7 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
if ((desc = find_ffp_frag_shader(&priv->ffp_fragment_shaders, args)))
return CONTAINING_RECORD(desc, struct glsl_ffp_fragment_shader, entry);
if (!(glsl_desc = heap_alloc(sizeof(*glsl_desc))))
if (!(glsl_desc = malloc(sizeof(*glsl_desc))))
return NULL;
glsl_desc->entry.settings = *args;
@ -10144,25 +10144,25 @@ static HRESULT shader_glsl_compile_compute_shader(struct shader_glsl_priv *priv,
struct glsl_shader_prog_link *entry;
GLuint shader_id, program_id;
if (!(entry = heap_alloc(sizeof(*entry))))
if (!(entry = malloc(sizeof(*entry))))
{
ERR("Out of memory.\n");
return E_OUTOFMEMORY;
}
if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
if (!(shader->backend_data = calloc(1, sizeof(*shader_data))))
{
ERR("Failed to allocate backend data.\n");
heap_free(entry);
free(entry);
return E_OUTOFMEMORY;
}
shader_data = shader->backend_data;
if (!(shader_data->gl_shaders.cs = heap_alloc(sizeof(*gl_shaders))))
if (!(shader_data->gl_shaders.cs = malloc(sizeof(*gl_shaders))))
{
ERR("Failed to allocate GL shader array.\n");
heap_free(entry);
heap_free(shader->backend_data);
free(entry);
free(shader->backend_data);
shader->backend_data = NULL;
return E_OUTOFMEMORY;
}
@ -10396,7 +10396,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl,
TRACE("Created new GLSL shader program %u.\n", program_id);
/* Create the entry */
entry = heap_alloc(sizeof(*entry));
entry = malloc(sizeof(*entry));
entry->id = program_id;
entry->vs.id = vs_id;
entry->hs.id = hs_id;
@ -10859,7 +10859,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
if (!shader_data || !shader_data->num_gl_shaders)
{
heap_free(shader_data);
free(shader_data);
shader->backend_data = NULL;
return;
}
@ -10886,7 +10886,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
GL_EXTCALL(glDeleteShader(gl_shaders[i].id));
checkGLcall("glDeleteShader");
}
heap_free(shader_data->gl_shaders.ps);
free(shader_data->gl_shaders.ps);
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs,
struct glsl_shader_prog_link, ps.shader_entry)
@ -10908,7 +10908,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
GL_EXTCALL(glDeleteShader(gl_shaders[i].id));
checkGLcall("glDeleteShader");
}
heap_free(shader_data->gl_shaders.vs);
free(shader_data->gl_shaders.vs);
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs,
struct glsl_shader_prog_link, vs.shader_entry)
@ -10930,7 +10930,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
GL_EXTCALL(glDeleteShader(gl_shaders[i].id));
checkGLcall("glDeleteShader");
}
heap_free(shader_data->gl_shaders.hs);
free(shader_data->gl_shaders.hs);
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs,
struct glsl_shader_prog_link, hs.shader_entry)
@ -10952,7 +10952,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
GL_EXTCALL(glDeleteShader(gl_shaders[i].id));
checkGLcall("glDeleteShader");
}
heap_free(shader_data->gl_shaders.ds);
free(shader_data->gl_shaders.ds);
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs,
struct glsl_shader_prog_link, ds.shader_entry)
@ -10974,7 +10974,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
GL_EXTCALL(glDeleteShader(gl_shaders[i].id));
checkGLcall("glDeleteShader");
}
heap_free(shader_data->gl_shaders.gs);
free(shader_data->gl_shaders.gs);
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs,
struct glsl_shader_prog_link, gs.shader_entry)
@ -10996,7 +10996,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
GL_EXTCALL(glDeleteShader(gl_shaders[i].id));
checkGLcall("glDeleteShader");
}
heap_free(shader_data->gl_shaders.cs);
free(shader_data->gl_shaders.cs);
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs,
struct glsl_shader_prog_link, cs.shader_entry)
@ -11014,7 +11014,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
}
}
heap_free(shader->backend_data);
free(shader->backend_data);
shader->backend_data = NULL;
context_release(context);
@ -11050,7 +11050,7 @@ static BOOL constant_heap_init(struct constant_heap *heap, unsigned int constant
+ constant_count * sizeof(*heap->positions);
void *mem;
if (!(mem = heap_alloc(size)))
if (!(mem = malloc(size)))
{
ERR("Failed to allocate memory\n");
return FALSE;
@ -11066,9 +11066,9 @@ static BOOL constant_heap_init(struct constant_heap *heap, unsigned int constant
return TRUE;
}
static void constant_heap_free(struct constant_heap *heap)
static void constant_free(struct constant_heap *heap)
{
heap_free(heap->entries);
free(heap->entries);
}
static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
@ -11078,7 +11078,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
void *vertex_priv, *fragment_priv;
struct shader_glsl_priv *priv;
if (!(priv = heap_alloc_zero(sizeof(*priv))))
if (!(priv = calloc(1, sizeof(*priv))))
return E_OUTOFMEMORY;
string_buffer_list_init(&priv->string_buffers);
@ -11086,7 +11086,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
if (!(vertex_priv = vertex_pipe->vp_alloc(&glsl_shader_backend, priv)))
{
ERR("Failed to initialize vertex pipe.\n");
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -11094,7 +11094,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
{
ERR("Failed to initialize fragment pipe.\n");
vertex_pipe->vp_free(device, NULL);
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -11104,7 +11104,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
goto fail;
}
if (!(priv->stack = heap_calloc(stack_size, sizeof(*priv->stack))))
if (!(priv->stack = calloc(stack_size, sizeof(*priv->stack))))
{
ERR("Failed to allocate memory.\n");
goto fail;
@ -11136,13 +11136,13 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
return WINED3D_OK;
fail:
constant_heap_free(&priv->pconst_heap);
constant_heap_free(&priv->vconst_heap);
heap_free(priv->stack);
constant_free(&priv->pconst_heap);
constant_free(&priv->vconst_heap);
free(priv->stack);
string_buffer_free(&priv->shader_buffer);
fragment_pipe->free_private(device, NULL);
vertex_pipe->vp_free(device, NULL);
heap_free(priv);
free(priv);
return E_OUTOFMEMORY;
}
@ -11152,15 +11152,15 @@ static void shader_glsl_free(struct wined3d_device *device, struct wined3d_conte
struct shader_glsl_priv *priv = device->shader_priv;
wine_rb_destroy(&priv->program_lookup, NULL, NULL);
constant_heap_free(&priv->pconst_heap);
constant_heap_free(&priv->vconst_heap);
heap_free(priv->stack);
constant_free(&priv->pconst_heap);
constant_free(&priv->vconst_heap);
free(priv->stack);
string_buffer_list_cleanup(&priv->string_buffers);
string_buffer_free(&priv->shader_buffer);
priv->fragment_pipe->free_private(device, context);
priv->vertex_pipe->vp_free(device, context);
heap_free(device->shader_priv);
free(device->shader_priv);
device->shader_priv = NULL;
}
@ -11168,7 +11168,7 @@ static BOOL shader_glsl_allocate_context_data(struct wined3d_context *context)
{
struct glsl_context_data *ctx_data;
if (!(ctx_data = heap_alloc_zero(sizeof(*ctx_data))))
if (!(ctx_data = calloc(1, sizeof(*ctx_data))))
return FALSE;
ctx_data->vertex_color_clamp = GL_FIXED_ONLY_ARB;
context->shader_backend_data = ctx_data;
@ -11177,7 +11177,7 @@ static BOOL shader_glsl_allocate_context_data(struct wined3d_context *context)
static void shader_glsl_free_context_data(struct wined3d_context *context)
{
heap_free(context->shader_backend_data);
free(context->shader_backend_data);
}
static void shader_glsl_init_context_state(struct wined3d_context *context)
@ -11627,7 +11627,7 @@ static void shader_glsl_free_ffp_vertex_shader(struct wine_rb_entry *entry, void
delete_glsl_program_entry(ctx->priv, gl_info, program);
}
GL_EXTCALL(glDeleteShader(shader->id));
heap_free(shader);
free(shader);
}
/* Context activation is done by the caller. */
@ -12146,7 +12146,7 @@ static void shader_glsl_free_ffp_fragment_shader(struct wine_rb_entry *entry, vo
delete_glsl_program_entry(ctx->priv, gl_info, program);
}
GL_EXTCALL(glDeleteShader(shader->id));
heap_free(shader);
free(shader);
}
/* Context activation is done by the caller. */
@ -12480,7 +12480,7 @@ static void glsl_free_blitter_program(struct wine_rb_entry *entry, void *ctx)
gl_info = context_gl->gl_info;
GL_EXTCALL(glDeleteProgram(program->id));
checkGLcall("glDeleteProgram()");
heap_free(program);
free(program);
}
/* Context activation is done by the caller. */
@ -12502,7 +12502,7 @@ static void glsl_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d
wine_rb_destroy(&glsl_blitter->programs, glsl_free_blitter_program, context_gl);
string_buffer_list_cleanup(&glsl_blitter->string_buffers);
heap_free(glsl_blitter);
free(glsl_blitter);
}
static void glsl_blitter_generate_p8_shader(struct wined3d_string_buffer *buffer,
@ -13030,7 +13030,7 @@ static struct glsl_blitter_program *glsl_blitter_get_program(struct wined3d_glsl
if ((entry = wine_rb_get(&blitter->programs, &args)))
return WINE_RB_ENTRY_VALUE(entry, struct glsl_blitter_program, entry);
if (!(program = heap_alloc(sizeof(*program))))
if (!(program = malloc(sizeof(*program))))
{
ERR("Failed to allocate blitter program memory.\n");
return NULL;
@ -13040,7 +13040,7 @@ static struct glsl_blitter_program *glsl_blitter_get_program(struct wined3d_glsl
if (!(program->id = glsl_blitter_generate_program(blitter, gl_info, &args)))
{
WARN("Failed to generate blitter program.\n");
heap_free(program);
free(program);
return NULL;
}
@ -13048,7 +13048,7 @@ static struct glsl_blitter_program *glsl_blitter_get_program(struct wined3d_glsl
{
ERR("Failed to store blitter program.\n");
GL_EXTCALL(glDeleteProgram(program->id));
heap_free(program);
free(program);
return NULL;
}
@ -13343,7 +13343,7 @@ struct wined3d_blitter *wined3d_glsl_blitter_create(struct wined3d_blitter **nex
if (!gl_info->supported[ARB_VERTEX_SHADER] || !gl_info->supported[ARB_FRAGMENT_SHADER])
return NULL;
if (!(blitter = heap_alloc(sizeof(*blitter))))
if (!(blitter = malloc(sizeof(*blitter))))
{
ERR("Failed to allocate blitter.\n");
return NULL;

View file

@ -36,7 +36,7 @@ static void wined3d_palette_destroy_object(void *object)
{
TRACE("object %p.\n", object);
heap_free(object);
free(object);
}
ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette)
@ -167,13 +167,13 @@ HRESULT CDECL wined3d_palette_create(struct wined3d_device *device, uint32_t fla
TRACE("device %p, flags %#x, entry_count %u, entries %p, palette %p.\n",
device, flags, entry_count, entries, palette);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_palette_init(object, device, flags, entry_count, entries)))
{
WARN("Failed to initialize palette, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}

View file

@ -373,7 +373,7 @@ static void wined3d_fence_free(struct wined3d_fence *fence)
void wined3d_fence_destroy(struct wined3d_fence *fence)
{
wined3d_fence_free(fence);
heap_free(fence);
free(fence);
}
static HRESULT wined3d_fence_init(struct wined3d_fence *fence, const struct wined3d_gl_info *gl_info)
@ -395,12 +395,12 @@ HRESULT wined3d_fence_create(struct wined3d_device *device, struct wined3d_fence
TRACE("device %p, fence %p.\n", device, fence);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_fence_init(object, gl_info)))
{
heap_free(object);
free(object);
return hr;
}
@ -1025,7 +1025,7 @@ static void wined3d_event_query_ops_destroy(struct wined3d_query *query)
struct wined3d_event_query *event_query = wined3d_event_query_from_query(query);
wined3d_fence_free(&event_query->fence);
heap_free(event_query);
free(event_query);
}
static const struct wined3d_query_ops event_query_ops =
@ -1046,13 +1046,13 @@ static HRESULT wined3d_event_query_create(struct wined3d_device *device,
TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
device, type, parent, parent_ops, query);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_fence_init(&object->fence, gl_info)))
{
WARN("Event queries not supported.\n");
heap_free(object);
free(object);
return hr;
}
@ -1071,7 +1071,7 @@ static void wined3d_occlusion_query_ops_destroy(struct wined3d_query *query)
if (oq->context_gl)
wined3d_context_gl_free_occlusion_query(oq);
heap_free(oq);
free(oq);
}
static const struct wined3d_query_ops occlusion_query_ops =
@ -1097,7 +1097,7 @@ static HRESULT wined3d_occlusion_query_create(struct wined3d_device *device,
return WINED3DERR_NOTAVAILABLE;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
wined3d_query_init(&object->query, device, type, &object->samples,
@ -1115,7 +1115,7 @@ static void wined3d_timestamp_query_ops_destroy(struct wined3d_query *query)
if (tq->context_gl)
wined3d_context_gl_free_timestamp_query(tq);
heap_free(tq);
free(tq);
}
static const struct wined3d_query_ops timestamp_query_ops =
@ -1141,7 +1141,7 @@ static HRESULT wined3d_timestamp_query_create(struct wined3d_device *device,
return WINED3DERR_NOTAVAILABLE;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
wined3d_query_init(&object->query, device, type, &object->timestamp,
@ -1155,7 +1155,7 @@ static HRESULT wined3d_timestamp_query_create(struct wined3d_device *device,
static void wined3d_timestamp_disjoint_query_ops_destroy(struct wined3d_query *query)
{
heap_free(query);
free(query);
}
static const struct wined3d_query_ops timestamp_disjoint_query_ops =
@ -1181,7 +1181,7 @@ static HRESULT wined3d_timestamp_disjoint_query_create(struct wined3d_device *de
return WINED3DERR_NOTAVAILABLE;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT)
@ -1211,7 +1211,7 @@ static void wined3d_so_statistics_query_ops_destroy(struct wined3d_query *query)
if (pq->context_gl)
wined3d_context_gl_free_so_statistics_query(pq);
heap_free(pq);
free(pq);
}
static const struct wined3d_query_ops so_statistics_query_ops =
@ -1250,7 +1250,7 @@ static HRESULT wined3d_so_statistics_query_create(struct wined3d_device *device,
return WINED3DERR_NOTAVAILABLE;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
wined3d_query_init(&object->query, device, type, &object->statistics,
@ -1268,7 +1268,7 @@ static void wined3d_pipeline_query_ops_destroy(struct wined3d_query *query)
struct wined3d_pipeline_statistics_query *pq = wined3d_pipeline_statistics_query_from_query(query);
if (pq->context_gl)
wined3d_context_gl_free_pipeline_statistics_query(pq);
heap_free(pq);
free(pq);
}
static const struct wined3d_query_ops pipeline_query_ops =
@ -1294,7 +1294,7 @@ static HRESULT wined3d_pipeline_query_create(struct wined3d_device *device,
return WINED3DERR_NOTAVAILABLE;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
wined3d_query_init(&object->query, device, type, &object->statistics,
@ -1742,8 +1742,8 @@ static void wined3d_query_vk_destroy(struct wined3d_query *query)
if (query_vk->vk_event)
wined3d_context_vk_destroy_vk_event(context_vk, query_vk->vk_event, query_vk->command_buffer_id);
context_release(&context_vk->c);
heap_free(query_vk->pending);
heap_free(query_vk);
free(query_vk->pending);
free(query_vk);
}
static const struct wined3d_query_ops wined3d_query_vk_ops =
@ -1948,7 +1948,7 @@ HRESULT wined3d_query_vk_create(struct wined3d_device *device, enum wined3d_quer
return WINED3DERR_NOTAVAILABLE;
}
if (!(query_vk = heap_alloc_zero(sizeof(*query_vk) + data_size)))
if (!(query_vk = calloc(1, sizeof(*query_vk) + data_size)))
return E_OUTOFMEMORY;
data = query_vk + 1;

View file

@ -339,7 +339,7 @@ static BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
static const SIZE_T align = RESOURCE_ALIGNMENT;
void *mem;
if (!(mem = heap_alloc_zero(resource->size + align)))
if (!(mem = calloc(1, resource->size + align)))
{
ERR("Failed to allocate system memory.\n");
return FALSE;
@ -365,7 +365,7 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
return;
resource->heap_memory = NULL;
heap_free(resource->heap_pointer);
free(resource->heap_pointer);
resource->heap_pointer = NULL;
}

View file

@ -395,7 +395,7 @@ void string_buffer_clear(struct wined3d_string_buffer *buffer)
BOOL string_buffer_init(struct wined3d_string_buffer *buffer)
{
buffer->buffer_size = 32;
if (!(buffer->buffer = heap_alloc(buffer->buffer_size)))
if (!(buffer->buffer = malloc(buffer->buffer_size)))
{
ERR("Failed to allocate shader buffer memory.\n");
return FALSE;
@ -407,7 +407,7 @@ BOOL string_buffer_init(struct wined3d_string_buffer *buffer)
void string_buffer_free(struct wined3d_string_buffer *buffer)
{
heap_free(buffer->buffer);
free(buffer->buffer);
}
BOOL string_buffer_resize(struct wined3d_string_buffer *buffer, int rc)
@ -417,7 +417,7 @@ BOOL string_buffer_resize(struct wined3d_string_buffer *buffer, int rc)
while (rc > 0 && (unsigned int)rc >= new_buffer_size - buffer->content_size)
new_buffer_size *= 2;
if (!(new_buffer = heap_realloc(buffer->buffer, new_buffer_size)))
if (!(new_buffer = realloc(buffer->buffer, new_buffer_size)))
{
ERR("Failed to grow buffer.\n");
buffer->buffer[buffer->content_size] = '\0';
@ -465,11 +465,11 @@ struct wined3d_string_buffer *string_buffer_get(struct wined3d_string_buffer_lis
if (list_empty(&list->list))
{
buffer = heap_alloc(sizeof(*buffer));
buffer = malloc(sizeof(*buffer));
if (!buffer || !string_buffer_init(buffer))
{
ERR("Couldn't allocate buffer for temporary string.\n");
heap_free(buffer);
free(buffer);
return NULL;
}
}
@ -526,7 +526,7 @@ void string_buffer_list_cleanup(struct wined3d_string_buffer_list *list)
LIST_FOR_EACH_ENTRY_SAFE(buffer, buffer_next, &list->list, struct wined3d_string_buffer, entry)
{
string_buffer_free(buffer);
heap_free(buffer);
free(buffer);
}
list_init(&list->list);
}
@ -536,7 +536,7 @@ static void shader_delete_constant_list(struct list *clist)
struct wined3d_shader_lconst *constant, *constant_next;
LIST_FOR_EACH_ENTRY_SAFE(constant, constant_next, clist, struct wined3d_shader_lconst, entry)
heap_free(constant);
free(constant);
list_init(clist);
}
@ -786,7 +786,7 @@ static void shader_record_sample(struct wined3d_shader_reg_maps *reg_maps,
if (!map->size)
{
if (!(entries = heap_calloc(4, sizeof(*entries))))
if (!(entries = calloc(4, sizeof(*entries))))
{
ERR("Failed to allocate sampler map entries.\n");
return;
@ -799,7 +799,7 @@ static void shader_record_sample(struct wined3d_shader_reg_maps *reg_maps,
size_t new_size = map->size * 2;
if (sizeof(*entries) * new_size <= sizeof(*entries) * map->size
|| !(entries = heap_realloc(entries, sizeof(*entries) * new_size)))
|| !(entries = realloc(entries, sizeof(*entries) * new_size)))
{
ERR("Failed to resize sampler map entries.\n");
return;
@ -885,9 +885,9 @@ static HRESULT shader_record_shader_phase(struct wined3d_shader *shader,
if (shader->u.hs.phases.control_point)
{
FIXME("Multiple control point phases.\n");
heap_free(shader->u.hs.phases.control_point);
free(shader->u.hs.phases.control_point);
}
if (!(shader->u.hs.phases.control_point = heap_alloc_zero(sizeof(*shader->u.hs.phases.control_point))))
if (!(shader->u.hs.phases.control_point = calloc(1, sizeof(*shader->u.hs.phases.control_point))))
return E_OUTOFMEMORY;
phase = shader->u.hs.phases.control_point;
break;
@ -1006,7 +1006,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
shader_set_limits(shader);
if (!(reg_maps->constf = heap_calloc(((min(shader->limits->constant_float, constf_size) + 31) / 32),
if (!(reg_maps->constf = calloc(((min(shader->limits->constant_float, constf_size) + 31) / 32),
sizeof(*reg_maps->constf))))
{
ERR("Failed to allocate constant map memory.\n");
@ -1161,7 +1161,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
{
struct wined3d_shader_indexable_temp *reg;
if (!(reg = heap_alloc(sizeof(*reg))))
if (!(reg = malloc(sizeof(*reg))))
return E_OUTOFMEMORY;
*reg = ins.declaration.indexable_temp;
@ -1346,7 +1346,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
struct wined3d_shader_lconst *lconst;
float *value;
if (!(lconst = heap_alloc(sizeof(*lconst))))
if (!(lconst = malloc(sizeof(*lconst))))
return E_OUTOFMEMORY;
lconst->idx = ins.dst[0].reg.idx[0].offset;
@ -1378,7 +1378,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
{
struct wined3d_shader_lconst *lconst;
if (!(lconst = heap_alloc(sizeof(*lconst))))
if (!(lconst = malloc(sizeof(*lconst))))
return E_OUTOFMEMORY;
lconst->idx = ins.dst[0].reg.idx[0].offset;
@ -1391,7 +1391,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
{
struct wined3d_shader_lconst *lconst;
if (!(lconst = heap_alloc(sizeof(*lconst))))
if (!(lconst = malloc(sizeof(*lconst))))
return E_OUTOFMEMORY;
lconst->idx = ins.dst[0].reg.idx[0].offset;
@ -1779,7 +1779,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
struct wined3d_shader_signature_element *e;
unsigned int i;
if (!(input_signature->elements = heap_calloc(count, sizeof(*input_signature->elements))))
if (!(input_signature->elements = calloc(count, sizeof(*input_signature->elements))))
return E_OUTOFMEMORY;
input_signature->element_count = count;
@ -1803,7 +1803,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
unsigned int count = wined3d_popcount(reg_maps->output_registers);
struct wined3d_shader_signature_element *e;
if (!(output_signature->elements = heap_calloc(count, sizeof(*output_signature->elements))))
if (!(output_signature->elements = calloc(count, sizeof(*output_signature->elements))))
return E_OUTOFMEMORY;
output_signature->element_count = count;
@ -1823,14 +1823,14 @@ static void shader_cleanup_reg_maps(struct wined3d_shader_reg_maps *reg_maps)
{
struct wined3d_shader_indexable_temp *reg, *reg_next;
heap_free(reg_maps->constf);
heap_free(reg_maps->sampler_map.entries);
free(reg_maps->constf);
free(reg_maps->sampler_map.entries);
LIST_FOR_EACH_ENTRY_SAFE(reg, reg_next, &reg_maps->indexable_temps, struct wined3d_shader_indexable_temp, entry)
heap_free(reg);
free(reg);
list_init(&reg_maps->indexable_temps);
heap_free(reg_maps->tgsm);
free(reg_maps->tgsm);
}
unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_maps *reg_maps, unsigned int max)
@ -1901,17 +1901,17 @@ static void shader_cleanup(struct wined3d_shader *shader)
{
if (shader->reg_maps.shader_version.type == WINED3D_SHADER_TYPE_HULL)
{
heap_free(shader->u.hs.phases.control_point);
heap_free(shader->u.hs.phases.fork);
heap_free(shader->u.hs.phases.join);
free(shader->u.hs.phases.control_point);
free(shader->u.hs.phases.fork);
free(shader->u.hs.phases.join);
}
heap_free(shader->patch_constant_signature.elements);
heap_free(shader->output_signature.elements);
heap_free(shader->input_signature.elements);
free(shader->patch_constant_signature.elements);
free(shader->output_signature.elements);
free(shader->input_signature.elements);
shader->device->shader_backend->shader_destroy(shader);
shader_cleanup_reg_maps(&shader->reg_maps);
heap_free(shader->byte_code);
free(shader->byte_code);
shader_delete_constant_list(&shader->constantsF);
shader_delete_constant_list(&shader->constantsB);
shader_delete_constant_list(&shader->constantsI);
@ -1969,13 +1969,13 @@ static HRESULT shader_none_alloc(struct wined3d_device *device, const struct win
void *vertex_priv, *fragment_priv;
struct shader_none_priv *priv;
if (!(priv = heap_alloc(sizeof(*priv))))
if (!(priv = malloc(sizeof(*priv))))
return E_OUTOFMEMORY;
if (!(vertex_priv = vertex_pipe->vp_alloc(&none_shader_backend, priv)))
{
ERR("Failed to initialize vertex pipe.\n");
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -1983,7 +1983,7 @@ static HRESULT shader_none_alloc(struct wined3d_device *device, const struct win
{
ERR("Failed to initialize fragment pipe.\n");
vertex_pipe->vp_free(device, NULL);
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -2003,7 +2003,7 @@ static void shader_none_free(struct wined3d_device *device, struct wined3d_conte
priv->fragment_pipe->free_private(device, context);
priv->vertex_pipe->vp_free(device, context);
heap_free(priv);
free(priv);
}
static BOOL shader_none_allocate_context_data(struct wined3d_context *context)
@ -2166,7 +2166,7 @@ static void wined3d_shader_destroy_object(void *object)
TRACE("object %p.\n", object);
shader_cleanup(object);
heap_free(object);
free(object);
}
ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
@ -2238,7 +2238,7 @@ HRESULT CDECL wined3d_shader_set_local_constants_float(struct wined3d_shader *sh
struct wined3d_shader_lconst *lconst;
float *value;
if (!(lconst = heap_alloc(sizeof(*lconst))))
if (!(lconst = malloc(sizeof(*lconst))))
return E_OUTOFMEMORY;
lconst->idx = i;
@ -2447,7 +2447,7 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
shader->byte_code_size = (ptr - desc->byte_code) * sizeof(*ptr);
if (!(shader->byte_code = heap_alloc(shader->byte_code_size)))
if (!(shader->byte_code = malloc(shader->byte_code_size)))
{
hr = E_OUTOFMEMORY;
goto fail;
@ -2461,7 +2461,7 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
{
unsigned int max_version;
if (!(shader->byte_code = heap_alloc(desc->byte_code_size)))
if (!(shader->byte_code = malloc(desc->byte_code_size)))
{
hr = E_OUTOFMEMORY;
goto fail;
@ -2594,7 +2594,7 @@ static HRESULT geometry_shader_init_so_desc(struct wined3d_geometry_shader *gs,
if (n)
size += strlen(n) + 1;
}
if (!(s = heap_alloc(size)))
if (!(s = malloc(size)))
return E_OUTOFMEMORY;
s->desc = *so_desc;
@ -2618,7 +2618,7 @@ static HRESULT geometry_shader_init_so_desc(struct wined3d_geometry_shader *gs,
if (wine_rb_put(&device->so_descs, &s->desc, &s->entry) == -1)
{
heap_free(s);
free(s);
return E_FAIL;
}
gs->so_desc = &s->desc;
@ -3141,20 +3141,20 @@ HRESULT CDECL wined3d_shader_create_cs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize compute shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
if (FAILED(hr = shader_set_function(object, device, WINED3D_SHADER_TYPE_COMPUTE, 0)))
{
shader_cleanup(object);
heap_free(object);
free(object);
return hr;
}
@ -3175,20 +3175,20 @@ HRESULT CDECL wined3d_shader_create_ds(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize domain shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
if (FAILED(hr = shader_set_function(object, device, WINED3D_SHADER_TYPE_DOMAIN, 0)))
{
shader_cleanup(object);
heap_free(object);
free(object);
return hr;
}
@ -3210,13 +3210,13 @@ HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, so_desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, so_desc, parent, parent_ops, shader);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = geometry_shader_init(object, device, desc, so_desc, parent, parent_ops)))
{
WARN("Failed to initialize geometry shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
@ -3237,20 +3237,20 @@ HRESULT CDECL wined3d_shader_create_hs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize hull shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
if (FAILED(hr = shader_set_function(object, device, WINED3D_SHADER_TYPE_HULL, 0)))
{
shader_cleanup(object);
heap_free(object);
free(object);
return hr;
}
@ -3271,13 +3271,13 @@ HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = pixel_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize pixel shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
@ -3298,13 +3298,13 @@ HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = vertex_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize vertex shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}

View file

@ -546,7 +546,7 @@ static void *shader_sm1_init(const DWORD *byte_code, size_t byte_code_size,
return NULL;
}
if (!(priv = heap_alloc(sizeof(*priv))))
if (!(priv = malloc(sizeof(*priv))))
return NULL;
if (output_signature->element_count)
@ -566,7 +566,7 @@ static void *shader_sm1_init(const DWORD *byte_code, size_t byte_code_size,
default:
FIXME("Unrecognized shader type %#lx.\n", *byte_code >> 16);
heap_free(priv);
free(priv);
return NULL;
}
priv->shader_version.major = WINED3D_SM1_VERSION_MAJOR(*byte_code);
@ -579,7 +579,7 @@ static void *shader_sm1_init(const DWORD *byte_code, size_t byte_code_size,
static void shader_sm1_free(void *data)
{
heap_free(data);
free(data);
}
static void shader_sm1_read_header(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version)

View file

@ -1311,7 +1311,7 @@ static void *shader_sm4_init(const DWORD *byte_code, size_t byte_code_size,
return NULL;
}
if (!(priv = heap_alloc(sizeof(*priv))))
if (!(priv = malloc(sizeof(*priv))))
{
ERR("Failed to allocate private data\n");
return NULL;
@ -1323,7 +1323,7 @@ static void *shader_sm4_init(const DWORD *byte_code, size_t byte_code_size,
priv->shader_version.type = wined3d_get_sm4_shader_type(byte_code, byte_code_size);
if (priv->shader_version.type == WINED3D_SHADER_TYPE_INVALID)
{
heap_free(priv);
free(priv);
return NULL;
}
@ -1361,9 +1361,9 @@ static void shader_sm4_free(void *data)
list_move_head(&priv->src_free, &priv->src);
LIST_FOR_EACH_ENTRY_SAFE(e1, e2, &priv->src_free, struct wined3d_shader_src_param_entry, entry)
{
heap_free(e1);
free(e1);
}
heap_free(priv);
free(priv);
}
static struct wined3d_shader_src_param *get_src_param(struct wined3d_sm4_data *priv)
@ -1378,7 +1378,7 @@ static struct wined3d_shader_src_param *get_src_param(struct wined3d_sm4_data *p
}
else
{
if (!(e = heap_alloc(sizeof(*e))))
if (!(e = malloc(sizeof(*e))))
return NULL;
elem = &e->entry;
}
@ -1922,7 +1922,7 @@ static HRESULT shader_parse_signature(DWORD tag, const char *data, unsigned int
return E_INVALIDARG;
}
if (!(e = heap_calloc(count, sizeof(*e))))
if (!(e = calloc(count, sizeof(*e))))
{
ERR("Failed to allocate input signature memory.\n");
return E_OUTOFMEMORY;
@ -1943,7 +1943,7 @@ static HRESULT shader_parse_signature(DWORD tag, const char *data, unsigned int
if (!(e[i].semantic_name = shader_get_string(data, data_size, name_offset)))
{
WARN("Invalid name offset %#x (data size %#x).\n", name_offset, data_size);
heap_free(e);
free(e);
return E_INVALIDARG;
}
e[i].semantic_idx = read_dword(&ptr);

View file

@ -464,8 +464,8 @@ static struct shader_spirv_compute_program_vk *shader_spirv_find_compute_program
static void shader_spirv_resource_bindings_cleanup(struct shader_spirv_resource_bindings *bindings)
{
heap_free(bindings->vk_bindings);
heap_free(bindings->bindings);
free(bindings->vk_bindings);
free(bindings->bindings);
}
static bool shader_spirv_resource_bindings_add_vk_binding(struct shader_spirv_resource_bindings *bindings,
@ -784,7 +784,7 @@ static void shader_spirv_precompile_compute(struct wined3d_shader *shader)
if (!(program_vk = shader->backend_data))
{
if (!(program_vk = heap_alloc_zero(sizeof(*program_vk))))
if (!(program_vk = calloc(1, sizeof(*program_vk))))
ERR("Failed to allocate program.\n");
shader->backend_data = program_vk;
}
@ -806,7 +806,7 @@ static void shader_spirv_precompile(void *shader_priv, struct wined3d_shader *sh
if (!(program_vk = shader->backend_data))
{
if (!(program_vk = heap_alloc_zero(sizeof(*program_vk))))
if (!(program_vk = calloc(1, sizeof(*program_vk))))
ERR("Failed to allocate program.\n");
shader->backend_data = program_vk;
}
@ -985,7 +985,7 @@ static void shader_spirv_destroy_compute_vk(struct wined3d_shader *shader)
VK_CALL(vkDestroyShaderModule(device_vk->vk_device, program->vk_module, NULL));
vkd3d_shader_free_scan_descriptor_info(&program->descriptor_info);
shader->backend_data = NULL;
heap_free(program);
free(program);
}
static void shader_spirv_destroy(struct wined3d_shader *shader)
@ -1012,12 +1012,12 @@ static void shader_spirv_destroy(struct wined3d_shader *shader)
shader_spirv_invalidate_contexts_graphics_program_variant(&device_vk->d, variant_vk);
VK_CALL(vkDestroyShaderModule(device_vk->vk_device, variant_vk->vk_module, NULL));
}
heap_free(program_vk->variants);
free(program_vk->variants);
vkd3d_shader_free_scan_descriptor_info(&program_vk->descriptor_info);
vkd3d_shader_free_scan_signature_info(&program_vk->signature_info);
shader->backend_data = NULL;
heap_free(program_vk);
free(program_vk);
}
static HRESULT shader_spirv_alloc(struct wined3d_device *device,
@ -1026,13 +1026,13 @@ static HRESULT shader_spirv_alloc(struct wined3d_device *device,
void *vertex_priv, *fragment_priv;
struct shader_spirv_priv *priv;
if (!(priv = heap_alloc(sizeof(*priv))))
if (!(priv = malloc(sizeof(*priv))))
return E_OUTOFMEMORY;
if (!(vertex_priv = vertex_pipe->vp_alloc(&spirv_shader_backend_vk, priv)))
{
ERR("Failed to initialise vertex pipe.\n");
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -1040,7 +1040,7 @@ static HRESULT shader_spirv_alloc(struct wined3d_device *device,
{
ERR("Failed to initialise fragment pipe.\n");
vertex_pipe->vp_free(device, NULL);
heap_free(priv);
free(priv);
return E_FAIL;
}
@ -1062,7 +1062,7 @@ static void shader_spirv_free(struct wined3d_device *device, struct wined3d_cont
shader_spirv_resource_bindings_cleanup(&priv->bindings);
priv->fragment_pipe->free_private(device, context);
priv->vertex_pipe->vp_free(device, context);
heap_free(priv);
free(priv);
}
static BOOL shader_spirv_allocate_context_data(struct wined3d_context *context)

View file

@ -405,7 +405,7 @@ static void stateblock_init_lights(struct wined3d_stateblock *stateblock, const
RB_FOR_EACH_ENTRY(src_light, src_tree, struct wined3d_light_info, entry)
{
struct wined3d_light_info *dst_light = heap_alloc(sizeof(*dst_light));
struct wined3d_light_info *dst_light = malloc(sizeof(*dst_light));
*dst_light = *src_light;
rb_put(dst_tree, (void *)(ULONG_PTR)dst_light->OriginalIndex, &dst_light->entry);
@ -592,7 +592,7 @@ static void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *st
if (light->changed)
list_remove(&light->changed_entry);
rb_remove(&state->light_state->lights_tree, &light->entry);
heap_free(light);
free(light);
}
}
@ -614,7 +614,7 @@ void state_cleanup(struct wined3d_state *state)
if (light->changed)
list_remove(&light->changed_entry);
rb_remove(&state->light_state.lights_tree, &light->entry);
heap_free(light);
free(light);
}
}
@ -628,7 +628,7 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
{
wined3d_mutex_lock();
wined3d_stateblock_state_cleanup(&stateblock->stateblock_state);
heap_free(stateblock);
free(stateblock);
wined3d_mutex_unlock();
}
@ -663,7 +663,7 @@ HRESULT wined3d_light_state_set_light(struct wined3d_light_state *state, DWORD l
if (!(object = wined3d_light_state_get_light(state, light_idx)))
{
TRACE("Adding new light.\n");
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
{
ERR("Failed to allocate light info.\n");
return E_OUTOFMEMORY;
@ -2058,7 +2058,7 @@ HRESULT CDECL wined3d_state_create(struct wined3d_device *device,
TRACE("Selected feature level %s.\n", wined3d_debug_feature_level(feature_level));
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
state_init(object, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT, feature_level);
@ -2078,7 +2078,7 @@ void CDECL wined3d_state_destroy(struct wined3d_state *state)
TRACE("state %p.\n", state);
state_cleanup(state);
heap_free(state);
free(state);
}
static void stateblock_state_init_default(struct wined3d_stateblock_state *state,
@ -2184,14 +2184,14 @@ HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, const str
TRACE("device %p, device_state %p, type %#x, stateblock %p.\n",
device, device_state, type, stateblock);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
hr = stateblock_init(object, device_state, device, type);
if (FAILED(hr))
{
WARN("Failed to initialize stateblock, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}

View file

@ -443,7 +443,7 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i
/* glReadPixels returns the image upside down, and there is no way to
* prevent this. Flip the lines in software. */
if (!(row = heap_alloc(row_pitch)))
if (!(row = malloc(row_pitch)))
goto error;
if (data.buffer_object)
@ -463,7 +463,7 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i
top += row_pitch;
bottom -= row_pitch;
}
heap_free(row);
free(row);
if (data.buffer_object)
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_PACK_BUFFER));
@ -541,7 +541,7 @@ static void cpu_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
heap_free(blitter);
free(blitter);
}
static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data,
@ -748,7 +748,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
{
wined3d_format_calculate_pitch(dst_format, 1, dst_box->right, dst_box->bottom,
&dst_map.row_pitch, &dst_map.slice_pitch);
dst_map.data = heap_alloc(dst_map.slice_pitch);
dst_map.data = malloc(dst_map.slice_pitch);
}
else
{
@ -1157,7 +1157,7 @@ release:
if (upload)
{
heap_free(dst_map.data);
free(dst_map.data);
}
else
{
@ -1350,7 +1350,7 @@ struct wined3d_blitter *wined3d_cpu_blitter_create(void)
{
struct wined3d_blitter *blitter;
if (!(blitter = heap_alloc(sizeof(*blitter))))
if (!(blitter = malloc(sizeof(*blitter))))
return NULL;
TRACE("Created blitter %p.\n", blitter);

View file

@ -57,7 +57,7 @@ void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain)
if (wined3d_texture_decref(swapchain->back_buffers[i]))
WARN("Something's still holding back buffer %u (%p).\n", i, swapchain->back_buffers[i]);
}
heap_free(swapchain->back_buffers);
free(swapchain->back_buffers);
swapchain->back_buffers = NULL;
}
@ -106,13 +106,13 @@ static void wined3d_swapchain_vk_destroy_vulkan_swapchain(struct wined3d_swapcha
if ((vr = VK_CALL(vkQueueWaitIdle(device_vk->vk_queue))) < 0)
ERR("Failed to wait on queue, vr %s.\n", wined3d_debug_vkresult(vr));
heap_free(swapchain_vk->vk_images);
free(swapchain_vk->vk_images);
for (i = 0; i < swapchain_vk->image_count; ++i)
{
VK_CALL(vkDestroySemaphore(device_vk->vk_device, swapchain_vk->vk_semaphores[i].available, NULL));
VK_CALL(vkDestroySemaphore(device_vk->vk_device, swapchain_vk->vk_semaphores[i].presentable, NULL));
}
heap_free(swapchain_vk->vk_semaphores);
free(swapchain_vk->vk_semaphores);
VK_CALL(vkDestroySwapchainKHR(device_vk->vk_device, swapchain_vk->vk_swapchain, NULL));
VK_CALL(vkDestroySurfaceKHR(vk_info->instance, swapchain_vk->vk_surface, NULL));
}
@ -681,7 +681,7 @@ static bool wined3d_swapchain_vk_present_mode_supported(struct wined3d_swapchain
return false;
}
if (!(vk_modes = heap_calloc(count, sizeof(*vk_modes))))
if (!(vk_modes = calloc(count, sizeof(*vk_modes))))
return false;
if ((vr = VK_CALL(vkGetPhysicalDeviceSurfacePresentModesKHR(vk_physical_device,
@ -701,7 +701,7 @@ static bool wined3d_swapchain_vk_present_mode_supported(struct wined3d_swapchain
}
done:
heap_free(vk_modes);
free(vk_modes);
return supported;
}
@ -751,14 +751,14 @@ static VkFormat wined3d_swapchain_vk_select_vk_format(struct wined3d_swapchain_v
return VK_FORMAT_UNDEFINED;
}
if (!(vk_formats = heap_calloc(format_count, sizeof(*vk_formats))))
if (!(vk_formats = calloc(format_count, sizeof(*vk_formats))))
return VK_FORMAT_UNDEFINED;
if ((vr = VK_CALL(vkGetPhysicalDeviceSurfaceFormatsKHR(vk_physical_device,
vk_surface, &format_count, vk_formats))) < 0)
{
WARN("Failed to get supported surface formats, vr %s.\n", wined3d_debug_vkresult(vr));
heap_free(vk_formats);
free(vk_formats);
return VK_FORMAT_UNDEFINED;
}
@ -778,7 +778,7 @@ static VkFormat wined3d_swapchain_vk_select_vk_format(struct wined3d_swapchain_v
break;
}
}
heap_free(vk_formats);
free(vk_formats);
if (i == format_count)
{
FIXME("Failed to find Vulkan swapchain format for %s.\n", debug_d3dformat(desc->backbuffer_format));
@ -807,7 +807,7 @@ static bool wined3d_swapchain_vk_create_vulkan_swapchain_images(struct wined3d_s
return false;
}
if (!(swapchain_vk->vk_images = heap_calloc(image_count, sizeof(*swapchain_vk->vk_images))))
if (!(swapchain_vk->vk_images = calloc(image_count, sizeof(*swapchain_vk->vk_images))))
{
ERR("Failed to allocate images array.\n");
return false;
@ -817,14 +817,14 @@ static bool wined3d_swapchain_vk_create_vulkan_swapchain_images(struct wined3d_s
vk_swapchain, &image_count, swapchain_vk->vk_images))) < 0)
{
ERR("Failed to get swapchain images, vr %s.\n", wined3d_debug_vkresult(vr));
heap_free(swapchain_vk->vk_images);
free(swapchain_vk->vk_images);
return false;
}
if (!(swapchain_vk->vk_semaphores = heap_calloc(image_count, sizeof(*swapchain_vk->vk_semaphores))))
if (!(swapchain_vk->vk_semaphores = calloc(image_count, sizeof(*swapchain_vk->vk_semaphores))))
{
ERR("Failed to allocate semaphores array.\n");
heap_free(swapchain_vk->vk_images);
free(swapchain_vk->vk_images);
return false;
}
@ -859,8 +859,8 @@ fail:
if (swapchain_vk->vk_semaphores[i].presentable)
VK_CALL(vkDestroySemaphore(device_vk->vk_device, swapchain_vk->vk_semaphores[i].presentable, NULL));
}
heap_free(swapchain_vk->vk_semaphores);
heap_free(swapchain_vk->vk_images);
free(swapchain_vk->vk_semaphores);
free(swapchain_vk->vk_images);
return false;
}
@ -1593,7 +1593,7 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
if (swapchain->state.desc.backbuffer_count > 0)
{
if (!(swapchain->back_buffers = heap_calloc(swapchain->state.desc.backbuffer_count,
if (!(swapchain->back_buffers = calloc(swapchain->state.desc.backbuffer_count,
sizeof(*swapchain->back_buffers))))
{
ERR("Failed to allocate backbuffer array memory.\n");
@ -1668,7 +1668,7 @@ err:
wined3d_texture_decref(swapchain->back_buffers[i]);
}
}
heap_free(swapchain->back_buffers);
free(swapchain->back_buffers);
}
if (swapchain->front_buffer)
@ -1769,7 +1769,7 @@ static struct wined3d_context_gl *wined3d_swapchain_gl_create_context(struct win
wined3d_from_cs(device->cs);
if (!(context_gl = heap_alloc_zero(sizeof(*context_gl))))
if (!(context_gl = calloc(1, sizeof(*context_gl))))
{
ERR("Failed to allocate context memory.\n");
return NULL;
@ -1778,7 +1778,7 @@ static struct wined3d_context_gl *wined3d_swapchain_gl_create_context(struct win
if (FAILED(wined3d_context_gl_init(context_gl, swapchain_gl)))
{
WARN("Failed to initialise context.\n");
heap_free(context_gl);
free(context_gl);
return NULL;
}
@ -2181,7 +2181,7 @@ static DWORD WINAPI set_window_state_thread(void *ctx)
wined3d_filter_messages(s->window, filter);
heap_free(s);
free(s);
return 0;
}
@ -2236,7 +2236,7 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
return WINED3DERR_NOTAVAILABLE;
}
if (!(s = heap_alloc(sizeof(*s))))
if (!(s = malloc(sizeof(*s))))
return E_OUTOFMEMORY;
s->window = window;
s->window_pos_after = HWND_TOPMOST;
@ -2282,7 +2282,7 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
if (!state->style && !state->exstyle)
return;
if (!(s = heap_alloc(sizeof(*s))))
if (!(s = malloc(sizeof(*s))))
return;
s->window = window;
@ -2468,7 +2468,7 @@ void CDECL wined3d_swapchain_state_get_size(const struct wined3d_swapchain_state
void CDECL wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state)
{
wined3d_swapchain_state_cleanup(state);
heap_free(state);
free(state);
}
HRESULT CDECL wined3d_swapchain_state_create(const struct wined3d_swapchain_desc *desc,
@ -2480,12 +2480,12 @@ HRESULT CDECL wined3d_swapchain_state_create(const struct wined3d_swapchain_desc
TRACE("desc %p, window %p, wined3d %p, state %p.\n", desc, window, wined3d, state);
if (!(s = heap_alloc_zero(sizeof(*s))))
if (!(s = calloc(1, sizeof(*s))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_swapchain_state_init(s, desc, window, wined3d, state_parent)))
{
heap_free(s);
free(s);
return hr;
}

View file

@ -932,7 +932,7 @@ static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture
wined3d_context_gl_destroy_bo(context_gl, bo_gl);
wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_BUFFER);
sub_resource->bo = NULL;
heap_free(bo_gl);
free(bo_gl);
}
static void wined3d_texture_unload_location(struct wined3d_texture *texture,
@ -1169,7 +1169,7 @@ static void wined3d_texture_create_dc(void *object)
{
unsigned int sub_count = texture->level_count * texture->layer_count;
if (!(texture->dc_info = heap_calloc(sub_count, sizeof(*texture->dc_info))))
if (!(texture->dc_info = calloc(sub_count, sizeof(*texture->dc_info))))
{
ERR("Failed to allocate DC info.\n");
return;
@ -1581,7 +1581,7 @@ static void wined3d_texture_destroy_object(void *object)
wined3d_texture_destroy_dc(&texture_idx);
}
}
heap_free(dc_info);
free(dc_info);
}
if (texture->overlay_info)
@ -1597,16 +1597,16 @@ static void wined3d_texture_destroy_object(void *object)
list_remove(&overlay->entry);
}
}
heap_free(texture->overlay_info);
free(texture->overlay_info);
}
if (texture->dirty_regions)
{
for (i = 0; i < texture->layer_count; ++i)
{
heap_free(texture->dirty_regions[i].boxes);
free(texture->dirty_regions[i].boxes);
}
heap_free(texture->dirty_regions);
free(texture->dirty_regions);
}
/* Discard the contents of resources with CPU access, to avoid downloading
@ -1877,7 +1877,7 @@ void wined3d_texture_gl_set_compatible_renderbuffer(struct wined3d_texture_gl *t
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format_gl->internal, width, height);
entry = heap_alloc(sizeof(*entry));
entry = malloc(sizeof(*entry));
entry->width = width;
entry->height = height;
entry->id = renderbuffer;
@ -2019,14 +2019,14 @@ static void wined3d_texture_gl_prepare_buffer_object(struct wined3d_texture_gl *
if (sub_resource->bo)
return;
if (!(bo = heap_alloc(sizeof(*bo))))
if (!(bo = malloc(sizeof(*bo))))
return;
if (!wined3d_device_gl_create_bo(wined3d_device_gl(texture_gl->t.resource.device),
context_gl, sub_resource->size, GL_PIXEL_UNPACK_BUFFER, GL_STREAM_DRAW, true,
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_CLIENT_STORAGE_BIT, bo))
{
heap_free(bo);
free(bo);
return;
}
@ -2509,7 +2509,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
wined3d_format_calculate_pitch(src_format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
if (!(converted_mem = heap_alloc(dst_slice_pitch)))
if (!(converted_mem = malloc(dst_slice_pitch)))
{
ERR("Failed to allocate upload buffer.\n");
return;
@ -2537,7 +2537,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
}
wined3d_context_gl_unmap_bo_address(context_gl, &bo, 0, NULL);
heap_free(converted_mem);
free(converted_mem);
}
else
{
@ -2621,7 +2621,7 @@ static void wined3d_texture_gl_download_data_slow_path(struct wined3d_texture_gl
WARN_(d3d_perf)("Downloading all miplevel layers to get the data for a single sub-resource.\n");
if (!(temporary_mem = heap_calloc(texture_gl->t.layer_count, sub_resource->size)))
if (!(temporary_mem = calloc(texture_gl->t.layer_count, sub_resource->size)))
{
ERR("Out of memory.\n");
return;
@ -2641,7 +2641,7 @@ static void wined3d_texture_gl_download_data_slow_path(struct wined3d_texture_gl
wined3d_texture_get_level_pow2_width(&texture_gl->t, level),
wined3d_texture_get_level_pow2_height(&texture_gl->t, level),
&src_row_pitch, &src_slice_pitch);
if (!(temporary_mem = heap_alloc(src_slice_pitch)))
if (!(temporary_mem = malloc(src_slice_pitch)))
{
ERR("Out of memory.\n");
return;
@ -2671,7 +2671,7 @@ static void wined3d_texture_gl_download_data_slow_path(struct wined3d_texture_gl
wined3d_texture_get_level_height(&texture_gl->t, level),
&src_row_pitch, &src_slice_pitch);
if (!(temporary_mem = heap_alloc(src_slice_pitch)))
if (!(temporary_mem = malloc(src_slice_pitch)))
{
ERR("Failed to allocate memory.\n");
return;
@ -2810,7 +2810,7 @@ static void wined3d_texture_gl_download_data_slow_path(struct wined3d_texture_gl
checkGLcall("glBindBuffer");
}
heap_free(temporary_mem);
free(temporary_mem);
}
static void wined3d_texture_gl_download_data(struct wined3d_context *context,
@ -3190,7 +3190,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
width, height, &dst_row_pitch, &dst_slice_pitch);
src_mem = wined3d_context_gl_map_bo_address(context_gl, &data, src_slice_pitch, WINED3D_MAP_READ);
if (!(dst_mem = heap_alloc(dst_slice_pitch)))
if (!(dst_mem = malloc(dst_slice_pitch)))
{
ERR("Out of memory (%u).\n", dst_slice_pitch);
return FALSE;
@ -3208,7 +3208,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
wined3d_texture_gl_upload_data(&context_gl->c, wined3d_const_bo_address(&data), format, &src_box,
src_row_pitch, src_slice_pitch, &texture_gl->t, sub_resource_idx, dst_location, 0, 0, 0);
heap_free(dst_mem);
free(dst_mem);
return TRUE;
}
@ -3457,7 +3457,7 @@ static void wined3d_texture_gl_unload_location(struct wined3d_texture *texture,
context_gl_resource_released(texture_gl->t.resource.device, entry->id, TRUE);
context_gl->gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id);
list_remove(&entry->entry);
heap_free(entry);
free(entry);
}
list_init(&texture_gl->renderbuffers);
texture_gl->current_renderbuffer = NULL;
@ -3949,7 +3949,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
if (flags & WINED3D_TEXTURE_CREATE_RECORD_DIRTY_REGIONS)
{
if (!(texture->dirty_regions = heap_calloc(texture->layer_count, sizeof(*texture->dirty_regions))))
if (!(texture->dirty_regions = calloc(texture->layer_count, sizeof(*texture->dirty_regions))))
{
wined3d_texture_cleanup_sync(texture);
return E_OUTOFMEMORY;
@ -3992,7 +3992,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
if (desc->usage & WINED3DUSAGE_OVERLAY)
{
if (!(texture->overlay_info = heap_calloc(sub_count, sizeof(*texture->overlay_info))))
if (!(texture->overlay_info = calloc(sub_count, sizeof(*texture->overlay_info))))
{
wined3d_texture_cleanup_sync(texture);
return E_OUTOFMEMORY;
@ -4627,7 +4627,7 @@ static void wined3d_texture_set_bo(struct wined3d_texture *texture,
assert(list_empty(&bo->users));
wined3d_context_destroy_bo(context, prev_bo);
heap_free(prev_bo);
free(prev_bo);
}
sub_resource->bo = bo;
@ -5523,14 +5523,14 @@ static BOOL wined3d_texture_vk_prepare_buffer_object(struct wined3d_texture_vk *
if (sub_resource->bo)
return TRUE;
if (!(bo = heap_alloc(sizeof(*bo))))
if (!(bo = malloc(sizeof(*bo))))
return FALSE;
if (!wined3d_context_vk_create_bo(context_vk, sub_resource->size,
VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, bo))
{
heap_free(bo);
free(bo);
return FALSE;
}
@ -5619,7 +5619,7 @@ static void wined3d_texture_vk_unload_location(struct wined3d_texture *texture,
struct wined3d_bo_vk *bo_vk = wined3d_bo_vk(sub_resource->bo);
wined3d_context_vk_destroy_bo(context_vk, bo_vk);
heap_free(bo_vk);
free(bo_vk);
sub_resource->bo = NULL;
}
}
@ -5773,7 +5773,7 @@ static void ffp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
heap_free(blitter);
free(blitter);
}
static bool ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3d_context *context,
@ -6382,7 +6382,7 @@ void wined3d_ffp_blitter_create(struct wined3d_blitter **next, const struct wine
{
struct wined3d_blitter *blitter;
if (!(blitter = heap_alloc(sizeof(*blitter))))
if (!(blitter = malloc(sizeof(*blitter))))
return;
TRACE("Created blitter %p.\n", blitter);
@ -6399,7 +6399,7 @@ static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
heap_free(blitter);
free(blitter);
}
static void fbo_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
@ -6495,7 +6495,7 @@ void wined3d_fbo_blitter_create(struct wined3d_blitter **next, const struct wine
if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
return;
if (!(blitter = heap_alloc(sizeof(*blitter))))
if (!(blitter = malloc(sizeof(*blitter))))
return;
TRACE("Created blitter %p.\n", blitter);
@ -6512,7 +6512,7 @@ static void raw_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
heap_free(blitter);
free(blitter);
}
static void raw_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
@ -6655,7 +6655,7 @@ void wined3d_raw_blitter_create(struct wined3d_blitter **next, const struct wine
if (!gl_info->supported[ARB_COPY_IMAGE])
return;
if (!(blitter = heap_alloc(sizeof(*blitter))))
if (!(blitter = malloc(sizeof(*blitter))))
return;
TRACE("Created blitter %p.\n", blitter);
@ -6674,7 +6674,7 @@ static void vk_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_c
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
heap_free(blitter);
free(blitter);
}
static void vk_blitter_clear_rendertargets(struct wined3d_context_vk *context_vk, unsigned int rt_count,
@ -7441,7 +7441,7 @@ void wined3d_vk_blitter_create(struct wined3d_blitter **next)
{
struct wined3d_blitter *blitter;
if (!(blitter = heap_alloc(sizeof(*blitter))))
if (!(blitter = malloc(sizeof(*blitter))))
return;
TRACE("Created blitter %p.\n", blitter);

View file

@ -4150,7 +4150,7 @@ static BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, si
{
unsigned int count = WINED3D_FORMAT_COUNT + ARRAY_SIZE(typeless_depth_stencil_formats);
if (!(adapter->formats = heap_calloc(count, format_size)))
if (!(adapter->formats = calloc(count, format_size)))
{
ERR("Failed to allocate memory.\n");
return FALSE;
@ -4169,7 +4169,7 @@ static BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, si
return TRUE;
fail:
heap_free(adapter->formats);
free(adapter->formats);
adapter->formats = NULL;
return FALSE;
}
@ -4237,7 +4237,7 @@ BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter, struct
return TRUE;
fail:
heap_free(adapter->formats);
free(adapter->formats);
adapter->formats = NULL;
return FALSE;
}
@ -4460,7 +4460,7 @@ BOOL wined3d_adapter_vk_init_format_info(struct wined3d_adapter_vk *adapter_vk,
return TRUE;
fail:
heap_free(adapter->formats);
free(adapter->formats);
adapter->formats = NULL;
return FALSE;
}
@ -7001,10 +7001,7 @@ BOOL wined3d_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE
if (new_capacity < count)
new_capacity = count;
if (!*elements)
new_elements = heap_alloc_zero(new_capacity * size);
else
new_elements = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *elements, new_capacity * size);
new_elements = _recalloc(*elements, new_capacity, size);
if (!new_elements)
return FALSE;
@ -7319,7 +7316,7 @@ static struct wined3d_allocator_block *wined3d_allocator_acquire_block(struct wi
struct wined3d_allocator_block *block;
if (!allocator->free)
return heap_alloc(sizeof(*block));
return malloc(sizeof(*block));
block = allocator->free;
allocator->free = block->parent;
@ -7417,13 +7414,13 @@ void wined3d_allocator_cleanup(struct wined3d_allocator *allocator)
allocator->ops->allocator_destroy_chunk(chunk);
}
}
heap_free(allocator->pools);
free(allocator->pools);
next = allocator->free;
while ((block = next))
{
next = block->parent;
heap_free(block);
free(block);
}
}
@ -7512,7 +7509,7 @@ bool wined3d_allocator_init(struct wined3d_allocator *allocator,
allocator->ops = allocator_ops;
allocator->pool_count = pool_count;
if (!(allocator->pools = heap_calloc(pool_count, sizeof(*allocator->pools))))
if (!(allocator->pools = calloc(pool_count, sizeof(*allocator->pools))))
return false;
for (i = 0; i < pool_count; ++i)
{

View file

@ -54,8 +54,8 @@ static void wined3d_vertex_declaration_destroy_object(void *object)
TRACE("declaration %p.\n", declaration);
heap_free(declaration->elements);
heap_free(declaration);
free(declaration->elements);
free(declaration);
}
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
@ -190,7 +190,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
declaration->parent = parent;
declaration->parent_ops = parent_ops;
declaration->device = device;
if (!(declaration->elements = heap_calloc(element_count, sizeof(*declaration->elements))))
if (!(declaration->elements = calloc(element_count, sizeof(*declaration->elements))))
{
ERR("Failed to allocate elements memory.\n");
return E_OUTOFMEMORY;
@ -230,7 +230,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
{
FIXME("The application tries to use an unsupported format (%s).\n",
debug_d3dformat(elements[i].format));
heap_free(declaration->elements);
free(declaration->elements);
return E_INVALIDARG;
}
@ -255,7 +255,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
{
WARN("Declaration element %u with format %s and offset %u is not %u byte aligned.\n",
i, debug_d3dformat(elements[i].format), e->offset, alignment);
heap_free(declaration->elements);
free(declaration->elements);
return E_INVALIDARG;
}
}
@ -273,14 +273,14 @@ HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device,
TRACE("device %p, elements %p, element_count %u, parent %p, parent_ops %p, declaration %p.\n",
device, elements, element_count, parent, parent_ops, declaration);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
hr = vertexdeclaration_init(object, device, elements, element_count, parent, parent_ops);
if (FAILED(hr))
{
WARN("Failed to initialize vertex declaration, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
@ -348,7 +348,7 @@ static unsigned int convert_fvf_to_declaration(const struct wined3d_adapter *ada
has_psize + has_diffuse + has_specular + num_textures;
state.adapter = adapter;
if (!(state.elements = heap_calloc(size, sizeof(*state.elements))))
if (!(state.elements = calloc(size, sizeof(*state.elements))))
return ~0u;
state.offset = 0;
state.idx = 0;
@ -448,6 +448,6 @@ HRESULT CDECL wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *
return E_OUTOFMEMORY;
hr = wined3d_vertex_declaration_create(device, elements, size, parent, parent_ops, declaration);
heap_free(elements);
free(elements);
return hr;
}

View file

@ -145,7 +145,7 @@ struct wined3d * CDECL wined3d_create(uint32_t flags)
struct wined3d *object;
HRESULT hr;
if (!(object = heap_alloc_zero(FIELD_OFFSET(struct wined3d, adapters[1]))))
if (!(object = calloc(1, FIELD_OFFSET(struct wined3d, adapters[1]))))
{
ERR("Failed to allocate wined3d object memory.\n");
return NULL;
@ -157,7 +157,7 @@ struct wined3d * CDECL wined3d_create(uint32_t flags)
if (FAILED(hr = wined3d_init(object, flags)))
{
WARN("Failed to initialize wined3d object, hr %#lx.\n", hr);
heap_free(object);
free(object);
return NULL;
}
@ -425,7 +425,7 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
{
size_t len = strlen(buffer) + 1;
if (!(wined3d_settings.logo = heap_alloc(len)))
if (!(wined3d_settings.logo = malloc(len)))
ERR("Failed to allocate logo path memory.\n");
else
memcpy(wined3d_settings.logo, buffer, len);
@ -526,17 +526,17 @@ static BOOL wined3d_dll_destroy(HINSTANCE hInstDLL)
* these entries. */
WARN("Leftover wndproc table entry %p.\n", &wndproc_table.entries[i]);
}
heap_free(wndproc_table.entries);
free(wndproc_table.entries);
heap_free(swapchain_state_table.states);
free(swapchain_state_table.states);
for (i = 0; i < swapchain_state_table.hook_count; ++i)
{
WARN("Leftover swapchain state hook %p.\n", &swapchain_state_table.hooks[i]);
UnhookWindowsHookEx(swapchain_state_table.hooks[i].hook);
}
heap_free(swapchain_state_table.hooks);
free(swapchain_state_table.hooks);
heap_free(wined3d_settings.logo);
free(wined3d_settings.logo);
UnregisterClassA(WINED3D_OPENGL_WINDOW_CLASS_NAME, hInstDLL);
DeleteCriticalSection(&wined3d_command_cs);

View file

@ -45,7 +45,6 @@
#include "winternl.h"
#include "ddk/d3dkmthk.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "objbase.h"
#include "wine/wined3d.h"
@ -3409,7 +3408,7 @@ static inline void *wined3d_texture_allocate_object_memory(SIZE_T s, SIZE_T leve
if (level_count > ((~(SIZE_T)0 - s) / sizeof(*t->sub_resources)) / layer_count)
return NULL;
return heap_alloc_zero(s + level_count * layer_count * sizeof(*t->sub_resources));
return calloc(1, s + level_count * layer_count * sizeof(*t->sub_resources));
}
static inline struct wined3d_texture *texture_from_resource(struct wined3d_resource *resource)