Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/d3dx9_36/effect.c | 63 +++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 35 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 53317a066b..0c28fae1ec 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -152,8 +152,6 @@ struct d3dx9_base_effect
{
struct d3dx_effect *effect;
- struct d3dx_technique *techniques;
-
struct d3dx_effect_pool *pool;
DWORD flags;
@@ -170,6 +168,7 @@ struct d3dx_effect
unsigned int technique_count;
unsigned int object_count;
struct d3dx_top_level_parameter *parameters;
+ struct d3dx_technique *techniques;
struct d3dx_object *objects;
struct wine_rb_tree param_tree;
char *full_name_tmp;
@@ -453,15 +452,14 @@ static inline D3DXHANDLE get_pass_handle(struct d3dx_pass *pass)
static struct d3dx_technique *get_technique_by_name(struct d3dx_effect *effect, const char *name)
{
- struct d3dx9_base_effect *base = &effect->base_effect;
unsigned int i;
if (!name) return NULL;
for (i = 0; i < effect->technique_count; ++i)
{
- if (!strcmp(base->techniques[i].name, name))
- return &base->techniques[i];
+ if (!strcmp(effect->techniques[i].name, name))
+ return &effect->techniques[i];
}
return NULL;
@@ -469,13 +467,12 @@ static struct d3dx_technique *get_technique_by_name(struct d3dx_effect *effect,
static struct d3dx_technique *get_valid_technique(struct d3dx_effect *effect, D3DXHANDLE technique)
{
- struct d3dx9_base_effect *base = &effect->base_effect;
unsigned int i;
for (i = 0; i < effect->technique_count; ++i)
{
- if (get_technique_handle(&base->techniques[i]) == technique)
- return &base->techniques[i];
+ if (get_technique_handle(&effect->techniques[i]) == technique)
+ return &effect->techniques[i];
}
return get_technique_by_name(effect, technique);
@@ -483,12 +480,11 @@ static struct d3dx_technique *get_valid_technique(struct d3dx_effect *effect, D3
static struct d3dx_pass *get_valid_pass(struct d3dx_effect *effect, D3DXHANDLE pass)
{
- struct d3dx9_base_effect *base = &effect->base_effect;
unsigned int i, k;
for (i = 0; i < effect->technique_count; ++i)
{
- struct d3dx_technique *technique = &base->techniques[i];
+ struct d3dx_technique *technique = &effect->techniques[i];
for (k = 0; k < technique->pass_count; ++k)
{
@@ -683,10 +679,9 @@ static void free_technique(struct d3dx_technique *technique)
static void d3dx9_base_effect_cleanup(struct d3dx_effect *effect)
{
- struct d3dx9_base_effect *base = &effect->base_effect;
unsigned int i;
- TRACE("base %p.\n", base);
+ TRACE("Effect %p.\n", effect);
heap_free(effect->full_name_tmp);
@@ -698,12 +693,12 @@ static void d3dx9_base_effect_cleanup(struct d3dx_effect *effect)
effect->parameters = NULL;
}
- if (base->techniques)
+ if (effect->techniques)
{
for (i = 0; i < effect->technique_count; ++i)
- free_technique(&base->techniques[i]);
- HeapFree(GetProcessHeap(), 0, base->techniques);
- base->techniques = NULL;
+ free_technique(&effect->techniques[i]);
+ heap_free(effect->techniques);
+ effect->techniques = NULL;
}
if (effect->objects)
@@ -1897,7 +1892,7 @@ static HRESULT WINAPI d3dx_effect_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDL
D3DXTECHNIQUE_DESC *desc)
{
struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
- struct d3dx_technique *tech = technique ? get_valid_technique(effect, technique) : &effect->base_effect.techniques[0];
+ struct d3dx_technique *tech = technique ? get_valid_technique(effect, technique) : &effect->techniques[0];
TRACE("iface %p, technique %p, desc %p.\n", iface, technique, desc);
@@ -2127,9 +2122,9 @@ static D3DXHANDLE WINAPI d3dx_effect_GetTechnique(ID3DXEffect *iface, UINT index
return NULL;
}
- TRACE("Returning technique %p.\n", &effect->base_effect.techniques[index]);
+ TRACE("Returning technique %p.\n", &effect->techniques[index]);
- return get_technique_handle(&effect->base_effect.techniques[index]);
+ return get_technique_handle(&effect->techniques[index]);
}
static D3DXHANDLE WINAPI d3dx_effect_GetTechniqueByName(ID3DXEffect *iface, const char *name)
@@ -3647,7 +3642,6 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D
D3DXHANDLE *next_technique)
{
struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
- struct d3dx9_base_effect *base = &effect->base_effect;
struct d3dx_technique *prev_tech, *tech;
unsigned int i;
@@ -3660,7 +3654,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D
for (i = 0; i < effect->technique_count; ++i)
{
- tech = &base->techniques[i];
+ tech = &effect->techniques[i];
if (tech == prev_tech)
{
++i;
@@ -3675,7 +3669,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D
for (; i < effect->technique_count; ++i)
{
- tech = &base->techniques[i];
+ tech = &effect->techniques[i];
if (SUCCEEDED(d3dx_effect_ValidateTechnique(iface, get_technique_handle(tech))))
{
*next_technique = get_technique_handle(tech);
@@ -3683,7 +3677,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D
}
}
- *next_technique = get_technique_handle(&base->techniques[0]);
+ *next_technique = get_technique_handle(&effect->techniques[0]);
return S_FALSE;
}
@@ -5774,7 +5768,6 @@ static HRESULT d3dx_parse_array_selector(struct d3dx_effect *effect, struct d3dx
static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, const char **ptr,
const char **skip_constants, unsigned int skip_constants_count)
{
- struct d3dx9_base_effect *base = &effect->base_effect;
DWORD technique_index;
DWORD index, state_index, usage, element_index;
struct d3dx_state *state;
@@ -5842,7 +5835,7 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data,
return E_FAIL;
}
- technique = &base->techniques[technique_index];
+ technique = &effect->techniques[technique_index];
if (index >= technique->pass_count)
{
FIXME("Index out of bounds: index %u >= pass_count %u\n", index, technique->pass_count);
@@ -6015,8 +6008,8 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U
if (effect->technique_count)
{
- base->techniques = heap_alloc_zero(sizeof(*base->techniques) * effect->technique_count);
- if (!base->techniques)
+ effect->techniques = heap_alloc_zero(sizeof(*effect->techniques) * effect->technique_count);
+ if (!effect->techniques)
{
ERR("Out of memory.\n");
hr = E_OUTOFMEMORY;
@@ -6026,7 +6019,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U
for (i = 0; i < effect->technique_count; ++i)
{
TRACE("Parsing technique %u.\n", i);
- hr = d3dx_parse_effect_technique(effect, &base->techniques[i], data, &ptr, effect->objects);
+ hr = d3dx_parse_effect_technique(effect, &effect->techniques[i], data, &ptr, effect->objects);
if (hr != D3D_OK)
{
WARN("Failed to parse technique %u.\n", i);
@@ -6081,12 +6074,12 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U
err_out:
- if (base->techniques)
+ if (effect->techniques)
{
for (i = 0; i < effect->technique_count; ++i)
- free_technique(&base->techniques[i]);
- HeapFree(GetProcessHeap(), 0, base->techniques);
- base->techniques = NULL;
+ free_technique(&effect->techniques[i]);
+ heap_free(effect->techniques);
+ effect->techniques = NULL;
}
if (effect->parameters)
@@ -6288,7 +6281,7 @@ static HRESULT d3dx9_base_effect_init(struct d3dx_effect *effect, const char *da
{
for (j = 0; j < effect->technique_count; ++j)
{
- if (is_parameter_used(param, &base->techniques[j]))
+ if (is_parameter_used(param, &effect->techniques[j]))
{
WARN("skip_constants parameter %s is used in technique %u.\n",
debugstr_a(skip_constants[i]), j);
@@ -6342,9 +6335,9 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev
}
/* initialize defaults - check because of unsupported ascii effects */
- if (effect->base_effect.techniques)
+ if (effect->techniques)
{
- effect->active_technique = &effect->base_effect.techniques[0];
+ effect->active_technique = &effect->techniques[0];
effect->active_pass = NULL;
}
--
2.20.1