Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/d3dx9_36/effect.c | 49 ++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 4af6f7f1b9..1703afa067 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -1177,33 +1177,6 @@ static HRESULT d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base, return D3D_OK; }
-static D3DXHANDLE d3dx9_base_effect_get_parameter_element(struct d3dx9_base_effect *base, - D3DXHANDLE parameter, UINT index) -{ - struct d3dx_parameter *param = get_valid_parameter(base, parameter); - - if (!param) - { - if (index < base->parameter_count) - { - TRACE("Returning parameter %p.\n", &base->parameters[index]); - return get_parameter_handle(&base->parameters[index].param); - } - } - else - { - if (index < param->element_count) - { - TRACE("Returning parameter %p.\n", ¶m->members[index]); - return get_parameter_handle(¶m->members[index]); - } - } - - WARN("Parameter not found.\n"); - - return NULL; -} - static D3DXHANDLE d3dx9_base_effect_get_technique(struct d3dx9_base_effect *base, UINT index) { if (index >= base->technique_count) @@ -3463,10 +3436,30 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic(ID3DXEffect *iface, static D3DXHANDLE WINAPI d3dx_effect_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index) { struct d3dx_effect *effect = impl_from_ID3DXEffect(iface); + struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect, parameter);
TRACE("iface %p, parameter %p, index %u.\n", iface, parameter, index);
- return d3dx9_base_effect_get_parameter_element(&effect->base_effect, parameter, index); + if (!param) + { + if (index < effect->base_effect.parameter_count) + { + TRACE("Returning parameter %p.\n", &effect->base_effect.parameters[index]); + return get_parameter_handle(&effect->base_effect.parameters[index].param); + } + } + else + { + if (index < param->element_count) + { + TRACE("Returning parameter %p.\n", ¶m->members[index]); + return get_parameter_handle(¶m->members[index]); + } + } + + WARN("Parameter not found.\n"); + + return NULL; }
static D3DXHANDLE WINAPI d3dx_effect_GetTechnique(ID3DXEffect *iface, UINT index)
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48601
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/d3dx9_36/effect.c:3465 error: patch failed: dlls/d3dx9_36/effect.c:1177 error: patch failed: dlls/d3dx9_36/effect.c:1177 error: patch failed: dlls/d3dx9_36/effect.c:1177 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/d3dx9_36/effect.c:3465 error: patch failed: dlls/d3dx9_36/effect.c:1177 error: patch failed: dlls/d3dx9_36/effect.c:1177 error: patch failed: dlls/d3dx9_36/effect.c:1177 Task: Patch failed to apply
From: Michael Stefaniuc mstefani@winehq.org
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/effect.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 1703afa067f..ae46216b7f2 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -152,7 +152,6 @@ struct d3dx9_base_effect { struct d3dx_effect *effect;
- UINT parameter_count; UINT technique_count; UINT object_count;
@@ -176,6 +175,7 @@ struct d3dx_effect LONG ref;
struct d3dx9_base_effect base_effect; + unsigned int parameter_count;
struct ID3DXEffectStateManager *manager; struct IDirect3DDevice9 *device; @@ -691,7 +691,7 @@ static void d3dx9_base_effect_cleanup(struct d3dx9_base_effect *base)
if (base->parameters) { - for (i = 0; i < base->parameter_count; ++i) + for (i = 0; i < base->effect->parameter_count; ++i) free_top_level_parameter(&base->parameters[i]); HeapFree(GetProcessHeap(), 0, base->parameters); base->parameters = NULL; @@ -3277,7 +3277,7 @@ static HRESULT WINAPI d3dx_effect_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *d /* TODO: add creator and function count. */ desc->Creator = NULL; desc->Functions = 0; - desc->Parameters = effect->base_effect.parameter_count; + desc->Parameters = effect->parameter_count; desc->Techniques = effect->base_effect.technique_count;
return D3D_OK; @@ -3329,7 +3329,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameter(ID3DXEffect *iface, D3DXHANDLE
if (!parameter) { - if (index < effect->base_effect.parameter_count) + if (index < effect->parameter_count) { TRACE("Returning parameter %p.\n", &effect->base_effect.parameters[index]); return get_parameter_handle(&effect->base_effect.parameters[index].param); @@ -3383,7 +3383,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic(ID3DXEffect *iface,
if (!parameter) { - for (i = 0; i < effect->base_effect.parameter_count; ++i) + for (i = 0; i < effect->parameter_count; ++i) { temp_param = &effect->base_effect.parameters[i].param;
@@ -3442,7 +3442,7 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterElement(ID3DXEffect *iface, D3D
if (!param) { - if (index < effect->base_effect.parameter_count) + if (index < effect->parameter_count) { TRACE("Returning parameter %p.\n", &effect->base_effect.parameters[index]); return get_parameter_handle(&effect->base_effect.parameters[index].param); @@ -4363,7 +4363,7 @@ static HRESULT WINAPI d3dx_effect_OnLostDevice(ID3DXEffect *iface)
TRACE("iface %p.\n", iface);
- for (i = 0; i < base->parameter_count; ++i) + for (i = 0; i < effect->parameter_count; ++i) walk_parameter_tree(&base->parameters[i].param, param_on_lost_device, NULL);
return D3D_OK; @@ -6143,9 +6143,9 @@ static HRESULT d3dx_parse_resource(struct d3dx_effect *effect, const char *data, struct d3dx_parameter *parameter; struct d3dx_sampler *sampler;
- if (index >= base->parameter_count) + if (index >= effect->parameter_count) { - FIXME("Index out of bounds: index %u >= parameter_count %u\n", index, base->parameter_count); + FIXME("Index out of bounds: index %u >= parameter_count %u\n", index, effect->parameter_count); return E_FAIL; }
@@ -6308,8 +6308,8 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U HRESULT hr; UINT i;
- read_dword(&ptr, &base->parameter_count); - TRACE("Parameter count: %u.\n", base->parameter_count); + read_dword(&ptr, &effect->parameter_count); + TRACE("Parameter count: %u.\n", effect->parameter_count);
read_dword(&ptr, &base->technique_count); TRACE("Technique count: %u.\n", base->technique_count); @@ -6328,10 +6328,10 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U }
wine_rb_init(&base->param_tree, param_rb_compare); - if (base->parameter_count) + if (effect->parameter_count) { base->parameters = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(*base->parameters) * base->parameter_count); + sizeof(*base->parameters) * effect->parameter_count); if (!base->parameters) { ERR("Out of memory.\n"); @@ -6339,7 +6339,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U goto err_out; }
- for (i = 0; i < base->parameter_count; ++i) + for (i = 0; i < effect->parameter_count; ++i) { param_set_magic_number(&base->parameters[i].param); hr = d3dx_parse_effect_parameter(effect, &base->parameters[i], data, &ptr, base->objects); @@ -6412,7 +6412,7 @@ static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, U } }
- for (i = 0; i < base->parameter_count; ++i) + for (i = 0; i < effect->parameter_count; ++i) { if (FAILED(hr = d3dx_pool_sync_shared_parameter(base->pool, &base->parameters[i]))) goto err_out; @@ -6435,7 +6435,7 @@ err_out:
if (base->parameters) { - for (i = 0; i < base->parameter_count; ++i) + for (i = 0; i < effect->parameter_count; ++i) { free_top_level_parameter(&base->parameters[i]); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48674
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/d3dx9_36/effect.c:3329 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/d3dx9_36/effect.c:3329 Task: Patch failed to apply