Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
January 2018
- 62 participants
- 1108 messages
[PATCH 5/5] d3d10: Use the global memory allocation helpers.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d10/d3d10_main.c | 6 +--
dlls/d3d10/d3d10_private.h | 8 +--
dlls/d3d10/effect.c | 119 ++++++++++++++++++++++-----------------------
dlls/d3d10/shader.c | 4 +-
dlls/d3d10/stateblock.c | 5 +-
5 files changed, 63 insertions(+), 79 deletions(-)
diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c
index 52585f0..f2fbb41 100644
--- a/dlls/d3d10/d3d10_main.c
+++ b/dlls/d3d10/d3d10_main.c
@@ -222,8 +222,7 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl
FIXME("data %p, data_size %lu, flags %#x, device %p, effect_pool %p, effect %p stub!\n",
data, data_size, flags, device, effect_pool, effect);
- object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
- if (!object)
+ if (!(object = heap_alloc_zero(sizeof(*object))))
{
ERR("Failed to allocate D3D10 effect object memory\n");
return E_OUTOFMEMORY;
@@ -303,8 +302,7 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad
FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector);
- object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
- if (!object)
+ if (!(object = heap_alloc_zero(sizeof(*object))))
{
ERR("Failed to allocate D3D10 shader reflection object memory\n");
return E_OUTOFMEMORY;
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index 93b6e35..e785b8b 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -21,6 +21,7 @@
#include "wine/debug.h"
#include "wine/rbtree.h"
+#include "wine/heap.h"
#define COBJMACROS
#include "winbase.h"
@@ -278,13 +279,6 @@ HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte
HRESULT parse_dxbc(const char *data, SIZE_T data_size,
HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) DECLSPEC_HIDDEN;
-static inline void *d3d10_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)
{
memcpy(d, *ptr, sizeof(*d));
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 4760489..10d8404 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -285,7 +285,7 @@ static BOOL fx10_copy_string(const char *data, size_t data_size, DWORD offset, c
return TRUE;
}
- if (!(*s = HeapAlloc(GetProcessHeap(), 0, len)))
+ if (!(*s = heap_alloc(len)))
{
ERR("Failed to allocate string memory.\n");
return FALSE;
@@ -308,8 +308,7 @@ static BOOL copy_name(const char *ptr, char **name)
return TRUE;
}
- *name = HeapAlloc(GetProcessHeap(), 0, name_len);
- if (!*name)
+ if (!(*name = heap_alloc(name_len)))
{
ERR("Failed to allocate name memory.\n");
return FALSE;
@@ -355,7 +354,7 @@ static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct
return E_INVALIDARG;
}
- if (!(e = d3d10_calloc(count, sizeof(*e))))
+ if (!(e = heap_calloc(count, sizeof(*e))))
{
ERR("Failed to allocate signature memory.\n");
return E_OUTOFMEMORY;
@@ -370,7 +369,7 @@ static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct
if (!(e[i].SemanticName = shader_get_string(data, data_size, name_offset)))
{
WARN("Invalid name offset %#x (data size %#x).\n", name_offset, data_size);
- HeapFree(GetProcessHeap(), 0, e);
+ heap_free(e);
return E_INVALIDARG;
}
read_dword(&ptr, &e[i].SemanticIndex);
@@ -396,8 +395,8 @@ static HRESULT shader_parse_signature(const char *data, DWORD data_size, struct
static void shader_free_signature(struct d3d10_effect_shader_signature *s)
{
- HeapFree(GetProcessHeap(), 0, s->signature);
- HeapFree(GetProcessHeap(), 0, s->elements);
+ heap_free(s->signature);
+ heap_free(s->elements);
}
static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag, void *ctx)
@@ -422,8 +421,7 @@ static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag
if (tag == TAG_ISGN) sig = &s->input_signature;
else sig = &s->output_signature;
- sig->signature = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
- if (!sig->signature)
+ if (!(sig->signature = heap_alloc_zero(size)))
{
ERR("Failed to allocate input signature data\n");
return E_OUTOFMEMORY;
@@ -698,7 +696,7 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
t->basetype = 0;
t->type_class = D3D10_SVC_STRUCT;
- if (!(t->members = d3d10_calloc(t->member_count, sizeof(*t->members))))
+ if (!(t->members = heap_calloc(t->member_count, sizeof(*t->members))))
{
ERR("Failed to allocate members memory.\n");
return E_OUTOFMEMORY;
@@ -759,8 +757,7 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
TRACE("Elementtype for type at offset: %#x\n", t->id);
/* allocate elementtype - we need only one, because all elements have the same type */
- t->elementtype = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t->elementtype));
- if (!t->elementtype)
+ if (!(t->elementtype = heap_alloc_zero(sizeof(*t->elementtype))))
{
ERR("Failed to allocate members memory.\n");
return E_OUTOFMEMORY;
@@ -828,8 +825,7 @@ static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect,
return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
}
- type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*type));
- if (!type)
+ if (!(type = heap_alloc_zero(sizeof(*type))))
{
ERR("Failed to allocate type memory.\n");
return NULL;
@@ -841,14 +837,14 @@ static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect,
if (FAILED(hr = parse_fx10_type(data, data_size, offset, type)))
{
ERR("Failed to parse type info, hr %#x.\n", hr);
- HeapFree(GetProcessHeap(), 0, type);
+ heap_free(type);
return NULL;
}
if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
{
ERR("Failed to insert type entry.\n");
- HeapFree(GetProcessHeap(), 0, type);
+ heap_free(type);
return NULL;
}
@@ -948,7 +944,7 @@ static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
if (v->type->member_count)
{
- if (!(v->members = d3d10_calloc(v->type->member_count, sizeof(*v->members))))
+ if (!(v->members = heap_calloc(v->type->member_count, sizeof(*v->members))))
{
ERR("Failed to allocate members memory.\n");
return E_OUTOFMEMORY;
@@ -990,7 +986,7 @@ static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
{
unsigned int bufferoffset = v->buffer_offset;
- if (!(v->elements = d3d10_calloc(v->type->element_count, sizeof(*v->elements))))
+ if (!(v->elements = heap_calloc(v->type->element_count, sizeof(*v->elements))))
{
ERR("Failed to allocate elements memory.\n");
return E_OUTOFMEMORY;
@@ -1592,7 +1588,7 @@ static HRESULT parse_fx10_pass(const char *data, size_t data_size,
read_dword(ptr, &p->annotation_count);
TRACE("Pass has %u annotations.\n", p->annotation_count);
- if (!(p->annotations = d3d10_calloc(p->annotation_count, sizeof(*p->annotations))))
+ if (!(p->annotations = heap_calloc(p->annotation_count, sizeof(*p->annotations))))
{
ERR("Failed to allocate pass annotations memory.\n");
return E_OUTOFMEMORY;
@@ -1609,7 +1605,7 @@ static HRESULT parse_fx10_pass(const char *data, size_t data_size,
return hr;
}
- if (!(p->objects = d3d10_calloc(p->object_count, sizeof(*p->objects))))
+ if (!(p->objects = heap_calloc(p->object_count, sizeof(*p->objects))))
{
ERR("Failed to allocate effect objects memory.\n");
return E_OUTOFMEMORY;
@@ -1655,7 +1651,7 @@ static HRESULT parse_fx10_technique(const char *data, size_t data_size,
read_dword(ptr, &t->annotation_count);
TRACE("Technique has %u annotations.\n", t->annotation_count);
- if (!(t->annotations = d3d10_calloc(t->annotation_count, sizeof(*t->annotations))))
+ if (!(t->annotations = heap_calloc(t->annotation_count, sizeof(*t->annotations))))
{
ERR("Failed to allocate technique annotations memory.\n");
return E_OUTOFMEMORY;
@@ -1672,7 +1668,7 @@ static HRESULT parse_fx10_technique(const char *data, size_t data_size,
return hr;
}
- if (!(t->passes = d3d10_calloc(t->pass_count, sizeof(*t->passes))))
+ if (!(t->passes = heap_calloc(t->pass_count, sizeof(*t->passes))))
{
ERR("Failed to allocate passes memory\n");
return E_OUTOFMEMORY;
@@ -1723,7 +1719,7 @@ static HRESULT parse_fx10_variable(const char *data, size_t data_size,
read_dword(ptr, &v->annotation_count);
TRACE("Variable has %u annotations.\n", v->annotation_count);
- if (!(v->annotations = d3d10_calloc(v->annotation_count, sizeof(*v->annotations))))
+ if (!(v->annotations = heap_calloc(v->annotation_count, sizeof(*v->annotations))))
{
ERR("Failed to allocate variable annotations memory.\n");
return E_OUTOFMEMORY;
@@ -1897,7 +1893,7 @@ static HRESULT parse_fx10_local_variable(const char *data, size_t data_size,
read_dword(ptr, &v->annotation_count);
TRACE("Variable has %u annotations.\n", v->annotation_count);
- if (!(v->annotations = d3d10_calloc(v->annotation_count, sizeof(*v->annotations))))
+ if (!(v->annotations = heap_calloc(v->annotation_count, sizeof(*v->annotations))))
{
ERR("Failed to allocate variable annotations memory.\n");
return E_OUTOFMEMORY;
@@ -1927,8 +1923,7 @@ static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
unsigned int stride = 0;
/* Generate our own type, it isn't in the fx blob. */
- l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type));
- if (!l->type)
+ if (!(l->type = heap_alloc_zero(sizeof(*l->type))))
{
ERR("Failed to allocate local buffer type memory.\n");
return E_OUTOFMEMORY;
@@ -1986,7 +1981,7 @@ static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
read_dword(ptr, &l->annotation_count);
TRACE("Local buffer has %u annotations.\n", l->annotation_count);
- if (!(l->annotations = d3d10_calloc(l->annotation_count, sizeof(*l->annotations))))
+ if (!(l->annotations = heap_calloc(l->annotation_count, sizeof(*l->annotations))))
{
ERR("Failed to allocate local buffer annotations memory.\n");
return E_OUTOFMEMORY;
@@ -2003,13 +1998,13 @@ static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size,
return hr;
}
- if (!(l->members = d3d10_calloc(l->type->member_count, sizeof(*l->members))))
+ if (!(l->members = heap_calloc(l->type->member_count, sizeof(*l->members))))
{
ERR("Failed to allocate members memory.\n");
return E_OUTOFMEMORY;
}
- if (!(l->type->members = d3d10_calloc(l->type->member_count, sizeof(*l->type->members))))
+ if (!(l->type->members = heap_calloc(l->type->member_count, sizeof(*l->type->members))))
{
ERR("Failed to allocate type members memory.\n");
return E_OUTOFMEMORY;
@@ -2112,8 +2107,8 @@ static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *ty
TRACE("effect type member %p.\n", typem);
/* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
- HeapFree(GetProcessHeap(), 0, typem->semantic);
- HeapFree(GetProcessHeap(), 0, typem->name);
+ heap_free(typem->semantic);
+ heap_free(typem->name);
}
static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
@@ -2124,8 +2119,8 @@ static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context
if (t->elementtype)
{
- HeapFree(GetProcessHeap(), 0, t->elementtype->name);
- HeapFree(GetProcessHeap(), 0, t->elementtype);
+ heap_free(t->elementtype->name);
+ heap_free(t->elementtype);
}
if (t->members)
@@ -2136,11 +2131,11 @@ static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context
{
d3d10_effect_type_member_destroy(&t->members[i]);
}
- HeapFree(GetProcessHeap(), 0, t->members);
+ heap_free(t->members);
}
- HeapFree(GetProcessHeap(), 0, t->name);
- HeapFree(GetProcessHeap(), 0, t);
+ heap_free(t->name);
+ heap_free(t);
}
static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD data_size)
@@ -2156,31 +2151,31 @@ static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD d
}
ptr = data + e->index_offset;
- if (!(e->local_buffers = d3d10_calloc(e->local_buffer_count, sizeof(*e->local_buffers))))
+ if (!(e->local_buffers = heap_calloc(e->local_buffer_count, sizeof(*e->local_buffers))))
{
ERR("Failed to allocate local buffer memory.\n");
return E_OUTOFMEMORY;
}
- if (!(e->local_variables = d3d10_calloc(e->local_variable_count, sizeof(*e->local_variables))))
+ if (!(e->local_variables = heap_calloc(e->local_variable_count, sizeof(*e->local_variables))))
{
ERR("Failed to allocate local variable memory.\n");
return E_OUTOFMEMORY;
}
- if (!(e->anonymous_shaders = d3d10_calloc(e->anonymous_shader_count, sizeof(*e->anonymous_shaders))))
+ if (!(e->anonymous_shaders = heap_calloc(e->anonymous_shader_count, sizeof(*e->anonymous_shaders))))
{
ERR("Failed to allocate anonymous shaders memory\n");
return E_OUTOFMEMORY;
}
- if (!(e->used_shaders = d3d10_calloc(e->used_shader_count, sizeof(*e->used_shaders))))
+ if (!(e->used_shaders = heap_calloc(e->used_shader_count, sizeof(*e->used_shaders))))
{
ERR("Failed to allocate used shaders memory\n");
return E_OUTOFMEMORY;
}
- if (!(e->techniques = d3d10_calloc(e->technique_count, sizeof(*e->techniques))))
+ if (!(e->techniques = heap_calloc(e->technique_count, sizeof(*e->techniques))))
{
ERR("Failed to allocate techniques memory\n");
return E_OUTOFMEMORY;
@@ -2398,15 +2393,15 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
TRACE("variable %p.\n", v);
- HeapFree(GetProcessHeap(), 0, v->name);
- HeapFree(GetProcessHeap(), 0, v->semantic);
+ heap_free(v->name);
+ heap_free(v->semantic);
if (v->annotations)
{
for (i = 0; i < v->annotation_count; ++i)
{
d3d10_effect_variable_destroy(&v->annotations[i]);
}
- HeapFree(GetProcessHeap(), 0, v->annotations);
+ heap_free(v->annotations);
}
if (v->members)
@@ -2415,7 +2410,7 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
{
d3d10_effect_variable_destroy(&v->members[i]);
}
- HeapFree(GetProcessHeap(), 0, v->members);
+ heap_free(v->members);
}
if (v->elements)
@@ -2424,7 +2419,7 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
{
d3d10_effect_variable_destroy(&v->elements[i]);
}
- HeapFree(GetProcessHeap(), 0, v->elements);
+ heap_free(v->elements);
}
if (v->type)
@@ -2508,7 +2503,7 @@ static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
TRACE("pass %p\n", p);
- HeapFree(GetProcessHeap(), 0, p->name);
+ heap_free(p->name);
if (p->objects)
{
@@ -2516,7 +2511,7 @@ static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
{
d3d10_effect_object_destroy(&p->objects[i]);
}
- HeapFree(GetProcessHeap(), 0, p->objects);
+ heap_free(p->objects);
}
if (p->annotations)
@@ -2525,7 +2520,7 @@ static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
{
d3d10_effect_variable_destroy(&p->annotations[i]);
}
- HeapFree(GetProcessHeap(), 0, p->annotations);
+ heap_free(p->annotations);
}
}
@@ -2535,14 +2530,14 @@ static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
TRACE("technique %p\n", t);
- HeapFree(GetProcessHeap(), 0, t->name);
+ heap_free(t->name);
if (t->passes)
{
for (i = 0; i < t->pass_count; ++i)
{
d3d10_effect_pass_destroy(&t->passes[i]);
}
- HeapFree(GetProcessHeap(), 0, t->passes);
+ heap_free(t->passes);
}
if (t->annotations)
@@ -2551,7 +2546,7 @@ static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
{
d3d10_effect_variable_destroy(&t->annotations[i]);
}
- HeapFree(GetProcessHeap(), 0, t->annotations);
+ heap_free(t->annotations);
}
}
@@ -2561,14 +2556,14 @@ static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
TRACE("local buffer %p.\n", l);
- HeapFree(GetProcessHeap(), 0, l->name);
+ heap_free(l->name);
if (l->members)
{
for (i = 0; i < l->type->member_count; ++i)
{
d3d10_effect_variable_destroy(&l->members[i]);
}
- HeapFree(GetProcessHeap(), 0, l->members);
+ heap_free(l->members);
}
if (l->type)
@@ -2580,7 +2575,7 @@ static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
{
d3d10_effect_variable_destroy(&l->annotations[i]);
}
- HeapFree(GetProcessHeap(), 0, l->annotations);
+ heap_free(l->annotations);
}
}
@@ -2636,7 +2631,7 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
{
d3d10_effect_technique_destroy(&This->techniques[i]);
}
- HeapFree(GetProcessHeap(), 0, This->techniques);
+ heap_free(This->techniques);
}
if (This->local_variables)
@@ -2645,7 +2640,7 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
{
d3d10_effect_variable_destroy(&This->local_variables[i]);
}
- HeapFree(GetProcessHeap(), 0, This->local_variables);
+ heap_free(This->local_variables);
}
if (This->local_buffers)
@@ -2654,7 +2649,7 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
{
d3d10_effect_local_buffer_destroy(&This->local_buffers[i]);
}
- HeapFree(GetProcessHeap(), 0, This->local_buffers);
+ heap_free(This->local_buffers);
}
if (This->anonymous_shaders)
@@ -2662,17 +2657,17 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
for (i = 0; i < This->anonymous_shader_count; ++i)
{
d3d10_effect_variable_destroy(&This->anonymous_shaders[i].shader);
- HeapFree(GetProcessHeap(), 0, This->anonymous_shaders[i].type.name);
+ heap_free(This->anonymous_shaders[i].type.name);
}
- HeapFree(GetProcessHeap(), 0, This->anonymous_shaders);
+ heap_free(This->anonymous_shaders);
}
- HeapFree(GetProcessHeap(), 0, This->used_shaders);
+ heap_free(This->used_shaders);
wine_rb_destroy(&This->types, d3d10_effect_type_destroy, NULL);
ID3D10Device_Release(This->device);
- HeapFree(GetProcessHeap(), 0, This);
+ heap_free(This);
}
return refcount;
diff --git a/dlls/d3d10/shader.c b/dlls/d3d10/shader.c
index a6a9a30..c97d8df 100644
--- a/dlls/d3d10/shader.c
+++ b/dlls/d3d10/shader.c
@@ -68,9 +68,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderRefle
TRACE("%p decreasing refcount to %u\n", This, refcount);
if (!refcount)
- {
- HeapFree(GetProcessHeap(), 0, This);
- }
+ heap_free(This);
return refcount;
}
diff --git a/dlls/d3d10/stateblock.c b/dlls/d3d10/stateblock.c
index 470d325..ebeebf7 100644
--- a/dlls/d3d10/stateblock.c
+++ b/dlls/d3d10/stateblock.c
@@ -275,7 +275,7 @@ static ULONG STDMETHODCALLTYPE d3d10_stateblock_Release(ID3D10StateBlock *iface)
{
stateblock_cleanup(stateblock);
ID3D10Device_Release(stateblock->device);
- HeapFree(GetProcessHeap(), 0, stateblock);
+ heap_free(stateblock);
}
return refcount;
@@ -522,8 +522,7 @@ HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *device,
TRACE("device %p, mask %p, stateblock %p.\n", device, mask, stateblock);
- object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
- if (!object)
+ if (!(object = heap_alloc_zero(sizeof(*object))))
{
ERR("Failed to allocate D3D10 stateblock object memory.\n");
return E_OUTOFMEMORY;
--
2.1.4
Jan. 31, 2018
[PATCH 4/5] d2d1: Replace d2d_calloc() with a global heap_calloc() helper.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d2d1/bitmap.c | 2 +-
dlls/d2d1/brush.c | 4 ++--
dlls/d2d1/d2d1_private.h | 9 ---------
dlls/d2d1/geometry.c | 4 ++--
dlls/d2d1/render_target.c | 2 +-
dlls/d2d1/stroke.c | 2 +-
include/wine/heap.h | 9 +++++++++
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 028fab3..0d4098f 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -511,7 +511,7 @@ HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *d
pitch = ((bpp * size.width) + 15) & ~15;
if (pitch / bpp < size.width)
return E_OUTOFMEMORY;
- if (!(data = d2d_calloc(size.height, pitch)))
+ if (!(data = heap_calloc(size.height, pitch)))
return E_OUTOFMEMORY;
data_size = size.height * pitch;
diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c
index 0531a3a..c46d940 100644
--- a/dlls/d2d1/brush.c
+++ b/dlls/d2d1/brush.c
@@ -142,7 +142,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
unsigned int i;
HRESULT hr;
- if (!(data = d2d_calloc(stop_count, 2 * sizeof(*data))))
+ if (!(data = heap_calloc(stop_count, 2 * sizeof(*data))))
{
ERR("Failed to allocate data.\n");
return E_OUTOFMEMORY;
@@ -205,7 +205,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
(*gradient)->view = view;
(*gradient)->stop_count = stop_count;
- if (!((*gradient)->stops = d2d_calloc(stop_count, sizeof(*stops))))
+ if (!((*gradient)->stops = heap_calloc(stop_count, sizeof(*stops))))
{
ID3D10ShaderResourceView_Release(view);
heap_free(*gradient);
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 07f71a0..dbfb83c 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -477,15 +477,6 @@ void d2d_transformed_geometry_init(struct d2d_geometry *geometry, ID2D1Factory *
ID2D1Geometry *src_geometry, const D2D_MATRIX_3X2_F *transform) DECLSPEC_HIDDEN;
struct d2d_geometry *unsafe_impl_from_ID2D1Geometry(ID2D1Geometry *iface) DECLSPEC_HIDDEN;
-static inline void *d2d_calloc(size_t count, size_t size)
-{
- SIZE_T s = count * size;
-
- if (size && s / size != count)
- return NULL;
- return heap_alloc(s);
-}
-
static inline BOOL d2d_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
{
size_t new_capacity, max_capacity;
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index 4a2f7d7..5b5a75b 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -2025,7 +2025,7 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
return S_OK;
}
- if (!(vertices = d2d_calloc(vertex_count, sizeof(*vertices))))
+ if (!(vertices = heap_calloc(vertex_count, sizeof(*vertices))))
return E_OUTOFMEMORY;
for (i = 0, j = 0; i < geometry->u.path.figure_count; ++i)
@@ -2792,7 +2792,7 @@ static HRESULT d2d_geometry_resolve_beziers(struct d2d_geometry *geometry)
geometry->fill.bezier_vertex_count += 3 * geometry->u.path.figures[i].bezier_control_count;
}
- if (!(geometry->fill.bezier_vertices = d2d_calloc(geometry->fill.bezier_vertex_count,
+ if (!(geometry->fill.bezier_vertices = heap_calloc(geometry->fill.bezier_vertex_count,
sizeof(*geometry->fill.bezier_vertices))))
{
ERR("Failed to allocate bezier vertices array.\n");
diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c
index a202279..7afbc84 100644
--- a/dlls/d2d1/render_target.c
+++ b/dlls/d2d1/render_target.c
@@ -1162,7 +1162,7 @@ static void d2d_rt_draw_glyph_run_bitmap(struct d2d_d3d_render_target *render_ta
if (texture_type == DWRITE_TEXTURE_CLEARTYPE_3x1)
bitmap_size.width *= 3;
- if (!(opacity_values = d2d_calloc(bitmap_size.height, bitmap_size.width)))
+ if (!(opacity_values = heap_calloc(bitmap_size.height, bitmap_size.width)))
{
ERR("Failed to allocate opacity values.\n");
goto done;
diff --git a/dlls/d2d1/stroke.c b/dlls/d2d1/stroke.c
index 63f88c7..511c134 100644
--- a/dlls/d2d1/stroke.c
+++ b/dlls/d2d1/stroke.c
@@ -212,7 +212,7 @@ HRESULT d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *fact
if (!dashes || !dash_count)
return E_INVALIDARG;
- if (!(style->dashes = d2d_calloc(dash_count, sizeof(*style->dashes))))
+ if (!(style->dashes = heap_calloc(dash_count, sizeof(*style->dashes))))
return E_OUTOFMEMORY;
memcpy(style->dashes, dashes, dash_count * sizeof(*style->dashes));
style->dash_count = dash_count;
diff --git a/include/wine/heap.h b/include/wine/heap.h
index 681887b..97d3a56 100644
--- a/include/wine/heap.h
+++ b/include/wine/heap.h
@@ -46,4 +46,13 @@ static inline void heap_free(void *mem)
HeapFree(GetProcessHeap(), 0, mem);
}
+static inline void *heap_calloc(SIZE_T count, SIZE_T size)
+{
+ SIZE_T len = count * size;
+
+ if (size && len / size != count)
+ return NULL;
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
#endif /* __WINE_WINE_HEAP_H */
--
2.1.4
Jan. 31, 2018
[PATCH 3/5] wined3d: Use more resource access flags in wined3d_texture_use_pbo().
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/texture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 101f9ad..f166c2a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -32,8 +32,8 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
static BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
{
- return texture->resource.pool == WINED3D_POOL_DEFAULT
- && texture->resource.access & WINED3D_RESOURCE_ACCESS_MAP
+ return (texture->resource.access & (WINED3D_RESOURCE_ACCESS_CPU
+ | WINED3D_RESOURCE_ACCESS_MAP)) == WINED3D_RESOURCE_ACCESS_MAP
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
&& !texture->resource.format->conv_byte_count
&& !(texture->flags & (WINED3D_TEXTURE_PIN_SYSMEM | WINED3D_TEXTURE_COND_NP2_EMULATED));
--
2.1.4
Jan. 31, 2018
[PATCH 2/5] wined3d: Use the resource access flags in wined3d_surface_blt().
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/surface.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5f34ad0..388b803 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3854,10 +3854,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
{
TRACE("Depth/stencil blit.\n");
- if (dst_texture->resource.pool == WINED3D_POOL_SYSTEM_MEM)
- dst_location = dst_texture->resource.map_binding;
- else
+ if (dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)
dst_location = dst_texture->resource.draw_binding;
+ else
+ dst_location = dst_texture->resource.map_binding;
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
valid_locations = device->blitter->ops->blitter_blit(device->blitter,
@@ -3959,10 +3959,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
blit_op = WINED3D_BLIT_OP_RAW_BLIT;
}
- if (dst_texture->resource.pool == WINED3D_POOL_SYSTEM_MEM)
- dst_location = dst_texture->resource.map_binding;
- else
+ if (dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)
dst_location = dst_texture->resource.draw_binding;
+ else
+ dst_location = dst_texture->resource.map_binding;
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context,
--
2.1.4
Jan. 31, 2018
[PATCH 1/5] wined3d: Use the resource access flags in ffp_blitter_use_cpu_clear().
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/surface.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5f91c21..5f34ad0 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2744,14 +2744,16 @@ static BOOL ffp_blitter_use_cpu_clear(struct wined3d_rendertarget_view *view)
resource = view->resource;
if (resource->type == WINED3D_RTYPE_BUFFER)
- return resource->pool == WINED3D_POOL_SYSTEM_MEM;
+ return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU);
texture = texture_from_resource(resource);
locations = texture->sub_resources[view->sub_resource_idx].locations;
if (locations & (resource->map_binding | WINED3D_LOCATION_DISCARDED))
- return resource->pool == WINED3D_POOL_SYSTEM_MEM || (texture->flags & WINED3D_TEXTURE_PIN_SYSMEM);
+ return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
+ || (texture->flags & WINED3D_TEXTURE_PIN_SYSMEM);
- return resource->pool == WINED3D_POOL_SYSTEM_MEM && !(texture->flags & WINED3D_TEXTURE_CONVERTED);
+ return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
+ && !(texture->flags & WINED3D_TEXTURE_CONVERTED);
}
static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
--
2.1.4
Jan. 31, 2018
Re: [PATCH] comctl32/tests: Add test for v6 combobox dropdown size
by Fabian Maurer
> > There seems to be some inconsistency between windows versions, the test
> > fails for xp and 2003. Should I just check for windows version and
> > adjust the tests accordingly?
>
> If it's not essential to demonstrate new behavior of version 6
> implementation, you can as well drop it.
It's not, I'll get rid of it when reducing the amount of tests.
> > +#define COMBO_YBORDERSIZE() 2
>
> Why is it defined like that if it's a constant? Also if it's going to be
> used in this new test only you can use actual constant variable in new
> test function.
It was defined in original combo like that, that's why I used that. But sure, I'll make it into a
local constant.
> I'm a bit concerned about somewhat long loops this data will cause. Is
> it really necessary to have that many items?
Probably not, no. I just wanted to make sure, I'll trim that down.
> Please reformat this to use consistent spacing - 1 space after keyword.
Ah, sorry I always forget about that... I'll clean it up right away.
Thanks for the quick reply, I'll send an updated version soon.
Regards,
Fabian Maurer
Jan. 31, 2018
[PATCH] msscript.ocx: Use the global HeapAlloc() wrappers
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msscript.ocx/msscript.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c
index b0ea1e55a1..1f706f5380 100644
--- a/dlls/msscript.ocx/msscript.c
+++ b/dlls/msscript.ocx/msscript.c
@@ -28,6 +28,7 @@
#include "msscript.h"
#include "wine/debug.h"
+#include "wine/heap.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(msscript);
@@ -103,16 +104,6 @@ struct ScriptControl {
static HINSTANCE msscript_instance;
-static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
-{
- return HeapAlloc(GetProcessHeap(), 0, len);
-}
-
-static inline BOOL heap_free(void *mem)
-{
- return HeapFree(GetProcessHeap(), 0, mem);
-}
-
typedef enum tid_t {
IScriptControl_tid,
LAST_tid
--
2.14.3
Jan. 31, 2018
[PATCH] msident: Use the global HeapAlloc() wrappers
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msident/msident.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/dlls/msident/msident.c b/dlls/msident/msident.c
index 3efb190a39..8b9842f960 100644
--- a/dlls/msident/msident.c
+++ b/dlls/msident/msident.c
@@ -24,19 +24,10 @@
#include "rpcproxy.h"
#include "wine/debug.h"
+#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(msident);
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
-{
- return HeapAlloc(GetProcessHeap(), 0, size);
-}
-
-static inline BOOL heap_free(void *mem)
-{
- return HeapFree(GetProcessHeap(), 0, mem);
-}
-
static HINSTANCE msident_instance;
typedef struct {
--
2.14.3
Jan. 31, 2018
[PATCH] mshtml: Use the global HeapAlloc() wrappers
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/mshtml/mshtml_private.h | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 51a1addaf2..ea38a66f24 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -30,6 +30,7 @@
#include "tlogstg.h"
#include "shdeprecated.h"
+#include "wine/heap.h"
#include "wine/list.h"
#include "wine/rbtree.h"
#include "wine/unicode.h"
@@ -1176,31 +1177,11 @@ DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x
/* memory allocation functions */
-static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
-{
- return HeapAlloc(GetProcessHeap(), 0, len);
-}
-
-static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
-{
- return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
-}
-
-static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
-{
- return HeapReAlloc(GetProcessHeap(), 0, mem, len);
-}
-
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
}
-static inline BOOL heap_free(void *mem)
-{
- return HeapFree(GetProcessHeap(), 0, mem);
-}
-
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
LPWSTR ret = NULL;
--
2.14.3
Jan. 31, 2018
[PATCH] jsproxy: Use the global HeapAlloc() wrappers
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/jsproxy/main.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/dlls/jsproxy/main.c b/dlls/jsproxy/main.c
index a52fbb4df7..d1ac903eb6 100644
--- a/dlls/jsproxy/main.c
+++ b/dlls/jsproxy/main.c
@@ -51,6 +51,7 @@
#include "dispex.h"
#include "activscp.h"
#include "wine/debug.h"
+#include "wine/heap.h"
#include "wine/unicode.h"
static HINSTANCE instance;
@@ -87,16 +88,6 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
return TRUE;
}
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
-{
- return HeapAlloc(GetProcessHeap(), 0, size);
-}
-
-static inline BOOL heap_free(void *mem)
-{
- return HeapFree(GetProcessHeap(), 0, mem);
-}
-
static inline WCHAR *strdupAW( const char *src, int len )
{
WCHAR *dst = NULL;
--
2.14.3
Jan. 31, 2018