Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 14 +++++++++----- dlls/d3d10/tests/effect.c | 27 +++++++++------------------ 2 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index ebcb5f4145b..672cbae3920 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -3223,14 +3223,14 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetCon
static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index) { - struct d3d10_effect *This = impl_from_ID3D10Effect(iface); + struct d3d10_effect *effect = impl_from_ID3D10Effect(iface); unsigned int i;
TRACE("iface %p, index %u\n", iface, index);
- for (i = 0; i < This->local_buffer_count; ++i) + for (i = 0; i < effect->local_buffer_count; ++i) { - struct d3d10_effect_variable *l = &This->local_buffers[i]; + struct d3d10_effect_variable *l = &effect->local_buffers[i];
if (index < l->type->member_count) { @@ -3242,13 +3242,17 @@ static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableB index -= l->type->member_count; }
- if (index < This->local_variable_count) + if (index < effect->local_variable_count) { - struct d3d10_effect_variable *v = &This->local_variables[index]; + struct d3d10_effect_variable *v = &effect->local_variables[index];
TRACE("Returning variable %p.\n", v); return &v->ID3D10EffectVariable_iface; } + index -= effect->local_variable_count; + + if (effect->pool) + return effect->pool->lpVtbl->GetVariableByIndex(effect->pool, index);
WARN("Invalid index specified\n");
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 9fbf8b9e865..31edd4a1c48 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -6641,33 +6641,24 @@ todo_wine
v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 2); hr = v->lpVtbl->GetDesc(v, &var_desc); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(!strcmp(var_desc.Name, "f1"), "Unexpected name %s.\n", var_desc.Name); - ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags); - } + ok(!strcmp(var_desc.Name, "f1"), "Unexpected name %s.\n", var_desc.Name); +todo_wine + ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 3); hr = v->lpVtbl->GetDesc(v, &var_desc); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(!strcmp(var_desc.Name, "f2"), "Unexpected name %s.\n", var_desc.Name); - ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags); - } + ok(!strcmp(var_desc.Name, "f2"), "Unexpected name %s.\n", var_desc.Name); +todo_wine + ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 4); hr = v->lpVtbl->GetDesc(v, &var_desc); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(!strcmp(var_desc.Name, "s_blendstate"), "Unexpected name %s.\n", var_desc.Name); - ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags); - } + ok(!strcmp(var_desc.Name, "s_blendstate"), "Unexpected name %s.\n", var_desc.Name); +todo_wine + ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = child_effect->lpVtbl->GetVariableByName(child_effect, "s_texture"); hr = v->lpVtbl->GetDesc(v, &var_desc);