Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 19 ++++++++++++------- dlls/d3d10/tests/effect.c | 10 +++------- 2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 623183311f2..19befb64b0f 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -3179,22 +3179,27 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface, UINT index) { - struct d3d10_effect *This = impl_from_ID3D10Effect(iface); + struct d3d10_effect *effect = impl_from_ID3D10Effect(iface); struct d3d10_effect_variable *l;
TRACE("iface %p, index %u\n", iface, index);
- if (index >= This->local_buffer_count) + if (index < effect->local_buffer_count) { - WARN("Invalid index specified\n"); - return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface; + l = &effect->local_buffers[index]; + + TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name)); + + return (ID3D10EffectConstantBuffer *)&l->ID3D10EffectVariable_iface; } + index -= effect->local_buffer_count;
- l = &This->local_buffers[index]; + if (effect->pool) + return effect->pool->lpVtbl->GetConstantBufferByIndex(effect->pool, index);
- TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name)); + WARN("Invalid index specified\n");
- return (ID3D10EffectConstantBuffer *)&l->ID3D10EffectVariable_iface; + return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface; }
static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface, diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 1dfd420ae36..d2761462c6d 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -6607,17 +6607,13 @@ todo_wine
cb = child_effect->lpVtbl->GetConstantBufferByIndex(child_effect, 2); ret = cb->lpVtbl->IsValid(cb); -todo_wine ok(ret, "Unexpected invalid variable.\n");
hr = cb->lpVtbl->GetDesc(cb, &var_desc); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(!strcmp(var_desc.Name, "s_cb"), "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_cb"), "Unexpected name %s.\n", var_desc.Name); +todo_wine + ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
/* Pool techniques are not accessible */ t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);