mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-01 18:58:29 +00:00
d3d10: Use CRT allocation functions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
24c900b91f
commit
b9a61cde89
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/rbtree.h"
|
#include "wine/rbtree.h"
|
||||||
#include "wine/heap.h"
|
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
|
|
|
@ -322,7 +322,7 @@ struct d3d10_effect_prop_dependency
|
||||||
|
|
||||||
static HRESULT d3d10_reg_table_allocate(struct d3d10_reg_table *table, unsigned int count)
|
static HRESULT d3d10_reg_table_allocate(struct d3d10_reg_table *table, unsigned int count)
|
||||||
{
|
{
|
||||||
if (!(table->f = heap_calloc(count, sizeof(*table->f))))
|
if (!(table->f = calloc(count, sizeof(*table->f))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
table->count = count;
|
table->count = count;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -333,10 +333,10 @@ static void d3d10_effect_preshader_clear(struct d3d10_effect_preshader *p)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(p->reg_tables); ++i)
|
for (i = 0; i < ARRAY_SIZE(p->reg_tables); ++i)
|
||||||
heap_free(p->reg_tables[i].f);
|
free(p->reg_tables[i].f);
|
||||||
if (p->code)
|
if (p->code)
|
||||||
ID3D10Blob_Release(p->code);
|
ID3D10Blob_Release(p->code);
|
||||||
heap_free(p->vars);
|
free(p->vars);
|
||||||
memset(p, 0, sizeof(*p));
|
memset(p, 0, sizeof(*p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ static void d3d10_effect_clear_prop_dependencies(struct d3d10_effect_prop_depend
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
heap_free(d->entries);
|
free(d->entries);
|
||||||
memset(d, 0, sizeof(*d));
|
memset(d, 0, sizeof(*d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,7 +829,7 @@ static BOOL d3d_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, S
|
||||||
if (new_capacity < count)
|
if (new_capacity < count)
|
||||||
new_capacity = count;
|
new_capacity = count;
|
||||||
|
|
||||||
if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
|
if (!(new_elements = realloc(*elements, new_capacity * size)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*elements = new_elements;
|
*elements = new_elements;
|
||||||
|
@ -966,7 +966,7 @@ static BOOL fx10_copy_string(const char *data, size_t data_size, DWORD offset, c
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*s = heap_alloc(len)))
|
if (!(*s = malloc(len)))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate string memory.\n");
|
ERR("Failed to allocate string memory.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -979,24 +979,14 @@ static BOOL fx10_copy_string(const char *data, size_t data_size, DWORD offset, c
|
||||||
|
|
||||||
static BOOL copy_name(const char *ptr, char **name)
|
static BOOL copy_name(const char *ptr, char **name)
|
||||||
{
|
{
|
||||||
size_t name_len;
|
if (!ptr || !*ptr) return TRUE;
|
||||||
|
|
||||||
if (!ptr) return TRUE;
|
if (!(*name = strdup(ptr)))
|
||||||
|
|
||||||
name_len = strlen(ptr) + 1;
|
|
||||||
if (name_len == 1)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(*name = heap_alloc(name_len)))
|
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate name memory.\n");
|
ERR("Failed to allocate name memory.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(*name, ptr, name_len);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1052,7 +1042,7 @@ static HRESULT get_fx10_shader_resources(struct d3d10_effect_variable *v)
|
||||||
sv->reflection->lpVtbl->GetDesc(sv->reflection, &desc);
|
sv->reflection->lpVtbl->GetDesc(sv->reflection, &desc);
|
||||||
sv->resource_count = desc.BoundResources;
|
sv->resource_count = desc.BoundResources;
|
||||||
|
|
||||||
if (!(sv->resources = heap_calloc(sv->resource_count, sizeof(*sv->resources))))
|
if (!(sv->resources = calloc(sv->resource_count, sizeof(*sv->resources))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate shader resource binding information memory.\n");
|
ERR("Failed to allocate shader resource binding information memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -1110,8 +1100,8 @@ struct d3d10_effect_so_decl
|
||||||
|
|
||||||
static void d3d10_effect_cleanup_so_decl(struct d3d10_effect_so_decl *so_decl)
|
static void d3d10_effect_cleanup_so_decl(struct d3d10_effect_so_decl *so_decl)
|
||||||
{
|
{
|
||||||
heap_free(so_decl->entries);
|
free(so_decl->entries);
|
||||||
heap_free(so_decl->decl);
|
free(so_decl->decl);
|
||||||
memset(so_decl, 0, sizeof(*so_decl));
|
memset(so_decl, 0, sizeof(*so_decl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,14 +1111,13 @@ static HRESULT d3d10_effect_parse_stream_output_declaration(const char *decl,
|
||||||
static const char * xyzw = "xyzw";
|
static const char * xyzw = "xyzw";
|
||||||
static const char * rgba = "rgba";
|
static const char * rgba = "rgba";
|
||||||
char *p, *ptr, *end, *next, *mask, *m, *slot;
|
char *p, *ptr, *end, *next, *mask, *m, *slot;
|
||||||
unsigned int len = strlen(decl);
|
|
||||||
D3D10_SO_DECLARATION_ENTRY e;
|
D3D10_SO_DECLARATION_ENTRY e;
|
||||||
|
unsigned int len;
|
||||||
|
|
||||||
memset(so_decl, 0, sizeof(*so_decl));
|
memset(so_decl, 0, sizeof(*so_decl));
|
||||||
|
|
||||||
if (!(so_decl->decl = heap_alloc(len + 1)))
|
if (!(so_decl->decl = strdup(decl)))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
memcpy(so_decl->decl, decl, len + 1);
|
|
||||||
|
|
||||||
p = so_decl->decl;
|
p = so_decl->decl;
|
||||||
|
|
||||||
|
@ -1485,7 +1474,7 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, uint32_t offs
|
||||||
t->basetype = 0;
|
t->basetype = 0;
|
||||||
t->type_class = D3D10_SVC_STRUCT;
|
t->type_class = D3D10_SVC_STRUCT;
|
||||||
|
|
||||||
if (!(t->members = heap_calloc(t->member_count, sizeof(*t->members))))
|
if (!(t->members = calloc(t->member_count, sizeof(*t->members))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate members memory.\n");
|
ERR("Failed to allocate members memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -1546,7 +1535,7 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, uint32_t offs
|
||||||
TRACE("Elementtype for type at offset: %#lx\n", t->id);
|
TRACE("Elementtype for type at offset: %#lx\n", t->id);
|
||||||
|
|
||||||
/* allocate elementtype - we need only one, because all elements have the same type */
|
/* allocate elementtype - we need only one, because all elements have the same type */
|
||||||
if (!(t->elementtype = heap_alloc_zero(sizeof(*t->elementtype))))
|
if (!(t->elementtype = calloc(1, sizeof(*t->elementtype))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate members memory.\n");
|
ERR("Failed to allocate members memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -1614,7 +1603,7 @@ static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, cons
|
||||||
return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
|
return WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(type = heap_alloc_zero(sizeof(*type))))
|
if (!(type = calloc(1, sizeof(*type))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate type memory.\n");
|
ERR("Failed to allocate type memory.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1626,14 +1615,14 @@ static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, cons
|
||||||
if (FAILED(hr = parse_fx10_type(data, data_size, offset, type)))
|
if (FAILED(hr = parse_fx10_type(data, data_size, offset, type)))
|
||||||
{
|
{
|
||||||
ERR("Failed to parse type info, hr %#lx.\n", hr);
|
ERR("Failed to parse type info, hr %#lx.\n", hr);
|
||||||
heap_free(type);
|
free(type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
|
if (wine_rb_put(&effect->types, &offset, &type->entry) == -1)
|
||||||
{
|
{
|
||||||
ERR("Failed to insert type entry.\n");
|
ERR("Failed to insert type entry.\n");
|
||||||
heap_free(type);
|
free(type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1734,7 +1723,7 @@ static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
|
||||||
|
|
||||||
if (v->type->member_count)
|
if (v->type->member_count)
|
||||||
{
|
{
|
||||||
if (!(v->members = heap_calloc(v->type->member_count, sizeof(*v->members))))
|
if (!(v->members = calloc(v->type->member_count, sizeof(*v->members))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate members memory.\n");
|
ERR("Failed to allocate members memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -1776,7 +1765,7 @@ static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v)
|
||||||
{
|
{
|
||||||
unsigned int bufferoffset = v->buffer_offset;
|
unsigned int bufferoffset = v->buffer_offset;
|
||||||
|
|
||||||
if (!(v->elements = heap_calloc(v->type->element_count, sizeof(*v->elements))))
|
if (!(v->elements = calloc(v->type->element_count, sizeof(*v->elements))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate elements memory.\n");
|
ERR("Failed to allocate elements memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -1891,7 +1880,7 @@ static HRESULT parse_fx10_annotations(const char *data, size_t data_size, const
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (!(annotations->elements = heap_calloc(annotations->count, sizeof(*annotations->elements))))
|
if (!(annotations->elements = calloc(annotations->count, sizeof(*annotations->elements))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate annotations memory.\n");
|
ERR("Failed to allocate annotations memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -2294,7 +2283,7 @@ static HRESULT parse_fx10_ctab(void *ctx, const char *data, unsigned int data_si
|
||||||
|
|
||||||
TRACE("Variable count %u.\n", p->vars_count);
|
TRACE("Variable count %u.\n", p->vars_count);
|
||||||
|
|
||||||
if (!(p->vars = heap_calloc(p->vars_count, sizeof(*p->vars))))
|
if (!(p->vars = calloc(p->vars_count, sizeof(*p->vars))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
info = (struct ctab_const_info *)(data + header.constantinfo);
|
info = (struct ctab_const_info *)(data + header.constantinfo);
|
||||||
|
@ -2821,7 +2810,7 @@ static HRESULT parse_fx10_technique(const char *data, size_t data_size,
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(t->passes = heap_calloc(t->pass_count, sizeof(*t->passes))))
|
if (!(t->passes = calloc(t->pass_count, sizeof(*t->passes))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate passes memory\n");
|
ERR("Failed to allocate passes memory\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -3061,7 +3050,7 @@ static HRESULT parse_fx10_object_variable(const char *data, size_t data_size,
|
||||||
case D3D10_SVT_TEXTURE2DMSARRAY:
|
case D3D10_SVT_TEXTURE2DMSARRAY:
|
||||||
case D3D10_SVT_TEXTURE3D:
|
case D3D10_SVT_TEXTURE3D:
|
||||||
case D3D10_SVT_TEXTURECUBE:
|
case D3D10_SVT_TEXTURECUBE:
|
||||||
if (!(v->u.resource.srv = heap_calloc(element_count, sizeof(*v->u.resource.srv))))
|
if (!(v->u.resource.srv = calloc(element_count, sizeof(*v->u.resource.srv))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate shader resource view array memory.\n");
|
ERR("Failed to allocate shader resource view array memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -3263,7 +3252,7 @@ static HRESULT parse_fx10_buffer(const char *data, size_t data_size, const char
|
||||||
unsigned int stride = 0;
|
unsigned int stride = 0;
|
||||||
|
|
||||||
/* Generate our own type, it isn't in the fx blob. */
|
/* Generate our own type, it isn't in the fx blob. */
|
||||||
if (!(l->type = heap_alloc_zero(sizeof(*l->type))))
|
if (!(l->type = calloc(1, sizeof(*l->type))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate local buffer type memory.\n");
|
ERR("Failed to allocate local buffer type memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -3335,19 +3324,19 @@ static HRESULT parse_fx10_buffer(const char *data, size_t data_size, const char
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(l->members = heap_calloc(l->type->member_count, sizeof(*l->members))))
|
if (!(l->members = calloc(l->type->member_count, sizeof(*l->members))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate members memory.\n");
|
ERR("Failed to allocate members memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(l->type->members = heap_calloc(l->type->member_count, sizeof(*l->type->members))))
|
if (!(l->type->members = calloc(l->type->member_count, sizeof(*l->type->members))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate type members memory.\n");
|
ERR("Failed to allocate type members memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local && !(l->u.buffer.local_buffer = heap_alloc_zero(l->data_size)))
|
if (local && !(l->u.buffer.local_buffer = calloc(1, l->data_size)))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate local constant buffer memory.\n");
|
ERR("Failed to allocate local constant buffer memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -3462,8 +3451,8 @@ static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *ty
|
||||||
TRACE("effect type member %p.\n", typem);
|
TRACE("effect type member %p.\n", typem);
|
||||||
|
|
||||||
/* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
|
/* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */
|
||||||
heap_free(typem->semantic);
|
free(typem->semantic);
|
||||||
heap_free(typem->name);
|
free(typem->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
|
static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context)
|
||||||
|
@ -3474,8 +3463,8 @@ static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context
|
||||||
|
|
||||||
if (t->elementtype)
|
if (t->elementtype)
|
||||||
{
|
{
|
||||||
heap_free(t->elementtype->name);
|
free(t->elementtype->name);
|
||||||
heap_free(t->elementtype);
|
free(t->elementtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t->members)
|
if (t->members)
|
||||||
|
@ -3486,11 +3475,11 @@ static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context
|
||||||
{
|
{
|
||||||
d3d10_effect_type_member_destroy(&t->members[i]);
|
d3d10_effect_type_member_destroy(&t->members[i]);
|
||||||
}
|
}
|
||||||
heap_free(t->members);
|
free(t->members);
|
||||||
}
|
}
|
||||||
|
|
||||||
heap_free(t->name);
|
free(t->name);
|
||||||
heap_free(t);
|
free(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL d3d10_effect_types_match(const struct d3d10_effect_type *t1,
|
static BOOL d3d10_effect_types_match(const struct d3d10_effect_type *t1,
|
||||||
|
@ -3560,55 +3549,55 @@ static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, size_t
|
||||||
}
|
}
|
||||||
ptr = data + e->index_offset;
|
ptr = data + e->index_offset;
|
||||||
|
|
||||||
if (!(e->local_buffers = heap_calloc(e->local_buffer_count, sizeof(*e->local_buffers))))
|
if (!(e->local_buffers = calloc(e->local_buffer_count, sizeof(*e->local_buffers))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate local buffer memory.\n");
|
ERR("Failed to allocate local buffer memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->local_variables = heap_calloc(e->local_variable_count, sizeof(*e->local_variables))))
|
if (!(e->local_variables = calloc(e->local_variable_count, sizeof(*e->local_variables))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate local variable memory.\n");
|
ERR("Failed to allocate local variable memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->anonymous_shaders = heap_calloc(e->anonymous_shader_count, sizeof(*e->anonymous_shaders))))
|
if (!(e->anonymous_shaders = calloc(e->anonymous_shader_count, sizeof(*e->anonymous_shaders))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate anonymous shaders memory\n");
|
ERR("Failed to allocate anonymous shaders memory\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->shaders.v = heap_calloc(e->shaders.count, sizeof(*e->shaders.v))))
|
if (!(e->shaders.v = calloc(e->shaders.count, sizeof(*e->shaders.v))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate used shaders memory\n");
|
ERR("Failed to allocate used shaders memory\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->samplers.v = heap_calloc(e->samplers.count, sizeof(*e->samplers.v))))
|
if (!(e->samplers.v = calloc(e->samplers.count, sizeof(*e->samplers.v))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate samplers array.\n");
|
ERR("Failed to allocate samplers array.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->blend_states.v = heap_calloc(e->blend_states.count, sizeof(*e->blend_states.v))))
|
if (!(e->blend_states.v = calloc(e->blend_states.count, sizeof(*e->blend_states.v))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate blend states array.\n");
|
ERR("Failed to allocate blend states array.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->ds_states.v = heap_calloc(e->ds_states.count, sizeof(*e->ds_states.v))))
|
if (!(e->ds_states.v = calloc(e->ds_states.count, sizeof(*e->ds_states.v))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate depth stencil states array.\n");
|
ERR("Failed to allocate depth stencil states array.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->rs_states.v = heap_calloc(e->rs_states.count, sizeof(*e->rs_states.v))))
|
if (!(e->rs_states.v = calloc(e->rs_states.count, sizeof(*e->rs_states.v))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate rasterizer states array.\n");
|
ERR("Failed to allocate rasterizer states array.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e->techniques = heap_calloc(e->technique_count, sizeof(*e->techniques))))
|
if (!(e->techniques = calloc(e->technique_count, sizeof(*e->techniques))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate techniques memory\n");
|
ERR("Failed to allocate techniques memory\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -3812,7 +3801,7 @@ static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_vari
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->resource_count)
|
if (s->resource_count)
|
||||||
heap_free(s->resources);
|
free(s->resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d10_effect_annotations_destroy(struct d3d10_effect_annotations *a)
|
static void d3d10_effect_annotations_destroy(struct d3d10_effect_annotations *a)
|
||||||
|
@ -3823,7 +3812,7 @@ static void d3d10_effect_annotations_destroy(struct d3d10_effect_annotations *a)
|
||||||
|
|
||||||
for (i = 0; i < a->count; ++i)
|
for (i = 0; i < a->count; ++i)
|
||||||
d3d10_effect_variable_destroy(&a->elements[i]);
|
d3d10_effect_variable_destroy(&a->elements[i]);
|
||||||
heap_free(a->elements);
|
free(a->elements);
|
||||||
a->elements = NULL;
|
a->elements = NULL;
|
||||||
a->count = 0;
|
a->count = 0;
|
||||||
}
|
}
|
||||||
|
@ -3834,8 +3823,8 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
|
||||||
|
|
||||||
TRACE("variable %p.\n", v);
|
TRACE("variable %p.\n", v);
|
||||||
|
|
||||||
heap_free(v->name);
|
free(v->name);
|
||||||
heap_free(v->semantic);
|
free(v->semantic);
|
||||||
d3d10_effect_annotations_destroy(&v->annotations);
|
d3d10_effect_annotations_destroy(&v->annotations);
|
||||||
|
|
||||||
if (v->members)
|
if (v->members)
|
||||||
|
@ -3844,7 +3833,7 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
|
||||||
{
|
{
|
||||||
d3d10_effect_variable_destroy(&v->members[i]);
|
d3d10_effect_variable_destroy(&v->members[i]);
|
||||||
}
|
}
|
||||||
heap_free(v->members);
|
free(v->members);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->elements)
|
if (v->elements)
|
||||||
|
@ -3853,7 +3842,7 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
|
||||||
{
|
{
|
||||||
d3d10_effect_variable_destroy(&v->elements[i]);
|
d3d10_effect_variable_destroy(&v->elements[i]);
|
||||||
}
|
}
|
||||||
heap_free(v->elements);
|
free(v->elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->type)
|
if (v->type)
|
||||||
|
@ -3897,11 +3886,11 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
|
||||||
ID3D10ShaderResourceView_Release(v->u.resource.srv[i]);
|
ID3D10ShaderResourceView_Release(v->u.resource.srv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
heap_free(v->u.resource.srv);
|
free(v->u.resource.srv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D3D10_SVT_STRING:
|
case D3D10_SVT_STRING:
|
||||||
heap_free(v->u.buffer.local_buffer);
|
free(v->u.buffer.local_buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -3914,7 +3903,7 @@ static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p)
|
||||||
{
|
{
|
||||||
TRACE("pass %p\n", p);
|
TRACE("pass %p\n", p);
|
||||||
|
|
||||||
heap_free(p->name);
|
free(p->name);
|
||||||
d3d10_effect_annotations_destroy(&p->annotations);
|
d3d10_effect_annotations_destroy(&p->annotations);
|
||||||
d3d10_effect_clear_prop_dependencies(&p->dependencies);
|
d3d10_effect_clear_prop_dependencies(&p->dependencies);
|
||||||
}
|
}
|
||||||
|
@ -3925,14 +3914,14 @@ static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t)
|
||||||
|
|
||||||
TRACE("technique %p\n", t);
|
TRACE("technique %p\n", t);
|
||||||
|
|
||||||
heap_free(t->name);
|
free(t->name);
|
||||||
if (t->passes)
|
if (t->passes)
|
||||||
{
|
{
|
||||||
for (i = 0; i < t->pass_count; ++i)
|
for (i = 0; i < t->pass_count; ++i)
|
||||||
{
|
{
|
||||||
d3d10_effect_pass_destroy(&t->passes[i]);
|
d3d10_effect_pass_destroy(&t->passes[i]);
|
||||||
}
|
}
|
||||||
heap_free(t->passes);
|
free(t->passes);
|
||||||
}
|
}
|
||||||
|
|
||||||
d3d10_effect_annotations_destroy(&t->annotations);
|
d3d10_effect_annotations_destroy(&t->annotations);
|
||||||
|
@ -3944,21 +3933,21 @@ static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l)
|
||||||
|
|
||||||
TRACE("local buffer %p.\n", l);
|
TRACE("local buffer %p.\n", l);
|
||||||
|
|
||||||
heap_free(l->name);
|
free(l->name);
|
||||||
if (l->members)
|
if (l->members)
|
||||||
{
|
{
|
||||||
for (i = 0; i < l->type->member_count; ++i)
|
for (i = 0; i < l->type->member_count; ++i)
|
||||||
{
|
{
|
||||||
d3d10_effect_variable_destroy(&l->members[i]);
|
d3d10_effect_variable_destroy(&l->members[i]);
|
||||||
}
|
}
|
||||||
heap_free(l->members);
|
free(l->members);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l->type)
|
if (l->type)
|
||||||
d3d10_effect_type_destroy(&l->type->entry, NULL);
|
d3d10_effect_type_destroy(&l->type->entry, NULL);
|
||||||
|
|
||||||
d3d10_effect_annotations_destroy(&l->annotations);
|
d3d10_effect_annotations_destroy(&l->annotations);
|
||||||
heap_free(l->u.buffer.local_buffer);
|
free(l->u.buffer.local_buffer);
|
||||||
|
|
||||||
if (l->u.buffer.buffer)
|
if (l->u.buffer.buffer)
|
||||||
ID3D10Buffer_Release(l->u.buffer.buffer);
|
ID3D10Buffer_Release(l->u.buffer.buffer);
|
||||||
|
@ -4018,7 +4007,7 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
|
||||||
{
|
{
|
||||||
d3d10_effect_technique_destroy(&effect->techniques[i]);
|
d3d10_effect_technique_destroy(&effect->techniques[i]);
|
||||||
}
|
}
|
||||||
heap_free(effect->techniques);
|
free(effect->techniques);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effect->local_variables)
|
if (effect->local_variables)
|
||||||
|
@ -4027,7 +4016,7 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
|
||||||
{
|
{
|
||||||
d3d10_effect_variable_destroy(&effect->local_variables[i]);
|
d3d10_effect_variable_destroy(&effect->local_variables[i]);
|
||||||
}
|
}
|
||||||
heap_free(effect->local_variables);
|
free(effect->local_variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effect->local_buffers)
|
if (effect->local_buffers)
|
||||||
|
@ -4036,7 +4025,7 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
|
||||||
{
|
{
|
||||||
d3d10_effect_local_buffer_destroy(&effect->local_buffers[i]);
|
d3d10_effect_local_buffer_destroy(&effect->local_buffers[i]);
|
||||||
}
|
}
|
||||||
heap_free(effect->local_buffers);
|
free(effect->local_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effect->anonymous_shaders)
|
if (effect->anonymous_shaders)
|
||||||
|
@ -4044,25 +4033,25 @@ static ULONG STDMETHODCALLTYPE d3d10_effect_Release(ID3D10Effect *iface)
|
||||||
for (i = 0; i < effect->anonymous_shader_count; ++i)
|
for (i = 0; i < effect->anonymous_shader_count; ++i)
|
||||||
{
|
{
|
||||||
d3d10_effect_variable_destroy(&effect->anonymous_shaders[i].shader);
|
d3d10_effect_variable_destroy(&effect->anonymous_shaders[i].shader);
|
||||||
heap_free(effect->anonymous_shaders[i].type.name);
|
free(effect->anonymous_shaders[i].type.name);
|
||||||
}
|
}
|
||||||
heap_free(effect->anonymous_shaders);
|
free(effect->anonymous_shaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
heap_free(effect->shaders.v);
|
free(effect->shaders.v);
|
||||||
heap_free(effect->samplers.v);
|
free(effect->samplers.v);
|
||||||
heap_free(effect->rtvs.v);
|
free(effect->rtvs.v);
|
||||||
heap_free(effect->dsvs.v);
|
free(effect->dsvs.v);
|
||||||
heap_free(effect->blend_states.v);
|
free(effect->blend_states.v);
|
||||||
heap_free(effect->ds_states.v);
|
free(effect->ds_states.v);
|
||||||
heap_free(effect->rs_states.v);
|
free(effect->rs_states.v);
|
||||||
|
|
||||||
wine_rb_destroy(&effect->types, d3d10_effect_type_destroy, NULL);
|
wine_rb_destroy(&effect->types, d3d10_effect_type_destroy, NULL);
|
||||||
|
|
||||||
if (effect->pool)
|
if (effect->pool)
|
||||||
IUnknown_Release(&effect->pool->ID3D10Effect_iface);
|
IUnknown_Release(&effect->pool->ID3D10Effect_iface);
|
||||||
ID3D10Device_Release(effect->device);
|
ID3D10Device_Release(effect->device);
|
||||||
heap_free(effect);
|
free(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
|
@ -4382,7 +4371,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
|
||||||
ID3D10Blob_Release(v->u.shader.bytecode);
|
ID3D10Blob_Release(v->u.shader.bytecode);
|
||||||
v->u.shader.bytecode = NULL;
|
v->u.shader.bytecode = NULL;
|
||||||
}
|
}
|
||||||
heap_free(v->u.shader.stream_output_declaration);
|
free(v->u.shader.stream_output_declaration);
|
||||||
v->u.shader.stream_output_declaration = NULL;
|
v->u.shader.stream_output_declaration = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4390,11 +4379,11 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
|
||||||
{
|
{
|
||||||
for (j = 0; j < effect->techniques[i].pass_count; ++j)
|
for (j = 0; j < effect->techniques[i].pass_count; ++j)
|
||||||
{
|
{
|
||||||
heap_free(effect->techniques[i].passes[j].name);
|
free(effect->techniques[i].passes[j].name);
|
||||||
effect->techniques[i].passes[j].name = NULL;
|
effect->techniques[i].passes[j].name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
heap_free(effect->techniques[i].name);
|
free(effect->techniques[i].name);
|
||||||
effect->techniques[i].name = NULL;
|
effect->techniques[i].name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9548,7 +9537,7 @@ static HRESULT d3d10_create_effect(void *data, SIZE_T data_size, ID3D10Device *d
|
||||||
struct d3d10_effect *object;
|
struct d3d10_effect *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
if (!(object = calloc(1, sizeof(*object))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
wine_rb_init(&object->types, d3d10_effect_type_compare);
|
wine_rb_init(&object->types, d3d10_effect_type_compare);
|
||||||
|
|
|
@ -310,7 +310,7 @@ static ULONG STDMETHODCALLTYPE d3d10_stateblock_Release(ID3D10StateBlock *iface)
|
||||||
{
|
{
|
||||||
stateblock_cleanup(stateblock);
|
stateblock_cleanup(stateblock);
|
||||||
ID3D10Device_Release(stateblock->device);
|
ID3D10Device_Release(stateblock->device);
|
||||||
heap_free(stateblock);
|
free(stateblock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
|
@ -557,7 +557,7 @@ HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *device,
|
||||||
|
|
||||||
TRACE("device %p, mask %p, stateblock %p.\n", device, mask, stateblock);
|
TRACE("device %p, mask %p, stateblock %p.\n", device, mask, stateblock);
|
||||||
|
|
||||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
if (!(object = calloc(1, sizeof(*object))))
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate D3D10 stateblock object memory.\n");
|
ERR("Failed to allocate D3D10 stateblock object memory.\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
Loading…
Reference in a new issue