Commit 600d6b01 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d11: Use the global memory allocation helpers.

parent 2e027f86
...@@ -189,7 +189,7 @@ static void STDMETHODCALLTYPE d3d_query_wined3d_object_destroyed(void *parent) ...@@ -189,7 +189,7 @@ static void STDMETHODCALLTYPE d3d_query_wined3d_object_destroyed(void *parent)
struct d3d_query *query = parent; struct d3d_query *query = parent;
wined3d_private_store_cleanup(&query->private_store); wined3d_private_store_cleanup(&query->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_query_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_query_wined3d_parent_ops =
...@@ -502,13 +502,13 @@ HRESULT d3d_query_create(struct d3d_device *device, const D3D11_QUERY_DESC *desc ...@@ -502,13 +502,13 @@ HRESULT d3d_query_create(struct d3d_device *device, const D3D11_QUERY_DESC *desc
if (is_predicate_type) if (is_predicate_type)
predicate = TRUE; predicate = TRUE;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_query_init(object, device, desc, predicate))) if (FAILED(hr = d3d_query_init(object, device, desc, predicate)))
{ {
WARN("Failed to initialize predicate, hr %#x.\n", hr); WARN("Failed to initialize predicate, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
......
...@@ -379,7 +379,7 @@ static void STDMETHODCALLTYPE d3d_buffer_wined3d_object_released(void *parent) ...@@ -379,7 +379,7 @@ static void STDMETHODCALLTYPE d3d_buffer_wined3d_object_released(void *parent)
struct d3d_buffer *buffer = parent; struct d3d_buffer *buffer = parent;
wined3d_private_store_cleanup(&buffer->private_store); wined3d_private_store_cleanup(&buffer->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_buffer_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_buffer_wined3d_parent_ops =
...@@ -484,13 +484,13 @@ HRESULT d3d_buffer_create(struct d3d_device *device, const D3D11_BUFFER_DESC *de ...@@ -484,13 +484,13 @@ HRESULT d3d_buffer_create(struct d3d_device *device, const D3D11_BUFFER_DESC *de
struct d3d_buffer *object; struct d3d_buffer *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_buffer_init(object, device, desc, data))) if (FAILED(hr = d3d_buffer_init(object, device, desc, data)))
{ {
WARN("Failed to initialize buffer, hr %#x.\n", hr); WARN("Failed to initialize buffer, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define __WINE_D3D11_PRIVATE_H #define __WINE_D3D11_PRIVATE_H
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include <assert.h> #include <assert.h>
...@@ -94,13 +95,6 @@ HRESULT d3d_set_private_data(struct wined3d_private_store *store, ...@@ -94,13 +95,6 @@ HRESULT d3d_set_private_data(struct wined3d_private_store *store,
HRESULT d3d_set_private_data_interface(struct wined3d_private_store *store, HRESULT d3d_set_private_data_interface(struct wined3d_private_store *store,
REFGUID guid, const IUnknown *object) DECLSPEC_HIDDEN; REFGUID guid, const IUnknown *object) DECLSPEC_HIDDEN;
static inline void *d3d11_calloc(SIZE_T count, SIZE_T size)
{
if (count > ~(SIZE_T)0 / size)
return NULL;
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * size);
}
static inline void read_dword(const char **ptr, DWORD *d) static inline void read_dword(const char **ptr, DWORD *d)
{ {
memcpy(d, *ptr, sizeof(*d)); memcpy(d, *ptr, sizeof(*d));
......
...@@ -5198,7 +5198,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp ...@@ -5198,7 +5198,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
} }
if (output_stream_decl_count if (output_stream_decl_count
&& !(so_entries = d3d11_calloc(output_stream_decl_count, sizeof(*so_entries)))) && !(so_entries = heap_calloc(output_stream_decl_count, sizeof(*so_entries))))
{ {
ERR("Failed to allocate D3D11 SO declaration array memory.\n"); ERR("Failed to allocate D3D11 SO declaration array memory.\n");
*shader = NULL; *shader = NULL;
...@@ -5220,7 +5220,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp ...@@ -5220,7 +5220,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
if (output_stream_stride) if (output_stream_stride)
{ {
WARN("Stride must be 0 when multiple output slots are used.\n"); WARN("Stride must be 0 when multiple output slots are used.\n");
HeapFree(GetProcessHeap(), 0, so_entries); heap_free(so_entries);
*shader = NULL; *shader = NULL;
return E_INVALIDARG; return E_INVALIDARG;
} }
...@@ -5229,7 +5229,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp ...@@ -5229,7 +5229,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
hr = d3d_geometry_shader_create(device, byte_code, byte_code_length, hr = d3d_geometry_shader_create(device, byte_code, byte_code_length,
so_entries, output_stream_decl_count, &output_stream_stride, stride_count, 0, &object); so_entries, output_stream_decl_count, &output_stream_stride, stride_count, 0, &object);
HeapFree(GetProcessHeap(), 0, so_entries); heap_free(so_entries);
if (FAILED(hr)) if (FAILED(hr))
{ {
*shader = NULL; *shader = NULL;
......
...@@ -54,7 +54,7 @@ static HRESULT d3d11_input_layout_to_wined3d_declaration(const D3D11_INPUT_ELEME ...@@ -54,7 +54,7 @@ static HRESULT d3d11_input_layout_to_wined3d_declaration(const D3D11_INPUT_ELEME
return E_FAIL; return E_FAIL;
} }
if (!(*wined3d_elements = d3d11_calloc(element_count, sizeof(**wined3d_elements)))) if (!(*wined3d_elements = heap_calloc(element_count, sizeof(**wined3d_elements))))
{ {
ERR("Failed to allocate wined3d vertex element array memory.\n"); ERR("Failed to allocate wined3d vertex element array memory.\n");
shader_free_signature(&is); shader_free_signature(&is);
...@@ -315,7 +315,7 @@ static void STDMETHODCALLTYPE d3d_input_layout_wined3d_object_destroyed(void *pa ...@@ -315,7 +315,7 @@ static void STDMETHODCALLTYPE d3d_input_layout_wined3d_object_destroyed(void *pa
struct d3d_input_layout *layout = parent; struct d3d_input_layout *layout = parent;
wined3d_private_store_cleanup(&layout->private_store); wined3d_private_store_cleanup(&layout->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_input_layout_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_input_layout_wined3d_parent_ops =
...@@ -347,7 +347,7 @@ static HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d ...@@ -347,7 +347,7 @@ static HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d
hr = wined3d_vertex_declaration_create(device->wined3d_device, wined3d_elements, element_count, hr = wined3d_vertex_declaration_create(device->wined3d_device, wined3d_elements, element_count,
layout, &d3d_input_layout_wined3d_parent_ops, &layout->wined3d_decl); layout, &d3d_input_layout_wined3d_parent_ops, &layout->wined3d_decl);
HeapFree(GetProcessHeap(), 0, wined3d_elements); heap_free(wined3d_elements);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr); WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
...@@ -370,15 +370,14 @@ HRESULT d3d_input_layout_create(struct d3d_device *device, ...@@ -370,15 +370,14 @@ HRESULT d3d_input_layout_create(struct d3d_device *device,
struct d3d_input_layout *object; struct d3d_input_layout *object;
HRESULT hr; HRESULT hr;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!(object = heap_alloc_zero(sizeof(*object))))
if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_input_layout_init(object, device, element_descs, element_count, if (FAILED(hr = d3d_input_layout_init(object, device, element_descs, element_count,
shader_byte_code, shader_byte_code_length))) shader_byte_code, shader_byte_code_length)))
{ {
WARN("Failed to initialize input layout, hr %#x.\n", hr); WARN("Failed to initialize input layout, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
......
...@@ -220,7 +220,7 @@ HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_size, ...@@ -220,7 +220,7 @@ HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_size,
return E_INVALIDARG; return E_INVALIDARG;
} }
if (!(e = d3d11_calloc(count, sizeof(*e)))) if (!(e = heap_calloc(count, sizeof(*e))))
{ {
ERR("Failed to allocate input signature memory.\n"); ERR("Failed to allocate input signature memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -238,7 +238,7 @@ HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_size, ...@@ -238,7 +238,7 @@ HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_size,
if (!(e[i].semantic_name = shader_get_string(data, data_size, name_offset))) 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); WARN("Invalid name offset %#x (data size %#x).\n", name_offset, data_size);
HeapFree(GetProcessHeap(), 0, e); heap_free(e);
return E_INVALIDARG; return E_INVALIDARG;
} }
read_dword(&ptr, &e[i].semantic_idx); read_dword(&ptr, &e[i].semantic_idx);
...@@ -277,7 +277,7 @@ struct wined3d_shader_signature_element *shader_find_signature_element(const str ...@@ -277,7 +277,7 @@ struct wined3d_shader_signature_element *shader_find_signature_element(const str
void shader_free_signature(struct wined3d_shader_signature *s) void shader_free_signature(struct wined3d_shader_signature *s)
{ {
HeapFree(GetProcessHeap(), 0, s->elements); heap_free(s->elements);
} }
/* ID3D11VertexShader methods */ /* ID3D11VertexShader methods */
...@@ -509,7 +509,7 @@ static void STDMETHODCALLTYPE d3d_vertex_shader_wined3d_object_destroyed(void *p ...@@ -509,7 +509,7 @@ static void STDMETHODCALLTYPE d3d_vertex_shader_wined3d_object_destroyed(void *p
struct d3d_vertex_shader *shader = parent; struct d3d_vertex_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store); wined3d_private_store_cleanup(&shader->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_vertex_shader_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_vertex_shader_wined3d_parent_ops =
...@@ -583,13 +583,13 @@ HRESULT d3d_vertex_shader_create(struct d3d_device *device, const void *byte_cod ...@@ -583,13 +583,13 @@ HRESULT d3d_vertex_shader_create(struct d3d_device *device, const void *byte_cod
struct d3d_vertex_shader *object; struct d3d_vertex_shader *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_vertex_shader_init(object, device, byte_code, byte_code_length))) if (FAILED(hr = d3d_vertex_shader_init(object, device, byte_code, byte_code_length)))
{ {
WARN("Failed to initialize vertex shader, hr %#x.\n", hr); WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -744,7 +744,7 @@ static void STDMETHODCALLTYPE d3d11_hull_shader_wined3d_object_destroyed(void *p ...@@ -744,7 +744,7 @@ static void STDMETHODCALLTYPE d3d11_hull_shader_wined3d_object_destroyed(void *p
struct d3d11_hull_shader *shader = parent; struct d3d11_hull_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store); wined3d_private_store_cleanup(&shader->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d11_hull_shader_wined3d_parent_ops = static const struct wined3d_parent_ops d3d11_hull_shader_wined3d_parent_ops =
...@@ -796,12 +796,12 @@ HRESULT d3d11_hull_shader_create(struct d3d_device *device, const void *byte_cod ...@@ -796,12 +796,12 @@ HRESULT d3d11_hull_shader_create(struct d3d_device *device, const void *byte_cod
struct d3d11_hull_shader *object; struct d3d11_hull_shader *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_hull_shader_init(object, device, byte_code, byte_code_length))) if (FAILED(hr = d3d11_hull_shader_init(object, device, byte_code, byte_code_length)))
{ {
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -947,7 +947,7 @@ static void STDMETHODCALLTYPE d3d11_domain_shader_wined3d_object_destroyed(void ...@@ -947,7 +947,7 @@ static void STDMETHODCALLTYPE d3d11_domain_shader_wined3d_object_destroyed(void
struct d3d11_domain_shader *shader = parent; struct d3d11_domain_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store); wined3d_private_store_cleanup(&shader->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d11_domain_shader_wined3d_parent_ops = static const struct wined3d_parent_ops d3d11_domain_shader_wined3d_parent_ops =
...@@ -999,12 +999,12 @@ HRESULT d3d11_domain_shader_create(struct d3d_device *device, const void *byte_c ...@@ -999,12 +999,12 @@ HRESULT d3d11_domain_shader_create(struct d3d_device *device, const void *byte_c
struct d3d11_domain_shader *object; struct d3d11_domain_shader *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_domain_shader_init(object, device, byte_code, byte_code_length))) if (FAILED(hr = d3d11_domain_shader_init(object, device, byte_code, byte_code_length)))
{ {
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -1253,7 +1253,7 @@ static void STDMETHODCALLTYPE d3d_geometry_shader_wined3d_object_destroyed(void ...@@ -1253,7 +1253,7 @@ static void STDMETHODCALLTYPE d3d_geometry_shader_wined3d_object_destroyed(void
struct d3d_geometry_shader *shader = parent; struct d3d_geometry_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store); wined3d_private_store_cleanup(&shader->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_geometry_shader_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_geometry_shader_wined3d_parent_ops =
...@@ -1491,7 +1491,7 @@ static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader, ...@@ -1491,7 +1491,7 @@ static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader,
so_desc.buffer_stride_count = buffer_stride_count; so_desc.buffer_stride_count = buffer_stride_count;
so_desc.rasterizer_stream_idx = rasterizer_stream; so_desc.rasterizer_stream_idx = rasterizer_stream;
if (!(so_desc.elements = d3d11_calloc(so_entry_count, sizeof(*so_desc.elements)))) if (!(so_desc.elements = heap_calloc(so_entry_count, sizeof(*so_desc.elements))))
{ {
ERR("Failed to allocate wined3d stream output element array memory.\n"); ERR("Failed to allocate wined3d stream output element array memory.\n");
free_shader_desc(&desc); free_shader_desc(&desc);
...@@ -1501,7 +1501,7 @@ static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader, ...@@ -1501,7 +1501,7 @@ static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader,
so_entries, so_entry_count, buffer_strides, buffer_stride_count, so_entries, so_entry_count, buffer_strides, buffer_stride_count,
&desc.output_signature, device->feature_level))) &desc.output_signature, device->feature_level)))
{ {
HeapFree(GetProcessHeap(), 0, so_desc.elements); heap_free(so_desc.elements);
free_shader_desc(&desc); free_shader_desc(&desc);
return hr; return hr;
} }
...@@ -1515,7 +1515,7 @@ static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader, ...@@ -1515,7 +1515,7 @@ static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader,
hr = wined3d_shader_create_gs(device->wined3d_device, &desc, so_entries ? &so_desc : NULL, hr = wined3d_shader_create_gs(device->wined3d_device, &desc, so_entries ? &so_desc : NULL,
shader, &d3d_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader); shader, &d3d_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader);
HeapFree(GetProcessHeap(), 0, so_desc.elements); heap_free(so_desc.elements);
free_shader_desc(&desc); free_shader_desc(&desc);
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -1540,14 +1540,14 @@ HRESULT d3d_geometry_shader_create(struct d3d_device *device, const void *byte_c ...@@ -1540,14 +1540,14 @@ HRESULT d3d_geometry_shader_create(struct d3d_device *device, const void *byte_c
struct d3d_geometry_shader *object; struct d3d_geometry_shader *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_geometry_shader_init(object, device, byte_code, byte_code_length, if (FAILED(hr = d3d_geometry_shader_init(object, device, byte_code, byte_code_length,
so_entries, so_entry_count, buffer_strides, buffer_stride_count, rasterizer_stream))) so_entries, so_entry_count, buffer_strides, buffer_stride_count, rasterizer_stream)))
{ {
WARN("Failed to initialize geometry shader, hr %#x.\n", hr); WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -1804,7 +1804,7 @@ static void STDMETHODCALLTYPE d3d_pixel_shader_wined3d_object_destroyed(void *pa ...@@ -1804,7 +1804,7 @@ static void STDMETHODCALLTYPE d3d_pixel_shader_wined3d_object_destroyed(void *pa
struct d3d_pixel_shader *shader = parent; struct d3d_pixel_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store); wined3d_private_store_cleanup(&shader->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_pixel_shader_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_pixel_shader_wined3d_parent_ops =
...@@ -1857,13 +1857,13 @@ HRESULT d3d_pixel_shader_create(struct d3d_device *device, const void *byte_code ...@@ -1857,13 +1857,13 @@ HRESULT d3d_pixel_shader_create(struct d3d_device *device, const void *byte_code
struct d3d_pixel_shader *object; struct d3d_pixel_shader *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_pixel_shader_init(object, device, byte_code, byte_code_length))) if (FAILED(hr = d3d_pixel_shader_init(object, device, byte_code, byte_code_length)))
{ {
WARN("Failed to initialize pixel shader, hr %#x.\n", hr); WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -2016,7 +2016,7 @@ static void STDMETHODCALLTYPE d3d11_compute_shader_wined3d_object_destroyed(void ...@@ -2016,7 +2016,7 @@ static void STDMETHODCALLTYPE d3d11_compute_shader_wined3d_object_destroyed(void
struct d3d11_compute_shader *shader = parent; struct d3d11_compute_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store); wined3d_private_store_cleanup(&shader->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d11_compute_shader_wined3d_parent_ops = static const struct wined3d_parent_ops d3d11_compute_shader_wined3d_parent_ops =
...@@ -2067,12 +2067,12 @@ HRESULT d3d11_compute_shader_create(struct d3d_device *device, const void *byte_ ...@@ -2067,12 +2067,12 @@ HRESULT d3d11_compute_shader_create(struct d3d_device *device, const void *byte_
struct d3d11_compute_shader *object; struct d3d11_compute_shader *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_compute_shader_init(object, device, byte_code, byte_code_length))) if (FAILED(hr = d3d11_compute_shader_init(object, device, byte_code, byte_code_length)))
{ {
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -2139,7 +2139,7 @@ static ULONG STDMETHODCALLTYPE d3d11_class_linkage_Release(ID3D11ClassLinkage *i ...@@ -2139,7 +2139,7 @@ static ULONG STDMETHODCALLTYPE d3d11_class_linkage_Release(ID3D11ClassLinkage *i
ID3D11Device *device = class_linkage->device; ID3D11Device *device = class_linkage->device;
wined3d_private_store_cleanup(&class_linkage->private_store); wined3d_private_store_cleanup(&class_linkage->private_store);
HeapFree(GetProcessHeap(), 0, class_linkage); heap_free(class_linkage);
ID3D11Device_Release(device); ID3D11Device_Release(device);
} }
...@@ -2228,7 +2228,7 @@ HRESULT d3d11_class_linkage_create(struct d3d_device *device, struct d3d11_class ...@@ -2228,7 +2228,7 @@ HRESULT d3d11_class_linkage_create(struct d3d_device *device, struct d3d11_class
{ {
struct d3d11_class_linkage *object; struct d3d11_class_linkage *object;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->ID3D11ClassLinkage_iface.lpVtbl = &d3d11_class_linkage_vtbl; object->ID3D11ClassLinkage_iface.lpVtbl = &d3d11_class_linkage_vtbl;
......
...@@ -87,7 +87,7 @@ static ULONG STDMETHODCALLTYPE d3d11_blend_state_Release(ID3D11BlendState *iface ...@@ -87,7 +87,7 @@ static ULONG STDMETHODCALLTYPE d3d11_blend_state_Release(ID3D11BlendState *iface
wine_rb_remove(&device->blend_states, &state->entry); wine_rb_remove(&device->blend_states, &state->entry);
d3d_blend_state_cleanup(state); d3d_blend_state_cleanup(state);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, state); heap_free(state);
} }
return refcount; return refcount;
...@@ -357,7 +357,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC ...@@ -357,7 +357,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
return S_OK; return S_OK;
} }
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -366,7 +366,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC ...@@ -366,7 +366,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
if (FAILED(hr = d3d_blend_state_init(object, device, &tmp_desc))) if (FAILED(hr = d3d_blend_state_init(object, device, &tmp_desc)))
{ {
WARN("Failed to initialize blend state, hr %#x.\n", hr); WARN("Failed to initialize blend state, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
} }
...@@ -375,7 +375,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC ...@@ -375,7 +375,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
{ {
ERR("Failed to insert blend state entry.\n"); ERR("Failed to insert blend state entry.\n");
d3d_blend_state_cleanup(object); d3d_blend_state_cleanup(object);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return E_FAIL; return E_FAIL;
} }
...@@ -467,7 +467,7 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_state_Release(ID3D11DepthStenc ...@@ -467,7 +467,7 @@ static ULONG STDMETHODCALLTYPE d3d11_depthstencil_state_Release(ID3D11DepthStenc
wine_rb_remove(&device->depthstencil_states, &state->entry); wine_rb_remove(&device->depthstencil_states, &state->entry);
d3d_depthstencil_state_cleanup(state); d3d_depthstencil_state_cleanup(state);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, state); heap_free(state);
} }
return refcount; return refcount;
...@@ -721,7 +721,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP ...@@ -721,7 +721,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
return S_OK; return S_OK;
} }
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -730,7 +730,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP ...@@ -730,7 +730,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
if (FAILED(hr = d3d_depthstencil_state_init(object, device, &tmp_desc))) if (FAILED(hr = d3d_depthstencil_state_init(object, device, &tmp_desc)))
{ {
WARN("Failed to initialize depthstencil state, hr %#x.\n", hr); WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
} }
...@@ -739,7 +739,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP ...@@ -739,7 +739,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
{ {
ERR("Failed to insert depthstencil state entry.\n"); ERR("Failed to insert depthstencil state entry.\n");
d3d_depthstencil_state_cleanup(object); d3d_depthstencil_state_cleanup(object);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return E_FAIL; return E_FAIL;
} }
...@@ -1025,7 +1025,7 @@ static void STDMETHODCALLTYPE d3d_rasterizer_state_wined3d_object_destroyed(void ...@@ -1025,7 +1025,7 @@ static void STDMETHODCALLTYPE d3d_rasterizer_state_wined3d_object_destroyed(void
wine_rb_remove(&device->rasterizer_states, &state->entry); wine_rb_remove(&device->rasterizer_states, &state->entry);
wined3d_private_store_cleanup(&state->private_store); wined3d_private_store_cleanup(&state->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_rasterizer_state_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_rasterizer_state_wined3d_parent_ops =
...@@ -1093,7 +1093,7 @@ HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTE ...@@ -1093,7 +1093,7 @@ HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTE
return S_OK; return S_OK;
} }
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1104,7 +1104,7 @@ HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTE ...@@ -1104,7 +1104,7 @@ HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTE
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize rasterizer state, hr %#x.\n", hr); WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -1388,7 +1388,7 @@ static void STDMETHODCALLTYPE d3d_sampler_wined3d_object_destroyed(void *parent) ...@@ -1388,7 +1388,7 @@ static void STDMETHODCALLTYPE d3d_sampler_wined3d_object_destroyed(void *parent)
wine_rb_remove(&device->sampler_states, &state->entry); wine_rb_remove(&device->sampler_states, &state->entry);
wined3d_private_store_cleanup(&state->private_store); wined3d_private_store_cleanup(&state->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_sampler_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_sampler_wined3d_parent_ops =
...@@ -1518,7 +1518,7 @@ HRESULT d3d_sampler_state_create(struct d3d_device *device, const D3D11_SAMPLER_ ...@@ -1518,7 +1518,7 @@ HRESULT d3d_sampler_state_create(struct d3d_device *device, const D3D11_SAMPLER_
return S_OK; return S_OK;
} }
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1529,7 +1529,7 @@ HRESULT d3d_sampler_state_create(struct d3d_device *device, const D3D11_SAMPLER_ ...@@ -1529,7 +1529,7 @@ HRESULT d3d_sampler_state_create(struct d3d_device *device, const D3D11_SAMPLER_
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize sampler state, hr %#x.\n", hr); WARN("Failed to initialize sampler state, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
......
...@@ -275,7 +275,7 @@ static void STDMETHODCALLTYPE d3d_texture2d_wined3d_object_released(void *parent ...@@ -275,7 +275,7 @@ static void STDMETHODCALLTYPE d3d_texture2d_wined3d_object_released(void *parent
if (texture->dxgi_surface) IUnknown_Release(texture->dxgi_surface); if (texture->dxgi_surface) IUnknown_Release(texture->dxgi_surface);
wined3d_private_store_cleanup(&texture->private_store); wined3d_private_store_cleanup(&texture->private_store);
HeapFree(GetProcessHeap(), 0, texture); heap_free(texture);
} }
static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface) static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface)
...@@ -502,7 +502,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE ...@@ -502,7 +502,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE
return E_INVALIDARG; return E_INVALIDARG;
} }
if (!(texture = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*texture)))) if (!(texture = heap_alloc_zero(sizeof(*texture))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
texture->ID3D11Texture2D_iface.lpVtbl = &d3d11_texture2d_vtbl; texture->ID3D11Texture2D_iface.lpVtbl = &d3d11_texture2d_vtbl;
...@@ -539,7 +539,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE ...@@ -539,7 +539,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE
{ {
WARN("Failed to create wined3d texture, hr %#x.\n", hr); WARN("Failed to create wined3d texture, hr %#x.\n", hr);
wined3d_private_store_cleanup(&texture->private_store); wined3d_private_store_cleanup(&texture->private_store);
HeapFree(GetProcessHeap(), 0, texture); heap_free(texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DERR_INVALIDCALL) if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DERR_INVALIDCALL)
hr = E_INVALIDARG; hr = E_INVALIDARG;
...@@ -642,7 +642,7 @@ static void STDMETHODCALLTYPE d3d_texture3d_wined3d_object_released(void *parent ...@@ -642,7 +642,7 @@ static void STDMETHODCALLTYPE d3d_texture3d_wined3d_object_released(void *parent
struct d3d_texture3d *texture = parent; struct d3d_texture3d *texture = parent;
wined3d_private_store_cleanup(&texture->private_store); wined3d_private_store_cleanup(&texture->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static ULONG STDMETHODCALLTYPE d3d11_texture3d_Release(ID3D11Texture3D *iface) static ULONG STDMETHODCALLTYPE d3d11_texture3d_Release(ID3D11Texture3D *iface)
...@@ -1016,13 +1016,13 @@ HRESULT d3d_texture3d_create(struct d3d_device *device, const D3D11_TEXTURE3D_DE ...@@ -1016,13 +1016,13 @@ HRESULT d3d_texture3d_create(struct d3d_device *device, const D3D11_TEXTURE3D_DE
struct d3d_texture3d *object; struct d3d_texture3d *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_texture3d_init(object, device, desc, data))) if (FAILED(hr = d3d_texture3d_init(object, device, desc, data)))
{ {
WARN("Failed to initialize texture, hr %#x.\n", hr); WARN("Failed to initialize texture, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
......
...@@ -1244,7 +1244,7 @@ static void STDMETHODCALLTYPE d3d_depth_stencil_view_wined3d_object_destroyed(vo ...@@ -1244,7 +1244,7 @@ static void STDMETHODCALLTYPE d3d_depth_stencil_view_wined3d_object_destroyed(vo
struct d3d_depthstencil_view *view = parent; struct d3d_depthstencil_view *view = parent;
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_depth_stencil_view_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_depth_stencil_view_wined3d_parent_ops =
...@@ -1367,13 +1367,13 @@ HRESULT d3d_depthstencil_view_create(struct d3d_device *device, ID3D11Resource * ...@@ -1367,13 +1367,13 @@ HRESULT d3d_depthstencil_view_create(struct d3d_device *device, ID3D11Resource *
struct d3d_depthstencil_view *object; struct d3d_depthstencil_view *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_depthstencil_view_init(object, device, resource, desc))) if (FAILED(hr = d3d_depthstencil_view_init(object, device, resource, desc)))
{ {
WARN("Failed to initialize depthstencil view, hr %#x.\n", hr); WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -1684,7 +1684,7 @@ static void STDMETHODCALLTYPE d3d_render_target_view_wined3d_object_destroyed(vo ...@@ -1684,7 +1684,7 @@ static void STDMETHODCALLTYPE d3d_render_target_view_wined3d_object_destroyed(vo
struct d3d_rendertarget_view *view = parent; struct d3d_rendertarget_view *view = parent;
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_render_target_view_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_render_target_view_wined3d_parent_ops =
...@@ -1815,13 +1815,13 @@ HRESULT d3d_rendertarget_view_create(struct d3d_device *device, ID3D11Resource * ...@@ -1815,13 +1815,13 @@ HRESULT d3d_rendertarget_view_create(struct d3d_device *device, ID3D11Resource *
struct d3d_rendertarget_view *object; struct d3d_rendertarget_view *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_rendertarget_view_init(object, device, resource, desc))) if (FAILED(hr = d3d_rendertarget_view_init(object, device, resource, desc)))
{ {
WARN("Failed to initialize rendertarget view, hr %#x.\n", hr); WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -2146,7 +2146,7 @@ static void STDMETHODCALLTYPE d3d_shader_resource_view_wined3d_object_destroyed( ...@@ -2146,7 +2146,7 @@ static void STDMETHODCALLTYPE d3d_shader_resource_view_wined3d_object_destroyed(
struct d3d_shader_resource_view *view = parent; struct d3d_shader_resource_view *view = parent;
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d_shader_resource_view_wined3d_parent_ops = static const struct wined3d_parent_ops d3d_shader_resource_view_wined3d_parent_ops =
...@@ -2316,13 +2316,13 @@ HRESULT d3d_shader_resource_view_create(struct d3d_device *device, ID3D11Resourc ...@@ -2316,13 +2316,13 @@ HRESULT d3d_shader_resource_view_create(struct d3d_device *device, ID3D11Resourc
struct d3d_shader_resource_view *object; struct d3d_shader_resource_view *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d_shader_resource_view_init(object, device, resource, desc))) if (FAILED(hr = d3d_shader_resource_view_init(object, device, resource, desc)))
{ {
WARN("Failed to initialize shader resource view, hr %#x.\n", hr); WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
...@@ -2496,7 +2496,7 @@ static void STDMETHODCALLTYPE d3d11_unordered_access_view_wined3d_object_destroy ...@@ -2496,7 +2496,7 @@ static void STDMETHODCALLTYPE d3d11_unordered_access_view_wined3d_object_destroy
struct d3d11_unordered_access_view *view = parent; struct d3d11_unordered_access_view *view = parent;
wined3d_private_store_cleanup(&view->private_store); wined3d_private_store_cleanup(&view->private_store);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
} }
static const struct wined3d_parent_ops d3d11_unordered_access_view_wined3d_parent_ops = static const struct wined3d_parent_ops d3d11_unordered_access_view_wined3d_parent_ops =
...@@ -2625,13 +2625,13 @@ HRESULT d3d11_unordered_access_view_create(struct d3d_device *device, ID3D11Reso ...@@ -2625,13 +2625,13 @@ HRESULT d3d11_unordered_access_view_create(struct d3d_device *device, ID3D11Reso
struct d3d11_unordered_access_view *object; struct d3d11_unordered_access_view *object;
HRESULT hr; HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_unordered_access_view_init(object, device, resource, desc))) if (FAILED(hr = d3d11_unordered_access_view_init(object, device, resource, desc)))
{ {
WARN("Failed to initialize unordered access view, hr %#x.\n", hr); WARN("Failed to initialize unordered access view, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); heap_free(object);
return hr; return hr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment